Пример #1
0
    def __init__(self,
                 username,
                 password,
                 auth_url,
                 project_name,
                 user_domain_name=None,
                 project_domain_name=None,
                 ca_path=None):
        CoreCredentials.__init__(self, collections.OrderedDict({username: password}))

        self.auth_url = auth_url
        self.project_name = project_name
        self.user_domain_name = user_domain_name
        self.project_domain_name = project_domain_name
        self.ca_path = ca_path

        # Decode the version

        self.version = None

        for version in self._supported_keystone_versions:
            if auth_url[-len(version):].lower() == version:
                self.version = version
                break

        if self.version is None:
            raise ValueError('{}: Unknown or unsupported Keystone version'.
                             format(auth_url))
        # Is SSL being used
        self.is_ssl = auth_url[:5].lower() == 'https'

        if self.is_ssl:
            if self.ca_path is None:
                raise ValueError('A path to a certificates file is required if SSL is in use')
            elif not os.path.exists(self.ca_path):
                raise IOError("Certificate file '{}' does not exist".format(self.ca_path))
Пример #2
0
    def __init__(self, username, password, address, port):
        Credentials.__init__(self, collections.OrderedDict({username: password}))

        self.address = address
        self.port = port