On 14.09.2010 23:12, Marc Zampetti wrote:
I've been banging my head on this all day, and I cannot seem to
figure out how to do it.
I have a package for Apache HTTPd. I want to be able to specify the
exact version of the package to use for a particular installation. And
it is also possible that I want to have two separate modules install
the same package.
So, what I end up with is the following
class app-apache {
package { "apache" : ensure => installed, noop => true }
}
class app-apache-server1 inherits app-apache {
Package["apache"] {ensure => "2.2.15", noop => false}
}
class app-apache-server2 inherits app-apache {
Package["apache"] {ensure => "2.2.15", noop => false}
}
Basically, I have two servers configured. Now, it is possible that
both servers could end up on the same host, depending upon a number of
facters. When that happens, I get an error about not being able to
override the "ensure" method in app-apache-server2 because it was
already overridden in app-apache-server1.
Anyone have any ideas on how to do this? I need to be able to specify
the version I want for a particular class, and that can change from
class to class. I realize that if two different classes define two
different versions and both classes end up on the same node, I will
get errors from YUM. I'm ok with that.
Marc Zampetti
I don't see any way to do what you want directly. But in your specific
case you may add another level of inheritance, that specifies the
version, and inherit both of your classes from that, and you will get an
error from puppet for double override in that case. You shouldn't feed
much into yum as you might get an actual response in package management...
As an alternative you may get the version from a variable for the
specified class, but this would leave you with somewhat of a nightmare
for double inclusion.
Leaving that aside what are you trying to do? What you are doing doesn't
seem right to me. Any code that uses copy/paste should be refactored to
call that common piece of code instead of the programmer/admin doing a
copy paste of that code.
Silviu
--
You received this message because you are subscribed to the Google Groups "Puppet
Users" group.
To post to this group, send email to puppet-us...@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.