hi. i was trying to list out my nodes and their AMI IDs, but i have a few
nodes that have no ec2 attribute. they're probably nodes that failed their
first chef run and need to be cleaned out anyway. when the search runs into
a node that has no ec2 attr, the search bails out before it completes listing
everything:
$ knife exec -E 'nodes.transform("*:*") {|n| puts "#{n.name}: #{n.ec2.ami_id}" }'
web1.dev.dsnine.com: ami-xxxxxxxx
admin2.stg.dsnine.com: ami-xxxxxxxx
db2.stg.dsnine.com: ami-xxxxxxxx
web4.dev.dsnine.com: ami-xxxxxxxx
app1.stg.dsnine.com: ami-xxxxxxxx
ERROR: ArgumentError: Attribute ec2 is not defined!
is there a way to craft the search so the search completes? i tried checking
if n.ec2.nil?, but that didn't help:
$ knife exec -E 'nodes.transform("*:*") {|n| puts "#{n.name}: #{n.ec2.ami_id}" if not n.ec2.nil? }'
web1.dev.dsnine.com: ami-xxxxxxxx
admin2.stg.dsnine.com: ami-xxxxxxxx
db2.stg.dsnine.com: ami-xxxxxxxx
web4.dev.dsnine.com: ami-xxxxxxxx
app1.stg.dsnine.com: ami-xxxxxxxx
ERROR: ArgumentError: Attribute ec2 is not defined!
$ knife exec -E 'nodes.transform("*:*") {|n| puts "#{n.name}" if n.ec2.nil? }'
ERROR: ArgumentError: Attribute ec2 is not defined!
thanks,
kallen
Archive powered by MHonArc 2.6.16.