From d73be7f461fc7c7abdc89554f97386d35dd5e13a Mon Sep 17 00:00:00 2001 From: Chris Houseknecht Date: Mon, 25 Dec 2017 21:50:58 -0500 Subject: [PATCH] Remove diff and request data. Add more return docs. (#34230) --- lib/ansible/module_utils/k8s/common.py | 5 --- lib/ansible/modules/clustering/k8s/k8s_raw.py | 41 ++++++++++++------- .../clustering/openshift/openshift_raw.py | 41 ++++++++++++------- 3 files changed, 54 insertions(+), 33 deletions(-) diff --git a/lib/ansible/module_utils/k8s/common.py b/lib/ansible/module_utils/k8s/common.py index 16f6424902a..45f9fc947a0 100644 --- a/lib/ansible/module_utils/k8s/common.py +++ b/lib/ansible/module_utils/k8s/common.py @@ -167,9 +167,6 @@ class KubernetesAnsibleModule(AnsibleModule): 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'): k8s_obj = self._read(name, namespace) return_attributes['result'] = k8s_obj.to_dict() @@ -225,8 +222,6 @@ class KubernetesAnsibleModule(AnsibleModule): if match: return_attributes['result'] = existing.to_dict() self.exit_json(**return_attributes) - elif self._diff: - return_attributes['differences'] = diff # Differences exist between the existing obj and requested params if not self.check_mode: try: diff --git a/lib/ansible/modules/clustering/k8s/k8s_raw.py b/lib/ansible/modules/clustering/k8s/k8s_raw.py index cac3e428996..fe97c1d738d 100644 --- a/lib/ansible/modules/clustering/k8s/k8s_raw.py +++ b/lib/ansible/modules/clustering/k8s/k8s_raw.py @@ -29,7 +29,7 @@ description: files and using Jinja templates. - Access to the full range of K8s APIs. - Authenticate using either a config file, certificates, password or token. - - Supports check mode, and the diff option. + - Supports check mode. extends_documentation_fragment: - k8s_state_options @@ -124,19 +124,32 @@ result: description: - The created, patched, or otherwise present object. Will be empty in the case of a deletion. returned: success - type: dict -request: - description: - - The object sent to the API. Useful for troubleshooting unexpected differences and 404 errors. - returned: when diff is true - type: dict -diff: - description: - - List of differences found when determining if an existing object will be patched. A copy of the existing object - is updated with the requested options, and the updated object is then compared to the original. If there are - differences, they will appear here. - returned: when diff is true - type: list + type: complex + contains: + api_version: + description: The versioned schema of this representation of an object. + returned: success + type: str + kind: + description: Represents the REST resource this object represents. + returned: success + type: str + metadata: + 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 ''' from ansible.module_utils.k8s.common import KubernetesAnsibleModule diff --git a/lib/ansible/modules/clustering/openshift/openshift_raw.py b/lib/ansible/modules/clustering/openshift/openshift_raw.py index 302295e9e08..b1e086c2cce 100644 --- a/lib/ansible/modules/clustering/openshift/openshift_raw.py +++ b/lib/ansible/modules/clustering/openshift/openshift_raw.py @@ -29,7 +29,7 @@ description: files and using Jinja templates. - Access to the full range of K8s and OpenShift APIs. - Authenticate using either a config file, certificates, password or token. - - Supports check mode, and the diff option. + - Supports check mode. extends_documentation_fragment: - k8s_state_options @@ -165,19 +165,32 @@ result: description: - The created, patched, or otherwise present object. Will be empty in the case of a deletion. returned: success - type: dict -request: - description: - - The object sent to the API. Useful for troubleshooting unexpected differences and 404 errors. - returned: when diff is true - type: dict -diff: - description: - - List of differences found when determining if an existing object will be patched. A copy of the existing object - is updated with the requested options, and the updated object is then compared to the original. If there are - differences, they will appear here. - returned: when diff is true - type: list + type: complex + contains: + api_version: + description: The versioned schema of this representation of an object. + returned: success + type: str + kind: + description: Represents the REST resource this object represents. + returned: success + type: str + metadata: + 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 ''' from ansible.module_utils.k8s.common import OpenShiftAnsibleModule