diff options
| author | Dean Troyer <dtroyer@gmail.com> | 2012-04-27 12:25:25 -0500 |
|---|---|---|
| committer | Dean Troyer <dtroyer@gmail.com> | 2012-04-27 12:25:25 -0500 |
| commit | 9c945bee7995f1853d7c8c2f55087ce4c00fa42d (patch) | |
| tree | abf000dc382525eaad381176d13cb2c04008b4a4 /openstackclient | |
| parent | 04730e6f409e94a8b41c296e9e660d147bf0a17f (diff) | |
| download | python-openstackclient-9c945bee7995f1853d7c8c2f55087ce4c00fa42d.tar.gz | |
Cleanup auth client path
Diffstat (limited to 'openstackclient')
| -rw-r--r-- | openstackclient/shell.py | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/openstackclient/shell.py b/openstackclient/shell.py index cd7a50ba..3e8c6dca 100644 --- a/openstackclient/shell.py +++ b/openstackclient/shell.py @@ -61,22 +61,6 @@ class OpenStackShell(App): command_manager=CommandManager('openstack.cli'), ) - def _authenticate(self, **kwargs): - """Get an auth token from Keystone - - :param username: name of user - :param password: user's password - :param tenant_id: unique identifier of tenant - :param tenant_name: name of tenant - :param auth_url: endpoint to authenticate against - """ - self.ksclient = ksclient.Client(username=kwargs.get('username'), - password=kwargs.get('password'), - tenant_id=kwargs.get('tenant_id'), - tenant_name=kwargs.get('tenant_name'), - auth_url=kwargs.get('auth_url')) - return self.ksclient.auth_token - def build_option_parser(self, description, version): parser = super(OpenStackShell, self).build_option_parser( description, @@ -177,14 +161,23 @@ class OpenStackShell(App): 'tenant_name': self.options.os_tenant_name, 'auth_url': self.options.os_auth_url } - token = self._authenticate(**kwargs) - endpoint = self.ksclient.service_catalog.url_for(service_type=cmd.api) + self.auth_client = ksclient.Client( + username=kwargs.get('username'), + password=kwargs.get('password'), + tenant_id=kwargs.get('tenant_id'), + tenant_name=kwargs.get('tenant_name'), + auth_url=kwargs.get('auth_url'), + ) + token = self.auth_client.auth_token + endpoint = self.auth_client.service_catalog.url_for(service_type=cmd.api) if self.options.debug: print "api: %s" % cmd.api print "token: %s" % token print "endpoint: %s" % endpoint + # get a client for the desired api here + def clean_up(self, cmd, result, err): self.log.debug('clean_up %s', cmd.__class__.__name__) if err: |
