Skip to content

Commit

Permalink
Fixed issue where a second trap was replacing the first and leaving a…
Browse files Browse the repository at this point in the history
… temp file
  • Loading branch information
Houlistonm authored and edwardecook committed Aug 29, 2019
1 parent f4e0ccb commit dba4785
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions bosh/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ func (r Runner) Run(data environment.Config, dryRun bool, boshArgs ...string) er
if len(boshArgs) > 0 {
lines = append(
lines,
fmt.Sprintf(`trap 'rm -f ${ssh_key_path}' EXIT`),
fmt.Sprintf(`trap 'rm -f ${bosh_ca_path}' EXIT`),
fmt.Sprintf(`trap 'rm -f ${ssh_key_path} ${bosh_ca_path}' EXIT`),
fmt.Sprintf(`/usr/bin/env $bosh_client $bosh_env $bosh_secret $bosh_ca_cert $bosh_proxy $bosh_gw_host $bosh_gw_user $bosh_gw_private_key bosh %s`, strings.Join(boshArgs, " ")),
)
prereqs = append(prereqs, "bosh")
Expand Down
3 changes: 1 addition & 2 deletions bosh/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ var _ = Describe("bosh runner", func() {
`bosh_gw_user="BOSH_GW_USER=ubuntu"`,
`bosh_gw_private_key="BOSH_GW_PRIVATE_KEY=${ssh_key_path}"`,

`trap 'rm -f ${ssh_key_path}' EXIT`,
`trap 'rm -f ${bosh_ca_path}' EXIT`,
`trap 'rm -f ${ssh_key_path} ${bosh_ca_path}' EXIT`,
`/usr/bin/env $bosh_client $bosh_env $bosh_secret $bosh_ca_cert $bosh_proxy $bosh_gw_host $bosh_gw_user $bosh_gw_private_key bosh arg1 arg2 arg3`,
}))

Expand Down
3 changes: 1 addition & 2 deletions integration/fixtures/bosh_cmd_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,5 @@ bosh_proxy="BOSH_ALL_PROXY=ssh+socks5://[email protected]:22?private-key=${s
bosh_gw_host="BOSH_GW_HOST=35.225.148.133"
bosh_gw_user="BOSH_GW_USER=ubuntu"
bosh_gw_private_key="BOSH_GW_PRIVATE_KEY=${ssh_key_path}"
trap 'rm -f ${ssh_key_path}' EXIT
trap 'rm -f ${bosh_ca_path}' EXIT
trap 'rm -f ${ssh_key_path} ${bosh_ca_path}' EXIT
/usr/bin/env $bosh_client $bosh_env $bosh_secret $bosh_ca_cert $bosh_proxy $bosh_gw_host $bosh_gw_user $bosh_gw_private_key bosh deployments

0 comments on commit dba4785

Please sign in to comment.