Skip to content

Commit

Permalink
Merge pull request #5 from davidmogar/master
Browse files Browse the repository at this point in the history
Add support for PuppetDB 4
  • Loading branch information
philippeganz authored Aug 10, 2018
2 parents 872965a + a3587a7 commit dfb4741
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ def destroy_krb_ticket(self):

def get_facts_puppetdb(self, apiurl, facts, hostgroup):
url ='%s/facts' % apiurl
query_base = '["and",["or",%s],["in", "certname", ["extract", "certname", ["select-facts", ["and", ["=", "name", "hostgroup"], ["~", "value", "%s"]]]]]]'
if 'v3' in apiurl:
query_base = '["and",["or",%s],["in", "certname", ["extract", "certname", ["select-facts", ["and", ["=", "name", "hostgroup"], ["~", "value", "%s"]]]]]]'
else:
query_base = '["and",["or",%s],["in", "certname", ["extract", "certname", ["select_facts", ["and", ["=", "name", "hostgroup"], ["~", "value", "%s"]]]]]]'
query_facts = ','.join(['["=","name","%s"]' % fact for fact in facts])
query = query_base % (query_facts, hostgroup)

Expand Down

0 comments on commit dfb4741

Please sign in to comment.