From 4734a79841d8e5ce759bf9870611f333464dd204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20K=C3=A4mmerling?= Date: Thu, 8 Apr 2021 12:55:10 +0200 Subject: [PATCH] Fix sanity tests --- plugins/modules/hcloud_server.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/plugins/modules/hcloud_server.py b/plugins/modules/hcloud_server.py index 91120de..1d24ae6 100644 --- a/plugins/modules/hcloud_server.py +++ b/plugins/modules/hcloud_server.py @@ -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):