You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mitogen/tests/ansible/lib/modules/custom_python_leaky_class_v...

26 lines
532 B
Python

#!/usr/bin/env python
# I am an Ansible new-style Python module. I leak state from each invocation
# into a class variable and a global variable.
from ansible.module_utils.basic import AnsibleModule
leak1 = []
class MyClass:
leak2 = []
def main():
module = AnsibleModule(argument_spec={'name': {'type': 'str'}})
leak1.append(module.params['name'])
MyClass.leak2.append(module.params['name'])
module.exit_json(
leak1=leak1,
leak2=MyClass.leak2,
)
if __name__ == '__main__':
main()