Skip to content

incompatible with regpg Ansible plugin #554

@fanf2

Description

@fanf2

I am using ansible 2.7.5 from Debian stretch-backports. Host and target are Debian stretch.

I am using the regpg gpg_d action plugin, which you can get from https://dotat.at/prog/regpg/. It's basically a clone-and-hack of Ansible's copy or template modules. Details of a minimal reproduction setup below. It works without Mitogen, but I might be mis-using the API in a way that is revealed by Mitogen...

I have tried Mitogen 0.2.5 (from the git tag) and latest Mitogen master. The error output is below; it occurs (in my code) around https://dotat.at/cgi/git/regpg.git/blob/HEAD:/ansible/action.py#l100

[pid 3135] 13:27:29.905395 D ansible_mitogen.mixins: _make_tmp_path(remote_user=None)
[pid 3135] 13:27:29.906262 D mitogen: unix.connect(path='/tmp/mitogen_unix_VpUUlK.sock')
[pid 3135] 13:27:29.907130 D mitogen: unix.connect(): local ID is 1003, remote is 0
[pid 3031] 13:27:29.907124 D mitogen: mitogen.unix.Listener('/tmp/mitogen_unix_VpUUlK.sock'): accepted mitogen.core.Stream('unix_client.3135')
[pid 3135] 13:27:29.908740 D ansible_mitogen.connection: Temporary directory: u'/home/fanf2/.ansible/tmp/ansible_mitogen_action_0cfadb91dc0a2803'
[pid 3135] 13:27:29.908866 D mitogen: CallChain(Context(2, u'local.3072')).call_no_reply(): posix.mkdir(u'/home/fanf2/.ansible/tmp/ansible_mitogen_action_0cfadb91dc0a2803')
[pid 3135] 13:27:29.909447 D ansible_mitogen.mixins: _remote_expand_user(u'/tmp/foo', sudoable=True)
[pid 3031] 13:27:29.913255 D mitogen.ctx.local.3072: mitogen: _dispatch_one(('grey.csi.cam.ac.uk-3135-7f21bd444700-582e022b1afe0', u'posix', None, u'mkdir', (u'/home/fanf2/.ansible/tmp/ansible_mitogen_action_0cfadb91dc0a2803',), Kwargs({})))
[pid 3031] 13:27:29.913637 D mitogen.ctx.local.3072: mitogen: _dispatch_calls: Message(2, 1003, 0, 101, 0, '\x80\x02(U2grey.csi.cam.ac.uk-3135-7f21bd444700-582e022b'..184) -> None
[pid 3135] 13:27:30.046436 D ansible_mitogen.mixins: _make_tmp_path(remote_user=u'fanf2')
[pid 3135] 13:27:30.047673 D mitogen: CallChain(Context(2, u'local.3072')).call_no_reply(): ansible_mitogen.target.prune_tree(u'/home/fanf2/.ansible/tmp/ansible_mitogen_action_0cfadb91dc0a2803')
[pid 3135] 13:27:30.048189 D mitogen: CallChain(Context(2, u'local.3072')).call_no_reply(): mitogen.core.Dispatcher.forget_chain('grey.csi.cam.ac.uk-3135-7f21bd444700-582e022b1afe0')
[pid 3031] 13:27:30.049134 D ansible_mitogen.services: ContextService().put(Context(2, u'local.3072'))
[pid 3031] 13:27:30.049511 D mitogen.ctx.local.3072: mitogen: _dispatch_one((None, u'ansible_mitogen.target', None, u'prune_tree', (u'/home/fanf2/.ansible/tmp/ansible_mitogen_action_0cfadb91dc0a2803',), Kwargs({})))
[pid 3031] 13:27:30.049903 D mitogen.ctx.local.3072: mitogen: _dispatch_calls: Message(2, 1003, 0, 101, 0, '\x80\x02(NX\x16\x00\x00\x00ansible_mitogen.targetNX\n\x00\x00\x00prune_treeX@\x00'..153) -> None
[pid 3031] 13:27:30.050023 D mitogen.ctx.local.3072: mitogen: _dispatch_one((None, u'mitogen.core', u'Dispatcher', u'forget_chain', ('grey.csi.cam.ac.uk-3135-7f21bd444700-582e022b1afe0',), Kwargs({})))
[pid 3031] 13:27:30.050123 D mitogen.ctx.local.3072: mitogen: _dispatch_calls: Message(2, 1003, 0, 101, 0, '\x80\x02(NX\x0c\x00\x00\x00mitogen.coreX\n\x00\x00\x00Dispatcherq\x01X\x0c\x00\x00\x00forget_'..144) -> None
[pid 3135] 13:27:30.049887 D mitogen: mitogen.core.Stream('unix_listener.3031').on_disconnect()
[pid 3031] 13:27:30.050276 D mitogen: mitogen.core.Stream('unix_client.3135').on_disconnect()
[pid 3135] 13:27:30.050302 D mitogen: Waker(Broker(0x7f21b5ca3cd0) rfd=10, wfd=12).on_disconnect()
[pid 3135] 13:27:30.050618 D mitogen: Router(Broker(0x7f21b5ca3cd0)): stats: 0 module requests in 0 ms, 0 sent (0 ms minify time), 0 negative responses. Sent 0.0 kb total, 0.0 kb avg.
The full traceback is:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/ansible/executor/task_executor.py", line 140, in run
    res = self._execute()
  File "/usr/lib/python2.7/dist-packages/ansible/executor/task_executor.py", line 612, in _execute
    result = self._handler.run(task_vars=variables)
  File "/home/fanf2/gnu/src/mitogen/ansible_mitogen/mixins.py", line 115, in run
    return super(ActionModuleMixin, self).run(tmp, task_vars)
  File "/home/fanf2/work/git/t/testing/plugins/action/gpg_d.py", line 107, in run
    tmp = self._make_tmp_path(remote_user)
  File "/home/fanf2/gnu/src/mitogen/ansible_mitogen/mixins.py", line 182, in _make_tmp_path
    return self._connection._make_tmp_path()
  File "/home/fanf2/gnu/src/mitogen/ansible_mitogen/connection.py", line 715, in _make_tmp_path
    assert getattr(self._shell, 'tmpdir', None) is None
AssertionError

I ran regpg init ansible; echo foo | regpg encrypt foo.asc to install the Ansible plugins, set up the regpg keyring, and make a file to be decrypted. I added the Mitogen lines to ansible.cfg. No other setup except for the playbook, which is:

---
- hosts: localhost
  tasks:
    - gpg_d:
         src: foo.asc
         dest: /tmp/foo

ansible-config dump --only-changed:

DEFAULT_ACTION_PLUGIN_PATH(/home/fanf2/work/git/t/testing/ansible.cfg) = [u'/home/fanf2/work/git/t/testing/plugins/action', u'/home/fanf2/work/git/t/testing/plugins/action']
DEFAULT_FILTER_PLUGIN_PATH(/home/fanf2/work/git/t/testing/ansible.cfg) = [u'/home/fanf2/work/git/t/testing/plugins/filter', u'/home/fanf2/work/git/t/testing/plugins/filter']
DEFAULT_STRATEGY(/home/fanf2/work/git/t/testing/ansible.cfg) = mitogen_linear
DEFAULT_STRATEGY_PLUGIN_PATH(/home/fanf2/work/git/t/testing/ansible.cfg) = [u'/home/fanf2/gnu/src/mitogen/ansible_mitogen/plugins/strategy']

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions