From 453051aafbc423143be4de922688ab90284528d7 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Tue, 22 Mar 2016 19:17:44 -0500 Subject: [PATCH] Don't pass OS_CLOUD and OS_REGION_NAME to expand-groups There is a bug in OCC that causes an envvars cloud to be created when the only two env vars are the selectors OS_CLOUD and OS_REGION_NAME. So exclude them from the envionment when running the group creation command. Also, there is a bug in the invocation of the hostname playbook, in that it was passing in the UUID as the target to run against, but we're writing out a name-based inventory. Change-Id: I0b524dc43ec96c6645ae82a090744eab463e7fb9 --- launch/launch-node.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/launch/launch-node.py b/launch/launch-node.py index d8bb5d46a2..caf5bbc26d 100755 --- a/launch/launch-node.py +++ b/launch/launch-node.py @@ -102,7 +102,7 @@ def bootstrap_server(server, key, name, volume, keep): '-i', inventory_file.name, '-l', name, '--private-key={key}'.format(key=key_file.name), "--ssh-common-args='-o StrictHostKeyChecking=no'", - '-e', 'target={id}'.format(id=server.id), + '-e', 'target={name}'.format(name=name), ] # Run the remote puppet apply playbook limited to just this server @@ -257,7 +257,15 @@ def main(): if os.path.exists(inventory_cache): with open(inventory_cache, 'w'): pass - os.system('/usr/local/bin/expand-groups.sh') + # Remove cloud and region from the environment to work around a bug in occ + expand_env = os.environ.copy() + expand_env.pop('OS_CLOUD', None) + expand_env.pop('OS_REGION_NAME', None) + + print subprocess.check_output( + '/usr/local/bin/expand-groups.sh', + env=expand_env, + stderr=subprocess.STDOUT) if __name__ == '__main__': main()