diff options
author | Michael DeHaan <michael.dehaan@gmail.com> | 2013-03-17 07:32:58 -0700 |
---|---|---|
committer | Michael DeHaan <michael.dehaan@gmail.com> | 2013-03-17 07:32:58 -0700 |
commit | 921cdaec48f2121f8867f903f742525aebca70dc (patch) | |
tree | d8fa63d3ae6331568a13d60d8e55a52dd05513c1 | |
parent | 6b566cfc1e9d3b842d2c9aebe6097367d0bfedc5 (diff) | |
parent | 27b8d3567ee3e23f1de16de7e0edfea5a834b902 (diff) | |
download | ansible-921cdaec48f2121f8867f903f742525aebca70dc.tar.gz |
Merge pull request #2402 from dparalen/ec2_inventory_hostname_check
check hostname presence
-rwxr-xr-x | plugins/inventory/ec2.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/plugins/inventory/ec2.py b/plugins/inventory/ec2.py index 08c37c065e..8cd3212eca 100755 --- a/plugins/inventory/ec2.py +++ b/plugins/inventory/ec2.py @@ -329,7 +329,15 @@ class Ec2Inventory(object): # Need to load index from cache self.load_index_from_cache() + if not self.args.host in self.index: + # try updating the cache + self.do_api_calls_update_cache() + if not self.args.host in self.index: + # host migh not exist anymore + return self.json_format_dict({}, True) + (region, instance_id) = self.index[self.args.host] + instance = self.get_instance(region, instance_id) instance_vars = {} for key in vars(instance): |