Keith Edmunds
2009-Feb-23 12:57 UTC
[Puppet Users] Require package not working as expected
I have the following as part of a module: -------------------------------------------------------------------------------- # Ensure "lsb-release" installed package {"lsb-release": ensure => installed, } # Use our sources.list file { "/etc/apt/sources.list": owner => root, group => root, mode => 644, content => template("tclbase/sources.erb"), require => [ Package["lsb-release"], Exec["Import $aptkey_volatile to apt keystore"] ] } -------------------------------------------------------------------------------- This works on some systems, but fails on at least one other with: err: Could not retrieve catalog: Failed to parse template tclbase/sources.erb: Could not find value for ''lsbdistcodename'' at /etc/puppet/modules/tclbase/manifests/init.pp:77 on node [deleted] The value ''lsbdistcodename'' comes from facter, but on Debian systems it requires lsb-release to be installed. On the system in question, lsb-release is not installed, hence the failure above. However, given the "require" statement above, why isn''t lsb-release installed? Thanks. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ohad Levy
2009-Feb-23 13:15 UTC
[Puppet Users] Re: Require package not working as expected
Hi, Facter runs and transffer the facts to the server before any config is actully done on the client ( puppet needs the facts to decide which configs to send to the client). Your only way around this is to install the package before the first puppet run or wait for the second run (and handle the nil value in the template...) Ohad On 2/23/09, Keith Edmunds <kae@midnighthax.com> wrote:> > I have the following as part of a module: > > -------------------------------------------------------------------------------- > # Ensure "lsb-release" installed > package {"lsb-release": > ensure => installed, > } > > # Use our sources.list > file { "/etc/apt/sources.list": > owner => root, > group => root, > mode => 644, > content => template("tclbase/sources.erb"), > require => [ Package["lsb-release"], Exec["Import $aptkey_volatile > to apt keystore"] ] } > -------------------------------------------------------------------------------- > > This works on some systems, but fails on at least one other with: > > err: Could not retrieve catalog: Failed to parse template > tclbase/sources.erb: Could not find value for ''lsbdistcodename'' > at /etc/puppet/modules/tclbase/manifests/init.pp:77 on node > [deleted] > > The value ''lsbdistcodename'' comes from facter, but on Debian systems it > requires lsb-release to be installed. On the system in question, > lsb-release is not installed, hence the failure above. However, given the > "require" statement above, why isn''t lsb-release installed? > > Thanks. > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Keith Edmunds
2009-Feb-23 15:52 UTC
[Puppet Users] Re: Require package not working as expected
> Your only way around this is to install the package before the first > puppet run or wait for the second run (and handle the nil value in the > template...)Thanks, that makes sense. I''m trying to handle the nil value in the template with: <% if has_variable?("lsbdistcodename") and lsbdistcodename == "etch" %> ..but that still gives "Could not find value for ''lsbdistcodename'' at ..." Sorry, I''m not a Ruby person (that''s slowly changing), so what syntax should be used? Thanks. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Mike Renfro
2009-Feb-23 16:57 UTC
[Puppet Users] Re: Require package not working as expected
On 2/23/2009 7:15 AM, Ohad Levy wrote:> Your only way around this is to install the package before the first > puppet run or wait for the second run (and handle the nil value in > the template...)The first option is what I''ve always done. Since I''m spending part of the morning rebuilding a system with a new hard drive in it, I''m also working up putting newer Puppet and Facter packages into my Debian etch preseed installs with: # Add openssh-server plus newer puppet dependencies d-i pkgsel/include string openssh-server ruby libxmlrpc-ruby libopenssl-ruby adduser lsb-base lsb-release libshadow-ruby1.8 d-i preseed/late_command string wget -O /target/root/facter_1.5.1-0.1_all.deb http://HOST/PATH/TO/facter_1.5.1-0.1_all.deb ; wget -O /target/root/puppet_0.24.6-1_all.deb http://HOST/PATH/TO/puppet_0.24.6-1_all.deb ; in-target dpkg --force-confold -i /root/facter_1.5.1-0.1_all.deb /root/puppet_0.24.6-1_all.deb ; wget -O /target/etc/puppet/puppet.conf http://HOST/PATH/TO/puppet.conf For existing installations, I''d just replace ''ssh host "apt-get install puppet"'' with ''ssh host "apt-get install lsb-release puppet"'' -- Mike Renfro / R&D Engineer, Center for Manufacturing Research, 931 372-3601 / Tennessee Technological University --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---