def __init__(self, credentials=None):
        """
        We allow overriding of the credentials used within the various
        client classes managed by the Manager object. Left as None, the
        standard username/password/tenant_name[/domain_name] is used.

        :param credentials: Override of the credentials
        """
        self.auth_version = CONF.identity.auth_version
        if credentials is None:
            self.credentials = cred_provider.get_configured_credentials('user')
        else:
            self.credentials = credentials
        # Check if passed or default credentials are valid
        if not self.credentials.is_valid():
            raise exceptions.InvalidCredentials()
        # Tenant isolation creates TestResources, but Accounts and some tests
        # creates Credentials
        if isinstance(credentials, cred_provider.TestResources):
            creds = self.credentials.credentials
        else:
            creds = self.credentials
        # Creates an auth provider for the credentials
        self.auth_provider = get_auth_provider(creds)
        # FIXME(andreaf) unused
        self.client_attr_names = []
Exemplo n.º 2
0
    def __init__(self, credentials=None):
        """
        We allow overriding of the credentials used within the various
        client classes managed by the Manager object. Left as None, the
        standard username/password/tenant_name[/domain_name] is used.

        :param credentials: Override of the credentials
        """
        self.auth_version = CONF.identity.auth_version
        if credentials is None:
            self.credentials = cred_provider.get_configured_credentials('user')
        else:
            self.credentials = credentials
        # Check if passed or default credentials are valid
        if not self.credentials.is_valid():
            raise exceptions.InvalidCredentials()
        # Tenant isolation creates TestResources, but Accounts and some tests
        # creates Credentials
        if isinstance(credentials, cred_provider.TestResources):
            creds = self.credentials.credentials
        else:
            creds = self.credentials
        # Creates an auth provider for the credentials
        self.auth_provider = get_auth_provider(creds)
        # FIXME(andreaf) unused
        self.client_attr_names = []
Exemplo n.º 3
0
 def __init__(self,
              identity_version=None,
              name=None,
              password='******',
              network_resources=None):
     super(IsolatedCreds, self).__init__(identity_version, name, password,
                                         network_resources)
     self.network_resources = network_resources
     self.isolated_creds = {}
     self.ports = []
     self.password = password
     self.default_admin_creds = cred_provider.get_configured_credentials(
         'identity_admin',
         fill_in=True,
         identity_version=self.identity_version)
     self.identity_admin_client, self.network_admin_client = (
         self._get_admin_clients())
     # Domain where isolated credentials are provisioned (v3 only).
     # Use that of the admin account is None is configured.
     self.creds_domain_name = None
     if self.identity_version == 'v3':
         self.creds_domain_name = (
             CONF.auth.tenant_isolation_domain_name
             or self.default_admin_creds.project_domain_name)
     self.creds_client = get_creds_client(self.identity_admin_client,
                                          self.creds_domain_name)
 def get_primary_creds(self):
     if self.isolated_creds.get('primary'):
         return self.isolated_creds.get('primary')
     primary_credential = cred_provider.get_configured_credentials(
         credential_type='user', identity_version=self.identity_version)
     self.isolated_creds['primary'] = cred_provider.TestResources(
         primary_credential)
     return self.isolated_creds['primary']
Exemplo n.º 5
0
 def get_alt_creds(self):
     if self.isolated_creds.get('alt'):
         return self.isolated_creds.get('alt')
     alt_credential = cred_provider.get_configured_credentials(
         credential_type='alt_user', identity_version=self.identity_version)
     self.isolated_creds['alt'] = cred_provider.TestResources(
         alt_credential)
     return self.isolated_creds['alt']
Exemplo n.º 6
0
 def get_primary_creds(self):
     if self.isolated_creds.get('primary'):
         return self.isolated_creds.get('primary')
     primary_credential = cred_provider.get_configured_credentials(
         credential_type='user', identity_version=self.identity_version)
     self.isolated_creds['primary'] = cred_provider.TestResources(
         primary_credential)
     return self.isolated_creds['primary']
def is_admin_available():
    is_admin = True
    # If tenant isolation is enabled admin will be available
    if CONF.auth.allow_tenant_isolation:
        return is_admin
    # Check whether test accounts file has the admin specified or not
    elif (CONF.auth.test_accounts_file and
            os.path.isfile(CONF.auth.test_accounts_file)):
        check_accounts = accounts.Accounts(name='check_admin')
        if not check_accounts.admin_available():
            is_admin = False
    else:
        try:
            cred_provider.get_configured_credentials('identity_admin',
                                                     fill_in=False)
        except exceptions.InvalidConfiguration:
            is_admin = False
    return is_admin
 def get_alt_creds(self):
     if self.isolated_creds.get('alt'):
         return self.isolated_creds.get('alt')
     alt_credential = cred_provider.get_configured_credentials(
         credential_type='alt_user',
         identity_version=self.identity_version)
     self.isolated_creds['alt'] = cred_provider.TestResources(
         alt_credential)
     return self.isolated_creds['alt']
Exemplo n.º 9
0
def is_admin_available():
    is_admin = True
    # If tenant isolation is enabled admin will be available
    if CONF.auth.allow_tenant_isolation:
        return is_admin
    # Check whether test accounts file has the admin specified or not
    elif (CONF.auth.test_accounts_file
          and os.path.isfile(CONF.auth.test_accounts_file)):
        check_accounts = accounts.Accounts(name='check_admin')
        if not check_accounts.admin_available():
            is_admin = False
    else:
        try:
            cred_provider.get_configured_credentials('identity_admin',
                                                     fill_in=False)
        except exceptions.InvalidConfiguration:
            is_admin = False
    return is_admin
Exemplo n.º 10
0
 def __init__(self, identity_version=None, name=None, password='******',
              network_resources=None):
     super(IsolatedCreds, self).__init__(identity_version, name, password,
                                         network_resources)
     self.network_resources = network_resources
     self.isolated_creds = {}
     self.ports = []
     self.password = password
     self.default_admin_creds = cred_provider.get_configured_credentials(
         'identity_admin', fill_in=True,
         identity_version=self.identity_version)
     self.identity_admin_client, self.network_admin_client = (
         self._get_admin_clients())
     # Domain where isolated credentials are provisioned (v3 only).
     # Use that of the admin account is None is configured.
     self.creds_domain_name = None
     if self.identity_version == 'v3':
         self.creds_domain_name = (
             CONF.auth.tenant_isolation_domain_name or
             self.default_admin_creds.project_domain_name)
     self.creds_client = get_creds_client(
         self.identity_admin_client, self.creds_domain_name)
 def __init__(self, service=None):
     super(AdminManager, self).__init__(
         credentials=cred_provider.get_configured_credentials(
             'identity_admin'),
         service=service)
Exemplo n.º 12
0
 def __init__(self, service=None):
     super(AdminManager, self).__init__(
         credentials=cred_provider.get_configured_credentials(
             'identity_admin'),
         service=service)
 def get_admin_creds(self):
     creds = cred_provider.get_configured_credentials(
         "identity_admin", fill_in=False)
     self.isolated_creds['admin'] = cred_provider.TestResources(creds)
     return self.isolated_creds['admin']
Exemplo n.º 14
0
 def get_admin_creds(self):
     creds = cred_provider.get_configured_credentials("identity_admin",
                                                      fill_in=False)
     self.isolated_creds['admin'] = cred_provider.TestResources(creds)
     return self.isolated_creds['admin']