a_frame/utils/action_providers/RestAction.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)

        full_url = self.protocol + "://" + self.host + self._saltapi_auth_path
        print(full_url)
        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")

        try:
            result_object = self.__perform_post(request, _auth_json)
            # catch the case where the result object is not a valid respone,
            # i.e. an error string or None
            if hasattr(result_object, "read"):
                result = result_object.read()
                json_results = json.loads(result)
                if 'return' in json_results:
                    self._auth_token = json_results['return'][0]['token']
            else:
                print('No valid response!')
                return False

        except HTTPError as he:
            print('Could not auth to salt_api!')
            print(str(he))
            return False
        except ValueError as ve:
            print('Could not parse json results from salt_api')
            print(str(ve))
            return False
        except KeyError:
            print('Could not find valid auth token in salt_api response!')
            print(json_results)
            return False

        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)
        full_url = self.protocol + "://" + self.host + self._saltapi_auth_path
        print(full_url)
        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")
        try:
            result_object = self.__perform_post(request, _auth_json)
            if hasattr(result_object, "read"):
                result = result_object.read()
                json_results = json.loads(result)
                if 'return' in json_results:
                    self._auth_token = json_results['return'][0]['token']
            else:
                print('No valid response!')
                return False
        except HTTPError as he:
            print('Could not auth to salt_api!')
            print(str(he))
            return False
        except ValueError as ve:
            print('Could not parse json results from salt_api')
            print(str(ve))
            return False
        except KeyError:
            print('Could not find valid auth token in salt_api response!')
            print(json_results)
            return False
        return True
def __connect_to_saltapi ( self ) : _auth_json = """
           {
            "username" : "%s",
            "password" : "%s",
            "eauth": "pam"
            }
            """ % ( self . username , self . password ) full_url = self . protocol + "://" + self . host + self . _saltapi_auth_path print ( full_url ) 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" ) try : result_object = self . __perform_post ( request , _auth_json ) if hasattr ( result_object , "read" ) : result = result_object . read ( ) json_results = json . loads ( result ) if 'return' in json_results : self . _auth_token = json_results [ 'return' ] [ 0 ] [ 'token' ] else : print ( 'No valid response!' ) return False except HTTPError as he : print ( 'Could not auth to salt_api!' ) print ( str ( he ) ) return False except ValueError as ve : print ( 'Could not parse json results from salt_api' ) print ( str ( ve ) ) return False except KeyError : print ( 'Could not find valid auth token in salt_api response!' ) print ( json_results ) return False 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

        """ # catch the case where the result object is not a valid respone, # i.e. an error string or None
boolean if successful
boolean if successful
self