mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Updated the Infoblox member module (#53747)
* Update api.py * Update nios_member.py * Update nios_member.py * Update api.py * Update api.py * Update nios_member.py
This commit is contained in:
parent
4573f349ea
commit
c5e5fef67e
2 changed files with 20 additions and 2 deletions
|
@ -245,7 +245,6 @@ class WapiModule(WapiBase):
|
|||
|
||||
# get object reference
|
||||
ib_obj_ref, update, new_name = self.get_object_ref(self.module, ib_obj_type, obj_filter, ib_spec)
|
||||
|
||||
proposed_object = {}
|
||||
for key, value in iteritems(ib_spec):
|
||||
if self.module.params[key] is not None:
|
||||
|
@ -268,7 +267,6 @@ class WapiModule(WapiBase):
|
|||
else:
|
||||
current_object = obj_filter
|
||||
ref = None
|
||||
|
||||
# checks if the object type is member to normalize the attributes being passed
|
||||
if (ib_obj_type == NIOS_MEMBER):
|
||||
proposed_object = member_normalize(proposed_object)
|
||||
|
@ -290,6 +288,12 @@ class WapiModule(WapiBase):
|
|||
if not self.module.check_mode:
|
||||
self.create_object(ib_obj_type, proposed_object)
|
||||
result['changed'] = True
|
||||
# Check if NIOS_MEMBER and the flag to call function create_token is set
|
||||
elif (ib_obj_type == NIOS_MEMBER) and (proposed_object['create_token']):
|
||||
proposed_object = None
|
||||
# the function creates a token that can be used by a pre-provisioned member to join the grid
|
||||
result['api_results'] = self.call_func('create_token', ref, proposed_object)
|
||||
result['changed'] = True
|
||||
elif modified:
|
||||
self.check_if_recordname_exists(obj_filter, ib_obj_ref, ib_obj_type, current_object, proposed_object)
|
||||
|
||||
|
@ -442,6 +446,14 @@ class WapiModule(WapiBase):
|
|||
# reinstate restart_if_needed key if it's set to true in play
|
||||
if module.params['restart_if_needed']:
|
||||
ib_spec['restart_if_needed'] = temp
|
||||
elif (ib_obj_type == NIOS_MEMBER):
|
||||
# del key 'create_token' as nios_member get_object fails with the key present
|
||||
temp = ib_spec['create_token']
|
||||
del ib_spec['create_token']
|
||||
ib_obj = self.get_object(ib_obj_type, obj_filter.copy(), return_fields=ib_spec.keys())
|
||||
if temp:
|
||||
# reinstate 'create_token' key
|
||||
ib_spec['create_token'] = temp
|
||||
else:
|
||||
ib_obj = self.get_object(ib_obj_type, obj_filter.copy(), return_fields=ib_spec.keys())
|
||||
return ib_obj, update, new_name
|
||||
|
|
|
@ -283,6 +283,11 @@ options:
|
|||
licenses:
|
||||
description:
|
||||
- An array of license types.
|
||||
create_token:
|
||||
description:
|
||||
- Flag for initiating a create token request for pre-provisioned members.
|
||||
type: bool
|
||||
default: False
|
||||
state:
|
||||
description:
|
||||
- Configures the intended state of the instance of the object on
|
||||
|
@ -464,6 +469,7 @@ def main():
|
|||
syslog_servers=dict(type='list', elements='dict', options=syslog_spec),
|
||||
pre_provisioning=dict(type='dict', elements='dict', options=pre_prov_spec),
|
||||
extattrs=dict(type='dict'),
|
||||
create_token=dict(type='bool', default=False),
|
||||
)
|
||||
|
||||
argument_spec = dict(
|
||||
|
|
Loading…
Reference in a new issue