mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
check hostname presence
This commit is contained in:
parent
fc8d9377d5
commit
27b8d3567e
1 changed files with 8 additions and 0 deletions
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue