endpoints/plugins/SaltMinion.py
def __connect_to_saltapi(self):
        """
        connects to salt api endpoint to get a token with the specified user and password

        defaults to 'pam' eauth method

        :return: boolean if successful

        """

        _auth_json = """
               {
                "username" : "%s",
                "password" : "%s",
                "eauth": "pam"
                }
                """ % (self.username, self.password)

        if ':' not in self.host:
            # if we don't have a port specified, let's add the default of 8000 here
            self.host += ':8000'

        full_url = self.protocol + "://" + self.host + self._saltapi_auth_path
        request = urllib2.Request(full_url)

        print "Authenticating to salt-api with username/password: %s %s" % (self.username, self.password)
        request.add_header("Content-Type", "application/json")

        result = self.__perform_post(request, _auth_json).read()
        json_results = json.loads(result)
        self._auth_token = json_results['return'][0]['token']

        return True

        connects to salt api endpoint to get a token with the specified user and password

        defaults to 'pam' eauth method

        :return: boolean if successful

        
connects to salt api endpoint to get a token with the specified user and password
defaults to 'pam' eauth method
connects to salt api endpoint to get a token with the specified user and password defaults to ' pam ' eauth method
def __connect_to_saltapi(self):
        _auth_json = """
               {
                "username" : "%s",
                "password" : "%s",
                "eauth": "pam"
                }
                """ % (self.username, self.password)
        if ':' not in self.host:
            self.host += ':8000'
        full_url = self.protocol + "://" + self.host + self._saltapi_auth_path
        request = urllib2.Request(full_url)
        print "Authenticating to salt-api with username/password: %s %s" % (self.username, self.password)
        request.add_header("Content-Type", "application/json")
        result = self.__perform_post(request, _auth_json).read()
        json_results = json.loads(result)
        self._auth_token = json_results['return'][0]['token']
        return True
def __connect_to_saltapi ( self ) : _auth_json = """
               {
                "username" : "%s",
                "password" : "%s",
                "eauth": "pam"
                }
                """ % ( self . username , self . password ) if ':' not in self . host : self . host += ':8000' full_url = self . protocol + "://" + self . host + self . _saltapi_auth_path request = urllib2 . Request ( full_url ) print "Authenticating to salt-api with username/password: %s %s" % ( self . username , self . password ) request . add_header ( "Content-Type" , "application/json" ) result = self . __perform_post ( request , _auth_json ) . read ( ) json_results = json . loads ( result ) self . _auth_token = json_results [ 'return' ] [ 0 ] [ 'token' ] return True
connects to salt api endpoint to get a token with the specified user and password
defaults to 'pam' eauth method
connects to salt api endpoint to get a token with the specified user and password defaults to ' pam ' eauth method
"""
        connects to salt api endpoint to get a token with the specified user and password

        defaults to 'pam' eauth method

        :return: boolean if successful

        """ # if we don't have a port specified, let's add the default of 8000 here
boolean if successful
boolean if successful
self