LTH
unread,May 17, 2012, 10:53:03 AM5/17/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to puppet...@googlegroups.com
Hello,
I'm having some trouble with subclasses accessing other subclasses within the same main class.
I have boiled it down a general case. I have the following files:
## /etc/puppet/modules/test1
class test1 {
class {'test2::bar':}
}
## /etc/puppet/modules/test2/init.pp
class test2 {
class {test2::foo}
class {test2::bar}
class {test2::baz}
}
## /etc/puppet/modules/test2/foo.pp
class test2::foo {
# do something here in foo
}
## /etc/puppet/modules/test2/bar.pp
class test2::bar {
# do something here that requires test2::foo
exec { 'bar_in_tmp':
path => '/usr/bin:/usr/sbin:/bin',
command => "touch /tmp/bar",
creates => '/tmp/bar',
require => [
Class['test2::foo'],
],
}
}
## /etc/puppet/modules/test2/baz.pp
class test2::baz {
# do something unwanted here
}
When the agent runs it dies saying "Could not find dependence Class['Test2::Foo'] for Exec['bar_in_tmp']"
Now if I change that line in test1 to just class {'test2':} it runs without error. However since the main class call test2::baz, it does more than I wanted. Am I not understanding something? How do I just do bar and foo?
Thanks in advance,
-LTH