Beispiel #1
0
 def create_client(self, version=None, service_type=None):
     """Return senlin client."""
     from senlinclient import client as senlin
     return senlin.Client(
         self.choose_version(version),
         **self._get_auth_info(project_name_key="project_name",
                               cacert_key="cert"))
Beispiel #2
0
 def _create(self):
     con = self.context
     args = {
         'auth_url': con.auth_url,
         'project_id': con.tenant_id,
         'token': self.auth_token,
     }
     return client.Client(self.VERSION, **args)
    def test_client_init(self, mock_import):
        the_module = mock.Mock()
        the_module.Client = FakeClient
        mock_import.return_value = the_module
        session = mock.Mock()

        res = sc.Client('FAKE_VER', session)

        mock_import.assert_called_once_with('FAKE_VER', 'client')
        self.assertIsInstance(res, FakeClient)
Beispiel #4
0
 def _create(self):
     con = self.context
     args = {
         'auth_url': con.auth_url,
         'project_id': con.tenant_id,
         'token': con.keystone_session.get_token(),
         'user_id': con.user_id,
         'auth_plugin': 'token',
     }
     return client.Client(self.VERSION, **args)
Beispiel #5
0
 def _create(self):
     interface = self._get_client_option(CLIENT_NAME, 'endpoint_type')
     prof = profile.Profile()
     prof.set_interface(self.CLUSTERING, interface)
     prof.set_region(self.CLUSTERING, self._get_region_name())
     keystone_session = self.context.keystone_session
     s = session.Session(session=keystone_session,
                         auth=keystone_session.auth,
                         profile=prof)
     return client.Client(self.VERSION, session=s)
    def _setup_senlin_client(self, api_ver, args):
        """Create senlin client using given args."""
        kwargs = {
            'auth_plugin': args.auth_plugin or 'password',
            'auth_url': args.auth_url,
            'project_name': args.project_name or args.tenant_name,
            'project_id': args.project_id or args.tenant_id,
            'domain_name': args.domain_name,
            'domain_id': args.domain_id,
            'project_domain_name': args.project_domain_name,
            'project_domain_id': args.project_domain_id,
            'user_domain_name': args.user_domain_name,
            'user_domain_id': args.user_domain_id,
            'username': args.username,
            'user_id': args.user_id,
            'password': args.password,
            'verify': args.verify,
            'token': args.token,
            'trust_id': args.trust_id,
        }

        return senlin_client.Client('1', user_agent=USER_AGENT, **kwargs)