It is unfortunately only documented in the release notes. facts are accessed as follows:
node 'default' do file '/tmp/one', :content => Facter[:operatingsystem].value end On Tue, Dec 7, 2010 at 6:05 AM, Martijn Grendelman <mart...@iphion.nl>wrote: > Hi, > > I'm sorry, this may not be the response you are waiting for. > Unfortunately, I have only questions to add... > > > I'm experimenting with converting some of my live puppet content to > > Ruby DSL and have found a few gaps I wouldn't mind some advice on. I'm > > not sure how many of you have already experimented in this arena yet. > > > > I've already read Dan Bode's excellent blog article on the subject: > > > > http://www.puppetlabs.com/blog/ruby-dsl/ > > > > I know the Ruby DSL is quite new - but I figured perhaps some of these > > items deserve to be tickets (or perhaps documented) and I thought I'd > > ask first :-). > > > > 1. Defaults > > > > How do I set defaults in Ruby DSL? For example what is the ruby DSL > > equivalent to this: > > > > Service { > > hasstatus => true > > } > > > > 2. Top scope > > > > I notice the convenience methodology does not work at 'top scope' for > > example > > this will fail: > > > > file "/tmp/zzz", :content => "foo" > > > > But this will not: > > > > node "default" do > > file "/tmp/zzz", :content => "foo" > > end > > > > Is there a proper way to call resources without using the convenience > > methods? Or > > perhaps is there a way to define elements that reside in top scope? > > > > 3. Class resource > > > > I think Dan Bode already raised this as a bug: > > > > https://projects.puppetlabs.com/issues/5236 > > > > The following returns an error 'method_missing': > > > > hostclass :foo do > > notify "bar" > > end > > node "default" do > > hostclass "foo", :stage => "baz" > > end > > > > This is because hostclass has not been defined as a convenience method > > it would seem. Just like issues 2 If someone knows > > a way to call a resource directly without requiring the convenience > > method that would be a decent enough work-around. > > > > 4. exec Resource > > > > The 'exec' resource as a convenience method is overlapping with the > > ruby 'exec' > > method. So if you do this: > > > > node "default" do > > exec "ls", :command => "/bin/ls" > > end > > > > You get: > > > > can't convert Hash into String on node obelisk.usr.bob.sh > > > > Returned from the Kernel.exec call. > > > > 5. Referencing other resources > > > > I'm not quite clear how to reference other resources that already > > exist. This is obviously a problem for the 'require' attribute: > > > > node "default" do > > package "foo", :ensure => "installed" > > service "foo", :enable => "true", :ensure => "running", :require > > => ??? > > end > > > > 6. Chaining Resources > > > > Is there a syntactical equivalent to this in Ruby DSL yet? For > > example: > > > > Stage[pre] -> Stage[main] -> Stage[post] > > > > Without knowing how to solve 5 I'm kind of stuck when it comes to > > defining dependencies :-). > > > > Cheers :-). > > > > > Is there, besides the mentioned blog post, any official documentation? I > haven't been able to find any. > > How can I use facts in pure-Ruby manifests? I don't know how to reference > them, and anything I have tried failed. > > Best regards, > Martijn. > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-us...@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscr...@googlegroups.com<puppet-users%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-us...@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.