|
|
@ -58,6 +58,10 @@ def _connect_local(spec):
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def wrap_or_none(klass, value):
|
|
|
|
|
|
|
|
if value is not None:
|
|
|
|
|
|
|
|
return klass(value)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _connect_ssh(spec):
|
|
|
|
def _connect_ssh(spec):
|
|
|
|
if C.HOST_KEY_CHECKING:
|
|
|
|
if C.HOST_KEY_CHECKING:
|
|
|
@ -71,7 +75,7 @@ def _connect_ssh(spec):
|
|
|
|
'check_host_keys': check_host_keys,
|
|
|
|
'check_host_keys': check_host_keys,
|
|
|
|
'hostname': spec['remote_addr'],
|
|
|
|
'hostname': spec['remote_addr'],
|
|
|
|
'username': spec['remote_user'],
|
|
|
|
'username': spec['remote_user'],
|
|
|
|
'password': spec['password'],
|
|
|
|
'password': wrap_or_none(mitogen.core.Secret, spec['password']),
|
|
|
|
'port': spec['port'],
|
|
|
|
'port': spec['port'],
|
|
|
|
'python_path': spec['python_path'],
|
|
|
|
'python_path': spec['python_path'],
|
|
|
|
'identity_file': spec['private_key_file'],
|
|
|
|
'identity_file': spec['private_key_file'],
|
|
|
@ -142,7 +146,7 @@ def _connect_su(spec):
|
|
|
|
'enable_lru': True,
|
|
|
|
'enable_lru': True,
|
|
|
|
'kwargs': {
|
|
|
|
'kwargs': {
|
|
|
|
'username': spec['become_user'],
|
|
|
|
'username': spec['become_user'],
|
|
|
|
'password': spec['become_pass'],
|
|
|
|
'password': wrap_or_none(mitogen.core.Secret, spec['become_pass']),
|
|
|
|
'python_path': spec['python_path'],
|
|
|
|
'python_path': spec['python_path'],
|
|
|
|
'su_path': spec['become_exe'],
|
|
|
|
'su_path': spec['become_exe'],
|
|
|
|
'connect_timeout': spec['timeout'],
|
|
|
|
'connect_timeout': spec['timeout'],
|
|
|
@ -156,7 +160,7 @@ def _connect_sudo(spec):
|
|
|
|
'enable_lru': True,
|
|
|
|
'enable_lru': True,
|
|
|
|
'kwargs': {
|
|
|
|
'kwargs': {
|
|
|
|
'username': spec['become_user'],
|
|
|
|
'username': spec['become_user'],
|
|
|
|
'password': spec['become_pass'],
|
|
|
|
'password': wrap_or_none(mitogen.core.Secret, spec['become_pass']),
|
|
|
|
'python_path': spec['python_path'],
|
|
|
|
'python_path': spec['python_path'],
|
|
|
|
'sudo_path': spec['become_exe'],
|
|
|
|
'sudo_path': spec['become_exe'],
|
|
|
|
'connect_timeout': spec['timeout'],
|
|
|
|
'connect_timeout': spec['timeout'],
|
|
|
@ -171,7 +175,7 @@ def _connect_mitogen_su(spec):
|
|
|
|
'method': 'su',
|
|
|
|
'method': 'su',
|
|
|
|
'kwargs': {
|
|
|
|
'kwargs': {
|
|
|
|
'username': spec['remote_user'],
|
|
|
|
'username': spec['remote_user'],
|
|
|
|
'password': spec['password'],
|
|
|
|
'password': wrap_or_none(mitogen.core.Secret, spec['password']),
|
|
|
|
'python_path': spec['python_path'],
|
|
|
|
'python_path': spec['python_path'],
|
|
|
|
'su_path': spec['become_exe'],
|
|
|
|
'su_path': spec['become_exe'],
|
|
|
|
'connect_timeout': spec['timeout'],
|
|
|
|
'connect_timeout': spec['timeout'],
|
|
|
@ -185,7 +189,7 @@ def _connect_mitogen_sudo(spec):
|
|
|
|
'method': 'sudo',
|
|
|
|
'method': 'sudo',
|
|
|
|
'kwargs': {
|
|
|
|
'kwargs': {
|
|
|
|
'username': spec['remote_user'],
|
|
|
|
'username': spec['remote_user'],
|
|
|
|
'password': spec['password'],
|
|
|
|
'password': wrap_or_none(mitogen.core.Secret, spec['password']),
|
|
|
|
'python_path': spec['python_path'],
|
|
|
|
'python_path': spec['python_path'],
|
|
|
|
'sudo_path': spec['become_exe'],
|
|
|
|
'sudo_path': spec['become_exe'],
|
|
|
|
'connect_timeout': spec['timeout'],
|
|
|
|
'connect_timeout': spec['timeout'],
|
|
|
@ -581,7 +585,7 @@ class Connection(ansible.plugins.connection.ConnectionBase):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
self.call(ansible_mitogen.target.write_path,
|
|
|
|
self.call(ansible_mitogen.target.write_path,
|
|
|
|
mitogen.utils.cast(out_path),
|
|
|
|
mitogen.utils.cast(out_path),
|
|
|
|
mitogen.utils.cast(data),
|
|
|
|
mitogen.core.Blob(data),
|
|
|
|
mode=mode,
|
|
|
|
mode=mode,
|
|
|
|
utimes=utimes)
|
|
|
|
utimes=utimes)
|
|
|
|
|
|
|
|
|
|
|
|