* puppetboard/app.py: Implementing and utilizing the new PyPuppetDB QueryBuilder
This fixes https://github.com/voxpupuli/puppetboard/issues/239
Replacing all the directly declared query strings with various objects
from the pypuppetdb.QueryBuilder sub-module. Using this Object-Oriented
functionality it is programmatically safer to construct large, complex
queries.
* puppetboard/app.py: Simplifying the environment logic in `node()`
The query in this function will now always be an `AndOperator()` object.
If a specific environment is queried then that constraint is added.
The resulting query difference will be:
env == 'production'
`["and",["=", "environment", "production"],["=", "certname", "puppet01.hammertime.local"]]`
env == '*'
`["and",["=", "certname", "puppet01.hammertime.local"]]`
* puppetboard/app.py: Minor code simplification for more accurate results.
In index() adding the configured OVERVIEW_FILTER query after adding the previous
constraints to num_nodes_query
In inventory() wrapping fact_query in an AndOperator() regardless of environment.
This update makes it more common with other endpoints that only add environment
constraints if an environment is selected.
* requirements.txt: Bumping the pypuppetdb version requirement
* requirements.txt: Bumping pypuppetdb version to new requirement.
* puppetboard/app.py: Fixing module load error.
Showing the Code ID field in the catalogs page. This is currently
unused in PuppetDB as of 3.2.2 but may be useful when it will be used
If available, using the latest_report_hash field of the node object
in the index and nodes templates for the link to the latest report
available for the node.
Updating the report_latest function in app.py to query the nodes
endpoint and redirecting using the latest_report_hash field if available.
If not query the reports endpoint for the node's latest report.
Some excerpts from CHANGELOG.rst include:
- Increasing the pypuppetdb requirements from 0.1.x to 0.2.x
- The Reports page now lists reports from the reports endpoint instead of
a link to a PuppetDB issue with a feature request
- Adding a Catalogs page to view either individual node catalogs or compare
them against other nodes
- New environment awareness adds a new query parameter to all applicable
endpoints to filter results based on the current environment. If the
default environment 'production' is not available, or any other unavailable
environment, the user is redirected to the first known environment.
- Adding pagination functionality for reports (for now) based on the value of
the REPORTS_COUNT configuration option (used for the limit and the offset
calculation). Implementation also makes it possible for other UI enhancements.
- Removing the limit_reports function from puppetboard/utils.py since paging
parameters are now accepted by the pypuppetdb endpoint functions.
- Bumping the version to 0.1.0
In addition to requiring pypuppet in versions less than 0.2.0 we also need versions greater than or equal to 0.1.0 because they support the Query API v3.