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
This commit is contained in:
Monty Taylor 2016-03-22 19:17:44 -05:00
parent 4929b1ea83
commit 453051aafb

View File

@ -102,7 +102,7 @@ def bootstrap_server(server, key, name, volume, keep):
'-i', inventory_file.name, '-l', name, '-i', inventory_file.name, '-l', name,
'--private-key={key}'.format(key=key_file.name), '--private-key={key}'.format(key=key_file.name),
"--ssh-common-args='-o StrictHostKeyChecking=no'", "--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 # Run the remote puppet apply playbook limited to just this server
@ -257,7 +257,15 @@ def main():
if os.path.exists(inventory_cache): if os.path.exists(inventory_cache):
with open(inventory_cache, 'w'): with open(inventory_cache, 'w'):
pass 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__': if __name__ == '__main__':
main() main()