From a87a239124c31d1e2b48581a982d9fe7b0093669 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Sun, 18 Sep 2016 14:25:56 -0400 Subject: [PATCH] draft of return common fields (cherry picked from commit da2da568a051d51edd8c25a4d324089f8bd616eb) --- .../module_docs_fragments/return_common.py | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 lib/ansible/utils/module_docs_fragments/return_common.py diff --git a/lib/ansible/utils/module_docs_fragments/return_common.py b/lib/ansible/utils/module_docs_fragments/return_common.py new file mode 100644 index 00000000000..bccc876adf5 --- /dev/null +++ b/lib/ansible/utils/module_docs_fragments/return_common.py @@ -0,0 +1,53 @@ +# Copyright (c) 2016 Ansible, Inc +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . + + +class ModuleDocFragment(object): + + # Standard documentation fragment + RETURN= ''' +changed: + description: whether the module affected changes on the target + returned: always + type: bool + sample: False +failed: + description: whether the module failed to execute + returned: always + type: bool + sample: True +msg: + description: human-readable message + returned: as needed + type: string + sample: "all ok" +skipped: + description: whether the module was skipped + returned: always + type: bool + sample: False +results: + description: list of module results, + returned: when using a loop + type: list + sample:[ {changed: True, msg: 'first item changed'}, {changed: False, msg: 'second item ok'}] +exception: + description: optional information from a handled error + returned: on some errors + type: string + sample: 'Unknown error' +'''