So I am using a mix of old puppet and the Ruby DSL on a new project
(loving it, new as it is!). But I've run into some behavior that
surprised me.

In my default node, (.pp), I have, among others, these lines:

node "default" {
  class { 'amqp': stage => system }
  include roles
}

(It seems that with the current Ruby DSL, the stage assignment must
happen, in a .pp file, after the 'amqp' class has been imported from
elsewhere).

In roles.rb, I have, among others, these lines:

hostclass 'roles' do
  roles = scope.lookupvar('ec2_security_groups').split(':').map {|s|
s.gsub(/-/,'_') }.map(&:to_sym)
  include 'amqp' if roles.include? :amqp
end

What surprised me is that my clever plan to do some fun logic on
system roles is thwarted by the stage assignment. Regardless of
whether or not I include the amqp class anywhere else, the stage
assignment includes the class in the configuration. I did not expect
this--I imagined that stage assignment was metadata, not assigning the
class as a requirement for the stage. Is that intended behavior?

Woefully, if my role logic is in a .rb file, I can't even do the stage
assignment conditionally, because of the aforementioned (surely
temporary) limitations in stage assignments from the Ruby DSL.

Am I missing something?  If not, can someone suggest a workaround?

Thanks,
Ben

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