Dear all, I''m trying to do this. Say for example, I want this link: "liblcgdm.so -> liblcgdm.so.1.8.0" to be present on the client only if "lcgdm- libs-1.8.0-1sec.sl5" is already listed. I already have this to create the link: file { ''liblcgdm.so'': ensure => symlink, name => ''/opt/lcg/lib/liblcgdm.so'', target => ''liblcgdm.so.1.8.0''; } but how do I check the existence of that particular package beforehand? Thanks in advance for your time. Cheers!! -- 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.
Rakhesh Sasidharan
2011-Apr-30 11:06 UTC
Re: [Puppet Users] How to check if a package exists
Hi Sans! On Sat, 30 Apr 2011 02:12 -0700, "Sans" <r.santanu.das@gmail.com> wrote:> Dear all, > > I''m trying to do this. Say for example, I want this link: "liblcgdm.so > -> liblcgdm.so.1.8.0" to be present on the client only if "lcgdm- > libs-1.8.0-1sec.sl5" is already listed. I already have this to create > the link: > > file { > ''liblcgdm.so'': > ensure => symlink, > name => ''/opt/lcg/lib/liblcgdm.so'', > target => ''liblcgdm.so.1.8.0''; > } >Not sure if this is the best way to do this, but one approach I would try would be to use the Exec resource. As in, have a Exec resource with a command to link the files above, but which runs only if the file does not already exist. Something along the lines of the example mentioned here - http://www.puppetcookbook.com/posts/exec-onlyif.html Regards, Rakhesh -- 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.
You can put a requires in the file resource require => Package["packagename"] then it will install the package first then put in the symlink. On Sat, Apr 30, 2011 at 5:12 AM, Sans <r.santanu.das@gmail.com> wrote:> Dear all, > > I''m trying to do this. Say for example, I want this link: "liblcgdm.so > -> liblcgdm.so.1.8.0" to be present on the client only if "lcgdm- > libs-1.8.0-1sec.sl5" is already listed. I already have this to create > the link: > > file { > ''liblcgdm.so'': > ensure => symlink, > name => ''/opt/lcg/lib/liblcgdm.so'', > target => ''liblcgdm.so.1.8.0''; > } > > but how do I check the existence of that particular package > beforehand? Thanks in advance for your time. Cheers!! > > -- > 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. > >-- 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.
Please look at ldconfig -N it will update the links for you. You could try something like (warning untested) class foo { package { "liblcgdm": notify => Exec[ "ldconfig::update" ], } include ldconfig::update } class ldconfig::update { exec { "ldconfig -N": refreshonly => true, } } Of course, the package manager should set up these links for you when installing the lib. The other thing to note: If you are installing a library without using the package manager you should run ldconfig anyway, in order to update your loader''s idea of what libraries exist, and where they are. It also creates any missing links. again, see ldconfig(8) -- vagn -- 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.
On Sun, May 1, 2011 at 12:48 AM, vagn scott <vagnscott@gmail.com> wrote:> > Please look at > > ldconfig -N > > it will update the links for you. > > You could try something like (warning untested) > > class foo { > package { "liblcgdm": > notify => Exec[ "ldconfig::update" ], > } > > include ldconfig::update > } > > class ldconfig::update { > exec { "ldconfig -N": > refreshonly => true, > } > } > > Of course, the package manager should set up these > links for you when installing the lib. > > The other thing to note: If you are installing a library > without using the package manager you should run > > ldconfig > > anyway, in order to update your loader''s idea of > what libraries exist, and where they are. > It also creates any missing links. > > again, see ldconfig(8) > > -- > vagn > > -- > 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. > >As vagn noted, the package manager should be handling this, there most likely is a valid reason it isn''t creating those links (aside from ''bugs''). And if you''re sure you want to customize a pkg., re-roll the pkg. You''ll thank yourself later, guaranteed. -- Cheers, Steven ----------------------- Steven Acres UNIX/Linux System Administrator -- 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.
On May 1, 4:59 am, Matthew Black <mjbl...@gmail.com> wrote:> You can put a requires in the file resource > > require => Package["packagename"] > > then it will install the package first then put in the symlink. >That not what I actually want. I just simply want: if the package already installed, create the sym-link otherwise, do nothing. Cheers!! -- 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.
Rakhesh Sasidharan
2011-May-01 07:14 UTC
Re: [Puppet Users] Re: How to check if a package exists
On Sat, 30 Apr 2011 23:21 -0700, "Sans" <r.santanu.das@gmail.com> wrote:> On May 1, 4:59 am, Matthew Black <mjbl...@gmail.com> wrote: > > You can put a requires in the file resource > > > > require => Package["packagename"] > > > > then it will install the package first then put in the symlink. > > > That not what I actually want. I just simply want: if the package > already installed, create the sym-link otherwise, do nothing. Cheers!!In that case my suggestion of yesterday should do the trick - Have a Exec resource with a command to link the files above, but which runs only if the file does not already exist. Something along the lines of the example mentioned here - http://www.puppetcookbook.com/posts/exec-onlyif.html Regards. -- 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.
Hi Steven and vagn, I almost forgot about ldconfig, I had a look now and ldconfig doesn''t appear to be working in this particular case. It''s conventional for the so_name to be the name+major version of the library (although, not universally done), so ldconfig will create a link like "foo.so.1 -> foo.so.1.1.1" and "foo.so.1.1 -> foo.so.1.1.1" but *not* foo.so -> foo.so.1.1.1, as far as I understand. It should be created manually, I suppose. Cheers!! On May 1, 6:03 am, Steven Acres <ad...@swatteksystems.com> wrote:> [ .... ] > > As vagn noted, the package manager should be handling this, there most > likely is a valid reason it isn''t creating those links (aside from ''bugs''). > And if you''re sure you want to customize a pkg., re-roll the pkg. You''ll > thank yourself later, guaranteed. > > -- > Cheers, > > Steven > ----------------------- > Steven Acres > UNIX/Linux System Administrator-- 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.
Thanks Rakhesh, looking into it. Cheers!! On May 1, 8:14 am, "Rakhesh Sasidharan" <pup...@rakhesh.net> wrote:> > In that case my suggestion of yesterday should do the trick - > > Have a Exec resource with a command to link the files above, but which > runs only if the file does not already exist. Something along the lines > of the example mentioned here -http://www.puppetcookbook.com/posts/exec-onlyif.html > > Regards.-- 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.
On 1.5.2011 10:15, Sans wrote:> Hi Steven and vagn, > > I almost forgot about ldconfig, I had a look now and ldconfig doesn''t > appear to be working in this particular case. It''s conventional for > the so_name to be the name+major version of the library (although, not > universally done), so ldconfig will create a link like "foo.so.1 -> > foo.so.1.1.1" and "foo.so.1.1 -> foo.so.1.1.1" but *not* foo.so -> > foo.so.1.1.1, as far as I understand. It should be created manually, I > suppose. Cheers!!foo.so is normally provided by the foo-devel package. Why do you need foo.so ? -- Kind Regards, Markus Falb
On May 1, 2:14 am, "Rakhesh Sasidharan" <pup...@rakhesh.net> wrote:> On Sat, 30 Apr 2011 23:21 -0700, "Sans" <r.santanu....@gmail.com> wrote: > > On May 1, 4:59 am, Matthew Black <mjbl...@gmail.com> wrote: > > > You can put a requires in the file resource > > > > require => Package["packagename"] > > > > then it will install the package first then put in the symlink. > > > That not what I actually want. I just simply want: if the package > > already installed, create the sym-link otherwise, do nothing. Cheers!! > > In that case my suggestion of yesterday should do the trick - > > Have a Exec resource with a command to link the files above, but which > runs only if the file does not already exist. Something along the lines > of the example mentioned here -http://www.puppetcookbook.com/posts/exec-onlyif.htmlAn Exec can do this job, but the more Puppetly way to do it is to write a custom fact (it''s easy) that informs the Puppetmaster whether lcgdm- libs-1.8.0-1sec.sl5 is present. Wrap the delaration of your File resource in a simple conditional (e.g. "if") statement based on that fact. In general, when you want Puppet to vary its behavior based on details of a particular node, facts and providers are the Puppet ways to approach the problem. John -- 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.