Retreive AdminPassword from heat instead of mistral

The overcloud admin password is currently retreived from the mistral
environment. Since this value can also be retreived via heat and the
mistral environment isn't used anywhere else, this change removes the
mistral dependency.

Change-Id: I38233ea71f81e547fed756fbdddf244db594da2f
This commit is contained in:
Florian Fuchs 2017-04-20 08:34:36 +00:00
parent 834d014e89
commit 748c46357b
3 changed files with 6 additions and 23 deletions

View File

@ -6,4 +6,3 @@ pbr!=2.1.0,>=2.0.0 # Apache-2.0
oslo.config>=3.22.0 # Apache-2.0
keystoneauth1>=2.20.0 # Apache-2.0
python-heatclient>=1.6.1 # Apache-2.0
python-mistralclient>=3.1.0 # Apache-2.0

View File

@ -26,7 +26,6 @@ import sys
import json
from heatclient import client as heat_client
import mistralclient.api.client
from oslo_config import cfg
from six.moves import configparser
@ -51,18 +50,6 @@ opts = [
]
def _get_mclient(session):
try:
endpoint = session.get_endpoint(service_type='workflowv2')
return mistralclient.api.client.client(
mistral_url=endpoint,
auth_token=session.get_token())
except Exception as e:
print("Error connecting to Mistral: {}".format(e.message),
file=sys.stderr)
sys.exit(1)
def _parse_config():
default_config = os.environ.get('TRIPLEO_INVENTORY_CONFIG')
if default_config:
@ -124,8 +111,7 @@ def main():
hclient = heat_client.Client('1', session=session)
inventory = TripleoInventory(configs,
session,
hclient,
_get_mclient(session))
hclient)
if configs.list or configs.static_inventory:
try:
inventory_list = inventory.list()

View File

@ -54,17 +54,16 @@ class StackOutputs(object):
class TripleoInventory(object):
def __init__(self, configs, session, hclient, mclient):
def __init__(self, configs, session, hclient):
self.configs = configs
self.session = session
self.hclient = hclient
self.mclient = mclient
self.stack_outputs = StackOutputs(self.configs.plan, self.hclient)
def get_overcloud_environment(self):
try:
environment = self.mclient.environments.get(self.configs.plan)
return environment.variables
environment = self.hclient.stacks.environment(self.configs.plan)
return environment
except Exception:
return {}
@ -88,9 +87,8 @@ class TripleoInventory(object):
keystone_url = self.stack_outputs.get('KeystoneURL')
if keystone_url:
ret['undercloud']['vars']['overcloud_keystone_url'] = keystone_url
overcloud_environment = self.get_overcloud_environment()
passwords = overcloud_environment.get('passwords', {})
admin_password = passwords.get('AdminPassword', '')
admin_password = self.get_overcloud_environment().get(
'parameter_defaults', {}).get('AdminPassword')
if admin_password:
ret['undercloud']['vars']['overcloud_admin_password'] = \
admin_password