Details
-
Type:
Task
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: Chef Shell
-
Labels:None
-
Environment:
all
Description
chef> help :nodes
....
Bulk edit nodes by passing a code block to the transform or bulk_edit
subcommand. The block will be applied to each matching node, and then the node
will be saved. If the block returns nil or false, that node will be
skipped.
nodes.transform do |node|
if node.fqdn =~ /.*\.preprod\.example\.com/
node.set[:environment] = "preprod"
end
end
The example does not work:
chef > nodes.transform do |node|
chef > puts node.fqdn
chef ?> end
ArgumentError: wrong number of arguments (0 for 1)
from (irb):4:in `transform'
from (irb):4
from /usr/lib/ruby/gems/1.8/gems/chef-0.9.8/lib/chef/provider/route.rb:47
transform wants a specifier either :all or a search string to run the transform against
chef > nodes.transform "platform:centos" do |node|
chef > puts node.platform
chef ?> end
centos
centos
centos
centos
centos
centos
Activity
- All
- Comments
- History
- Activity
- Transitions Summary