-
Notifications
You must be signed in to change notification settings - Fork 23.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jsonify inventory #32990
jsonify inventory #32990
Conversation
LGTM |
Actually eating my words.
|
I think this is a good addition, but we shouldn't have any datetime objects coming from vars, unless someone uses a YAML date. If so, you are likely going to experience problems with that elsewhere. |
I'm just experiencing the datetime issues with the WIP aws_ec2 inventory plugin. If that should be handled in aws_ec2 that's fine too. |
i would add the 'datetime' as many modules hit this issue also (i thought we had fixed already, but clearly we did not) |
9e92054
to
da95a0a
Compare
The test
|
* The plan would be for that to migrate to common/json_utils when we split basic.py so no need to get people using a new location now when they will just be expected to switch again later * json_dict_bytes_to_unicode and json_dict_unicode_to_bytes will also change names and move to common/text.py at that time (not to json). Their purpose is to recursively change the elements of a container (dict, list, set, tuple) into text or bytes, not to json encode or decode (they could be a generic precursor to that but are not limited to that.) * Reimplement the private _SetEncoder which changes sets and datetimes into objects that are json serializable into a private function instead. Functions are more flexible, less overhead, and simpler than an object. * Remove code that handled simplejson-1.5.x and earlier. Raise an error if that's the case instead. * We require python-2.6 or better which has the json module builtin to the stdlib. So this is only an issue if the stdlib json has been overridden by a third party module and the simplejson on the system is 1.5.x or less. (1.5 was released on 2007-01-18)
da95a0a
to
442433e
Compare
* jsonify inventory * smarter import, dont pass kwargs where not needed * added datetime * Eventual plan for json utilities to migrate to common/json_utils when we split basic.py no need to move jsonify to another file now as we'll do that later. * json_dict_bytes_to_unicode and json_dict_unicode_to_bytes will also change names and move to common/text.py at that time (not to json). Their purpose is to recursively change the elements of a container (dict, list, set, tuple) into text or bytes, not to json encode or decode (they could be a generic precursor to that but are not limited to that.) * Reimplement the private _SetEncoder which changes sets and datetimes into objects that are json serializable into a private function instead. Functions are more flexible, less overhead, and simpler than an object. * Remove code that handled simplejson-1.5.x and earlier. Raise an error if that's the case instead. * We require python-2.6 or better which has the json module builtin to the stdlib. So this is only an issue if the stdlib json has been overridden by a third party module and the simplejson on the system is 1.5.x or less. (1.5 was released on 2007-01-18) (cherry picked from commit ebd08d2)
Merged and cherrypicked to stable-2.4 |
SUMMARY
Use same 'jsonifyier' that we use for modules in ansible-inventory to allow encoding 'problem cases'
ISSUE TYPE
COMPONENT NAME
ansible-inventory
ANSIBLE VERSION