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
|
# get object reference
|
||||||
ib_obj_ref, update, new_name = self.get_object_ref(self.module, ib_obj_type, obj_filter, ib_spec)
|
ib_obj_ref, update, new_name = self.get_object_ref(self.module, ib_obj_type, obj_filter, ib_spec)
|
||||||
|
|
||||||
proposed_object = {}
|
proposed_object = {}
|
||||||
for key, value in iteritems(ib_spec):
|
for key, value in iteritems(ib_spec):
|
||||||
if self.module.params[key] is not None:
|
if self.module.params[key] is not None:
|
||||||
|
@ -268,7 +267,6 @@ class WapiModule(WapiBase):
|
||||||
else:
|
else:
|
||||||
current_object = obj_filter
|
current_object = obj_filter
|
||||||
ref = None
|
ref = None
|
||||||
|
|
||||||
# checks if the object type is member to normalize the attributes being passed
|
# checks if the object type is member to normalize the attributes being passed
|
||||||
if (ib_obj_type == NIOS_MEMBER):
|
if (ib_obj_type == NIOS_MEMBER):
|
||||||
proposed_object = member_normalize(proposed_object)
|
proposed_object = member_normalize(proposed_object)
|
||||||
|
@ -290,6 +288,12 @@ class WapiModule(WapiBase):
|
||||||
if not self.module.check_mode:
|
if not self.module.check_mode:
|
||||||
self.create_object(ib_obj_type, proposed_object)
|
self.create_object(ib_obj_type, proposed_object)
|
||||||
result['changed'] = True
|
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:
|
elif modified:
|
||||||
self.check_if_recordname_exists(obj_filter, ib_obj_ref, ib_obj_type, current_object, proposed_object)
|
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
|
# reinstate restart_if_needed key if it's set to true in play
|
||||||
if module.params['restart_if_needed']:
|
if module.params['restart_if_needed']:
|
||||||
ib_spec['restart_if_needed'] = temp
|
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:
|
else:
|
||||||
ib_obj = self.get_object(ib_obj_type, obj_filter.copy(), return_fields=ib_spec.keys())
|
ib_obj = self.get_object(ib_obj_type, obj_filter.copy(), return_fields=ib_spec.keys())
|
||||||
return ib_obj, update, new_name
|
return ib_obj, update, new_name
|
||||||
|
|
|
@ -283,6 +283,11 @@ options:
|
||||||
licenses:
|
licenses:
|
||||||
description:
|
description:
|
||||||
- An array of license types.
|
- An array of license types.
|
||||||
|
create_token:
|
||||||
|
description:
|
||||||
|
- Flag for initiating a create token request for pre-provisioned members.
|
||||||
|
type: bool
|
||||||
|
default: False
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- Configures the intended state of the instance of the object on
|
- 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),
|
syslog_servers=dict(type='list', elements='dict', options=syslog_spec),
|
||||||
pre_provisioning=dict(type='dict', elements='dict', options=pre_prov_spec),
|
pre_provisioning=dict(type='dict', elements='dict', options=pre_prov_spec),
|
||||||
extattrs=dict(type='dict'),
|
extattrs=dict(type='dict'),
|
||||||
|
create_token=dict(type='bool', default=False),
|
||||||
)
|
)
|
||||||
|
|
||||||
argument_spec = dict(
|
argument_spec = dict(
|
||||||
|
|
Loading…
Reference in a new issue