def delete_stack_file(stackname):
try:
core.describe_stack(stackname) # triggers exception if NOT exists
LOG.warning('stack %r still exists, refusing to delete stack files. delete active stack first.', stackname)
return
except BotoServerError as ex:
if not ex.message.endswith('does not exist'):
LOG.exception("unhandled exception attempting to confirm if stack %r exists", stackname)
raise
ext_list = [
".pem",
".pub",
".json",
".yaml", # yaml files are now deprecated
]
paths = [join(config.STACK_DIR, stackname + ext) for ext in ext_list]
paths = filter(os.path.exists, paths)
def _unlink(path):
os.unlink(path)
return not os.path.exists(path)
return dict(zip(paths, map(_unlink, paths)))
评论列表
文章目录