Skip to content

Commit 37c8560

Browse files
authored
Type options of cache plugins (#8624)
* Type options of cache plugins. * Do not change type of _timeout for now.
1 parent 1a8f172 commit 37c8560

File tree

5 files changed

+17
-2
lines changed

5 files changed

+17
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
minor_changes:
2+
- "memcached, pickle, redis, yaml cache plugins - make sure that all options are typed (https://github.com/ansible-collections/community.general/pull/8624)."

plugins/cache/memcached.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
section: defaults
3030
_prefix:
3131
description: User defined prefix to use when creating the DB entries
32+
type: string
3233
default: ansible_facts
3334
env:
3435
- name: ANSIBLE_CACHE_PLUGIN_PREFIX
@@ -37,13 +38,14 @@
3738
section: defaults
3839
_timeout:
3940
default: 86400
41+
type: integer
42+
# TODO: determine whether it is OK to change to: type: float
4043
description: Expiration timeout in seconds for the cache plugin data. Set to 0 to never expire
4144
env:
4245
- name: ANSIBLE_CACHE_PLUGIN_TIMEOUT
4346
ini:
4447
- key: fact_caching_timeout
4548
section: defaults
46-
type: integer
4749
'''
4850

4951
import collections

plugins/cache/pickle.py

+3
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@
2424
ini:
2525
- key: fact_caching_connection
2626
section: defaults
27+
type: path
2728
_prefix:
2829
description: User defined prefix to use when creating the files
2930
env:
3031
- name: ANSIBLE_CACHE_PLUGIN_PREFIX
3132
ini:
3233
- key: fact_caching_prefix
3334
section: defaults
35+
type: string
3436
_timeout:
3537
default: 86400
3638
description: Expiration timeout in seconds for the cache plugin data. Set to 0 to never expire
@@ -39,6 +41,7 @@
3941
ini:
4042
- key: fact_caching_timeout
4143
section: defaults
44+
type: float
4245
'''
4346

4447
try:

plugins/cache/redis.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
- The format is V(host:port:db:password), for example V(localhost:6379:0:changeme).
2222
- To use encryption in transit, prefix the connection with V(tls://), as in V(tls://localhost:6379:0:changeme).
2323
- To use redis sentinel, use separator V(;), for example V(localhost:26379;localhost:26379;0:changeme). Requires redis>=2.9.0.
24+
type: string
2425
required: true
2526
env:
2627
- name: ANSIBLE_CACHE_PLUGIN_CONNECTION
@@ -29,6 +30,7 @@
2930
section: defaults
3031
_prefix:
3132
description: User defined prefix to use when creating the DB entries
33+
type: string
3234
default: ansible_facts
3335
env:
3436
- name: ANSIBLE_CACHE_PLUGIN_PREFIX
@@ -37,6 +39,7 @@
3739
section: defaults
3840
_keyset_name:
3941
description: User defined name for cache keyset name.
42+
type: string
4043
default: ansible_cache_keys
4144
env:
4245
- name: ANSIBLE_CACHE_REDIS_KEYSET_NAME
@@ -46,6 +49,7 @@
4649
version_added: 1.3.0
4750
_sentinel_service_name:
4851
description: The redis sentinel service name (or referenced as cluster name).
52+
type: string
4953
env:
5054
- name: ANSIBLE_CACHE_REDIS_SENTINEL
5155
ini:
@@ -54,13 +58,14 @@
5458
version_added: 1.3.0
5559
_timeout:
5660
default: 86400
61+
type: integer
62+
# TODO: determine whether it is OK to change to: type: float
5763
description: Expiration timeout in seconds for the cache plugin data. Set to 0 to never expire
5864
env:
5965
- name: ANSIBLE_CACHE_PLUGIN_TIMEOUT
6066
ini:
6167
- key: fact_caching_timeout
6268
section: defaults
63-
type: integer
6469
'''
6570

6671
import re

plugins/cache/yaml.py

+3
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@
2424
ini:
2525
- key: fact_caching_connection
2626
section: defaults
27+
type: string
2728
_prefix:
2829
description: User defined prefix to use when creating the files
2930
env:
3031
- name: ANSIBLE_CACHE_PLUGIN_PREFIX
3132
ini:
3233
- key: fact_caching_prefix
3334
section: defaults
35+
type: string
3436
_timeout:
3537
default: 86400
3638
description: Expiration timeout in seconds for the cache plugin data. Set to 0 to never expire
@@ -40,6 +42,7 @@
4042
- key: fact_caching_timeout
4143
section: defaults
4244
type: integer
45+
# TODO: determine whether it is OK to change to: type: float
4346
'''
4447

4548

0 commit comments

Comments
 (0)