浏览代码

fixed bug in new ec2.py destination_format code

Thomas Wiest 10 年之前
父节点
当前提交
4c40994930
共有 1 个文件被更改,包括 8 次插入2 次删除
  1. 8 2
      inventory/aws/ec2.py

+ 8 - 2
inventory/aws/ec2.py

@@ -215,8 +215,14 @@ class Ec2Inventory(object):
         # Destination addresses
         self.destination_variable = config.get('ec2', 'destination_variable')
         self.vpc_destination_variable = config.get('ec2', 'vpc_destination_variable')
-        self.destination_format = config.get('ec2', 'destination_format')
-        self.destination_format_tags = config.get('ec2', 'destination_format_tags', '').split(',')
+
+        if config.has_option('ec2', 'destination_format') and \
+           config.has_option('ec2', 'destination_format_tags'):
+            self.destination_format = config.get('ec2', 'destination_format')
+            self.destination_format_tags = config.get('ec2', 'destination_format_tags').split(',')
+        else:
+            self.destination_format = None
+            self.destination_format_tags = None
 
         # Route53
         self.route53_enabled = config.getboolean('ec2', 'route53')