Updating based on PR comments
This commit is contained in:
parent
1ab5987ebc
commit
14124ef1b8
1 changed files with 8 additions and 15 deletions
|
@ -113,12 +113,7 @@ changed:
|
||||||
returned: always
|
returned: always
|
||||||
type: bool
|
type: bool
|
||||||
sample: True
|
sample: True
|
||||||
check_mode:
|
state:
|
||||||
description: Whether or not the module was executed in check mode.
|
|
||||||
returned: always
|
|
||||||
type: bool
|
|
||||||
sample: True
|
|
||||||
Results:
|
|
||||||
description: Facts about the current state of the object.
|
description: Facts about the current state of the object.
|
||||||
returned: always
|
returned: always
|
||||||
type: dict
|
type: dict
|
||||||
|
@ -176,9 +171,9 @@ class AzureRMPublicIPAddress(AzureRMModuleBase):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
self.module_arg_spec = dict(
|
self.module_arg_spec = dict(
|
||||||
resource_group=dict(required=True),
|
resource_group=dict(type='str', required=True),
|
||||||
name=dict(required=True),
|
name=dict(type='str', required=True),
|
||||||
state=dict(default='present', choices=['present', 'absent']),
|
state=dict(type='str', default='present', choices=['present', 'absent']),
|
||||||
location=dict(type='str'),
|
location=dict(type='str'),
|
||||||
allocation_method=dict(type='str', default='Dynamic', choices=['Dynamic', 'Static']),
|
allocation_method=dict(type='str', default='Dynamic', choices=['Dynamic', 'Static']),
|
||||||
domain_name=dict(type='str', aliases=['domain_name_label']),
|
domain_name=dict(type='str', aliases=['domain_name_label']),
|
||||||
|
@ -194,7 +189,7 @@ class AzureRMPublicIPAddress(AzureRMModuleBase):
|
||||||
|
|
||||||
self.results = dict(
|
self.results = dict(
|
||||||
changed=False,
|
changed=False,
|
||||||
results=dict()
|
state=dict()
|
||||||
)
|
)
|
||||||
|
|
||||||
super(AzureRMPublicIPAddress, self).__init__(derived_arg_spec=self.module_arg_spec,
|
super(AzureRMPublicIPAddress, self).__init__(derived_arg_spec=self.module_arg_spec,
|
||||||
|
@ -205,8 +200,6 @@ class AzureRMPublicIPAddress(AzureRMModuleBase):
|
||||||
for key in self.module_arg_spec.keys() + ['tags']:
|
for key in self.module_arg_spec.keys() + ['tags']:
|
||||||
setattr(self, key, kwargs[key])
|
setattr(self, key, kwargs[key])
|
||||||
|
|
||||||
self.results['check_mode'] = self.check_mode
|
|
||||||
|
|
||||||
results = dict()
|
results = dict()
|
||||||
changed = False
|
changed = False
|
||||||
pip = None
|
pip = None
|
||||||
|
@ -250,7 +243,7 @@ class AzureRMPublicIPAddress(AzureRMModuleBase):
|
||||||
self.log("CHANGED: pip {0} does not exist but requested state is 'present'".format(self.name))
|
self.log("CHANGED: pip {0} does not exist but requested state is 'present'".format(self.name))
|
||||||
changed = True
|
changed = True
|
||||||
|
|
||||||
self.results['results'] = results
|
self.results['state'] = results
|
||||||
self.results['changed'] = changed
|
self.results['changed'] = changed
|
||||||
|
|
||||||
if self.check_mode:
|
if self.check_mode:
|
||||||
|
@ -281,7 +274,7 @@ class AzureRMPublicIPAddress(AzureRMModuleBase):
|
||||||
pip.dns_settings = PublicIPAddressDnsSettings(
|
pip.dns_settings = PublicIPAddressDnsSettings(
|
||||||
domain_name_label=self.domain_name
|
domain_name_label=self.domain_name
|
||||||
)
|
)
|
||||||
self.results['results'] = self.create_or_update_pip(pip)
|
self.results['state'] = self.create_or_update_pip(pip)
|
||||||
elif self.state == 'absent':
|
elif self.state == 'absent':
|
||||||
self.log('Delete public ip {0}'.format(self.name))
|
self.log('Delete public ip {0}'.format(self.name))
|
||||||
self.delete_pip()
|
self.delete_pip()
|
||||||
|
@ -303,7 +296,7 @@ class AzureRMPublicIPAddress(AzureRMModuleBase):
|
||||||
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)
|
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['results']['status'] = 'Deleted'
|
self.results['state']['status'] = 'Deleted'
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue