Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ansible 2.12 and + compat + become fix #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions sshjail.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,17 @@
vars:
- name: ansible_ssh_use_tty
version_added: '2.7'
pkcs11_provider:
version_added: '2.12'
default: ''
description:
- PKCS11 SmartCard provider such as opensc, example: /usr/local/lib/opensc-pkcs11.so
- Requires sshpass version 1.06+, sshpass must support the -P option.
env: [{name: ANSIBLE_PKCS11_PROVIDER}]
ini:
- {key: pkcs11_provider, section: ssh_connection}
vars:
- name: ansible_ssh_pkcs11_provider
timeout:
default: 10
description:
Expand Down Expand Up @@ -442,9 +453,11 @@ def _normalize_path(self, path, prefix):
return os.path.join(prefix, normpath[1:])

def _copy_file(self, from_file, to_file, executable='/bin/sh'):
plugin = self.become
shell = get_shell_plugin(executable=executable)
copycmd = plugin.build_become_command(' '.join(['cp', from_file, to_file]), shell)
copycmd = ' '.join(['cp', from_file, to_file])
if self._play_context.become:
plugin = self.become
shell = get_shell_plugin(executable=executable)
copycmd = plugin.build_become_command(copycmd, shell)

display.vvv(u"REMOTE COPY {0} TO {1}".format(from_file, to_file), host=self.inventory_hostname)
code, stdout, stderr = self._jailhost_command(copycmd)
Expand Down