mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-07-28 18:34:42 +00:00
The type of wait_condition.status is str (#310)
The `wait_condition.status` key is a string. - Use actually string in the documentation - Use core's `boolean()` method to convert the value internally to boolean
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
minor_changes:
|
||||||
|
- Adjust the documentation to clarify the fact ``wait_condition.status`` is a string.
|
||||||
@@ -52,9 +52,9 @@ options:
|
|||||||
- The value of the status field in your desired condition.
|
- The value of the status field in your desired condition.
|
||||||
- For example, if a C(Deployment) is paused, the C(Progressing) C(type) will have the C(Unknown) status.
|
- For example, if a C(Deployment) is paused, the C(Progressing) C(type) will have the C(Unknown) status.
|
||||||
choices:
|
choices:
|
||||||
- True
|
- "True"
|
||||||
- False
|
- "False"
|
||||||
- Unknown
|
- "Unknown"
|
||||||
default: "True"
|
default: "True"
|
||||||
reason:
|
reason:
|
||||||
type: str
|
type: str
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
|||||||
from ansible.module_utils.six import iteritems, string_types
|
from ansible.module_utils.six import iteritems, string_types
|
||||||
from ansible.module_utils._text import to_native
|
from ansible.module_utils._text import to_native
|
||||||
from ansible.module_utils.common.dict_transformations import dict_merge
|
from ansible.module_utils.common.dict_transformations import dict_merge
|
||||||
|
from ansible.module_utils.parsing.convert_bool import boolean
|
||||||
|
|
||||||
|
|
||||||
K8S_IMP_ERR = None
|
K8S_IMP_ERR = None
|
||||||
try:
|
try:
|
||||||
@@ -181,7 +183,7 @@ WAIT_ARG_SPEC = dict(
|
|||||||
default=None,
|
default=None,
|
||||||
options=dict(
|
options=dict(
|
||||||
type=dict(),
|
type=dict(),
|
||||||
status=dict(default=True, choices=[True, False, "Unknown"]),
|
status=dict(type='str', default="True", choices=["True", "False", "Unknown"]),
|
||||||
reason=dict()
|
reason=dict()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -438,7 +440,7 @@ class K8sAnsibleMixin(object):
|
|||||||
return match.reason == condition['reason']
|
return match.reason == condition['reason']
|
||||||
return False
|
return False
|
||||||
status = True if match.status == 'True' else False
|
status = True if match.status == 'True' else False
|
||||||
if status == condition['status']:
|
if status == boolean(condition['status']):
|
||||||
if condition.get('reason'):
|
if condition.get('reason'):
|
||||||
return match.reason == condition['reason']
|
return match.reason == condition['reason']
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user