mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-27 18:50:21 -07: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:
parent
2d5908255a
commit
2276c5f206
1 changed files with 2 additions and 1 deletions
|
@ -49,6 +49,7 @@ options:
|
||||||
cache_valid_time:
|
cache_valid_time:
|
||||||
description:
|
description:
|
||||||
- Update the apt cache if its older than the I(cache_valid_time). This option is set in seconds.
|
- 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
|
required: false
|
||||||
default: 0
|
default: 0
|
||||||
purge:
|
purge:
|
||||||
|
@ -926,7 +927,7 @@ def main():
|
||||||
# Cache valid time is default 0, which will update the cache if
|
# Cache valid time is default 0, which will update the cache if
|
||||||
# needed and `update_cache` was set to true
|
# needed and `update_cache` was set to true
|
||||||
updated_cache = False
|
updated_cache = False
|
||||||
if p['update_cache']:
|
if p['update_cache'] or p['cache_valid_time']:
|
||||||
now = datetime.datetime.now()
|
now = datetime.datetime.now()
|
||||||
tdelta = datetime.timedelta(seconds=p['cache_valid_time'])
|
tdelta = datetime.timedelta(seconds=p['cache_valid_time'])
|
||||||
if not mtimestamp + tdelta >= now:
|
if not mtimestamp + tdelta >= now:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue