os_ironic_node: avoid set_node_instance_info and purge_node_instance_info (#54463)

These openstacksdk calls are awkward special-case wrappers around
patch_machine, and I would like to deprecate them in openstacksdk change
https://review.openstack.org/647730. Use much simpler update_machine instead.
pull/54463/merge
Dmitry Tantsur 5 years ago committed by ansibot
parent 886f4c66ca
commit d33ee72085

@ -125,18 +125,6 @@ def _choose_id_value(module):
return None
# TODO(TheJulia): Change this over to use the machine patch method
# in shade once it is available.
def _prepare_instance_info_patch(instance_info):
patch = []
patch.append({
'op': 'replace',
'path': '/instance_info',
'value': instance_info
})
return patch
def _is_true(value):
true_values = [True, 'yes', 'Yes', 'True', 'true', 'present', 'on']
if value in true_values:
@ -306,8 +294,7 @@ def main():
# deployment specific. Perhaps consider adding rebuild
# support, although there is a known desire to remove
# rebuild support from Ironic at some point in the future.
patch = _prepare_instance_info_patch(instance_info)
cloud.set_node_instance_info(uuid, patch)
cloud.update_machine(uuid, instance_info=instance_info)
cloud.validate_node(uuid)
if not wait:
cloud.activate_node(uuid, module.params['config_drive'])
@ -322,7 +309,7 @@ def main():
elif _is_false(module.params['state']):
if node['provision_state'] not in "deleted":
cloud.purge_node_instance_info(uuid)
cloud.update_machine(uuid, instance_info={})
if not wait:
cloud.deactivate_node(uuid)
else:

Loading…
Cancel
Save