On 8/21/2012 9:05 AM, lamour wrote:
I'm starting to feel like, maybe, I have a fundamentally flawed concept
of how puppet is intended to be used.  (new to puppet.  setting up
initial puppet environment.  blah blah)

so, I've got most of the pieces worked out, but I've hit a major
roadblock with the way packages are handled in puppet.  (according to my
limited understanding of puppet, that is)  The problem starts with the
fact that including the following in two different classes:

    package { 'perl': ensure => installed }

causes this error:

    "Duplicate definition: Package[perl] is already defined"

This is pretty unfortunate, but we can try to work around it by doing this:

    package { 'test-perl': ensure => installed, alias => 'perl' }

which gives us this error:

    "Parameter alias failed: test-perl can not create alias perl: object
already exists"

Ok, can't even get around it like that.  I've found two ways around this
so far, both are kinda gross, so I'm starting to wonder if I'm working
against some "prime directive" of puppet.

What happens when you have two or more statements about the same resource in conflict?

 package { 'mysql': ensure => installed, }
 package { 'mysql': ensure => 5.0.92, }
 package { 'mysql': ensure => latest, }
        
Therefore you need to specify it once. You can do this a few different ways.

class perl {
  package { 'perl': ensure => installed }
}

class someclass {
  include perl
  file { 'somefile': content => 'stuff', require => Class['perl',}
}

or going in a different direction

class virtualpackages {
  @package { 'perl': }
}

class someclass {
  include perl
  file { 'somefile': content => 'stuff', require => Package['perl',}

  realize Package['perl']
}

Personally I find it simpler to use the first method for most complex things and the later for one off packages that might be needed for multiple things like mysql-client libs.

Ramin

--
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