Jira (PUP-2019) Expose catalog version

23 views
Skip to first unread message

Nicholas Fagerlund (JIRA)

unread,
May 16, 2017, 1:28:05 PM5/16/17
to puppe...@googlegroups.com
Nicholas Fagerlund updated an issue
 
Puppet / New Feature PUP-2019
Expose catalog version
Change By: Nicholas Fagerlund
Labels: redmine  triaged
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe)
Atlassian logo

Moses Mendoza (JIRA)

unread,
May 18, 2017, 2:00:27 PM5/18/17
to puppe...@googlegroups.com
Moses Mendoza updated an issue
Change By: Moses Mendoza
Labels: redmine  triaged

Nathan Grubb (JIRA)

unread,
Oct 20, 2019, 11:56:04 AM10/20/19
to puppe...@googlegroups.com
Nathan Grubb commented on New Feature PUP-2019
 
Re: Expose catalog version

I guess this isn't super in demand since this ticket is quite old, but if possible I would like this functionality. I tried adding it myself, but it didn't seem trivial. I'm using a puppet server with environment configuration backed by git and setting config_version to git parse-rev HEAD. I would like to access what the config_version/catalog.version/configuration_version from a manifest file. The reason for this is because I'm using Jenkins CasC and would like to put in the description the exact link in Git to the template that was used to configure Jenkins with.

This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Nathan Grubb (JIRA)

unread,
Oct 20, 2019, 11:58:03 AM10/20/19
to puppe...@googlegroups.com
Nathan Grubb commented on New Feature PUP-2019
 
Re: Expose catalog version

If it's no possible to add, could someone point me to how I can expose a variable to a manifest file. The catalog version isn't available until after facts are generated so I can't add it to facter and seems like all variables are put there, but perhaps there is another easy way?

Henrik Lindberg (JIRA)

unread,
Oct 21, 2019, 8:09:02 AM10/21/19
to puppe...@googlegroups.com
Henrik Lindberg commented on New Feature PUP-2019
 
Re: Expose catalog version

When a catalog is compiled it will get a "version" that contains a value that determined by the "config_version" setting. By default this is a timestamp, but can be the result of some external script.

https://puppet.com/docs/puppetdb/6.3/api/wire_format/catalog_format_v8.html#version-1

https://puppet.com/docs/puppet/latest/configuration.html#configversion

It would be trivial to write a function that returns the "version" of the catalog being compiled. The (4x API) function would evaluate the line of logic below to pick up the version. A function like that can be placed in a module and does not have to be in puppet. It will depend on the internal APIs of scope (getting the catalog), and catalog (getting the version) - but those APIs are not likely to change.

closure_scope.catalog.version

Nathan Grubb (JIRA)

unread,
Oct 21, 2019, 8:14:04 AM10/21/19
to puppe...@googlegroups.com
Nathan Grubb commented on New Feature PUP-2019
 
Re: Expose catalog version

Will try this, I do have config_version setup for the puppet master/server to read the git version and that part all work. The hack I did was in the configurer.rb of the puppet client to 

  1. Get the facts
  2. Get the catalog with the fact
  3. Inject catalog.version into the facts
  4. Get the rest of the fact again
  5. Get the catalog again with the new facts

I'll try writing a function that does this as this seems much better and more efficient. 

Henrik Lindberg (JIRA)

unread,
Oct 21, 2019, 8:20:02 AM10/21/19
to puppe...@googlegroups.com
Henrik Lindberg commented on New Feature PUP-2019
 
Re: Expose catalog version

Typically you would call the function when compiling the catalog. Then you do whatever you want with that value.
Uncertain how "facts" comes into play here or if you are asking because you need the catalog version on the agent side when applying.

Nathan Grubb (JIRA)

unread,
Oct 21, 2019, 10:48:06 AM10/21/19
to puppe...@googlegroups.com
Nathan Grubb commented on New Feature PUP-2019
 
Re: Expose catalog version

Yes I need it on the agent side since config_version is set properly on the server side so that's not an issue, it's just not set correctly on the agent side since well it doesn't even have the "master" git repository. 

Nathan Grubb (JIRA)

unread,
Oct 21, 2019, 10:49:05 AM10/21/19
to puppe...@googlegroups.com
Nathan Grubb commented on New Feature PUP-2019
 
Re: Expose catalog version

the "facts" is definitely a hack so I can just have it as a variable in my manifest, but sounds like I can create a function for this so I will give that a shot.

Henrik Lindberg (JIRA)

unread,
Oct 21, 2019, 12:11:03 PM10/21/19
to puppe...@googlegroups.com
Henrik Lindberg commented on New Feature PUP-2019
 
Re: Expose catalog version

Where on the agent side do you need it? Can you perhaps pass it as a value to a resource, or do you need the value to be a fact?
(Maybe easier to discuss what you need on Slack)

Rob Braden (JIRA)

unread,
Nov 4, 2019, 12:50:04 PM11/4/19
to puppe...@googlegroups.com
Rob Braden commented on New Feature PUP-2019
 
Re: Expose catalog version

Henrik Lindberg or Nathan Grubb - were you able to work out a solution for this? Does this still need attention?

Henrik Lindberg (JIRA)

unread,
Nov 4, 2019, 12:59:02 PM11/4/19
to puppe...@googlegroups.com
Henrik Lindberg commented on New Feature PUP-2019
 
Re: Expose catalog version

Rob Braden I don't have anything to add as the request is for the version to be available agent side - maybe Josh Cooper has an idea for how you can get that.

Josh Cooper (JIRA)

unread,
Nov 4, 2019, 1:24:04 PM11/4/19
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Team: Coremunity

Josh Cooper (JIRA)

unread,
Nov 4, 2019, 1:24:04 PM11/4/19
to puppe...@googlegroups.com
Josh Cooper commented on New Feature PUP-2019
 
Re: Expose catalog version

The catalog.version and catalog.environment are serialized with the catalog, so are available on the agent side. However, puppet doesn't support interpolating values in the pre/post run command. I can imagine that being useful though.

Reply all
Reply to author
Forward
0 new messages