Beispiel #1
0
 def _get_mon_client(self):
     k = keystone.Keystone(self._config)
     endpoint = k.get_monasca_url()
     session = k.get_session()
     c = client.Client(api_version=self._api_version,
                       endpoint=endpoint,
                       session=session,
                       timeout=self.write_timeout,
                       **keystone.get_args(self._config))
     return c
Beispiel #2
0
    def test_should_sanitize_config(self):
        config_keys = [
            'keystone_url', 'username', 'password', 'project_name',
            'service_type', 'url', 'endpoint_type', 'region_name'
        ]
        config = {c: mock.NonCallableMock() for c in config_keys}
        random_key_for_no_value = random.choice(config_keys)
        config[random_key_for_no_value] = None

        clean = keystone.get_args(config)

        self.assertNotIn(random_key_for_no_value, clean)
    def test_should_sanitize_config(self):
        config_keys = [
            'keystone_url', 'username', 'password', 'project_name',
            'service_type', 'url', 'endpoint_type', 'region_name'
        ]
        config = {c: mock.NonCallableMock() for c in config_keys}
        random_key_for_no_value = random.choice(config_keys)
        config[random_key_for_no_value] = None

        clean = keystone.get_args(config)

        self.assertNotIn(random_key_for_no_value, clean)
Beispiel #4
0
 def _get_mon_client(self):
     k = keystone.Keystone(self._config)
     endpoint = k.get_monasca_url()
     session = k.get_session()
     c = client.Client(
         api_version=self._api_version,
         endpoint=endpoint,
         session=session,
         timeout=self.write_timeout,
         **keystone.get_args(self._config)
     )
     return c
Beispiel #5
0
 def _get_mon_client(self):
     try:
         k = keystone.Keystone(self._config)
         endpoint = k.get_monasca_url()
         session = k.get_session()
         c = client.Client(api_version=self._api_version,
                           endpoint=endpoint,
                           session=session,
                           timeout=self.write_timeout,
                           **keystone.get_args(self._config))
         return c
     except keystoneauth_exception.ClientException as ex:
         log.error('Failed to initialize Monasca client. {}'.format(ex))