From 763ecec1b3e051ebbd280a89906762e37fd8ee26 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Fri, 26 Jan 2018 13:49:11 -0800 Subject: [PATCH] Add boilderplate to remove a module but keep documentation. --- lib/ansible/module_utils/common/__init__.py | 0 lib/ansible/module_utils/common/removed.py | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 lib/ansible/module_utils/common/__init__.py create mode 100644 lib/ansible/module_utils/common/removed.py diff --git a/lib/ansible/module_utils/common/__init__.py b/lib/ansible/module_utils/common/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/lib/ansible/module_utils/common/removed.py b/lib/ansible/module_utils/common/removed.py new file mode 100644 index 00000000000..81921c72aa7 --- /dev/null +++ b/lib/ansible/module_utils/common/removed.py @@ -0,0 +1,20 @@ +# Copyright (c) 2018, Ansible Project +# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) + +from ansible.module_utils._text import to_text + + +def removed_module(msg=u'This module has been removed. The module documentation may contain hints for porting'): + """ + When a module is removed, we want the documentation available for a few releases to aid in + porting playbooks. So leave the documentation but remove the actual code and instead have this + boilerplate:: + + from ansible.module_utils.common.removed import removed_module + + if __name__ == '__main__': + removed_module() + """ + # We may not have an AnsibleModule when this is called + msg = to_text(msg).translate({ord(u'"'): u'\\"'}) + print('\n{{"msg": "{0}", "failed": true}}'.format(msg))