Skip to content

Commit

Permalink
Fixes bugs in the bigip_software modules (ansible#45577)
Browse files Browse the repository at this point in the history
This patch makes hotfix code work, where before, only base images
were working

(cherry picked from commit e266a24)
  • Loading branch information
caphrim007 authored and abadger committed Sep 12, 2018
1 parent 186f4ef commit 25349b8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
6 changes: 3 additions & 3 deletions lib/ansible/modules/network/f5/bigip_software_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def present(self):
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

Expand Down Expand Up @@ -408,7 +408,7 @@ def read_iso_from_device(self, type):
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:
Expand Down Expand Up @@ -438,7 +438,7 @@ def remove_iso_from_device(self, type):
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:
Expand Down
9 changes: 3 additions & 6 deletions lib/ansible/modules/network/f5/bigip_software_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def read_image(self):
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
Expand All @@ -206,11 +206,8 @@ def read_image_from_device(self, type):
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


Expand Down

0 comments on commit 25349b8

Please sign in to comment.