Fix trailing space added at end of line in converted inventory

Change-Id: Id2513a99fb37c3f82c1815a444e87622ab18de8a
Closes-Bug: #1657951
This commit is contained in:
Cuong Nguyen 2017-01-20 09:59:49 +07:00
parent d8847875e8
commit 8df22c4644
3 changed files with 6 additions and 2 deletions

View File

@ -191,6 +191,7 @@ def write_hostnames(save_path, hostnames_ips):
json.dumps(
hostnames_ips,
indent=4,
separators=(',', ': '),
sort_keys=True
)
)

View File

@ -1074,6 +1074,7 @@ def main(config=None, check=False, debug=False, environment=None, **kwargs):
inventory_json = json.dumps(
inventory,
indent=4,
separators=(',', ': '),
sort_keys=True
)

View File

@ -324,12 +324,14 @@ def main():
print(json.dumps(export_host_info(inventory), indent=2))
elif user_args['clear_ips'] is True:
remove_ip_addresses(inventory)
inventory_json = json.dumps(inventory, indent=2)
inventory_json = json.dumps(inventory, indent=2,
separators=(',', ': '))
filesys.save_inventory(inventory_json, filename)
print('Success. . .')
else:
du.recursive_dict_removal(inventory, user_args['remove_item'])
inventory_json = json.dumps(inventory, indent=2)
inventory_json = json.dumps(inventory, indent=2,
seprators=(',', ': '))
filesys.save_inventory(inventory_json, filename)
print('Success. . .')