diff options
author | Jorge Quintás <jorge.quintas@jobandtalent.com> | 2015-10-07 14:42:37 +0200 |
---|---|---|
committer | Brian Coca <bcoca@users.noreply.github.com> | 2017-05-17 10:45:54 -0400 |
commit | d3c94e82a5cee89c2388ee13f89d5e01d24d475b (patch) | |
tree | e820148ecdbc3d7302d19a2b6883f4c7ed37562f | |
parent | 38eeeb755d5e27f7f7848287d6eac84828b90897 (diff) | |
download | ansible-d3c94e82a5cee89c2388ee13f89d5e01d24d475b.tar.gz |
take into account if cache file exists when loading data from digitalocean even with --force-cache
-rwxr-xr-x | contrib/inventory/digital_ocean.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/contrib/inventory/digital_ocean.py b/contrib/inventory/digital_ocean.py index 2489d89b7d..24ba64370e 100755 --- a/contrib/inventory/digital_ocean.py +++ b/contrib/inventory/digital_ocean.py @@ -192,7 +192,7 @@ or environment variables (DO_API_TOKEN)\n''') self.cache_filename = self.cache_path + "/ansible-digital_ocean.cache" self.cache_refreshed = False - if self.is_cache_valid: + if self.is_cache_valid(): self.load_from_cache() if len(self.data) == 0: if self.args.force_cache: @@ -318,7 +318,7 @@ or environment variables (DO_API_TOKEN)\n''') def load_from_digital_ocean(self, resource=None): '''Get JSON from DigitalOcean API''' - if self.args.force_cache: + if self.args.force_cache and os.path.isfile(self.cache_filename): return # We always get fresh droplets if self.is_cache_valid() and not (resource == 'droplets' or resource is None): |