mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
take into account if cache file exists when loading data from digitalocean even with --force-cache
This commit is contained in:
parent
38eeeb755d
commit
d3c94e82a5
1 changed files with 2 additions and 2 deletions
|
@ -192,7 +192,7 @@ or environment variables (DO_API_TOKEN)\n''')
|
||||||
self.cache_filename = self.cache_path + "/ansible-digital_ocean.cache"
|
self.cache_filename = self.cache_path + "/ansible-digital_ocean.cache"
|
||||||
self.cache_refreshed = False
|
self.cache_refreshed = False
|
||||||
|
|
||||||
if self.is_cache_valid:
|
if self.is_cache_valid():
|
||||||
self.load_from_cache()
|
self.load_from_cache()
|
||||||
if len(self.data) == 0:
|
if len(self.data) == 0:
|
||||||
if self.args.force_cache:
|
if self.args.force_cache:
|
||||||
|
@ -318,7 +318,7 @@ or environment variables (DO_API_TOKEN)\n''')
|
||||||
|
|
||||||
def load_from_digital_ocean(self, resource=None):
|
def load_from_digital_ocean(self, resource=None):
|
||||||
'''Get JSON from DigitalOcean API'''
|
'''Get JSON from DigitalOcean API'''
|
||||||
if self.args.force_cache:
|
if self.args.force_cache and os.path.isfile(self.cache_filename):
|
||||||
return
|
return
|
||||||
# We always get fresh droplets
|
# We always get fresh droplets
|
||||||
if self.is_cache_valid() and not (resource == 'droplets' or resource is None):
|
if self.is_cache_valid() and not (resource == 'droplets' or resource is None):
|
||||||
|
|
Loading…
Reference in a new issue