Skip to content

Commit

Permalink
Merge pull request ansible#2402 from dparalen/ec2_inventory_hostname_…
Browse files Browse the repository at this point in the history
…check

check hostname presence
  • Loading branch information
mpdehaan committed Mar 17, 2013
2 parents 6b566cf + 27b8d35 commit 921cdae
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions plugins/inventory/ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,15 @@ def get_host_info(self):
# 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):
Expand Down

0 comments on commit 921cdae

Please sign in to comment.