Page MenuHomePhabricator

Cumin: allow to query for Puppet primitive types
Closed, ResolvedPublic

Description

The PuppetDB backend in cumin does force every resource parameter's value to be a string, not allowing to match parameters that have other Puppet primitive types.

We should improve it to at least allow for the basic types:

  • Boolean
  • Integer
  • Float
  • [optionally] Octal, Hexadecimal
  • undef
  • default

Allowing of course the user to "force" the string type by adding quotes to it so that a query for = true means boolean true and a query for = "true" means string "true".

Event Timeline

Volans triaged this task as Medium priority.Oct 15 2018, 2:20 PM
Volans updated the task description. (Show Details)
Volans added a subscriber: Joe.

https://puppet.com/docs/puppet/4.8/lang_data_type.html documentation about types

Plan:

  • communicate enquotedness of values from top level parser
  • if enquoted -> fall to string
  • if not, if bareword (undef, true, false etc) -> bareword
  • if not if parses as numeric -> numeric
  • else -> fall to string

Change 474087 had a related patch set uploaded (by CRusnov; owner: CRusnov):
[operations/software/cumin@master] Make the puppetdb backend process primitive types for queries.

https://gerrit.wikimedia.org/r/474087

would love to see this happen as well.. i've been banging my head against this trying to figure out why =true wouldn't work until I found this ticket. :) as a stopgap, documenting this limitation would be a good start...

For the record, the latest patchset was just pending on me testing null values work in puppetdb queries, which I've done now so this should be coming soon.

Change 474087 had a related patch set uploaded (by Volans; owner: CRusnov):
[operations/software/cumin@master] Make the puppetdb backend process primitive types for queries

https://gerrit.wikimedia.org/r/474087

Change 474087 merged by jenkins-bot:
[operations/software/cumin@master] Make the puppetdb backend process primitive types for queries

https://gerrit.wikimedia.org/r/474087

Resolving as this was merged already. The release process is out of scope for this task.