Beispiel #1
0
 def _verify_credentials(self, credentials_class, filled=True,
                         identity_version=None):
     for ctype in cred_provider.CREDENTIAL_TYPES:
         if identity_version is None:
             creds = cred_provider.get_configured_credentials(
                 credential_type=ctype, fill_in=filled)
         else:
             creds = cred_provider.get_configured_credentials(
                 credential_type=ctype, fill_in=filled,
                 identity_version=identity_version)
         self._check(creds, credentials_class, filled)
Beispiel #2
0
def is_admin_available():
    is_admin = True
    # In the case of a pre-provisioned account, if even if creds were
    # configured, the admin credentials won't be available
    if (CONF.auth.locking_credentials_provider
            and not CONF.auth.allow_tenant_isolation):
        is_admin = False
    else:
        try:
            cred_provider.get_configured_credentials('identity_admin')
        except NotImplementedError:
            is_admin = False

    return is_admin
Beispiel #3
0
def is_admin_available():
    is_admin = True
    # In the case of a pre-provisioned account, if even if creds were
    # configured, the admin credentials won't be available
    if (CONF.auth.locking_credentials_provider and
        not CONF.auth.allow_tenant_isolation):
        is_admin = False
    else:
        try:
            cred_provider.get_configured_credentials('identity_admin')
        except NotImplementedError:
            is_admin = False

    return is_admin
Beispiel #4
0
    def create_client(self, client_type):
        creds = cred_provider.get_configured_credentials('identity_admin')
        auth_prov = tempestmanager.get_auth_provider(creds)

        return policy_client.PolicyClient(
            auth_prov, client_type,
            CONF.identity.region)
Beispiel #5
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)
Beispiel #6
0
 def __init__(self):
     os = clients.Manager(
         cred_provider.get_configured_credentials('user', fill_in=False))
     self.images_client = os.images_client
     self.flavors_client = os.flavors_client
     self.image_pattern = CONF.input_scenario.image_regex
     self.flavor_pattern = CONF.input_scenario.flavor_regex
Beispiel #7
0
    def setUpClass(cls):
        super(ScenarioPolicyBase, cls).setUpClass()
        # auth provider for admin credentials
        creds = cred_provider.get_configured_credentials("identity_admin")
        auth_prov = tempestmanager.get_auth_provider(creds)

        cls.admin_manager.congress_client = policy_client.PolicyClient(auth_prov, "policy", CONF.identity.region)
Beispiel #8
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'] = primary_credential
     return primary_credential
Beispiel #9
0
 def __init__(self):
     os = clients.Manager(
         cred_provider.get_configured_credentials('user', fill_in=False))
     self.images_client = os.images_client
     self.flavors_client = os.flavors_client
     self.image_pattern = CONF.input_scenario.image_regex
     self.flavor_pattern = CONF.input_scenario.flavor_regex
Beispiel #10
0
 def get_alt_creds(self):
     if self._creds.get('alt'):
         return self._creds.get('alt')
     alt_credential = cred_provider.get_configured_credentials(
         credential_type='alt_user', identity_version=self.identity_version)
     self._creds['alt'] = cred_provider.TestResources(alt_credential)
     return self._creds['alt']
Beispiel #11
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 = []
Beispiel #12
0
 def __init__(self,
              identity_version,
              name=None,
              network_resources=None,
              credentials_domain=None):
     super(DynamicCredentialProvider,
           self).__init__(identity_version=identity_version,
                          name=name,
                          network_resources=network_resources,
                          credentials_domain=credentials_domain)
     self._creds = {}
     self.ports = []
     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.networks_admin_client,
      self.subnets_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 = (
             self.default_admin_creds.project_domain_name
             or self.credentials_domain)
     self.creds_client = cred_client.get_creds_client(
         self.identity_admin_client, self.creds_domain_name)
Beispiel #13
0
 def get_alt_creds(self):
     if self._creds.get("alt"):
         return self._creds.get("alt")
     alt_credential = cred_provider.get_configured_credentials(
         credential_type="alt_user", identity_version=self.identity_version
     )
     self._creds["alt"] = cred_provider.TestResources(alt_credential)
     return self._creds["alt"]
Beispiel #14
0
 def get_primary_creds(self):
     if self._creds.get("primary"):
         return self._creds.get("primary")
     primary_credential = cred_provider.get_configured_credentials(
         credential_type="user", identity_version=self.identity_version
     )
     self._creds["primary"] = cred_provider.TestResources(primary_credential)
     return self._creds["primary"]
Beispiel #15
0
 def get_primary_creds(self):
     if self._creds.get('primary'):
         return self._creds.get('primary')
     primary_credential = cred_provider.get_configured_credentials(
         credential_type='user', identity_version=self.identity_version)
     self._creds['primary'] = cred_provider.TestResources(
         primary_credential)
     return self._creds['primary']
Beispiel #16
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'] = alt_credential
     return alt_credential
Beispiel #17
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']
Beispiel #18
0
    def setUpClass(cls):
        super(TestCase, cls).setUpClass()

        # If no credentials are provided, the Manager will use those
        # in CONF.identity and generate an auth_provider from them
        cls.creds = cred_provider.get_configured_credentials(
            credential_type='identity_admin')
        mgr = clients.Manager(cls.creds)
        cls.client = MuranoClient(mgr.auth_provider)
Beispiel #19
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']
Beispiel #20
0
    def setUpClass(cls):
        super(TestCase, cls).setUpClass()

        # If no credentials are provided, the Manager will use those
        # in CONF.identity and generate an auth_provider from them
        cls.creds = cred_provider.get_configured_credentials(
            credential_type='identity_admin')
        mgr = clients.Manager(cls.creds)
        cls.client = MuranoClient(mgr.auth_provider)
