Remove diff and request data. Add more return docs. (#34230)
This commit is contained in:
parent
32f963aa0f
commit
d73be7f461
3 changed files with 54 additions and 33 deletions
|
@ -167,9 +167,6 @@ class KubernetesAnsibleModule(AnsibleModule):
|
||||||
|
|
||||||
return_attributes = dict(changed=False, result=dict())
|
return_attributes = dict(changed=False, result=dict())
|
||||||
|
|
||||||
if self._diff:
|
|
||||||
return_attributes['request'] = self.helper.request_body_from_params(self.params)
|
|
||||||
|
|
||||||
if self.helper.base_model_name_snake.endswith('list'):
|
if self.helper.base_model_name_snake.endswith('list'):
|
||||||
k8s_obj = self._read(name, namespace)
|
k8s_obj = self._read(name, namespace)
|
||||||
return_attributes['result'] = k8s_obj.to_dict()
|
return_attributes['result'] = k8s_obj.to_dict()
|
||||||
|
@ -225,8 +222,6 @@ class KubernetesAnsibleModule(AnsibleModule):
|
||||||
if match:
|
if match:
|
||||||
return_attributes['result'] = existing.to_dict()
|
return_attributes['result'] = existing.to_dict()
|
||||||
self.exit_json(**return_attributes)
|
self.exit_json(**return_attributes)
|
||||||
elif self._diff:
|
|
||||||
return_attributes['differences'] = diff
|
|
||||||
# Differences exist between the existing obj and requested params
|
# Differences exist between the existing obj and requested params
|
||||||
if not self.check_mode:
|
if not self.check_mode:
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -29,7 +29,7 @@ description:
|
||||||
files and using Jinja templates.
|
files and using Jinja templates.
|
||||||
- Access to the full range of K8s APIs.
|
- Access to the full range of K8s APIs.
|
||||||
- Authenticate using either a config file, certificates, password or token.
|
- Authenticate using either a config file, certificates, password or token.
|
||||||
- Supports check mode, and the diff option.
|
- Supports check mode.
|
||||||
|
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- k8s_state_options
|
- k8s_state_options
|
||||||
|
@ -124,18 +124,31 @@ result:
|
||||||
description:
|
description:
|
||||||
- The created, patched, or otherwise present object. Will be empty in the case of a deletion.
|
- The created, patched, or otherwise present object. Will be empty in the case of a deletion.
|
||||||
returned: success
|
returned: success
|
||||||
type: dict
|
type: complex
|
||||||
request:
|
contains:
|
||||||
description:
|
api_version:
|
||||||
- The object sent to the API. Useful for troubleshooting unexpected differences and 404 errors.
|
description: The versioned schema of this representation of an object.
|
||||||
returned: when diff is true
|
returned: success
|
||||||
type: dict
|
type: str
|
||||||
diff:
|
kind:
|
||||||
description:
|
description: Represents the REST resource this object represents.
|
||||||
- List of differences found when determining if an existing object will be patched. A copy of the existing object
|
returned: success
|
||||||
is updated with the requested options, and the updated object is then compared to the original. If there are
|
type: str
|
||||||
differences, they will appear here.
|
metadata:
|
||||||
returned: when diff is true
|
description: Standard object metadata. Includes name, namespace, annotations, labels, etc.
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
spec:
|
||||||
|
description: Specific attributes of the object. Will vary based on the I(api_version) and I(kind).
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
status:
|
||||||
|
description: Current status details for the object.
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
items:
|
||||||
|
description: Returned only when the I(kind) is a List type resource. Contains a set of objects.
|
||||||
|
returned: when resource is a List
|
||||||
type: list
|
type: list
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ description:
|
||||||
files and using Jinja templates.
|
files and using Jinja templates.
|
||||||
- Access to the full range of K8s and OpenShift APIs.
|
- Access to the full range of K8s and OpenShift APIs.
|
||||||
- Authenticate using either a config file, certificates, password or token.
|
- Authenticate using either a config file, certificates, password or token.
|
||||||
- Supports check mode, and the diff option.
|
- Supports check mode.
|
||||||
|
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- k8s_state_options
|
- k8s_state_options
|
||||||
|
@ -165,18 +165,31 @@ result:
|
||||||
description:
|
description:
|
||||||
- The created, patched, or otherwise present object. Will be empty in the case of a deletion.
|
- The created, patched, or otherwise present object. Will be empty in the case of a deletion.
|
||||||
returned: success
|
returned: success
|
||||||
type: dict
|
type: complex
|
||||||
request:
|
contains:
|
||||||
description:
|
api_version:
|
||||||
- The object sent to the API. Useful for troubleshooting unexpected differences and 404 errors.
|
description: The versioned schema of this representation of an object.
|
||||||
returned: when diff is true
|
returned: success
|
||||||
type: dict
|
type: str
|
||||||
diff:
|
kind:
|
||||||
description:
|
description: Represents the REST resource this object represents.
|
||||||
- List of differences found when determining if an existing object will be patched. A copy of the existing object
|
returned: success
|
||||||
is updated with the requested options, and the updated object is then compared to the original. If there are
|
type: str
|
||||||
differences, they will appear here.
|
metadata:
|
||||||
returned: when diff is true
|
description: Standard object metadata. Includes name, namespace, annotations, labels, etc.
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
spec:
|
||||||
|
description: Specific attributes of the object. Will vary based on the I(api_version) and I(kind).
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
status:
|
||||||
|
description: Current status details for the object.
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
items:
|
||||||
|
description: Returned only when the I(kind) is a List type resource. Contains a set of objects.
|
||||||
|
returned: when resource is a List
|
||||||
type: list
|
type: list
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue