andreasscherbaum / ansible-lxc-ssh

Ansible connection plugin using ssh + lxc-attach
45 stars 22 forks source link

Incompatible with ansible 2.4.0.0? #6

Closed perburn closed 6 years ago

perburn commented 7 years ago

This plugin works great for me in ansible 2.2.1.0 (Debian stretch).

After upgrading to ansible 2.4.0.0 (still python 2.7.14) I can't get it to work anymore:

1) Import from ansible.compat.six fails " ImportError: No module named six fatal"

2) Type Error Since ansible.compat.six seems to be not available anymore I tried to change it to the regular "six" package by doing "from six import text_type, binary_type". The import works but later execution of the plugin fails with " line 184, in _build_command to_bytes(C.ANSIBLE_SSH_CONTROL_PATH % dict(directory=cpdir)))

TypeError: unsupported operand type(s) for %: 'NoneType' and 'dict' "

Any pointers to get the plugin working again?

andreasscherbaum commented 7 years ago

Unfortunately I have no installation with Ansible 2.4 here (still on 2.2), and can't debug this right now. If you can come up with a workaround or patch, please send a PR.

lgeorget commented 7 years ago

Can you give a try to https://github.com/lgeorget/ansible-lxc-ssh? (See also https://github.com/andreasscherbaum/ansible-lxc-ssh/pull/7)

andreasscherbaum commented 6 years ago

@lgeorget I updated the module, and added support for Ansible 2.3 (which I currently have installed - Ubuntu 17.10) and hopefully Ansible 2.4. The patch is in https://github.com/andreasscherbaum/ansible-lxc-ssh/commit/07bb5c98181568bed915f28ca310bad2c199c011

I used your PR #7, but added conditions to make it work with Ansible < 2.3 as well (untested).

Also there is a single import which does not work on 2.3:

from ansible.module_utils.parsing.convert_bool import BOOLEANS, boolean

I added a condition for 2.4, but don't know if the import is just wrong, or the module is only available in 2.4. Also it works just fine in 2.3 without the import.

lgeorget commented 6 years ago

I don't know, maybe it's some python2.7/python3 make-it-work-in-all-cases import? In any case, I've imported it from the ansible-2.4 ssh module.

andreasscherbaum commented 6 years ago

Ok, as I mentioned it is conditionally imported on 2.4. Eventually I will come around and test it as well, but would be nice if you can see if the plugin in the current form works for you.

Would like to close the Issue.

Thanks, Andreas

lgeorget commented 6 years ago

Ansible modules "shell", "fetch", and "copy" works perfectly as well as my "apt update" playbook, with your plugin.

Thank you very much 👍

andreasscherbaum commented 6 years ago

Thanks for the verification.