>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.

On Thursday, March 12, 2026 at 12:29:13 PM UTC-4 [email protected] wrote:

> 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
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/puppet-users/a5dfde5d-f3b9-456f-9520-9afdaa60acd4n%40googlegroups.com.

Reply via email to