faster git checkout

14 views
Skip to first unread message

mvo...@gmail.com

unread,
Mar 12, 2026, 12:29:13 PM (2 days ago) Mar 12
to Puppet Users
Hello,

I need a faster way to get the current catalog version on the puppet server.

For example, the following script:

$ cat getcat.sh
#!/bin/sh

HOST=$HOSTNAME

curl -s --cert /etc/puppetlabs/puppet/ssl/certs/${HOST}.pem \
 --key /etc/puppetlabs/puppet/ssl/private_keys/${HOST}.pem \
 --cacert /etc/puppetlabs/puppet/ssl/certs/ca.pem \
 https://puppet:8140/puppet/v3/catalog/$HOST?environment=production


returns the complete catalog from the server. It takes around 4 secs.
I'm only interested in the version:

$ ./getcat.sh  | jq .version
"heads/devel-0-ge66985f4"

Is it possible to enhance the REST API that I can get the information faster,
eg instantly?

I'm checking if a puppet run is necessary, by comparing:

/opt/puppetlabs/puppet/public/last_run_summary.yaml

against the version on the server. For this I only need the version, not 
everything else.

best regards,

Martin


Jason St-Cyr

unread,
Mar 13, 2026, 10:59:20 AM (24 hours ago) Mar 13
to Puppet Users
From my understanding, going to the endpoint is always going to trigger a catalog build in order to get the catalog version. For the purposes of deciding if a puppet run is necessary, do you think the data in PuppetDB could fit your need? Running something like:

GET /pdb/query/v4/catalogs?query=["=", "certname", "node.example.com"]

That should get you the last compiled catalog info, including version and code_id.
Reply all
Reply to author
Forward
0 new messages