puppetdb.v4 package

Submodules

puppetdb.v4.facts module

facts.py: A bunch of API methods for interacting with v4 facts in the PuppetDB API.

Successful responses will be in application/json. Errors will be returned as non-JSON strings.

The result will be a JSON array, with one entry per fact. Each entry is of the form:

Generic Response Type {

“certname”: <node name>, “name”: <fact name>, “value”: <fact value>

}

puppetdb.v4.facts.get_facts(api_url=None, query='', verify=False, cert=[])

Returns facts

Parameters:
  • api_url – Base PuppetDB API url
  • query – Optional. A JSON array containing the query in prefix notation. If not provided, all results will be returned.

Response [{“certname”: “a.example.com”, “name”: “operatingsystem”, “value”: “Debian”}, {“certname”: “b.example.com”, “name”: “operatingsystem”, “value”: “RedHat”}, {“certname”: “c.example.com”, “name”: “operatingsystem”, “value”: “Darwin”}]

puppetdb.v4.facts.get_facts_by_name(api_url=None, fact_name=None, verify=False, cert=[])

Returns facts by name

Parameters:
  • api_url – Base PuppetDB API url
  • fact_name – Name of fact

Response [{“certname”: “a.example.com”, “name”: “operatingsystem”, “value”: “Debian”}, {“certname”: “b.example.com”, “name”: “operatingsystem”, “value”: “Redhat”}, {“certname”: “c.example.com”, “name”: “operatingsystem”, “value”: “Ubuntu”}]

puppetdb.v4.facts.get_facts_by_name_and_value(api_url=None, fact_name=None, fact_value=None, verify=False, cert=[])

Returns facts by name and value

Parameters:
  • api_url – Base PuppetDB API url
  • fact_name – Name of fact
  • fact_value – Value of fact

Response [{“certname”: “a.example.com”, “name”: “operatingsystem”, “value”: “Debian”}, {“certname”: “b.example.com”, “name”: “operatingsystem”, “value”: “Debian}]

puppetdb.v4.nodes module

nodes.py: A bunch of API methods for interacting with v4 nodes in the PuppetDB API.

puppetdb.v4.nodes.get_facts(api_url=None, query={}, verify=False, cert=[])

Returns info for all Nodes

Parameters:api_url – Base PuppetDB API url
puppetdb.v4.nodes.get_node(api_url=None, node_name=None, verify=False, cert=[])

Returns info for a Node

Parameters:
  • api_url – Base PuppetDB API url
  • node_name – Name of node
puppetdb.v4.nodes.get_node_fact_by_name(api_url=None, node_name=None, fact_name=None, verify=False, cert=[])

Returns specified fact for a Node

Parameters:
  • api_url – Base PuppetDB API url
  • node_name – Name of node
  • fact_name – Name of fact
puppetdb.v4.nodes.get_node_facts(api_url=None, node_name=None, verify=False, cert=[])

Returns facts for a Node

Parameters:
  • api_url – Base PuppetDB API url
  • node_name – Name of node
puppetdb.v4.nodes.get_node_resource_by_type(api_url=None, node_name=None, type_name=None, verify=False, cert=[])

Returns specified resource for a Node

Parameters:
  • api_url – Base PuppetDB API url
  • node_name – Name of node
  • type_name – Type of resource
puppetdb.v4.nodes.get_node_resources(api_url=None, node_name=None, verify=False, cert=[])

Returns resources for a Node

Parameters:
  • api_url – Base PuppetDB API url
  • node_name – Name of node
puppetdb.v4.nodes.get_nodes(api_url=None, verify=False, cert=[])

Returns info for all Nodes

Parameters:api_url – Base PuppetDB API url

puppetdb.v4.resources module

resources.py: A bunch of API methods for interacting with v4 resources in the PuppetDB API.

puppetdb.v4.resources.get_resources(api_url=None, query='', verify=False, cert=[])

Returns resources

Parameters:api_url – Base PuppetDB API url
puppetdb.v4.resources.get_resources_by_name(api_url=None, resource_name=None, verify=False, cert=[])

Returns facts by name

Parameters:
  • api_url – Base PuppetDB API url
  • resource_name – Name of resource
puppetdb.v4.resources.get_resources_by_name_and_value(api_url=None, resource_name=None, resource_value=None, verify=False, cert=[])

Returns resources by name and value

Parameters:
  • api_url – Base PuppetDB API url
  • resource_name – Name of fact
  • resource_value – Value of fact

Module contents

__init__.py: init for v4 api calls.