Junhao schrieb: > Greg wrote: > >> Only way I know is to make individual objects depend on other objects. >> Can't do it at >> class level... I think there is a feature request somewhere in the >> system for this, because >> I'd like it as well... >> >> Greg >> >> On May 27, 9:56 pm, philipp Hanselmann <philipp.hanselm...@gmail.com> >> wrote: >> >>> May somebody has answer ... >>> >>> How can I ensure that certain classes get executed on the client side >>> before the other ones do? >>> >>> Have a look on the example: >>> >>> class AA >>> case $operatingsystem { >>> "redhat": { include AA::do-first } >>> default: {} >>> } >>> include AA::software >>> include AA::desktop >>> } >>> >>> class AA::do-first { >>> # do an rhn_register >>> exec { "register-system": >>> command => "rm -f /etc/sysconfig/rhn/systemid ; rhnreg_ks >>> --force --serverUrl=https://$rhn_server/XMLRPC >>> --sslCACert=/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT >>> --activationkey=$activation_key", >>> logoutput => true, >>> unless => "/usr/sbin/rhn_check", >>> tag => register-system, >>> } >>> >>> } >>> class AA::software { >>> # do someting after AA::do-first >>> } >>> class AA::desktop { >>> # do something after AA::do-first >>> } >>> >>> For an Redhat system the resource(s) in AA::do-first should run before >>> the resource(s) in AA::software & AA::desktop. >>> >>> Is their an simple way for that? >>> >>> An other wish would be: If Exec "register-system" fails, puppet should >>> stop his execution without do go through the class AA::software & >>> AA::desktop. >>> >>> Thanks for the help! >>> >>> Philipp >>> > > What about: > > module AA: > class AA {} > class AA::do-first { $myvariable > } > class AA::software inherits AA::do-first {} > class AA::desktop inherits AA::do-first {} > > node foo: > > node foo { > import "AA" > include AA::desktop > } > > Junhao > > Hi Janhao
Even this works, I had issues with the scope of my global defined variables, so I decided to replace all my inherits code trough include(s). Since than puppet handle my variables like expected. So not really willing to go back. I must commit up to date I couldn't understand the advances of using class inheritance comparing to include statements ... class master { # do something } class slave inherits master { # do something } OR class master { # do something } class slave { include master # do something } What are differences execpt to get issues with the variable scope in inheritanced classes? Philipp > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---