#NEWLINE# def update_machine( self , name_or_id , chassis_uuid = None , driver = None , driver_info = None , name = None , instance_info = None , instance_uuid = None , properties = None ) : #NEWLINE# #INDENT# 'Update a machine with new configuration information\n\n        A user-friendly method to perform updates of a machine, in whole or\n        part.\n\n        :param string name_or_id: A machine name or UUID to be updated.\n        :param string chassis_uuid: Assign a chassis UUID to the machine.\n                                    NOTE: As of the Kilo release, this value\n                                    cannot be changed once set. If a user\n                                    attempts to change this value, then the\n                                    Ironic API, as of Kilo, will reject the\n                                    request.\n        :param string driver: The driver name for controlling the machine.\n        :param dict driver_info: The dictonary defining the configuration\n                                 that the driver will utilize to control\n                                 the machine.  Permutations of this are\n                                 dependent upon the specific driver utilized.\n        :param string name: A human relatable name to represent the machine.\n        :param dict instance_info: A dictonary of configuration information\n                                   that conveys to the driver how the host\n                                   is to be configured when deployed.\n                                   be deployed to the machine.\n        :param string instance_uuid: A UUID value representing the instance\n                                     that the deployed machine represents.\n        :param dict properties: A dictonary defining the properties of a\n                                machine.\n\n        :raises: OpenStackCloudException on operation error.\n\n        :returns: Dictonary containing a machine sub-dictonary consisting\n                  of the updated data returned from the API update operation,\n                  and a list named changes which contains all of the API paths\n                  that received updates.\n        ' #NEWLINE# machine = self . get_machine ( name_or_id ) #NEWLINE# if ( not machine ) : #NEWLINE# #INDENT# raise OpenStackCloudException ( ( 'Machine update failed to find Machine: %s. ' % name_or_id ) ) #NEWLINE# #UNINDENT# machine_config = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# new_config = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# try : #NEWLINE# #INDENT# if chassis_uuid : #NEWLINE# #INDENT# machine_config [ 'chassis_uuid' ] = machine [ 'chassis_uuid' ] #NEWLINE# new_config [ 'chassis_uuid' ] = chassis_uuid #NEWLINE# #UNINDENT# if driver : #NEWLINE# #INDENT# machine_config [ 'driver' ] = machine [ 'driver' ] #NEWLINE# new_config [ 'driver' ] = driver #NEWLINE# #UNINDENT# if driver_info : #NEWLINE# #INDENT# machine_config [ 'driver_info' ] = machine [ 'driver_info' ] #NEWLINE# new_config [ 'driver_info' ] = driver_info #NEWLINE# #UNINDENT# if name : #NEWLINE# #INDENT# machine_config [ 'name' ] = machine [ 'name' ] #NEWLINE# new_config [ 'name' ] = name #NEWLINE# #UNINDENT# if instance_info : #NEWLINE# #INDENT# machine_config [ 'instance_info' ] = machine [ 'instance_info' ] #NEWLINE# new_config [ 'instance_info' ] = instance_info #NEWLINE# #UNINDENT# if instance_uuid : #NEWLINE# #INDENT# machine_config [ 'instance_uuid' ] = machine [ 'instance_uuid' ] #NEWLINE# new_config [ 'instance_uuid' ] = instance_uuid #NEWLINE# #UNINDENT# if properties : #NEWLINE# #INDENT# machine_config [ 'properties' ] = machine [ 'properties' ] #NEWLINE# new_config [ 'properties' ] = properties #NEWLINE# #UNINDENT# #UNINDENT# except KeyError as e : #NEWLINE# #INDENT# self . log . debug ( ( 'Unexpected machine response missing key %s [%s]' % ( e . args [ 0 ] , name_or_id ) ) ) #NEWLINE# raise OpenStackCloudException ( ( 'Machine update failed - machine [%s] missing key %s. Potential API issue.' % ( name_or_id , e . args [ 0 ] ) ) ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# patch = jsonpatch . JsonPatch . from_diff ( machine_config , new_config ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# raise OpenStackCloudException ( ( 'Machine update failed - Error generating JSON patch object for submission to the API. Machine: %s Error: %s' % ( name_or_id , str ( e ) ) ) ) #NEWLINE# #UNINDENT# with _utils . shade_exceptions ( 'Machine update failed - patch operation failed on Machine {node}' . format ( node = name_or_id ) ) : #NEWLINE# #INDENT# if ( not patch ) : #NEWLINE# #INDENT# return dict ( node = machine , changes = None ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# machine = self . patch_machine ( machine [ 'uuid' ] , list ( patch ) ) #NEWLINE# change_list = [ ] #NEWLINE# for change in list ( patch ) : #NEWLINE# #INDENT# change_list . append ( change [ 'path' ] ) #NEWLINE# #UNINDENT# return dict ( node = machine , changes = change_list )