On Thursday, May 17, 2012 11:23:40 AM UTC-4, James Sweeny wrote:
>
> You can't require Class['test2::foo'] unless it's already available where 
> you're requiring it. You need to include test2::foo in test2::bar.
>
>
Thanks.

If I include test2:foo in test2::bar, do I still need  require => 
[Class['test2::foo'] on the exec?  In testing this, it seems that I don't. 




On Thu, May 17, 2012 at 10:53 AM, LTH wrote:
>
>> 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
>>
>>
>>
>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Puppet Users" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/puppet-users/-/QJOSn1NqhEsJ.
>> 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.
>>
>
>
>
> -- 
>
> James Sweeny
> Professional Services
> http://puppetlabs.com/
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/MqrvCA3LpnYJ.
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