Hi all,
I'm trying to come up with a way to do resource references in the pure
Ruby DSL. My hope was to do magic with constants; something like:
hostclass :foo {
file "/my/file", :ensure => :present
service "apache", :subscribe => File["/my/file"]
}
The problem is that const_missing is relative to the current constant
scope (or something silly like that), not relative to the object
evaluating the block, so this won't work.
Anyone else have any bright ideas for how to specify resource
references? About the only thing I can think of to start is to return
the type if no arguments have been passed, so the following would work:
hostclass :foo {
file "/my/file", :ensure => :present
service "apache", :subscribe => file["/my/file"]
}
It makes the method magic even more magical, which is less than awesome.
I've also added the ability to do exported and virtual resources, and
should soon have collections:
hostclass :foo {
virtual { file "/my/file", :ensure => :present }
virtual file("/other/file", :ensure => :present)
}
hostclass :bar {
realize File["/my/file"] # doesn't work :/
}
--
It's a small world, but I wouldn't want to paint it.
-- Stephen Wright
---------------------------------------------------------------------
Luke Kanies -|- http://reductivelabs.com -|- +1(615)594-8199
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en.