|
1 | 1 | # pypuppetdbquery |
2 | | -A port of @dalen's PuppetDB Query language to Python |
3 | 2 |
|
4 | 3 | [](https://travis-ci.org/bootc/pypuppetdbquery) |
5 | 4 | [](https://codecov.io/gh/bootc/pypuppetdbquery) |
6 | 5 | [](http://pypuppetdbquery.readthedocs.io/en/latest/?badge=latest) |
| 6 | + |
| 7 | +A port of [Erik Dalén](https://github.com/dalen)'s PuppetDB Query language to |
| 8 | +Python. This module is designed to be paired with |
| 9 | +[pypuppetdb](https://github.com/voxpupuli/pypuppetdb) but does not depend on it |
| 10 | +directly. |
| 11 | + |
| 12 | +This module is a Python implementation of the query language also implemented |
| 13 | +in [puppet-puppetdbquery](https://github.com/dalen/puppet-puppetdbquery) (in |
| 14 | +Ruby) and [node-puppetdbquery](``https://github.com/dalen/node-puppetdbquery) (in |
| 15 | +JavaScript/NodeJS). |
| 16 | + |
| 17 | +Please see the |
| 18 | +[pypuppetdbquery documentation](http://pypuppetdbquery.readthedocs.io/en/latest/?badge=latest) |
| 19 | +courtesy of [Read the Docs](https://readthedocs.org/) and |
| 20 | +[Sphinx](http://www.sphinx-doc.org/en/stable/). |
| 21 | + |
| 22 | +## Installation |
| 23 | + |
| 24 | +You can install this package from source or from PyPi. |
| 25 | + |
| 26 | +```sh |
| 27 | +$ pip install pypuppetdb |
| 28 | +``` |
| 29 | + |
| 30 | +```sh |
| 31 | +$ git clone https://github.com/voxpupuli/pypuppetdb |
| 32 | +$ python setup.py install |
| 33 | +``` |
| 34 | + |
| 35 | +If you wish to hack on it clone the repository but after that run: |
| 36 | + |
| 37 | +```sh |
| 38 | +$ pip install -r requirements.txt |
| 39 | +$ pip install -r requirements-dev.txt |
| 40 | +``` |
| 41 | + |
| 42 | +This will install all the runtime requirements of pypuppetdbquery and the |
| 43 | +dependencies for the test suite and generation of documentation. |
| 44 | + |
| 45 | +## Usage Example |
| 46 | + |
| 47 | +```python |
| 48 | +import pypuppetdb |
| 49 | +import pypuppetdbquery |
| 50 | + |
| 51 | +pdb = pypuppetdb.connect() |
| 52 | + |
| 53 | +pdb_ast = pypuppetdbquery.parse( |
| 54 | + '(processorcount=4 or processorcount=8) and kernel=Linux') |
| 55 | + |
| 56 | +for node in pdb.nodes(query=pdb_ast): |
| 57 | + print(node) |
| 58 | +``` |
| 59 | + |
| 60 | +## License |
| 61 | + |
| 62 | +This project is licensed under the Apache License Version 2.0. |
| 63 | + |
| 64 | +Copyright © 2016 [Chris Boot](http://github.com/bootc). |
0 commit comments