Skip to content

Commit

Permalink
Revert api_key change in novaclient Client argument
Browse files Browse the repository at this point in the history
Fixes bug 891442

Also, still need to support NOVA_API_KEY environment variable for now.
Bump version to 2.6.8 so we can get this into pypi
Updated setup.py to build properly

Change-Id: I16233ac559bf44b78666118d68975509da6bfb0d
  • Loading branch information
comstud committed Nov 17, 2011
1 parent 7a179e6 commit 0e1e38d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
21 changes: 15 additions & 6 deletions novaclient/shell.py
Expand Up @@ -62,6 +62,10 @@ def get_base_parser(self):
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].')
Expand Down Expand Up @@ -157,9 +161,10 @@ def main(self, argv):
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'
Expand All @@ -171,10 +176,14 @@ def main(self, argv):
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"
Expand Down
5 changes: 4 additions & 1 deletion novaclient/v1_0/client.py
Expand Up @@ -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)
Expand Down
5 changes: 4 additions & 1 deletion novaclient/v1_1/client.py
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Expand Up @@ -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",
Expand Down

0 comments on commit 0e1e38d

Please sign in to comment.