Beispiel #21
0
def is_admin_available():
    is_admin = True
    # If dynamic credentials is enabled admin will be available
    if CONF.auth.use_dynamic_credentials:
        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
Beispiel #22
0
def is_admin_available():
    is_admin = True
    # If dynamic credentials is enabled admin will be available
    if CONF.auth.use_dynamic_credentials:
        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
Beispiel #23
0
 def get_alt_creds(self):
     if self.isolated_creds.get('alt'):
         return self.isolated_creds.get('alt')
     if not self.use_default_creds:
         creds = self.get_creds(1)
         alt_credential = cred_provider.get_credentials(**creds)
     else:
         alt_credential = cred_provider.get_configured_credentials(
             'alt_user')
     self.isolated_creds['alt'] = alt_credential
     return alt_credential
Beispiel #24
0
 def get_primary_creds(self):
     if self.isolated_creds.get('primary'):
         return self.isolated_creds.get('primary')
     if not self.use_default_creds:
         creds = self.get_creds(0)
         primary_credential = cred_provider.get_credentials(**creds)
     else:
         primary_credential = cred_provider.get_configured_credentials(
             'user')
     self.isolated_creds['primary'] = primary_credential
     return primary_credential
Beispiel #25
0
 def get_primary_creds(self):
     if self.isolated_creds.get('primary'):
         return self.isolated_creds.get('primary')
     if not self.use_default_creds:
         creds = self.get_creds(0)
         primary_credential = cred_provider.get_credentials(**creds)
     else:
         primary_credential = cred_provider.get_configured_credentials(
             'user')
     self.isolated_creds['primary'] = primary_credential
     return primary_credential
Beispiel #26
0
 def get_alt_creds(self):
     if self.isolated_creds.get('alt'):
         return self.isolated_creds.get('alt')
     if not self.use_default_creds:
         creds = self.get_creds(1)
         alt_credential = cred_provider.get_credentials(**creds)
     else:
         alt_credential = cred_provider.get_configured_credentials(
             'alt_user')
     self.isolated_creds['alt'] = alt_credential
     return alt_credential
def is_admin_available(identity_version):
    is_admin = True
    # If dynamic credentials is enabled admin will be available
    if CONF.auth.use_dynamic_credentials:
        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 = preprov_creds.PreProvisionedCredentialProvider(
            identity_version=identity_version, name='check_admin',
            admin_role=CONF.identity.admin_role)
        if not check_accounts.admin_available():
            is_admin = False
    else:
        try:
            cred_provider.get_configured_credentials(
                'identity_admin', fill_in=False,
                identity_version=identity_version)
        except exceptions.InvalidConfiguration:
            is_admin = False
    return is_admin
Beispiel #28
0
 def __init__(self, identity_version=None, name=None,
              network_resources=None):
     super(IsolatedCreds, self).__init__(identity_version, name,
                                         network_resources)
     self.network_resources = network_resources
     self.isolated_creds = {}
     self.ports = []
     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)
Beispiel #29
0
 def __init__(self, identity_version, name=None, network_resources=None,
              credentials_domain=None):
     super(DynamicCredentialProvider, self).__init__(
         identity_version=identity_version, name=name,
         network_resources=network_resources,
         credentials_domain=credentials_domain)
     self._creds = {}
     self.ports = []
     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.networks_admin_client,
      self.subnets_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 = (
             self.default_admin_creds.project_domain_name or
             self.credentials_domain)
     self.creds_client = cred_client.get_creds_client(
         self.identity_admin_client, self.creds_domain_name)
Beispiel #30
0
 def __init__(self, service=None):
     super(AdminManager, self).__init__(
         credentials=cred_provider.get_configured_credentials(
             'identity_admin'),
         service=service)
 def setup_credentials(cls):
     super(TestHugepages, cls).setup_credentials()
     cls.manager = clients.Manager(
         credentials=cred_provider.get_configured_credentials(
             'identity_admin', fill_in=False))
Beispiel #32
0
 def get_admin_creds(self):
     creds = cred_provider.get_configured_credentials(
         "identity_admin", fill_in=False)
     self._creds['admin'] = cred_provider.TestResources(creds)
     return self._creds['admin']
Beispiel #33
0
 def get_admin_creds(self):
     return cred_provider.get_configured_credentials(
         "identity_admin", fill_in=False)
Beispiel #34
0
 def __init__(self, service=None):
     super(AdminManager, self).__init__(
         credentials=cred_provider.get_configured_credentials(
             'identity_admin'),
         service=service)
 def setup_credentials(cls):
     super(TestHugepages, cls).setup_credentials()
     cls.manager = clients.Manager(
         credentials=cred_provider.get_configured_credentials(
             'identity_admin', fill_in=False))
Beispiel #36
0
 def __init__(self, service=None):
     super(AltManager, self).__init__(
         cred_provider.get_configured_credentials('alt_user'), service)
Beispiel #37
0
def main():
    config = read_tempest_conf()
    credentials = cred_provider.get_configured_credentials('identity_admin')
    manager = clients.Manager(credentials=credentials)
    check_image_ref(manager)
    fix_tempest_conf(manager, config)
Beispiel #38
0
 def get_admin_creds(self):
     return cred_provider.get_configured_credentials("identity_admin",
                                                     fill_in=False)
Beispiel #39
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']
Beispiel #40
0
 def get_admin_creds(self):
     creds = cred_provider.get_configured_credentials(
         "identity_admin", fill_in=False)
     self.isolated_creds['admin'] = creds
     return creds
Beispiel #41
0
def main():
    credentials = cred_provider.get_configured_credentials('identity_admin')
    network_client, image_client, glance_client, nova_client = set_context(credentials)
    # Start to config
    fix_cirros(glance_client, image_client)
    fix_tempest_conf(network_client, nova_client)