def agent_service_maintenance(consul_url=None, serviceid=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 (not serviceid):
  raise SaltInvocationError('Required argument "serviceid" is missing.')
 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/service/maintenance/{0}'.format(serviceid)
 res = _query(consul_url=consul_url, function=function, query_params=query_params)
 if res['res']:
  ret['res'] = True
  ret['message'] = 'Service {0} set in maintenance mode.'.format(serviceid)
 else:
  ret['res'] = False
  ret['message'] = 'Unable to set service {0} to maintenance mode.'.format(serviceid)
 return ret

def agent_service_maintenance ( consul_url = None , serviceid = 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 ( not serviceid ) : raise SaltInvocationError ( 'Required argument "serviceid" is missing.' ) 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/service/maintenance/{0}' . format ( serviceid ) res = _query ( consul_url = consul_url , function = function , query_params = query_params ) if res [ 'res' ] : ret [ 'res' ] = True ret [ 'message' ] = 'Service {0} set in maintenance mode.' . format ( serviceid ) else : ret [ 'res' ] = False ret [ 'message' ] = 'Unable to set service {0} to maintenance mode.' . format ( serviceid ) return ret
used to place a service into maintenance mode .