forked from mitogen-hq/mitogen
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ansible_mitogen: Fix errant ModuleNotFoundError blacklist exceptions
Current module whitelist/blacklist behaviour is to reject any module not on the whitelist if the whitelist is populated. Adding `ansible` and `ansible_mitogen` to the whitelist effectively blocklisted every other Python module/package, negating much of the benefit of Mitogen. Fixes mitogen-hq#1011
- Loading branch information
Showing
7 changed files
with
66 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- import_playbook: imports.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
- name: integration/responder/imports.yml | ||
hosts: test-targets | ||
tasks: | ||
- meta: end_play | ||
when: not is_mitogen | ||
|
||
- name: Import pure Python module via Ansible module | ||
mitogen_plain_old_add: | ||
x: 2 | ||
y: 2 | ||
register: mitogen_plain_old_add_result | ||
|
||
- name: Import binary module via Responder | ||
custom_python_run_script: | ||
script: | | ||
import lxml | ||
register: binary_module_result | ||
|
||
- name: Import missing module via Responder | ||
custom_python_run_script: | ||
script: | | ||
import does_not_exist | ||
register: missing_module_result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env python | ||
|
||
DOCUMENTATION = ''' | ||
module: mitogen_plain_old_add | ||
options: | ||
x: {type: int, required: true} | ||
y: {type: int, required: true} | ||
author: | ||
- Alex Willmer (@moreati) | ||
''' | ||
|
||
RETURN = ''' | ||
total: {type: int, returned: always, sample: 42} | ||
''' | ||
|
||
from ansible.module_utils.basic import AnsibleModule | ||
|
||
import plain_old_module | ||
|
||
def main(): | ||
module = AnsibleModule( | ||
argument_spec={ | ||
'x': {'type': int, 'required': True}, | ||
'x': {'type': int, 'required': True}, | ||
}, | ||
supports_check_mode=True, | ||
) | ||
result = { | ||
'changed': False, | ||
'total': plain_old_module.add(module.params['x'], module.params['y']), | ||
} | ||
module.exit_json(**result) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters