mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
apt: Update cache if cache_valid_time is set (#27618)
It's not clear from the docs whether you need to set `update_cache` when using `cache_valid_time`. Setting `cache_valid_time` should imply `update_cache`. Update docs to reflect this.
This commit is contained in:
@@ -49,6 +49,7 @@ options:
|
||||
cache_valid_time:
|
||||
description:
|
||||
- Update the apt cache if its older than the I(cache_valid_time). This option is set in seconds.
|
||||
As of Ansible 2.4, this implicitly sets I(update_cache) if set.
|
||||
required: false
|
||||
default: 0
|
||||
purge:
|
||||
@@ -926,7 +927,7 @@ def main():
|
||||
# Cache valid time is default 0, which will update the cache if
|
||||
# needed and `update_cache` was set to true
|
||||
updated_cache = False
|
||||
if p['update_cache']:
|
||||
if p['update_cache'] or p['cache_valid_time']:
|
||||
now = datetime.datetime.now()
|
||||
tdelta = datetime.timedelta(seconds=p['cache_valid_time'])
|
||||
if not mtimestamp + tdelta >= now:
|
||||
|
||||
Reference in New Issue
Block a user