def agent_maintenance(consul_url=None, **kwargs):
 ret = {}
 query_params = {}
 if (not consul_url):
  consul_url = _get_config()
  if (not consul_url):
   log.error('No Consul URL found.')
   ret['message'] = 'No Consul URL found.'
   ret['res'] = False
   return ret
 if ('enable' in kwargs):
  query_params['enable'] = kwargs['enable']
 else:
  ret['message'] = 'Required parameter "enable" is missing.'
  ret['res'] = False
  return ret
 if ('reason' in kwargs):
  query_params['reason'] = kwargs['reason']
 function = 'agent/maintenance'
 res = _query(consul_url=consul_url, function=function, method='GET', query_params=query_params)
 if res['res']:
  ret['res'] = True
  ret['message'] = 'Agent maintenance mode {0}ed.'.format(kwargs['enable'])
 else:
  ret['res'] = True
  ret['message'] = 'Unable to change maintenance mode for agent.'
 return ret

def agent_maintenance ( consul_url = None , ** kwargs ) : ret = { } query_params = { } if ( not consul_url ) : consul_url = _get_config ( ) if ( not consul_url ) : log . error ( 'No Consul URL found.' ) ret [ 'message' ] = 'No Consul URL found.' ret [ 'res' ] = False return ret if ( 'enable' in kwargs ) : query_params [ 'enable' ] = kwargs [ 'enable' ] else : ret [ 'message' ] = 'Required parameter "enable" is missing.' ret [ 'res' ] = False return ret if ( 'reason' in kwargs ) : query_params [ 'reason' ] = kwargs [ 'reason' ] function = 'agent/maintenance' res = _query ( consul_url = consul_url , function = function , method = 'GET' , query_params = query_params ) if res [ 'res' ] : ret [ 'res' ] = True ret [ 'message' ] = 'Agent maintenance mode {0}ed.' . format ( kwargs [ 'enable' ] ) else : ret [ 'res' ] = True ret [ 'message' ] = 'Unable to change maintenance mode for agent.' return ret
manages node maintenance mode .