diff --git a/changelogs/fragments/8624-cache-types.yml b/changelogs/fragments/8624-cache-types.yml new file mode 100644 index 0000000000..8efa34b6c0 --- /dev/null +++ b/changelogs/fragments/8624-cache-types.yml @@ -0,0 +1,2 @@ +minor_changes: + - "memcached, pickle, redis, yaml cache plugins - make sure that all options are typed (https://github.com/ansible-collections/community.general/pull/8624)." diff --git a/plugins/cache/memcached.py b/plugins/cache/memcached.py index 0bc5256b3f..93131172c5 100644 --- a/plugins/cache/memcached.py +++ b/plugins/cache/memcached.py @@ -29,6 +29,7 @@ DOCUMENTATION = ''' section: defaults _prefix: description: User defined prefix to use when creating the DB entries + type: string default: ansible_facts env: - name: ANSIBLE_CACHE_PLUGIN_PREFIX @@ -37,13 +38,14 @@ DOCUMENTATION = ''' section: defaults _timeout: default: 86400 + type: integer + # TODO: determine whether it is OK to change to: type: float description: Expiration timeout in seconds for the cache plugin data. Set to 0 to never expire env: - name: ANSIBLE_CACHE_PLUGIN_TIMEOUT ini: - key: fact_caching_timeout section: defaults - type: integer ''' import collections diff --git a/plugins/cache/pickle.py b/plugins/cache/pickle.py index 06b673921e..aeffa68939 100644 --- a/plugins/cache/pickle.py +++ b/plugins/cache/pickle.py @@ -24,6 +24,7 @@ DOCUMENTATION = ''' ini: - key: fact_caching_connection section: defaults + type: path _prefix: description: User defined prefix to use when creating the files env: @@ -31,6 +32,7 @@ DOCUMENTATION = ''' ini: - key: fact_caching_prefix section: defaults + type: string _timeout: default: 86400 description: Expiration timeout in seconds for the cache plugin data. Set to 0 to never expire @@ -39,6 +41,7 @@ DOCUMENTATION = ''' ini: - key: fact_caching_timeout section: defaults + type: float ''' try: diff --git a/plugins/cache/redis.py b/plugins/cache/redis.py index c43b1dbb5e..e01083e863 100644 --- a/plugins/cache/redis.py +++ b/plugins/cache/redis.py @@ -21,6 +21,7 @@ DOCUMENTATION = ''' - The format is V(host:port:db:password), for example V(localhost:6379:0:changeme). - To use encryption in transit, prefix the connection with V(tls://), as in V(tls://localhost:6379:0:changeme). - To use redis sentinel, use separator V(;), for example V(localhost:26379;localhost:26379;0:changeme). Requires redis>=2.9.0. + type: string required: true env: - name: ANSIBLE_CACHE_PLUGIN_CONNECTION @@ -29,6 +30,7 @@ DOCUMENTATION = ''' section: defaults _prefix: description: User defined prefix to use when creating the DB entries + type: string default: ansible_facts env: - name: ANSIBLE_CACHE_PLUGIN_PREFIX @@ -37,6 +39,7 @@ DOCUMENTATION = ''' section: defaults _keyset_name: description: User defined name for cache keyset name. + type: string default: ansible_cache_keys env: - name: ANSIBLE_CACHE_REDIS_KEYSET_NAME @@ -46,6 +49,7 @@ DOCUMENTATION = ''' version_added: 1.3.0 _sentinel_service_name: description: The redis sentinel service name (or referenced as cluster name). + type: string env: - name: ANSIBLE_CACHE_REDIS_SENTINEL ini: @@ -54,13 +58,14 @@ DOCUMENTATION = ''' version_added: 1.3.0 _timeout: default: 86400 + type: integer + # TODO: determine whether it is OK to change to: type: float description: Expiration timeout in seconds for the cache plugin data. Set to 0 to never expire env: - name: ANSIBLE_CACHE_PLUGIN_TIMEOUT ini: - key: fact_caching_timeout section: defaults - type: integer ''' import re diff --git a/plugins/cache/yaml.py b/plugins/cache/yaml.py index 3a5ddf3e6f..a3d6f34521 100644 --- a/plugins/cache/yaml.py +++ b/plugins/cache/yaml.py @@ -24,6 +24,7 @@ DOCUMENTATION = ''' ini: - key: fact_caching_connection section: defaults + type: string _prefix: description: User defined prefix to use when creating the files env: @@ -31,6 +32,7 @@ DOCUMENTATION = ''' ini: - key: fact_caching_prefix section: defaults + type: string _timeout: default: 86400 description: Expiration timeout in seconds for the cache plugin data. Set to 0 to never expire @@ -40,6 +42,7 @@ DOCUMENTATION = ''' - key: fact_caching_timeout section: defaults type: integer + # TODO: determine whether it is OK to change to: type: float '''