refactored --service_name to only work with compute calls and added
--volume_service_name for volume calls Change-Id: I2b1188fb57f9576daebfaceaddc6eea44a47b4ee
This commit is contained in:
parent
d743f92dc2
commit
636f32b00a
1
AUTHORS
1
AUTHORS
@ -12,6 +12,7 @@ Chmouel Boudjnah <chmouel.boudjnah@rackspace.co.uk>
|
|||||||
Chris Behrens <cbehrens+github@codestud.com>
|
Chris Behrens <cbehrens+github@codestud.com>
|
||||||
Christian Berendt <berendt@b1-systems.de>
|
Christian Berendt <berendt@b1-systems.de>
|
||||||
Christopher MacGown <ignoti+github@gmail.com>
|
Christopher MacGown <ignoti+github@gmail.com>
|
||||||
|
Chuck Thier <cthier@gmail.com>
|
||||||
Cole Robinson <crobinso@redhat.com>
|
Cole Robinson <crobinso@redhat.com>
|
||||||
Dan Prince <dprince@redhat.com>
|
Dan Prince <dprince@redhat.com>
|
||||||
Dan Wendlandt <dan@nicira.com>
|
Dan Wendlandt <dan@nicira.com>
|
||||||
|
@ -42,7 +42,7 @@ class HTTPClient(httplib2.Http):
|
|||||||
timeout=None, proxy_tenant_id=None,
|
timeout=None, proxy_tenant_id=None,
|
||||||
proxy_token=None, region_name=None,
|
proxy_token=None, region_name=None,
|
||||||
endpoint_type='publicURL', service_type=None,
|
endpoint_type='publicURL', service_type=None,
|
||||||
service_name=None):
|
service_name=None, volume_service_name=None):
|
||||||
super(HTTPClient, self).__init__(timeout=timeout)
|
super(HTTPClient, self).__init__(timeout=timeout)
|
||||||
self.user = user
|
self.user = user
|
||||||
self.password = password
|
self.password = password
|
||||||
@ -53,6 +53,7 @@ class HTTPClient(httplib2.Http):
|
|||||||
self.endpoint_type = endpoint_type
|
self.endpoint_type = endpoint_type
|
||||||
self.service_type = service_type
|
self.service_type = service_type
|
||||||
self.service_name = service_name
|
self.service_name = service_name
|
||||||
|
self.volume_service_name = volume_service_name
|
||||||
|
|
||||||
self.management_url = None
|
self.management_url = None
|
||||||
self.auth_token = None
|
self.auth_token = None
|
||||||
@ -163,7 +164,8 @@ class HTTPClient(httplib2.Http):
|
|||||||
filter_value=self.region_name,
|
filter_value=self.region_name,
|
||||||
endpoint_type=self.endpoint_type,
|
endpoint_type=self.endpoint_type,
|
||||||
service_type=self.service_type,
|
service_type=self.service_type,
|
||||||
service_name=self.service_name)
|
service_name=self.service_name,
|
||||||
|
volume_service_name=self.volume_service_name,)
|
||||||
self.management_url = management_url.rstrip('/')
|
self.management_url = management_url.rstrip('/')
|
||||||
return None
|
return None
|
||||||
except exceptions.AmbiguousEndpoints:
|
except exceptions.AmbiguousEndpoints:
|
||||||
|
@ -30,7 +30,7 @@ class ServiceCatalog(object):
|
|||||||
|
|
||||||
def url_for(self, attr=None, filter_value=None,
|
def url_for(self, attr=None, filter_value=None,
|
||||||
service_type=None, endpoint_type='publicURL',
|
service_type=None, endpoint_type='publicURL',
|
||||||
service_name=None):
|
service_name=None, volume_service_name=None):
|
||||||
"""Fetch the public URL from the Compute service for
|
"""Fetch the public URL from the Compute service for
|
||||||
a particular endpoint attribute. If none given, return
|
a particular endpoint attribute. If none given, return
|
||||||
the first. See tests for sample service catalog."""
|
the first. See tests for sample service catalog."""
|
||||||
@ -54,7 +54,12 @@ class ServiceCatalog(object):
|
|||||||
if service.get("type") != service_type:
|
if service.get("type") != service_type:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if service_name and service.get('name') != service_name:
|
if (service_name and service_type == 'compute' and
|
||||||
|
service.get('name') != service_name):
|
||||||
|
continue
|
||||||
|
|
||||||
|
if (volume_service_name and service_type == 'volume' and
|
||||||
|
service.get('name') != volume_service_name):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
endpoints = service['endpoints']
|
endpoints = service['endpoints']
|
||||||
|
@ -113,6 +113,10 @@ class OpenStackComputeShell(object):
|
|||||||
default=utils.env('NOVA_SERVICE_NAME'),
|
default=utils.env('NOVA_SERVICE_NAME'),
|
||||||
help='Defaults to env[NOVA_SERVICE_NAME]')
|
help='Defaults to env[NOVA_SERVICE_NAME]')
|
||||||
|
|
||||||
|
parser.add_argument('--volume_service_name',
|
||||||
|
default=utils.env('NOVA_VOLUME_SERVICE_NAME'),
|
||||||
|
help='Defaults to env[NOVA_VOLUME_SERVICE_NAME]')
|
||||||
|
|
||||||
parser.add_argument('--endpoint_type',
|
parser.add_argument('--endpoint_type',
|
||||||
default=utils.env('NOVA_ENDPOINT_TYPE',
|
default=utils.env('NOVA_ENDPOINT_TYPE',
|
||||||
default=DEFAULT_NOVA_ENDPOINT_TYPE),
|
default=DEFAULT_NOVA_ENDPOINT_TYPE),
|
||||||
@ -292,14 +296,15 @@ class OpenStackComputeShell(object):
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
(os_username, os_password, os_tenant_name, os_auth_url,
|
(os_username, os_password, os_tenant_name, os_auth_url,
|
||||||
os_region_name, endpoint_type,
|
os_region_name, endpoint_type, insecure,
|
||||||
insecure, service_type, service_name,
|
service_type, service_name, volume_service_name,
|
||||||
username, apikey, projectid, url, region_name) = (
|
username, apikey, projectid, url, region_name) = (
|
||||||
args.os_username, args.os_password,
|
args.os_username, args.os_password,
|
||||||
args.os_tenant_name, args.os_auth_url,
|
args.os_tenant_name, args.os_auth_url,
|
||||||
args.os_region_name, args.endpoint_type,
|
args.os_region_name, args.endpoint_type,
|
||||||
args.insecure, args.service_type, args.service_name,
|
args.insecure, args.service_type, args.service_name,
|
||||||
args.username, args.apikey, args.projectid,
|
args.volume_service_name, args.username,
|
||||||
|
args.apikey, args.projectid,
|
||||||
args.url, args.region_name)
|
args.url, args.region_name)
|
||||||
|
|
||||||
if not endpoint_type:
|
if not endpoint_type:
|
||||||
@ -360,7 +365,8 @@ class OpenStackComputeShell(object):
|
|||||||
os_password, os_tenant_name, os_auth_url, insecure,
|
os_password, os_tenant_name, os_auth_url, insecure,
|
||||||
region_name=os_region_name, endpoint_type=endpoint_type,
|
region_name=os_region_name, endpoint_type=endpoint_type,
|
||||||
extensions=self.extensions, service_type=service_type,
|
extensions=self.extensions, service_type=service_type,
|
||||||
service_name=service_name)
|
service_name=service_name,
|
||||||
|
volume_service_name=volume_service_name)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not utils.isunauthenticated(args.func):
|
if not utils.isunauthenticated(args.func):
|
||||||
|
@ -44,7 +44,8 @@ class Client(object):
|
|||||||
insecure=False, timeout=None, proxy_tenant_id=None,
|
insecure=False, timeout=None, proxy_tenant_id=None,
|
||||||
proxy_token=None, region_name=None,
|
proxy_token=None, region_name=None,
|
||||||
endpoint_type='publicURL', extensions=None,
|
endpoint_type='publicURL', extensions=None,
|
||||||
service_type='compute', service_name=None):
|
service_type='compute', service_name=None,
|
||||||
|
volume_service_name=None):
|
||||||
# FIXME(comstud): Rename the api_key argument above when we
|
# FIXME(comstud): Rename the api_key argument above when we
|
||||||
# know it's not being used as keyword argument
|
# know it's not being used as keyword argument
|
||||||
password = api_key
|
password = api_key
|
||||||
@ -93,7 +94,8 @@ class Client(object):
|
|||||||
region_name=region_name,
|
region_name=region_name,
|
||||||
endpoint_type=endpoint_type,
|
endpoint_type=endpoint_type,
|
||||||
service_type=service_type,
|
service_type=service_type,
|
||||||
service_name=service_name)
|
service_name=service_name,
|
||||||
|
volume_service_name=volume_service_name)
|
||||||
|
|
||||||
def authenticate(self):
|
def authenticate(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user