Convert Ruby output of older Hiera versions to equivalent Python or JSON data structures.
Usage: hipy [OPTIONS]
Convert Hiera output to JSON/Python
Options:
--version Show the version and exit.
--json / --python Format output as JSON/Python (default: JSON)
--help Show this message and exit.
$ echo nil | hipy
null
$ echo nil | hipy --json
null
$ echo nil | hipy --python
None
For more examples (and possible limitations), cf. the test examples.
>>> from hipy.parser import HieraOutputParser
>>> parser = HieraOutputParser(text='nil')
>>> parser.get_json()
'null'
>>> parser.get_python() is None
True
>>> parser = HieraOutputParser(text='nil', debug=True)
<Node called "nil" matching "nil">
pip install tox
tox
pip install -r test-requirements.txt
nosetests -c nose.cfg
pip install hipy
Run python setup.py install
.
virtualenv venv
source venv/bin/activate
pip install hipy pex
pex -r <(pip freeze) -c hipy -o hipy.pex
deactivate
mv hipy.pex /tmp
cd /tmp
echo '{"a"=>6}' | ./hipy.pex --python
{u'a': 6}