From e266a242638405bf8a48cf3fdd0adcd8cc54190a Mon Sep 17 00:00:00 2001 From: Tim Rupp Date: Wed, 12 Sep 2018 15:56:43 -0400 Subject: [PATCH] Fixes bugs in the bigip_software modules (#45577) This patch makes hotfix code work, where before, only base images were working --- lib/ansible/modules/network/f5/bigip_software_image.py | 6 +++--- lib/ansible/modules/network/f5/bigip_software_install.py | 9 +++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/ansible/modules/network/f5/bigip_software_image.py b/lib/ansible/modules/network/f5/bigip_software_image.py index cb88b51956e..9d10098296d 100644 --- a/lib/ansible/modules/network/f5/bigip_software_image.py +++ b/lib/ansible/modules/network/f5/bigip_software_image.py @@ -285,7 +285,7 @@ class ModuleManager(object): return self.create() def exists(self): - if self.image_exists() or self.image_exists(): + if self.image_exists() or self.hotfix_exists(): return True return False @@ -408,7 +408,7 @@ class ModuleManager(object): except ValueError as ex: raise F5ModuleError(str(ex)) - if 'code' in response and response['code'] == 400: + if 'code' in response and response['code'] in [400, 404]: if 'message' in response: raise F5ModuleError(response['message']) else: @@ -438,7 +438,7 @@ class ModuleManager(object): response = self.client.api.delete(uri) if response.status == 200: return True - if 'code' in response and response['code'] == 400: + if 'code' in response and response['code'] in [400, 404]: if 'message' in response: raise F5ModuleError(response['message']) else: diff --git a/lib/ansible/modules/network/f5/bigip_software_install.py b/lib/ansible/modules/network/f5/bigip_software_install.py index 3666f83661b..f8fdba4a0de 100644 --- a/lib/ansible/modules/network/f5/bigip_software_install.py +++ b/lib/ansible/modules/network/f5/bigip_software_install.py @@ -188,7 +188,7 @@ class ModuleParameters(Parameters): image = self.read_image_from_device(type='image') if image: return image - image = self.read_hotfix_from_device(type='hotfix') + image = self.read_image_from_device(type='hotfix') if image: return image return None @@ -206,11 +206,8 @@ class ModuleParameters(Parameters): except ValueError: return None - if 'code' in response and response['code'] == 400: - if 'message' in response: - return None - else: - return None + if 'code' in response and response['code'] in [400, 404]: + return None return response