Martin Harrigan
2011-Jan-06 17:24 UTC
[Puppet Users] Retrieving Version Numbers from Packages
Hi, I install the latest version of a Ruby gem using: package { ''passenger'': ensure => latest, provider => ''gem'' } However, I want to retrieve the actual version number for further configuration. Is this possible? I don''t think I can use a custom fact since it may be evaluated on the client before the gem is installed. Is there something like Package[''passenger''].version? Regards, Martin. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Daniel Pittman
2011-Jan-06 17:55 UTC
Re: [Puppet Users] Retrieving Version Numbers from Packages
On Thu, Jan 6, 2011 at 09:24, Martin Harrigan <martinharrigan@gmail.com> wrote:> I install the latest version of a Ruby gem using: > > package { ''passenger'': ensure => latest, provider => ''gem'' } > > However, I want to retrieve the actual version number for further > configuration. Is this possible?Not inside the puppet catalog in a client/server situation: the catalog is fully and completely compiled on the server, sent to the client, and then executed - at which point any passenger upgrade would happen.> I don''t think I can use a custom fact since it may be evaluated on the > client before the gem is installed. Is there something like > Package[''passenger''].version?Your two choices I can see at this stage are: 1. Use an ''exec'' or something like that which evaluates on the client, and ensure that it depends on the package action so that is completed first. That can then react, and a ''refreshonly'' exec will trigger only when the upgrade happened. 2. Use a custom fact, and accept that you have two run puppet twice for things to converge on your machines. If you tell us *why* you need to know the version number, though, we might be able to suggest the super-clever and much nicer option number 3 for you. ;) Regards, Daniel -- ✉ Daniel Pittman <daniel@rimspace.net> ⌨ daniel@rimspace.net (XMPP) ☎ +1 503 893 2285 ♻ made with 100 percent post-consumer electrons -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Martin Harrigan
2011-Jan-07 17:06 UTC
Re: [Puppet Users] Retrieving Version Numbers from Packages
On Thu, Jan 6, 2011 at 5:55 PM, Daniel Pittman <daniel@rimspace.net> wrote:> On Thu, Jan 6, 2011 at 09:24, Martin Harrigan <martinharrigan@gmail.com> > wrote: > > > I install the latest version of a Ruby gem using: > > > > package { ''passenger'': ensure => latest, provider => ''gem'' } > > > > However, I want to retrieve the actual version number for further > > configuration. Is this possible? > > Not inside the puppet catalog in a client/server situation: the > catalog is fully and completely compiled on the server, sent to the > client, and then executed - at which point any passenger upgrade would > happen. > > > I don''t think I can use a custom fact since it may be evaluated on the > > client before the gem is installed. Is there something like > > Package[''passenger''].version? > > Your two choices I can see at this stage are: > > 1. Use an ''exec'' or something like that which evaluates on the client, > and ensure that it depends on the package action so that is completed > first. That can then react, and a ''refreshonly'' exec will trigger > only when the upgrade happened. > > 2. Use a custom fact, and accept that you have two run puppet twice > for things to converge on your machines. > > If you tell us *why* you need to know the version number, though, we > might be able to suggest the super-clever and much nicer option number > 3 for you. ;) >After installing Passenger, I install nginx. I use the template below for an nginx configuration file: ... http { passenger_root /usr/lib64/ruby/gems/1.8/gems/passenger-<%= passenger_version %>; ... } ... My problem is the passenger_version variable. I need to know the version of Passenger that was installed in the previous step. Thank you for your suggestions; I will try something like (1). Martin. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Daniel Pittman
2011-Jan-07 17:19 UTC
Re: [Puppet Users] Retrieving Version Numbers from Packages
On Jan 7, 2011 9:07 AM, "Martin Harrigan" <martinharrigan@gmail.com> wrote:> On Thu, Jan 6, 2011 at 5:55 PM, Daniel Pittman <daniel@rimspace.net>wrote:>> On Thu, Jan 6, 2011 at 09:24, Martin Harrigan <martinharrigan@gmail.com>wrote:>> >> > I install the latest version of a Ruby gem using: >> > package { ''passenger'': ensure => latest, provider => ''gem'' } >> > >> > However, I want to retrieve the actual version number for further >> > configuration. Is this possible? >> >> 1. Use an ''exec'' or something like that which evaluates on the client, >> and ensure that it depends on the package action so that is completed >> first. That can then react, and a ''refreshonly'' exec will trigger >> only when the upgrade happened. > > After installing Passenger, I install nginx. I use the template below foran> nginx configuration file: > ... > http { > passenger_root /usr/lib64/ruby/gems/1.8/gems/passenger-<%passenger_version > %>; > ... > } > ... > > My problem is the passenger_version variable. I need to know the versionof> Passenger that was installed in the previous step. > > Thank you for your suggestions; I will try something like (1).I would probably use a fixed path in my nginx template, and use the exec to make that path a symlink to the appropriate version of the passenger gem. Regards, Daniel -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.