github.com/loafoe/cli@v7.1.0+incompatible/actor/v7pushaction/handle_disk_override.go (about)

     1  package v7pushaction
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/command/translatableerror"
     5  	"code.cloudfoundry.org/cli/util/manifestparser"
     6  )
     7  
     8  func HandleDiskOverride(manifest manifestparser.Manifest, overrides FlagOverrides) (manifestparser.Manifest, error) {
     9  	if overrides.Disk != "" {
    10  		if manifest.ContainsMultipleApps() {
    11  			return manifest, translatableerror.CommandLineArgsWithMultipleAppsError{}
    12  		}
    13  
    14  		webProcess := manifest.GetFirstAppWebProcess()
    15  		if webProcess != nil {
    16  			webProcess.DiskQuota = overrides.Disk
    17  		} else {
    18  			app := manifest.GetFirstApp()
    19  			app.DiskQuota = overrides.Disk
    20  		}
    21  	}
    22  
    23  	return manifest, nil
    24  }