mirror of
https://github.com/ansible-collections/hetzner.hcloud.git
synced 2026-02-04 08:01:49 +00:00
Fix sanity tests
This commit is contained in:
parent
8c74ae070d
commit
4734a79841
1 changed files with 6 additions and 9 deletions
|
|
@ -400,21 +400,18 @@ class AnsibleHcloudServer(Hcloud):
|
|||
else:
|
||||
try:
|
||||
image = self.client.images.get_by_id(self.module.params.get("image"))
|
||||
except Exception:
|
||||
except:
|
||||
self.module.fail_json(msg="Image %s was not found" % image.name)
|
||||
if image.deprecated is not None:
|
||||
available_until = image.deprecated + timedelta(days=180)
|
||||
if self.module.params.get("allow_deprecated_image"):
|
||||
self.module.warn(
|
||||
("You try to use a deprecated image. The image %s will " +
|
||||
"continue to be available until %s.") % (image.name, available_until.strftime('%Y-%m-%d'))
|
||||
)
|
||||
"You try to use a deprecated image. The image %s will continue to be available until %s."
|
||||
% (image.name, available_until.strftime('%Y-%m-%d')))
|
||||
else:
|
||||
self.module.fail_json(msg=("You try to use a deprecated image. The image %s will " +
|
||||
"continue to be available until %s. " +
|
||||
"If you want to use this image use allow_deprecated_image=yes.") % (
|
||||
image.name, available_until.strftime('%Y-%m-%d'))
|
||||
)
|
||||
self.module.fail_json(
|
||||
msg=("You try to use a deprecated image. The image %s will continue to be available until %s. " +
|
||||
"If you want to use this image use allow_deprecated_image=yes.") % (image.name, available_until.strftime('%Y-%m-%d')))
|
||||
return image
|
||||
|
||||
def _update_server(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue