-
Notifications
You must be signed in to change notification settings - Fork 929
/
push_command.go
552 lines (493 loc) · 22.8 KB
/
push_command.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
package v6
import (
"os"
"path/filepath"
"code.cloudfoundry.org/cli/actor/pushaction"
"code.cloudfoundry.org/cli/actor/sharedaction"
"code.cloudfoundry.org/cli/actor/v2action"
"code.cloudfoundry.org/cli/actor/v2v3action"
"code.cloudfoundry.org/cli/actor/v3action"
"code.cloudfoundry.org/cli/command"
"code.cloudfoundry.org/cli/command/flag"
"code.cloudfoundry.org/cli/command/translatableerror"
"code.cloudfoundry.org/cli/command/v6/shared"
sharedV3 "code.cloudfoundry.org/cli/command/v6/shared"
"code.cloudfoundry.org/cli/util/configv3"
"code.cloudfoundry.org/cli/util/manifest"
"code.cloudfoundry.org/cli/util/progressbar"
"github.com/cloudfoundry/bosh-cli/director/template"
"github.com/cloudfoundry/noaa/consumer"
log "github.com/sirupsen/logrus"
)
//go:generate counterfeiter . ProgressBar
type ProgressBar interface {
pushaction.ProgressBar
Complete()
Ready()
}
//go:generate counterfeiter . V2PushActor
type V2PushActor interface {
Apply(config pushaction.ApplicationConfig, progressBar pushaction.ProgressBar) (<-chan pushaction.ApplicationConfig, <-chan pushaction.Event, <-chan pushaction.Warnings, <-chan error)
CloudControllerV2APIVersion() string
CloudControllerV3APIVersion() string
ConvertToApplicationConfigs(orgGUID string, spaceGUID string, noStart bool, apps []manifest.Application) ([]pushaction.ApplicationConfig, pushaction.Warnings, error)
MergeAndValidateSettingsAndManifests(cmdSettings pushaction.CommandLineSettings, apps []manifest.Application) ([]manifest.Application, error)
ReadManifest(pathToManifest string, pathsToVarsFiles []string, vars []template.VarKV) ([]manifest.Application, pushaction.Warnings, error)
}
type PushCommand struct {
OptionalArgs flag.OptionalAppName `positional-args:"yes"`
Buildpacks []string `short:"b" description:"Custom buildpack by name (e.g. my-buildpack) or Git URL (e.g. 'https://github.com/cloudfoundry/java-buildpack.git') or Git URL with a branch or tag (e.g. 'https://github.com/cloudfoundry/java-buildpack.git#v3.3.0' for 'v3.3.0' tag). To use built-in buildpacks only, specify 'default' or 'null'"`
Command flag.Command `short:"c" description:"Startup command, set to null to reset to default start command"`
Domain string `short:"d" description:"Specify a custom domain (e.g. private-domain.example.com, apps.internal.com) to use instead of the default domain"`
DockerImage flag.DockerImage `long:"docker-image" short:"o" description:"Docker-image to be used (e.g. user/docker-image-name)"`
DockerUsername string `long:"docker-username" description:"Repository username; used with password from environment variable CF_DOCKER_PASSWORD"`
DropletPath flag.PathWithExistenceCheck `long:"droplet" description:"Path to a tgz file with a pre-staged app"`
PathToManifest flag.PathWithExistenceCheck `short:"f" description:"Path to manifest"`
HealthCheckType flag.HealthCheckTypeWithDeprecatedValue `long:"health-check-type" short:"u" description:"Application health check type (Default: 'port', 'none' accepted for 'process', 'http' implies endpoint '/')"`
Hostname string `long:"hostname" short:"n" description:"Hostname (e.g. my-subdomain)"`
Instances flag.Instances `short:"i" description:"Number of instances"`
DiskQuota flag.Megabytes `short:"k" description:"Disk limit (e.g. 256M, 1024M, 1G)"`
Memory flag.Megabytes `short:"m" description:"Memory limit (e.g. 256M, 1024M, 1G)"`
NoHostname bool `long:"no-hostname" description:"Map the root domain to this app"`
NoManifest bool `long:"no-manifest" description:"Ignore manifest file"`
NoRoute bool `long:"no-route" description:"Do not map a route to this app and remove routes from previous pushes of this app"`
NoStart bool `long:"no-start" description:"Do not start an app after pushing"`
AppPath flag.PathWithExistenceCheck `short:"p" description:"Path to app directory or to a zip file of the contents of the app directory"`
RandomRoute bool `long:"random-route" description:"Create a random route for this app"`
RoutePath flag.V6RoutePath `long:"route-path" description:"Path for the route"`
StackName string `short:"s" description:"Stack to use (a stack is a pre-built file system, including an operating system, that can run apps)"`
VarsFilePaths []flag.PathWithExistenceCheck `long:"vars-file" description:"Path to a variable substitution file for manifest; can specify multiple times"`
Vars []template.VarKV `long:"var" description:"Variable key value pair for variable substitution, (e.g., name=app1); can specify multiple times"`
HealthCheckTimeout uint64 `short:"t" description:"Time (in seconds) allowed to elapse between starting up an app and the first healthy response from the app"`
envCFStagingTimeout interface{} `environmentName:"CF_STAGING_TIMEOUT" environmentDescription:"Max wait time for buildpack staging, in minutes" environmentDefault:"15"`
envCFStartupTimeout interface{} `environmentName:"CF_STARTUP_TIMEOUT" environmentDescription:"Max wait time for app instance startup, in minutes" environmentDefault:"5"`
dockerPassword interface{} `environmentName:"CF_DOCKER_PASSWORD" environmentDescription:"Password used for private docker repository"`
usage interface{} `usage:"CF_NAME push APP_NAME [-b BUILDPACK_NAME] [-c COMMAND] [-f MANIFEST_PATH | --no-manifest] [--no-start]\n [-i NUM_INSTANCES] [-k DISK] [-m MEMORY] [-p PATH] [-s STACK] [-t HEALTH_TIMEOUT] [-u (process | port | http)]\n [--no-route | --random-route | --hostname HOST | --no-hostname] [-d DOMAIN] [--route-path ROUTE_PATH] [--var KEY=VALUE]... [--vars-file VARS_FILE_PATH]...\n\n CF_NAME push APP_NAME --docker-image [REGISTRY_HOST:PORT/]IMAGE[:TAG] [--docker-username USERNAME]\n [-c COMMAND] [-f MANIFEST_PATH | --no-manifest] [--no-start]\n [-i NUM_INSTANCES] [-k DISK] [-m MEMORY] [-t HEALTH_TIMEOUT] [-u (process | port | http)]\n [--no-route | --random-route | --hostname HOST | --no-hostname] [-d DOMAIN] [--route-path ROUTE_PATH] [--var KEY=VALUE]... [--vars-file VARS_FILE_PATH]...\n\n CF_NAME push APP_NAME --droplet DROPLET_PATH\n [-c COMMAND] [-f MANIFEST_PATH | --no-manifest] [--no-start]\n [-i NUM_INSTANCES] [-k DISK] [-m MEMORY] [-t HEALTH_TIMEOUT] [-u (process | port | http)]\n [--no-route | --random-route | --hostname HOST | --no-hostname] [-d DOMAIN] [--route-path ROUTE_PATH] [--var KEY=VALUE]... [--vars-file VARS_FILE_PATH]...\n\n CF_NAME push -f MANIFEST_WITH_MULTIPLE_APPS_PATH [APP_NAME] [--no-start]"`
relatedCommands interface{} `related_commands:"apps, create-app-manifest, logs, ssh, start"`
UI command.UI
Config command.Config
SharedActor command.SharedActor
Actor V2PushActor
ApplicationSummaryActor shared.ApplicationSummaryActor
ProgressBar ProgressBar
RestartActor RestartActor
NOAAClient *consumer.Consumer
}
func (cmd *PushCommand) Setup(config command.Config, ui command.UI) error {
cmd.UI = ui
cmd.Config = config
sharedActor := sharedaction.NewActor(config)
cmd.SharedActor = sharedActor
ccClient, uaaClient, err := shared.GetNewClientsAndConnectToCF(config, ui)
if err != nil {
return err
}
ccClientV3, _, err := sharedV3.NewV3BasedClients(config, ui, true)
if err != nil {
return err
}
v2Actor := v2action.NewActor(ccClient, uaaClient, config)
v3Actor := v3action.NewActor(ccClientV3, config, sharedActor, nil)
cmd.RestartActor = v2Actor
cmd.Actor = pushaction.NewActor(v2Actor, v3Actor, sharedActor)
cmd.ApplicationSummaryActor = v2v3action.NewActor(v2Actor, v3Actor)
cmd.NOAAClient = shared.NewNOAAClient(ccClient.DopplerEndpoint(), config, uaaClient, ui)
cmd.ProgressBar = progressbar.NewProgressBar()
return nil
}
func (cmd PushCommand) Execute(args []string) error {
err := cmd.SharedActor.CheckTarget(true, true)
if err != nil {
return err
}
user, err := cmd.Config.CurrentUser()
if err != nil {
return err
}
log.Info("collating flags")
cliSettings, err := cmd.GetCommandLineSettings()
if err != nil {
log.Errorln("reading flags:", err)
return err
}
log.Info("checking manifest")
rawApps, err := cmd.findAndReadManifestWithFlavorText(cliSettings)
if err != nil {
log.Errorln("reading manifest:", err)
return err
}
log.Info("merging manifest and command flags")
manifestApplications, err := cmd.Actor.MergeAndValidateSettingsAndManifests(cliSettings, rawApps)
if err != nil {
log.Errorln("merging manifest:", err)
return err
}
cmd.UI.DisplayText("Getting app info...")
log.Info("converting manifests to ApplicationConfigs")
appConfigs, warnings, err := cmd.Actor.ConvertToApplicationConfigs(
cmd.Config.TargetedOrganization().GUID,
cmd.Config.TargetedSpace().GUID,
cmd.NoStart,
manifestApplications,
)
cmd.UI.DisplayWarnings(warnings)
if err != nil {
log.Errorln("converting manifest:", err)
return err
}
for _, appConfig := range appConfigs {
if appConfig.CreatingApplication() {
cmd.UI.DisplayText("Creating app with these attributes...")
} else {
cmd.UI.DisplayText("Updating app with these attributes...")
}
log.Infoln("starting create/update:", appConfig.DesiredApplication.Name)
changes := shared.GetApplicationChanges(appConfig)
err := cmd.UI.DisplayChangesForPush(changes)
if err != nil {
log.Errorln("display changes:", err)
return err
}
cmd.UI.DisplayNewline()
}
for appNumber, appConfig := range appConfigs {
if appConfig.CreatingApplication() {
cmd.UI.DisplayTextWithFlavor("Creating app {{.AppName}}...", map[string]interface{}{
"AppName": appConfig.DesiredApplication.Name,
})
} else {
cmd.UI.DisplayTextWithFlavor("Updating app {{.AppName}}...", map[string]interface{}{
"AppName": appConfig.DesiredApplication.Name,
})
}
configStream, eventStream, warningsStream, errorStream := cmd.Actor.Apply(appConfig, cmd.ProgressBar)
updatedConfig, err := cmd.processApplyStreams(user, appConfig, configStream, eventStream, warningsStream, errorStream)
if err != nil {
log.Errorln("process apply stream:", err)
return err
}
if !cmd.NoStart {
messages, logErrs, appState, apiWarnings, errs := cmd.RestartActor.RestartApplication(updatedConfig.CurrentApplication.Application, cmd.NOAAClient)
err = shared.PollStart(cmd.UI, cmd.Config, messages, logErrs, appState, apiWarnings, errs)
if err != nil {
return err
}
}
cmd.UI.DisplayNewline()
log.WithField("v3_api_version", cmd.ApplicationSummaryActor.CloudControllerV3APIVersion()).Debug("using v3 for app display")
appSummary, warnings, err := cmd.ApplicationSummaryActor.GetApplicationSummaryByNameAndSpace(appConfig.DesiredApplication.Name, cmd.Config.TargetedSpace().GUID, true)
cmd.UI.DisplayWarnings(warnings)
if err != nil {
return err
}
shared.NewAppSummaryDisplayer2(cmd.UI).AppDisplay(appSummary, true)
if appNumber+1 <= len(appConfigs) {
cmd.UI.DisplayNewline()
}
}
return nil
}
// GetCommandLineSettings generates a push CommandLineSettings object from the
// command's command line flags. It also validates those settings, preventing
// contradictory flags.
func (cmd PushCommand) GetCommandLineSettings() (pushaction.CommandLineSettings, error) {
err := cmd.validateArgs()
if err != nil {
return pushaction.CommandLineSettings{}, err
}
pwd, err := os.Getwd()
if err != nil {
return pushaction.CommandLineSettings{}, err
}
cmd.warnOnAnyDeprecatedRouteFlags()
dockerPassword := cmd.Config.DockerPassword()
if dockerPassword != "" {
cmd.UI.DisplayText("Using docker repository password from environment variable CF_DOCKER_PASSWORD.")
} else if cmd.DockerUsername != "" {
cmd.UI.DisplayText("Environment variable CF_DOCKER_PASSWORD not set.")
dockerPassword, err = cmd.UI.DisplayPasswordPrompt("Docker password")
if err != nil {
return pushaction.CommandLineSettings{}, err
}
}
config := pushaction.CommandLineSettings{
Buildpacks: cmd.Buildpacks, // -b
Command: cmd.Command.FilteredString, // -c
CurrentDirectory: pwd,
DefaultRouteDomain: cmd.Domain, // -d
DefaultRouteHostname: cmd.Hostname, // -n/--hostname
DiskQuota: cmd.DiskQuota.Value, // -k
DockerImage: cmd.DockerImage.Path, // -o
DockerPassword: dockerPassword, // ENV - CF_DOCKER_PASSWORD
DockerUsername: cmd.DockerUsername, // --docker-username
DropletPath: string(cmd.DropletPath), // --droplet
HealthCheckTimeout: cmd.HealthCheckTimeout, // -t
HealthCheckType: cmd.HealthCheckType.Type, // -u/--health-check-type
Instances: cmd.Instances.NullInt, // -i
Memory: cmd.Memory.Value, // -m
Name: cmd.OptionalArgs.AppName, // arg
NoHostname: cmd.NoHostname, // --no-hostname
NoRoute: cmd.NoRoute, // --no-route
ProvidedAppPath: string(cmd.AppPath), // -p
RandomRoute: cmd.RandomRoute, // --random-route
RoutePath: cmd.RoutePath.Path, // --route-path
StackName: cmd.StackName, // -s
}
log.Debugln("Command Line Settings:", config)
return config, nil
}
func (cmd PushCommand) warnOnAnyDeprecatedRouteFlags() {
var deprecatedFlag string
if cmd.NoHostname {
deprecatedFlag = "--no-hostname"
} else if cmd.Domain != "" {
deprecatedFlag = "-d"
} else if cmd.Hostname != "" {
deprecatedFlag = "--hostname"
} else if cmd.RoutePath.Path != "" {
deprecatedFlag = "--route-path"
}
if len(deprecatedFlag) > 0 {
cmd.UI.DisplayWarning("Deprecation warning: Use of the '{{.Flag}}' command-line flag option is deprecated in favor of the 'routes' property in the manifest. Please see https://docs.cloudfoundry.org/devguide/deploy-apps/manifest-attributes.html#routes for usage information. The '{{.Flag}}' command-line flag option will be removed in the future.",
map[string]interface{}{
"Flag": deprecatedFlag,
})
}
}
func (cmd PushCommand) findAndReadManifestWithFlavorText(settings pushaction.CommandLineSettings) ([]manifest.Application, error) {
var (
pathToManifest string
)
switch {
case cmd.NoManifest:
log.Debug("skipping reading of manifest")
case cmd.PathToManifest != "":
log.WithField("file", cmd.PathToManifest).Debug("using specified manifest file")
pathToManifest = string(cmd.PathToManifest)
fileInfo, err := os.Stat(pathToManifest)
if err != nil {
return nil, err
}
if fileInfo.IsDir() {
manifestPaths := []string{
filepath.Join(pathToManifest, "manifest.yml"),
filepath.Join(pathToManifest, "manifest.yaml"),
}
for _, manifestPath := range manifestPaths {
if _, err = os.Stat(manifestPath); err == nil {
pathToManifest = manifestPath
break
}
}
}
if err != nil {
return nil, translatableerror.ManifestFileNotFoundInDirectoryError{
PathToManifest: pathToManifest,
}
}
default:
log.Debug("searching for manifest file")
pathToManifest = filepath.Join(settings.CurrentDirectory, "manifest.yml")
if _, err := os.Stat(pathToManifest); os.IsNotExist(err) {
log.WithField("pathToManifest", pathToManifest).Debug("could not find")
// While this is unlikely to be used, it is kept for backwards
// compatibility.
pathToManifest = filepath.Join(settings.CurrentDirectory, "manifest.yaml")
if _, err := os.Stat(pathToManifest); os.IsNotExist(err) {
log.WithField("pathToManifest", pathToManifest).Debug("could not find")
pathToManifest = ""
}
}
}
user, err := cmd.Config.CurrentUser()
if err != nil {
return nil, err
}
if pathToManifest == "" {
cmd.UI.DisplayTextWithFlavor("Pushing app {{.AppName}} to org {{.OrgName}} / space {{.SpaceName}} as {{.Username}}...", map[string]interface{}{
"AppName": settings.Name,
"OrgName": cmd.Config.TargetedOrganization().Name,
"SpaceName": cmd.Config.TargetedSpace().Name,
"Username": user.Name,
})
return nil, nil
}
var pathsToVarsFiles []string
for _, path := range cmd.VarsFilePaths {
pathsToVarsFiles = append(pathsToVarsFiles, string(path))
}
cmd.UI.DisplayTextWithFlavor("Pushing from manifest to org {{.OrgName}} / space {{.SpaceName}} as {{.Username}}...", map[string]interface{}{
"OrgName": cmd.Config.TargetedOrganization().Name,
"SpaceName": cmd.Config.TargetedSpace().Name,
"Username": user.Name,
})
log.WithField("pathToManifest", pathToManifest).Info("reading manifest")
cmd.UI.DisplayText("Using manifest file {{.Path}}", map[string]interface{}{
"Path": pathToManifest,
})
apps, warnings, err := cmd.Actor.ReadManifest(pathToManifest, pathsToVarsFiles, cmd.Vars)
cmd.UI.DisplayWarnings(warnings)
return apps, err
}
func (cmd PushCommand) processApplyStreams(
user configv3.User,
appConfig pushaction.ApplicationConfig,
configStream <-chan pushaction.ApplicationConfig,
eventStream <-chan pushaction.Event,
warningsStream <-chan pushaction.Warnings,
errorStream <-chan error,
) (pushaction.ApplicationConfig, error) {
var configClosed, eventClosed, warningsClosed, complete bool
var updatedConfig pushaction.ApplicationConfig
for {
select {
case config, ok := <-configStream:
if !ok {
log.Debug("processing config stream closed")
configClosed = true
break
}
updatedConfig = config
log.Debugf("updated config received: %#v", updatedConfig)
case event, ok := <-eventStream:
if !ok {
log.Debug("processing event stream closed")
eventClosed = true
break
}
complete = cmd.processEvent(user, appConfig, event)
case warnings, ok := <-warningsStream:
if !ok {
log.Debug("processing warnings stream closed")
warningsClosed = true
break
}
cmd.UI.DisplayWarnings(warnings)
case err, ok := <-errorStream:
if !ok {
log.Debug("processing error stream closed")
warningsClosed = true
break
}
return pushaction.ApplicationConfig{}, err
}
if configClosed && eventClosed && warningsClosed && complete {
log.Debug("breaking apply display loop")
break
}
}
return updatedConfig, nil
}
func (cmd PushCommand) processEvent(user configv3.User, appConfig pushaction.ApplicationConfig, event pushaction.Event) bool {
log.Infoln("received apply event:", event)
switch event {
case pushaction.CreatingAndMappingRoutes:
cmd.UI.DisplayText("Mapping routes...")
case pushaction.UnmappingRoutes:
cmd.UI.DisplayText("Unmapping routes...")
case pushaction.ConfiguringServices:
cmd.UI.DisplayText("Binding services...")
case pushaction.ResourceMatching:
cmd.UI.DisplayText("Comparing local files to remote cache...")
case pushaction.CreatingArchive:
cmd.UI.DisplayText("Packaging files to upload...")
case pushaction.UploadingApplication:
cmd.UI.DisplayText("All files found in remote cache; nothing to upload.")
cmd.UI.DisplayText("Waiting for API to complete processing files...")
case pushaction.UploadingDroplet:
cmd.UI.DisplayText("Uploading droplet...")
log.Debug("starting progress bar")
cmd.ProgressBar.Ready()
case pushaction.UploadingApplicationWithArchive:
cmd.UI.DisplayText("Uploading files...")
log.Debug("starting progress bar")
cmd.ProgressBar.Ready()
case pushaction.RetryUpload:
cmd.UI.DisplayText("Retrying upload due to an error...")
case pushaction.UploadWithArchiveComplete:
cmd.ProgressBar.Complete()
cmd.UI.DisplayNewline()
cmd.UI.DisplayText("Waiting for API to complete processing files...")
case pushaction.UploadDropletComplete:
cmd.ProgressBar.Complete()
cmd.UI.DisplayNewline()
cmd.UI.DisplayText("Waiting for API to complete processing droplet...")
case pushaction.Complete:
return true
default:
log.WithField("event", event).Debug("ignoring event")
}
return false
}
func (cmd PushCommand) validateArgs() error {
switch {
case cmd.DropletPath != "" && cmd.AppPath != "":
return translatableerror.ArgumentCombinationError{
Args: []string{"--droplet", "-p"},
}
case cmd.DropletPath != "" && cmd.DockerImage.Path != "":
return translatableerror.ArgumentCombinationError{
Args: []string{"--droplet", "--docker-image", "-o"},
}
// ArgumentCombinationError trumps RequiredArgsError in this case (when
// DockerImage unspecified)
case cmd.DropletPath != "" && cmd.DockerUsername != "":
return translatableerror.ArgumentCombinationError{
Args: []string{"--droplet", "--docker-username", "-p"},
}
case cmd.DockerImage.Path != "" && cmd.AppPath != "":
return translatableerror.ArgumentCombinationError{
Args: []string{"--docker-image, -o", "-p"},
}
case cmd.DockerImage.Path != "" && cmd.Buildpacks != nil:
return translatableerror.ArgumentCombinationError{
Args: []string{"-b", "--docker-image, -o"},
}
case cmd.DockerUsername != "" && cmd.DockerImage.Path == "":
return translatableerror.RequiredFlagsError{
Arg1: "--docker-image, -o",
Arg2: "--docker-username",
}
case cmd.Domain != "" && cmd.NoRoute:
return translatableerror.ArgumentCombinationError{
Args: []string{"-d", "--no-route"},
}
case cmd.Hostname != "" && cmd.NoHostname:
return translatableerror.ArgumentCombinationError{
Args: []string{"--hostname", "-n", "--no-hostname"},
}
case cmd.Hostname != "" && cmd.NoRoute:
return translatableerror.ArgumentCombinationError{
Args: []string{"--hostname", "-n", "--no-route"},
}
case cmd.NoHostname && cmd.NoRoute:
return translatableerror.ArgumentCombinationError{
Args: []string{"--no-hostname", "--no-route"},
}
case cmd.PathToManifest != "" && cmd.NoManifest:
return translatableerror.ArgumentCombinationError{
Args: []string{"-f", "--no-manifest"},
}
case cmd.RandomRoute && cmd.Hostname != "":
return translatableerror.ArgumentCombinationError{
Args: []string{"--hostname", "-n", "--random-route"},
}
case cmd.RandomRoute && cmd.NoHostname:
return translatableerror.ArgumentCombinationError{
Args: []string{"--no-hostname", "--random-route"},
}
case cmd.RandomRoute && cmd.NoRoute:
return translatableerror.ArgumentCombinationError{
Args: []string{"--no-route", "--random-route"},
}
case cmd.RandomRoute && cmd.RoutePath.Path != "":
return translatableerror.ArgumentCombinationError{
Args: []string{"--random-route", "--route-path"},
}
case cmd.RoutePath.Path != "" && cmd.NoRoute:
return translatableerror.ArgumentCombinationError{
Args: []string{"--route-path", "--no-route"},
}
}
return nil
}