Add parameter to set Almanach API URL
Change-Id: I2982ab5f619e26a20fa22eb5da88e96374cb8573
This commit is contained in:
parent
637ab6e65a
commit
ca46eab6df
@ -92,16 +92,26 @@ class AlmanachApp(app.App):
|
|||||||
parser.add_argument('--almanach-token',
|
parser.add_argument('--almanach-token',
|
||||||
default=os.environ.get('ALMANACH_TOKEN'),
|
default=os.environ.get('ALMANACH_TOKEN'),
|
||||||
help='Almanach API token (Env: ALMANACH_TOKEN).')
|
help='Almanach API token (Env: ALMANACH_TOKEN).')
|
||||||
|
|
||||||
|
parser.add_argument('--almanach-url',
|
||||||
|
default=os.environ.get('ALMANACH_URL'),
|
||||||
|
help='Almanach API base URL (Env: ALMANACH_URL).')
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def get_client(self):
|
def get_client(self):
|
||||||
|
return Client(self.get_almanach_url(), token=self.options.almanach_token)
|
||||||
|
|
||||||
|
def get_almanach_url(self):
|
||||||
|
if self.options.almanach_url:
|
||||||
|
return self.options.almanach_url
|
||||||
|
|
||||||
keystone = KeystoneClient(auth_url=self.options.os_auth_url,
|
keystone = KeystoneClient(auth_url=self.options.os_auth_url,
|
||||||
username=self.options.os_username,
|
username=self.options.os_username,
|
||||||
password=self.options.os_password,
|
password=self.options.os_password,
|
||||||
service=self.options.almanach_service,
|
service=self.options.almanach_service,
|
||||||
region_name=self.options.os_region_name)
|
region_name=self.options.os_region_name)
|
||||||
|
|
||||||
return Client(keystone.get_endpoint_url(), token=self.options.almanach_token)
|
return keystone.get_endpoint_url()
|
||||||
|
|
||||||
|
|
||||||
def main(argv=sys.argv[1:]):
|
def main(argv=sys.argv[1:]):
|
||||||
|
@ -10,6 +10,7 @@ Environment variables
|
|||||||
* :code:`OS_PASSWORD`: OpenStack password
|
* :code:`OS_PASSWORD`: OpenStack password
|
||||||
* :code:`ALMANACH_SERVICE`: Almanach catalog service name
|
* :code:`ALMANACH_SERVICE`: Almanach catalog service name
|
||||||
* :code:`ALMANACH_TOKEN`: Almanach API key
|
* :code:`ALMANACH_TOKEN`: Almanach API key
|
||||||
|
* :code:`ALMANACH_URL`: Almanach API base URL, override Keystone catalog lookup if specified
|
||||||
|
|
||||||
Get server version
|
Get server version
|
||||||
------------------
|
------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user