#NEWLINE# @ cliutils . arg ( 'node' , metavar = '<node>' , help = 'Name or UUID of the node.' ) #NEWLINE# @ cliutils . arg ( 'maintenance_mode' , metavar = '<maintenance-mode>' , help = "'true' or 'false'; 'on' or 'off'." ) #NEWLINE# @ cliutils . arg ( '--reason' , metavar = '<reason>' , default = None , help = "Reason for setting maintenance mode to 'true' or 'on'; not valid when setting to 'false' or 'off'." ) #NEWLINE# def do_node_set_maintenance( cc , args ) : #NEWLINE# #INDENT# 'Enable or disable maintenance mode for a node.' #NEWLINE# maintenance_mode = utils . bool_argument_value ( '<maintenance-mode>' , args . maintenance_mode ) #NEWLINE# if ( args . reason and ( not maintenance_mode ) ) : #NEWLINE# #INDENT# raise exceptions . CommandError ( _ ( 'Cannot set "reason" when turning off maintenance mode.' ) ) #NEWLINE# #UNINDENT# cc . node . set_maintenance ( args . node , maintenance_mode , maint_reason = cc . reason )