Fix inventory vars containing spaces

Some clouds have availability zones with spaces in their
names. Currently zuul generates something like this as ansible
inventory:

node nodepool_region=None (...) nodepool_az=Failure domain 1

This breaks ansible when trying to read the inventory. Quoting the
inventory variable values solves this issue.

Change-Id: I3e97f40986689b3779efc448eb0d5f1db009e796
This commit is contained in:
Tobias Henkel 2017-05-16 15:14:42 +02:00
parent f60bbcd8a5
commit 751ba697d6
1 changed files with 1 additions and 1 deletions

View File

@ -942,7 +942,7 @@ class AnsibleJob(object):
for item in self.getHostList(args):
inventory.write(item['name'])
for k, v in item['host_vars'].items():
inventory.write(' %s=%s' % (k, v))
inventory.write(' %s="%s"' % (k, v))
inventory.write('\n')
for key in item['host_keys']:
keys.append(key)