瀏覽代碼

fixed bug in AwsUtil that was causing it to blow up on hosts without an environment set.

Thomas Wiest 10 年之前
父節點
當前提交
8279328096
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      bin/awsutil.py

+ 4 - 0
bin/awsutil.py

@@ -87,6 +87,10 @@ class AwsUtil(object):
 
         inst_by_env = {}
         for dns, host in inv['_meta']['hostvars'].items():
+            # If you don't have an environment tag, we're going to ignore you
+            if not host.has_key('ec2_tag_environment'):
+                continue
+
             if host['ec2_tag_environment'] not in inst_by_env:
                 inst_by_env[host['ec2_tag_environment']] = {}
             host_id = "%s:%s" % (host['ec2_tag_Name'],host['ec2_id'])