Hello!
In Shef, you can enter the attributes context:
On Tue, Oct 4, 2011 at 7:03 PM, Michael Glenney < " target="_blank"> > wrote:
>
> But what I don't know is how to test that attribute first, before committing
> that to a recipe. Generally, for ruby scripting, I do that in IRB. Was
> kind of hoping shef would provide that for me but I can't get it to work
> like I think it should (and/or don't understand how it should so I can
> change the way I do things). Another case might be verifying that an
> attribute has been overridden as expected.
>
> I've tried dumping attributes from a node with 'knife node show <nodename>
> -F json > somefile.json' and then launching shef and importing those 'shef
> -j somefile.json' but I still don't seem to be able to access my attributes.
chef > attributes
chef:attributes >
Which lets you apply attributes to the node object as though you were
modifying a cookbook's attributes file.
If you want to operate on the node object as though in the context of a recipe:
chef > recipe
Then use the set, default or override methods on the node object to
set the attributes you want for testing purposes.
chef > recipe
chef:recipe > node.set['tomcat']['folder'] = "/usr/local/tomcat"
To 'erase' the attribute value (e.g., test for non-extistence, simply
set it to nil.
Yes. Shef is an IRB console with a bunch of Chef classes already
> I'm not really seeking tech support here. More I'd like to hear from the
> people who are knee deep in chef every day. Is shef the IRB of Chef as I
> assumed it was? Do you know of any "best practices" guides or how-tos for
> writing recipes and the best tools/environment settings for doing so? Am I
> completely off in left field (aka, I'm looking at this all wrong)?
loaded. It can function in different contexts (attributes, recipe,
main) and modes (solo, client, standalone). I probably use Shef daily
in testing recipe development.
The wiki has:
http://wiki.opscode.com/display/chef/Shef
We're working on adding a unit on Shef to the Chef Advanced training class.
Archive powered by MHonArc 2.6.16.