delete_stemcell is causing bosh CLI to fail when stemcell already does not exist
ryanmichaelsmith opened this issue · 2 comments
ryanmichaelsmith commented
This code snip is the end of a bosh create-env run where it's trying to clean up an unused stemcell. I'm not sure why it's trying to clean up a stemcell that doesn't exist, however this operation shouldn't cause the command to fail.
Deleting unused stemcell 'ami-092de32f5f076d587'... Failed (00:00:03)
Cleaning up rendered CPI jobs... Finished (00:00:00)
Deleting stemcell from cloud:
CPI 'delete_stemcell' method responded with error: CmdError{"type":"Bosh::Clouds::CloudError","message":"could not find AMI 'ami-092de32f5f076d587'","ok_to_retry":false}
Exit code 1
===== 2023-05-10 03:43:09 UTC Finished "/usr/local/bin/bosh --no-color --non-interactive --tty create-env /var/tempest/workspaces/default/deployments/bosh.yml"; Duration: 1234s; Exit Status: 1
{"type":"step_finished","id":"bosh_product.deploying","description":"Installing BOSH"}
I believe delete_stemcell is already supposed to ignore this error, but this doesn't appear to be working as expected. At least in the context of CreateEnv.
func (s *cloudStemcell) Delete() error {
deleteErr := s.cloud.DeleteStemcell(s.cid)
if deleteErr != nil {
// allow StemcellNotFoundError for idempotency
cloudErr, ok := deleteErr.(bicloud.Error)
if !ok || cloudErr.Type() != bicloud.StemcellNotFoundError {
return bosherr.WrapError(deleteErr, "Deleting stemcell from cloud")
}
}
ryanmichaelsmith commented
Bosh cli 7.2.3. CPI is AWS.
rkoster commented
Thanks for reporting this, unfortunately we currently don't have the bandwidth to fix this, but we are happy to review a PR.