Пример #1
0
    def __init__(self, **kwargs):
        """Initialize a new client for the Keystone v2.0 API."""

        if not kwargs.get('session'):
            warnings.warn(
                'Constructing an instance of the '
                'keystoneclient.v2_0.client.Client class without a session is '
                'deprecated as of the 1.7.0 release and may be removed in '
                'the 2.0.0 release.', DeprecationWarning)

        super(Client, self).__init__(**kwargs)

        self.certificates = certificates.CertificatesManager(self._adapter)
        self.endpoints = endpoints.EndpointManager(self._adapter)
        self.extensions = extensions.ExtensionManager(self._adapter)
        self.roles = roles.RoleManager(self._adapter)
        self.services = services.ServiceManager(self._adapter)
        self.tokens = tokens.TokenManager(self._adapter)
        self.users = users.UserManager(self._adapter, self.roles)

        self.tenants = tenants.TenantManager(self._adapter, self.roles,
                                             self.users)

        # extensions
        self.ec2 = ec2.CredentialsManager(self._adapter)

        # DEPRECATED: if session is passed then we go to the new behaviour of
        # authenticating on the first required call.
        if not kwargs.get('session') and self.management_url is None:
            self.authenticate()
Пример #2
0
def ec2_manager(request):
    client = keystoneclient(request)
    if hasattr(client, 'ec2'):
        return client.ec2

    # Keystoneclient 4.0 was released without the ec2 creds manager.
    from keystoneclient.v2_0 import ec2
    return ec2.CredentialsManager(client)
Пример #3
0
    def __init__(self, http_client, **kwargs):
        """ Initialize a new client for the Keystone v2.0 API. """
        super(IdentityAdminClient, self).__init__(http_client)

        self.endpoints = endpoints.EndpointManager(self)
        self.roles = roles.RoleManager(self)
        self.services = services.ServiceManager(self)
        self.tenants = tenants.TenantManager(self)
        self.tokens = tokens.TokenManager(self)
        self.users = users.UserManager(self)

        # extensions
        self.ec2 = ec2.CredentialsManager(self)
Пример #4
0
    def __init__(self, **kwargs):
        """ Initialize a new client for the Keystone v2.0 API. """
        super(Client, self).__init__(**kwargs)
        self.endpoints = endpoints.EndpointManager(self)
        self.roles = roles.RoleManager(self)
        self.services = services.ServiceManager(self)
        self.tenants = tenants.TenantManager(self)
        self.tokens = tokens.TokenManager(self)
        self.users = users.UserManager(self)

        # extensions
        self.ec2 = ec2.CredentialsManager(self)

        if self.management_url is None:
            self.authenticate()
Пример #5
0
    def __init__(self, **kwargs):
        """Initialize a new client for the Keystone v2.0 API."""
        super(Client, self).__init__(**kwargs)
        self.endpoints = endpoints.EndpointManager(self)
        self.roles = roles.RoleManager(self)
        self.services = services.ServiceManager(self)
        self.tenants = tenants.TenantManager(self)
        self.tokens = tokens.TokenManager(self)
        self.users = users.UserManager(self)

        # extensions
        self.ec2 = ec2.CredentialsManager(self)

        # DEPRECATED: if session is passed then we go to the new behaviour of
        # authenticating on the first required call.
        if not kwargs.get('session') and self.management_url is None:
            self.authenticate()
Пример #6
0
    def __init__(self, endpoint=None, **kwargs):
        """ Initialize a new client for the Keystone v2.0 API. """
        super(Client, self).__init__(endpoint=endpoint, **kwargs)
        self.endpoints = endpoints.EndpointManager(self)
        self.roles = roles.RoleManager(self)
        self.services = services.ServiceManager(self)
        self.tenants = tenants.TenantManager(self)
        self.tokens = tokens.TokenManager(self)
        self.users = users.UserManager(self)
        # NOTE(gabriel): If we have a pre-defined endpoint then we can
        #                get away with lazy auth. Otherwise auth immediately.

        # extensions
        self.ec2 = ec2.CredentialsManager(self)

        self.management_url = endpoint
        if endpoint is None:
            self.authenticate()
    def __init__(self, **kwargs):
        """Initialize a new client for the Keystone v2.0 API."""
        if not kwargs.get('session'):
            warnings.warn(
                'Constructing an instance of the '
                'keystoneclient.v2_0.client.Client class without a session is '
                'deprecated as of the 1.7.0 release and may be removed in '
                'the 2.0.0 release.', DeprecationWarning)

        # NOTE(knasim-wrs): As per US76645, the Keystone adminURL
        # is no longer an internal address since it needs to be
        # accessible via remote Openstack client. Things get
        # complicated with HTTPS where the internal keystone client
        # gets this adminURL and cannot connect to Keystone server
        # as it cannot verify the SSL certificate.
        # We will check for this condition here, if OS_ENDPOINT_TYPE
        # is not publicURL then this is an internal access scenario and
        # Keystone client will be set to SSL insecure mode
        if os.environ.get('OS_ENDPOINT_TYPE') == 'internalURL':
            kwargs['insecure'] = True
            # disable verbose insecurity warnings
            urllib3_disable_warnings(InsecureRequestWarning)

        super(Client, self).__init__(**kwargs)

        self.certificates = certificates.CertificatesManager(self._adapter)
        self.endpoints = endpoints.EndpointManager(self._adapter)
        self.extensions = extensions.ExtensionManager(self._adapter)
        self.roles = roles.RoleManager(self._adapter)
        self.services = services.ServiceManager(self._adapter)
        self.tokens = tokens.TokenManager(self._adapter)
        self.users = users.UserManager(self._adapter, self.roles)

        self.tenants = tenants.TenantManager(self._adapter, self.roles,
                                             self.users)

        # extensions
        self.ec2 = ec2.CredentialsManager(self._adapter)

        # DEPRECATED: if session is passed then we go to the new behaviour of
        # authenticating on the first required call.
        if not kwargs.get('session') and self.management_url is None:
            self.authenticate()
Пример #8
0
 def setUp(self):
     self.m = mox.Mox()
     self.fc = fakes.FakeClient()
     self.fc.users = users.UserManager(None)
     self.fc.roles = roles.RoleManager(None)
     self.fc.ec2 = ec2.CredentialsManager(None)
     self.m.StubOutWithMock(user.User, 'keystone')
     self.m.StubOutWithMock(user.AccessKey, 'keystone')
     self.m.StubOutWithMock(self.fc.users, 'create')
     self.m.StubOutWithMock(self.fc.users, 'get')
     self.m.StubOutWithMock(self.fc.users, 'delete')
     self.m.StubOutWithMock(self.fc.users, 'list')
     self.m.StubOutWithMock(self.fc.roles, 'list')
     self.m.StubOutWithMock(self.fc.roles, 'add_user_role')
     self.m.StubOutWithMock(self.fc.ec2, 'create')
     self.m.StubOutWithMock(self.fc.ec2, 'get')
     self.m.StubOutWithMock(self.fc.ec2, 'delete')
     self.m.StubOutWithMock(eventlet, 'sleep')
     config.register_engine_opts()
     cfg.CONF.set_default('heat_stack_user_role', 'stack_user_role')