如何启动交互式Chef客户端就像通过"rails console"启动一个rails?

Hua*_*uan 3 chef-infra

在厨师工作站客户端,我想启动一个交互式控制台来调试和检查角色/配方,或者使用搜索API,例如

 chef-client > nodes=search ("node","name:*")
 chef-client > puts "#{nodes}"
Run Code Online (Sandbox Code Playgroud)

...

就像在rails中一样,使用"rails console"将所有rails环境加载到irb中.

怎么做?

Dav*_*ber 7

"shef"工具可能是您正在寻找的工具,它会在您的厨师环境中启动IRB会话,您可以在其中执行搜索,浏览和操作节点,角色等操作.甚至还有一个调试器可以逐步完成您的食谱使用"断点"资源.

这是一个真实的基本例子

chef > nodes.list
=> [node[db1-production], node[worker1-production], node[app1-production]]
chef > nodes.show('app1-production').class
 => Chef::Node 
Run Code Online (Sandbox Code Playgroud)

等等.查看OpsCode维基页面:http://wiki.opscode.com/display/chef/Shef