1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Merge pull request #12532 from fboender/devel

Output proper JSON from vbox dynamic inventory contrib script
This commit is contained in:
James Cammarata 2015-09-26 14:20:45 -04:00
commit 4c7843f268

View file

@ -23,6 +23,11 @@ try:
except ImportError:
import simplejson as json
class SetEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, set):
return list(obj)
return json.JSONEncoder.default(self, obj)
VBOX="VBoxManage"
@ -110,5 +115,4 @@ if __name__ == '__main__':
else:
inventory = get_hosts()
import pprint
pprint.pprint(inventory)
sys.stdout.write(json.dumps(inventory, indent=2, cls=SetEncoder))