diff options
-rw-r--r-- | novaclient/shell.py | 21 | ||||
-rw-r--r-- | novaclient/v1_0/client.py | 5 | ||||
-rw-r--r-- | novaclient/v1_1/client.py | 5 | ||||
-rw-r--r-- | setup.py | 4 |
4 files changed, 25 insertions, 10 deletions
diff --git a/novaclient/shell.py b/novaclient/shell.py index 5e0eef40..534b5aa5 100644 --- a/novaclient/shell.py +++ b/novaclient/shell.py @@ -62,6 +62,10 @@ class OpenStackComputeShell(object): default=env('NOVA_USERNAME'), help='Defaults to env[NOVA_USERNAME].') + parser.add_argument('--apikey', + default=env('NOVA_API_KEY'), + help='Defaults to env[NOVA_API_KEY].') + parser.add_argument('--password', default=env('NOVA_PASSWORD'), help='Defaults to env[NOVA_PASSWORD].') @@ -157,9 +161,10 @@ class OpenStackComputeShell(object): self.do_help(args) return 0 - user, password, projectid, url, region_name, endpoint_name, insecure =\ - args.username, args.password, args.projectid, args.url, \ - args.region_name, args.endpoint_name, args.insecure + (user, apikey, password, projectid, url, region_name, + endpoint_name, insecure) = (args.username, args.apikey, + args.password, args.projectid, args.url, + args.region_name, args.endpoint_name, args.insecure) if not endpoint_name: endpoint_name = 'publicURL' @@ -171,10 +176,14 @@ class OpenStackComputeShell(object): raise exc.CommandError("You must provide a username, either" "via --username or via " "env[NOVA_USERNAME]") + if not password: - raise exc.CommandError("You must provide a password, either" - "via --password or via" - "env[NOVA_PASSWORD]") + if not apikey: + raise exc.CommandError("You must provide a password, either" + "via --password or via env[NOVA_PASSWORD]") + else: + password = apikey + if options.version and options.version != '1.0': if not projectid: raise exc.CommandError("You must provide an projectid, either" diff --git a/novaclient/v1_0/client.py b/novaclient/v1_0/client.py index 794ed951..7e326cd3 100644 --- a/novaclient/v1_0/client.py +++ b/novaclient/v1_0/client.py @@ -25,10 +25,13 @@ class Client(object): """ - def __init__(self, username, password, project_id, auth_url=None, + def __init__(self, username, api_key, project_id, auth_url=None, insecure=False, timeout=None, token=None, region_name=None, endpoint_name='publicURL'): + # FIXME(comstud): Rename the api_key argument above when we + # know it's not being used as keyword argument + password = api_key self.accounts = accounts.AccountManager(self) self.backup_schedules = backup_schedules.BackupScheduleManager(self) self.flavors = flavors.FlavorManager(self) diff --git a/novaclient/v1_1/client.py b/novaclient/v1_1/client.py index b89d4047..2e00345c 100644 --- a/novaclient/v1_1/client.py +++ b/novaclient/v1_1/client.py @@ -30,9 +30,12 @@ class Client(object): """ # FIXME(jesse): project_id isn't required to authenticate - def __init__(self, username, password, project_id, auth_url, + def __init__(self, username, api_key, project_id, auth_url, insecure=False, timeout=None, token=None, region_name=None, endpoint_name='publicURL'): + # FIXME(comstud): Rename the api_key argument above when we + # know it's not being used as keyword argument + password = api_key self.flavors = flavors.FlavorManager(self) self.floating_ips = floating_ips.FloatingIPManager(self) self.images = images.ImageManager(self) @@ -28,14 +28,14 @@ def read_file(file_name): setuptools.setup( name="python-novaclient", - version="2.6.7", + version="2.6.8", author="Rackspace, based on work by Jacob Kaplan-Moss", author_email="github@racklabs.com", description="Client library for OpenStack Nova API.", long_description=read_file("README.rst"), license="Apache License, Version 2.0", url="https://github.com/openstack/python-novaclient", - packages=["novaclient"], + packages=["novaclient", "novaclient.v1_0", "novaclient.v1_1"], install_requires=requirements, tests_require=["nose", "mock"], test_suite="nose.collector", |