CleanupOnFail option for the upgrade Step [#65]

This commit is contained in:
Erin Call 2020-01-07 12:53:55 -08:00
parent e071d23fef
commit 8c6c6fbfa5
No known key found for this signature in database
GPG key ID: 4071FF6C15B8DAD1
2 changed files with 28 additions and 22 deletions

View file

@ -19,6 +19,7 @@ type Upgrade struct {
Timeout string Timeout string
Force bool Force bool
Atomic bool Atomic bool
CleanupOnFail bool
cmd cmd cmd cmd
} }
@ -69,6 +70,9 @@ func (u *Upgrade) Prepare(cfg Config) error {
if u.Atomic { if u.Atomic {
args = append(args, "--atomic") args = append(args, "--atomic")
} }
if u.CleanupOnFail {
args = append(args, "--cleanup-on-fail")
}
if u.Values != "" { if u.Values != "" {
args = append(args, "--set", u.Values) args = append(args, "--set", u.Values)
} }

View file

@ -101,6 +101,7 @@ func (suite *UpgradeTestSuite) TestPrepareWithUpgradeFlags() {
Timeout: "sit_in_the_corner", Timeout: "sit_in_the_corner",
Force: true, Force: true,
Atomic: true, Atomic: true,
CleanupOnFail: true,
} }
cfg := Config{} cfg := Config{}
@ -115,6 +116,7 @@ func (suite *UpgradeTestSuite) TestPrepareWithUpgradeFlags() {
"--timeout", "sit_in_the_corner", "--timeout", "sit_in_the_corner",
"--force", "--force",
"--atomic", "--atomic",
"--cleanup-on-fail",
"--set", "age=35", "--set", "age=35",
"--set-string", "height=5ft10in", "--set-string", "height=5ft10in",
"--values", "/usr/local/stats", "--values", "/usr/local/stats",