• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

voxpupuli / pypuppetdb / 211
85%

Build:
DEFAULT BRANCH: master
Ran 11 Jun 2016 09:55PM UTC
Jobs 3
Files 7
Run time 6s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
211

push

travis-ci

GitHub
Query builder (#92)

* pypuppetdb/QueryBuilder.py: Adding initial work on an OOP query builder.

Part of https://github.com/voxpupuli/pypuppetdb/issues/77

Currently this only contains all available binary operators as listed in
https://docs.puppet.com/puppetdb/4.1/api/query/v4/ast.html#binary-operators.
Further work will include boolean and projection operators.

* pypuppetdb/QueryBuilder.py: Quoting only string type fields.

Some queries, like those querying resource parameter values, require the
field to be an array. For example: '["=", ["parameter", "ensure"], "present"]'

Adding test cases for this development.

* pypuppetdb: Adding the first BooleanOperator object, AndOperator

This object will build an AND PuppetDB query, as per
https://docs.puppet.com/puppetdb/4.1/api/query/v4/ast.html#boolean-operators.
PuppetDB will only return results from this query only if it matches
ALL included query criteria.

Including test cases for the AndOperator object.

* pypuppetdb/QueryBuilder.py: Adding OrOperator and NotOperator objects.

The OrOperator object is programmatically identical to the AndOperator.
The only difference the NotOperator has is that it only allows a single
operation, this enforces the PuppetDB funcionality.

* pypuppetdb/QueryBuilder.py: Adding ExtractOperator object.

Following the documentation available https://docs.puppet.com/puppetdb/4.1/api/query/v4/ast.html#extract

This object allows users to create, as the name suggests, an extraction query
to return the number of fields returned in the PuppetDB response. This is
done by passing a string or an array of strings to the add_field(), should
add this to the constructor too.

Adding an option query can be done through the add_query() fuction.
A group_by, https://docs.puppet.com/puppetdb/4.1/api/query/v4/ast.html#groupby,
can be added through add_group_by(). The values in this variable will always
be appended to the end of the ExtractOperator output.

Adding test cases to cover the new code.

* pypuppetdb/QueryBuilder.py: Adding repr() and unicode() support for ExtractOperator

Updating test cases to include new code.

* pypuppetdb/QueryBuilder.py: Adding FunctionOperator object

This object allows an aggregate function to be performed on the result
on an ExtractOperator object (in the fields and group_by clauses only)

Adding test cases for these additions, some of the tests are used in
https://github.com/puppetlabs/puppetdb/blob/master/test/puppetlabs/puppetdb/http/reports_test.clj#L110

* pypuppetdb/QueryBuilder.py: Adding small updates and documentation.

Replacing string concatenation with string formatting in BinaryOperator
constructor.
Replacing all ValueErrors with APIError

* docs/api.rst: Adding brief description of the Query Builder and its objects.

* pypuppetdb/api.py: Integrating the QueryBuilder classes into api

* test_querybuilder.py: Fixing Unicode keyword error.

Also removing a redundant set of parenthesis.

* tests/test_querybuilder.py: Adding a missing blank line before the first test class

* docs/api.rst: Including the strings used to import and use QueryBuilder

* pypuppetdb/QueryBuilder.py: Fixing bugs after first test against a real PuppetDB

The code was interpreting the type of the field attribute as a unicode
in the BinaryOperator constructor, have to check for that as well as a string

The Python boolean value, True or False, are not liked by PuppetDB, they
have to be lowercase.

* pypuppetdb/api.py: Removing the string casting for the query parameter in _query

Python again interpreted this as a unicode type with the str() wrapper.
Removing it removed the bug.

* pypuppetdb/types.py: Removing all __query_scope variables for QueryBuilder objects

Removing additional private class variables for QueryBuilder objects,
currently all EqualsOperator objects, to replace the __query_scope
variables present in the `Reports()` and `Node()` objects.

* pypuppetdb/QueryBuilder.py: Quoting datetime.datetime objects in BinaryOperator constructor

Updating test cases to include datetime object support.

* pypuppetdb/QueryBuilder.py: Updating doc string to include examples.

* pypuppetdb/QueryBuilder.py: NotOperator() objects do not allow multi-element lists in add()

Users who try to add a list of operators in the add() function now
receive an APIError.

This further enhances the restriction that this query only accepts a
single query string.

* tests/test_querybuilder.py: Fixing Python 3.3 tests.

Python 3.3 tests failed because of the zero-padded month values in the
datetime constructor. Replacing the 06 with 6 to fix tests, string outputs
remain the same.

0 of 649 relevant lines covered (0.0%)

0.0 hits per line

Jobs
ID Job ID Ran Files Coverage
1 211.1 11 Jun 2016 09:55PM UTC 0
0.0
Travis Job 211.1
2 211.2 11 Jun 2016 09:55PM UTC 0
0.0
Travis Job 211.2
3 211.3 11 Jun 2016 09:55PM UTC 0
0.0
Travis Job 211.3
Source Files on build 211
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #211
  • 564f7da1 on github
  • Prev Build on master (#210)
  • Next Build on master (#213)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc