@utils.arg('--all-tenants', action='store_const', const=1, default=0, help=_('Reset state server(s) in another tenant by name (Admin only).'))
@utils.arg('server', metavar='<server>', nargs='+', help=_('Name or ID of server(s).'))
@utils.arg('--active', action='store_const', dest='state', default='error', const='active', help=_('Request the server be reset to "active" state instead of "error" state (the default).'))
def do_reset_state(cs, args):
 failure_flag = False
 find_args = {'all_tenants': args.all_tenants}
 for server in args.server:
  try:
   _find_server(cs, server, **find_args).reset_state(args.state)
   msg = 'Reset state for server %s succeeded; new state is %s'
   print((msg % (server, args.state)))
  except Exception as e:
   failure_flag = True
   msg = ('Reset state for server %s failed: %s' % (server, e))
   print(msg)
 if failure_flag:
  msg = 'Unable to reset the state for the specified server(s).'
  raise exceptions.CommandError(msg)

@ utils . arg ( '--all-tenants' , action = 'store_const' , const = 1 , default = 0 , help = _ ( 'Reset state server(s) in another tenant by name (Admin only).' ) ) @ utils . arg ( 'server' , metavar = '<server>' , nargs = '+' , help = _ ( 'Name or ID of server(s).' ) ) @ utils . arg ( '--active' , action = 'store_const' , dest = 'state' , default = 'error' , const = 'active' , help = _ ( 'Request the server be reset to "active" state instead of "error" state (the default).' ) ) def do_reset_state ( cs , args ) : failure_flag = False find_args = { 'all_tenants' : args . all_tenants } for server in args . server : try : _find_server ( cs , server , ** find_args ) . reset_state ( args . state ) msg = 'Reset state for server %s succeeded; new state is %s' print ( ( msg % ( server , args . state ) ) ) except Exception as e : failure_flag = True msg = ( 'Reset state for server %s failed: %s' % ( server , e ) ) print ( msg ) if failure_flag : msg = 'Unable to reset the state for the specified server(s).' raise exceptions . CommandError ( msg )
reset the state of a server .