#NEWLINE# @ base . passthru ( [ 'POST' ] ) #NEWLINE# @ task_manager . require_exclusive_lock #NEWLINE# def pass_deploy_info( self , task , **kwargs ) : #NEWLINE# #INDENT# 'Continues the deployment of baremetal node.' #NEWLINE# node = task . node #NEWLINE# task . process_event ( 'resume' ) #NEWLINE# err_msg = _ ( 'Failed to continue deployment with Fuel Agent.' ) #NEWLINE# agent_status = kwargs . get ( 'status' ) #NEWLINE# if ( agent_status != 'ready' ) : #NEWLINE# #INDENT# LOG . error ( _LE ( 'Deploy failed for node %(node)s. Fuel Agent is not in ready state, error: %(error)s' ) , { #NEWLINE# #INDENT# 'node' : node . uuid , #NEWLINE# 'error' : kwargs . get ( 'error_message' ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# deploy_utils . set_failed_state ( task , err_msg ) #NEWLINE# return #NEWLINE# #UNINDENT# params = _parse_driver_info ( node ) #NEWLINE# params [ 'host' ] = kwargs . get ( 'address' ) #NEWLINE# cmd = ( '%s --data_driver ironic  --config-file /etc/fuel-agent/fuel-agent.conf' % params . pop ( 'script' ) ) #NEWLINE# if CONF . debug : #NEWLINE# #INDENT# cmd += ' --debug' #NEWLINE# #UNINDENT# instance_info = node . instance_info #NEWLINE# try : #NEWLINE# #INDENT# deploy_data = _get_deploy_data ( task . context , instance_info [ 'image_source' ] ) #NEWLINE# image_data = { #NEWLINE# #INDENT# '/' : { #NEWLINE# #INDENT# 'uri' : instance_info [ 'image_url' ] , #NEWLINE# 'format' : 'raw' , #NEWLINE# 'container' : 'raw' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# deploy_data [ 'ks_meta' ] [ 'image_data' ] = image_data #NEWLINE# ssh = utils . ssh_connect ( params ) #NEWLINE# sftp = ssh . open_sftp ( ) #NEWLINE# _sftp_upload ( sftp , json . dumps ( deploy_data ) , '/tmp/provision.json' ) #NEWLINE# configdrive = instance_info . get ( 'configdrive' ) #NEWLINE# if ( configdrive is not None ) : #NEWLINE# #INDENT# _sftp_upload ( sftp , configdrive , '/tmp/config-drive.img' ) #NEWLINE# #UNINDENT# _ssh_execute ( ssh , cmd , params ) #NEWLINE# LOG . info ( _LI ( 'Fuel Agent pass on node %s' ) , node . uuid ) #NEWLINE# manager_utils . node_set_boot_device ( task , boot_devices . DISK , persistent = True ) #NEWLINE# manager_utils . node_power_action ( task , states . REBOOT ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# msg = ( _ ( 'Deploy failed for node %(node)s. Error: %(error)s' ) % { #NEWLINE# #INDENT# 'node' : node . uuid , #NEWLINE# 'error' : e , #NEWLINE# #UNINDENT# } ) #NEWLINE# LOG . error ( msg ) #NEWLINE# deploy_utils . set_failed_state ( task , msg ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# task . process_event ( 'done' ) #NEWLINE# LOG . info ( _LI ( 'Deployment to node %s done' ) , task . node . uuid )