Add timeout flag for phase run in cli

Syntax:
	airshipctl phase run <PHASE_NAME> --timeout <time_unit>

Exmaple:
	airshipctl phase run initinfra-ephemeral --debug --wait-timeout 1000s

Change-Id: Ic8c699f5302eb482f32aee0e7d7c593df2ed7d3b
This commit is contained in:
Sirajudeen
2020-09-25 03:11:16 +00:00
parent 484a4b1549
commit 3e4c228638
5 changed files with 21 additions and 6 deletions

View File

@@ -104,11 +104,17 @@ func (e *Executor) Run(ch chan events.Event, runOpts ifc.RunOptions) {
if runOpts.DryRun {
dryRunStrategy = common.DryRunClient
}
timeout := time.Second * time.Duration(e.apiObject.Config.WaitOptions.Timeout)
if int64(runOpts.Timeout/time.Second) != 0 {
timeout = runOpts.Timeout
}
log.Debugf("WaitTimeout: %v", timeout)
applyOptions := ApplyOptions{
DryRunStrategy: dryRunStrategy,
Prune: e.apiObject.Config.PruneOptions.Prune,
BundleName: e.Options.BundleName,
WaitTimeout: time.Second * time.Duration(e.apiObject.Config.WaitOptions.Timeout),
WaitTimeout: timeout,
}
applier.ApplyBundle(filteredBundle, applyOptions)
}