diff options
Diffstat (limited to '')
3 files changed, 73 insertions, 0 deletions
diff --git a/test/integration/targets/ansiballz_python/library/check_rlimit_and_maxfd.py b/test/integration/targets/ansiballz_python/library/check_rlimit_and_maxfd.py new file mode 100644 index 0000000..a01ee99 --- /dev/null +++ b/test/integration/targets/ansiballz_python/library/check_rlimit_and_maxfd.py @@ -0,0 +1,31 @@ +#!/usr/bin/python +# +# Copyright 2018 Red Hat | Ansible +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +import resource +import subprocess + +from ansible.module_utils.basic import AnsibleModule + + +def main(): + module = AnsibleModule( + argument_spec=dict() + ) + + rlimit_nofile = resource.getrlimit(resource.RLIMIT_NOFILE) + + try: + maxfd = subprocess.MAXFD + except AttributeError: + maxfd = -1 + + module.exit_json(rlimit_nofile=rlimit_nofile, maxfd=maxfd, infinity=resource.RLIM_INFINITY) + + +if __name__ == '__main__': + main() diff --git a/test/integration/targets/ansiballz_python/library/custom_module.py b/test/integration/targets/ansiballz_python/library/custom_module.py new file mode 100644 index 0000000..625823e --- /dev/null +++ b/test/integration/targets/ansiballz_python/library/custom_module.py @@ -0,0 +1,19 @@ +#!/usr/bin/python + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +from ..module_utils.basic import AnsibleModule # pylint: disable=relative-beyond-top-level +from ..module_utils.custom_util import forty_two # pylint: disable=relative-beyond-top-level + + +def main(): + module = AnsibleModule( + argument_spec=dict() + ) + + module.exit_json(answer=forty_two()) + + +if __name__ == '__main__': + main() diff --git a/test/integration/targets/ansiballz_python/library/sys_check.py b/test/integration/targets/ansiballz_python/library/sys_check.py new file mode 100644 index 0000000..aa22fe6 --- /dev/null +++ b/test/integration/targets/ansiballz_python/library/sys_check.py @@ -0,0 +1,23 @@ +#!/usr/bin/python +# https://github.com/ansible/ansible/issues/64664 +# https://github.com/ansible/ansible/issues/64479 + +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + +import sys + +from ansible.module_utils.basic import AnsibleModule + + +def main(): + module = AnsibleModule({}) + + this_module = sys.modules[__name__] + module.exit_json( + failed=not getattr(this_module, 'AnsibleModule', False) + ) + + +if __name__ == '__main__': + main() |