Add a wait argument to baremetal_node

openstacksdk will start using cleaning in 1.0.0 [1], so we need to be
able to wait for it to finish.

[1] https://review.opendev.org/c/openstack/openstacksdk/+/849402

Change-Id: I9695b1a5acfa007ad474c9b5b07a4fdb4c1b1198
This commit is contained in:
Dmitry Tantsur 2022-07-13 11:21:32 +02:00 committed by Jakob Meng
parent 960e5df17f
commit fd15087c4d

View File

@ -164,6 +164,18 @@ options:
type: bool
aliases:
- skip_update_of_driver_password
wait:
description:
- A boolean value instructing the module to wait for the newly created
node to reach the available state.
type: bool
default: 'no'
timeout:
description:
- An integer value representing the number of seconds to
wait for the newly created node to reach the available state.
default: 1800
type: int
requirements:
- "python >= 3.6"
- "openstacksdk"
@ -304,7 +316,9 @@ def main():
version='2.0.0',
collection_name='openstack.cloud')]
),
state=dict(required=False, default='present', choices=['present', 'absent'])
state=dict(required=False, default='present', choices=['present', 'absent']),
wait=dict(type='bool', required=False, default=False),
timeout=dict(required=False, type='int', default=1800),
)
module_kwargs = openstack_module_kwargs()
module = IronicModule(argument_spec, **module_kwargs)
@ -358,8 +372,11 @@ def main():
if module.params['uuid']:
kwargs['uuid'] = module.params['uuid']
server = cloud.register_machine(module.params['nics'],
**kwargs)
server = cloud.register_machine(
module.params['nics'],
wait=module.params['wait'],
timeout=module.params['timeout'],
**kwargs)
module.exit_json(changed=True, uuid=server['uuid'],
provision_state=server['provision_state'])
else: