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
Force bool
Atomic bool
CleanupOnFail bool
cmd cmd
}
@ -69,6 +70,9 @@ func (u *Upgrade) Prepare(cfg Config) error {
if u.Atomic {
args = append(args, "--atomic")
}
if u.CleanupOnFail {
args = append(args, "--cleanup-on-fail")
}
if u.Values != "" {
args = append(args, "--set", u.Values)
}

View file

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