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:
Gonéri Le Bouder
2020-11-25 14:01:38 -05:00
committed by GitHub
parent 4d94cb9439
commit 8f14bf6c46
3 changed files with 10 additions and 5 deletions

View File

@@ -0,0 +1,3 @@
---
minor_changes:
- Adjust the documentation to clarify the fact ``wait_condition.status`` is a string.

View File

@@ -52,9 +52,9 @@ options:
- 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.
choices:
- True
- False
- Unknown
- "True"
- "False"
- "Unknown"
default: "True"
reason:
type: str

View File

@@ -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._text import to_native
from ansible.module_utils.common.dict_transformations import dict_merge
from ansible.module_utils.parsing.convert_bool import boolean
K8S_IMP_ERR = None
try:
@@ -181,7 +183,7 @@ WAIT_ARG_SPEC = dict(
default=None,
options=dict(
type=dict(),
status=dict(default=True, choices=[True, False, "Unknown"]),
status=dict(type='str', default="True", choices=["True", "False", "Unknown"]),
reason=dict()
)
)
@@ -438,7 +440,7 @@ class K8sAnsibleMixin(object):
return match.reason == condition['reason']
return False
status = True if match.status == 'True' else False
if status == condition['status']:
if status == boolean(condition['status']):
if condition.get('reason'):
return match.reason == condition['reason']
return True