Hello,

Are you looking for "include" rather than "import" in the example below?

Not :
 >> class class_A {
 >>         import class_B
 >>         package { foo }

but:
class class_A{
        include class_B
        package { foo }


Regards,
-Roy

Moty wrote:
> Hi
> 
> If I understand it correctly I'm not sure you can import a class ...
> 
> But if it's possible so it is probably as importing manifests. In that
> case the import just
> put it into scope and not "running" it.
> 
> 
> Please correct me if I'm wrong
> 
> Mort
> 
> 
> 
> On Jun 30, 7:01 pm, Arnau Bria <arnaub...@pic.es> wrote:
>> Hi all,
>>
>> I have a couple of "basic" questions on classes.
>>
>> In a class, what's the diff between:
>>
>> *don't take in count syntax, please.
>>
>> ----------------------------------
>> class class_B {
>>         package { fortune }
>>         file { dummy }
>>         }
>> ----------------------------------
>>
>> example 1)
>>
>> class class_A {
>>         import class_B
>>         package { foo }
>>
>> example 2)
>>
>> class class_A {
>>         file { bogus
>>                 before = > Package [foo],
>>                 }
>>         package { foo
>>                 require  => Class["class_B"],
>>                 }
>>         }
>>
>> example 3)
>>
>> class class_A inherits class_B {
>>         package { foo }
>>
>> In first example class_B will be evaluated before ALL class_A.
>> so package fortuen and dummy file will be installed/created before
>> package foo.
>>
>> In second one, class_B will be evaluted ONLY when package
>> foo. So, first bogus package, then, before foo, fortune and summy file.
>>
>> And on third example? same as first one?
>>
>> I don't see difference between example 1 and 3.
>>
>> All comes from some examples from David 
>> Schmitt:http://git.black.co.at/?p=module-ssh;a=blob;f=manifests/init.pp;h=9c8...
>>
>>    5 class ssh::common {
>>    6         file {
>>    7                 "/etc/ssh":
>>    8                         ensure => directory,
>>    9                         mode => 0755, owner => root, group => root,
>>   10         }
>>   11         group {
>>   12                 ssh:
>>   13                         gid => 204,
>>   14                         allowdupe => false,
>>   15         }
>>   16 }
>>   17
>>   18 class ssh::client inherits ssh::common {
>>   19         package {
>>   20                 "openssh-client":
>>   21                         ensure => installed,
>>   22                         require => [ File["/etc/ssh"], Group[ssh] ],
>>   23         }
>> [...]
>>
>> Why is he requering File and Group if class ssh::client inherits
>> ssh:common?
>>
>> Oh, if I include class_B in class_A, node def should be enough with:
>>
>> node "node.bogus.com" {
>>         include class_A
>>         }
>>
>> right?
>>
>> TIA,
>> Arnau
> > 

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