def _login(**kwargs):
 connargs = dict()
 def _connarg(name, key=None):
  "\n        Add key to connargs, only if name exists in our kwargs or, as zabbix.<name> in __opts__ or __pillar__\n\n        Evaluate in said order - kwargs, opts, then pillar. To avoid collision with other functions,\n        kwargs-based connection arguments are prefixed with 'connection_' (i.e. '_connection_user', etc.).\n\n        Inspired by mysql salt module.\n        "
  if (key is None):
   key = name
  if (name in kwargs):
   connargs[key] = kwargs[name]
  else:
   prefix = '_connection_'
   if name.startswith(prefix):
    try:
     name = name[len(prefix):]
    except IndexError:
     return
   val = __salt__['config.option']('zabbix.{0}'.format(name), None)
   if (val is not None):
    connargs[key] = val
 _connarg('_connection_user', 'user')
 _connarg('_connection_password', 'password')
 _connarg('_connection_url', 'url')
 if ('url' not in connargs):
  connargs['url'] = _frontend_url()
 try:
  if (connargs['user'] and connargs['password'] and connargs['url']):
   params = {'user': connargs['user'], 'password': connargs['password']}
   method = 'user.login'
   ret = _query(method, params, connargs['url'])
   auth = ret['result']
   connargs['auth'] = auth
   connargs.pop('user', None)
   connargs.pop('password', None)
   return connargs
  else:
   raise KeyError
 except KeyError:
  return False

def _login ( ** kwargs ) : connargs = dict ( ) def _connarg ( name , key = None ) : if ( key is None ) : key = name if ( name in kwargs ) : connargs [ key ] = kwargs [ name ] else : prefix = '_connection_' if name . startswith ( prefix ) : try : name = name [ len ( prefix ) : ] except IndexError : return val = __salt__ [ 'config.option' ] ( 'zabbix.{0}' . format ( name ) , None ) if ( val is not None ) : connargs [ key ] = val _connarg ( '_connection_user' , 'user' ) _connarg ( '_connection_password' , 'password' ) _connarg ( '_connection_url' , 'url' ) if ( 'url' not in connargs ) : connargs [ 'url' ] = _frontend_url ( ) try : if ( connargs [ 'user' ] and connargs [ 'password' ] and connargs [ 'url' ] ) : params = { 'user' : connargs [ 'user' ] , 'password' : connargs [ 'password' ] } method = 'user.login' ret = _query ( method , params , connargs [ 'url' ] ) auth = ret [ 'result' ] connargs [ 'auth' ] = auth connargs . pop ( 'user' , None ) connargs . pop ( 'password' , None ) return connargs else : raise KeyError except KeyError : return False
this function is used internally and should not ever be called directly .