Fix poller error handling

reviewable/pr18780/r1
chouseknecht 9 years ago
parent 14124ef1b8
commit 3f8d04e74b
No known key found for this signature in database
GPG Key ID: 78F1698C5705A81B

@ -284,17 +284,17 @@ class AzureRMPublicIPAddress(AzureRMModuleBase):
def create_or_update_pip(self, pip): def create_or_update_pip(self, pip):
try: try:
poller = self.network_client.public_ip_addresses.create_or_update(self.resource_group, self.name, pip) poller = self.network_client.public_ip_addresses.create_or_update(self.resource_group, self.name, pip)
pip = self.get_poller_result(poller)
except Exception as exc: except Exception as exc:
self.fail("Error creating or updating {0} - {1}".format(self.name, str(exc))) self.fail("Error creating or updating {0} - {1}".format(self.name, str(exc)))
pip = self.get_poller_result(poller)
return pip_to_dict(pip) return pip_to_dict(pip)
def delete_pip(self): def delete_pip(self):
try: try:
poller = self.network_client.public_ip_addresses.delete(self.resource_group, self.name) poller = self.network_client.public_ip_addresses.delete(self.resource_group, self.name)
self.get_poller_result(poller)
except Exception as exc: except Exception as exc:
self.fail("Error deleting {0} - {1}".format(self.name, str(exc))) self.fail("Error deleting {0} - {1}".format(self.name, str(exc)))
self.get_poller_result(poller)
# Delete returns nada. If we get here, assume that all is well. # Delete returns nada. If we get here, assume that all is well.
self.results['state']['status'] = 'Deleted' self.results['state']['status'] = 'Deleted'
return True return True

Loading…
Cancel
Save