Class dependencies

84 views
Skip to first unread message

Hiu

unread,
Nov 5, 2012, 11:51:28 PM11/5/12
to puppet...@googlegroups.com
hi all,

How are you? I have a question on the class dependencies.

This is my init.pp script looks like

class mapr {
        Class['mapr::install'] -> Class["mapr::config"]

        include mapr::install,
                mapr::config

}

In my mapr::install class i have another few lines of includes statement to install different packages. Same goes to mapr::config. My Class dependency is not working at all when i put 

 Class['mapr::install'] -> Class["mapr::config"]

It executed config first before install, which is the one that i wish to do. 

can anyone educate me on this? thanks! 


Nick Fagerlund

unread,
Nov 6, 2012, 12:07:52 AM11/6/12
to puppet...@googlegroups.com
Yup, this is the classes-can't-contain-classes problem. It sucks, everyone runs into it eventually, and it's explained in detail here:

http://docs.puppetlabs.com/puppet/3/reference/lang_containment.html#known-issues

http://projects.puppetlabs.com/issues/8040

You'll need to use the "anchor pattern" (http://docs.puppetlabs.com/puppet/3/reference/lang_containment.html#workaround-the-anchor-pattern) to ensure that the interior classes get "held" in place inside their wrapper class.

The platform development team uses votes in our issue tracker to help decide what they'll focus on next. If this problem bothered you a lot, please vote for issue 8040 here: http://projects.puppetlabs.com/issues/8040

Sorry for the inconvenience, and good luck.

N

Hiu

unread,
Nov 6, 2012, 12:42:03 AM11/6/12
to puppet...@googlegroups.com
Thanks for the info.


Do you have more descriptive explanation on the anchor pattern? From what you have pasted on this link isn't sound descriptive. Or can you give me a pattern of codes instead? thanks!
Reply all
Reply to author
Forward
0 new messages