#NEWLINE# @ cliutils . arg ( 'node' , metavar = '<node>' , help = 'Name or UUID of the node.' ) #NEWLINE# @ cliutils . arg ( 'provision_state' , metavar = '<provision-state>' , choices = [ 'active' , 'deleted' , 'rebuild' , 'inspect' , 'provide' , 'manage' , 'clean' , 'abort' ] , help = "Supported states: 'active', 'deleted', 'rebuild', 'inspect', 'provide', 'manage', 'clean' or 'abort'." ) #NEWLINE# @ cliutils . arg ( '--config-drive' , metavar = '<config-drive>' , default = None , help = "A gzipped, base64-encoded configuration drive string OR the path to the configuration drive file OR the path to a directory containing the config drive files. In case it's a directory, a config drive will be generated from it. This argument is only valid when setting provision-state to 'active'." ) #NEWLINE# @ cliutils . arg ( '--clean-steps' , metavar = '<clean-steps>' , default = None , help = "The clean steps in JSON format. May be the path to a file containing the clean steps; OR '-', with the clean steps being read from standard input; OR a string. The value should be a list of clean-step dictionaries; each dictionary should have keys 'interface' and 'step', and optional key 'args'. This argument must be specified (and is only valid) when setting provision-state to 'clean'." ) #NEWLINE# def do_node_set_provision_state( cc , args ) : #NEWLINE# #INDENT# 'Initiate a provisioning state change for a node.' #NEWLINE# if ( args . config_drive and ( args . provision_state != 'active' ) ) : #NEWLINE# #INDENT# raise exceptions . CommandError ( _ ( '--config-drive is only valid when setting provision state to "active"' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( args . clean_steps and ( args . provision_state != 'clean' ) ) : #NEWLINE# #INDENT# raise exceptions . CommandError ( _ ( '--clean-steps is only valid when setting provision state to "clean"' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( args . provision_state == 'clean' ) and ( not args . clean_steps ) ) : #NEWLINE# #INDENT# raise exceptions . CommandError ( _ ( '--clean-steps must be specified when setting provision state to "clean"' ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# clean_steps = args . clean_steps #NEWLINE# if ( args . clean_steps == '-' ) : #NEWLINE# #INDENT# clean_steps = _get_from_stdin ( 'clean steps' ) #NEWLINE# #UNINDENT# if cc : #NEWLINE# #INDENT# clean_steps = _handle_json_or_file_arg ( clean_steps ) #NEWLINE# #UNINDENT# cc . node . set_provision_state ( args . node , args . provision_state , configdrive = args . config_drive , cleansteps = clean_steps )