In regard to: Re: [Puppet Users] package handling in puppet?, lamour said...:

Another, less gross, way to do it is to do something like this:


      if !defined(Package['perl']) {
         package { 'perl':
            ensure => installed,
         }
      }

I would instead do something more like

   file { 'your-unpackaged-perl-script-here.pl':
     ensure  => file,
     owner   => 'whomever',
     group   => 'ditto',
     mode    => '0whatever-whatever-whatever',
     require => Package['perl'],
     source  => 'puppet:///module_name/script-source-here.pl',
   }


So, I guess I don't understand this.  Does this require not cause a
collision?

The answer is, "it depends".  I didn't include everything I should have
in that example, because you *still* need to have a

        package { 'perl': }

somewhere *and* that needs to be either included from some other class
or it needs to be established in the same manifest.

 Does this require cause the resource to become defined?

No it does not, that still has to happen elsewhere.

 Can
you require more than one package?

Yes, and you can have multiple different resources that require the
same resource, e.g.

  package { 'cricket':
    ensure  => installed,
    require => [
      Yumrepo['ndsu'],
      Package['httpd', 'pmacct'],
      User['cricket'],
    ],
  }

  package { 'flow-utils':
    ensure  => installed,
    require => [
      User['cricket'],
      Mount['/var/netflow'],
    ],
  }

 I'll have to go read the documentation
to learn more about what this does, even though I don't think this helps
me, because I can't see how I could realistically tie all of my package
definitions to files.

My example was really meant for the case where you have one-off scripts
that are *not* installed via the OS package management system.  As I said
before, you generally want to let the OS package management system handle
the dependencies as much as possible.

One more thing: if you search the archives, I think you'll find that
although "defined()" has its uses, it seems like the general feeling is
that it's somewhat overused, and used in cases where it really was not
intended.  Your use of defined() might be perfect, but I just tend to shy
away from defined(), probably because my knowledge of puppet doesn't make
me certain that I would use it in the appropriate cases.

Thanks for all of your advice.  It's nice to get a bit of perspective from
people who are already using puppet in the wild.

I'm hoping that other more experienced puppet users will weigh in on this
too, as I certainly am not expert enough yet to have all the answers for
this particular area.

Tim
--
Tim Mooney                                             tim.moo...@ndsu.edu
Enterprise Computing & Infrastructure                  701-231-1076 (Voice)
Room 242-J6, IACC Building                             701-231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164

--
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to