15
0

Accepting request 807100 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/807100
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-parallax?expand=0&rev=16
This commit is contained in:
2020-05-19 12:49:48 +00:00
committed by Git OBS Bridge
3 changed files with 89 additions and 0 deletions

View File

@@ -0,0 +1,80 @@
From f5ccee901d346873adbe5d979b5b70d0ba029570 Mon Sep 17 00:00:00 2001
From: liangxin1300 <XLiang@suse.com>
Date: Fri, 24 Apr 2020 07:05:13 +0800
Subject: [PATCH] Add ssh_key option used by -i option of ssh/scp
---
parallax/__init__.py | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/parallax/__init__.py b/parallax/__init__.py
index fc1a6e7..1008ca2 100644
--- a/parallax/__init__.py
+++ b/parallax/__init__.py
@@ -87,6 +87,7 @@ class Options(object):
askpass = False # Ask for a password
outdir = None # Write stdout to a file per host in this directory
errdir = None # Write stderr to a file per host in this directory
+ ssh_key = None # Specific ssh key used by ssh/scp -i option
ssh_options = [] # Extra options to pass to SSH
ssh_extra = [] # Extra arguments to pass to SSH
verbose = False # Warning and diagnostic messages
@@ -138,19 +139,21 @@ class _CallOutputBuilder(object):
return ret
-def _build_call_cmd(host, port, user, cmdline, options, extra):
+def _build_call_cmd(host, port, user, cmdline, opts):
cmd = ['ssh', host,
'-o', 'NumberOfPasswordPrompts=1',
'-o', 'SendEnv=PARALLAX_NODENUM PARALLAX_HOST']
- if options:
- for opt in options:
+ if opts.ssh_options:
+ for opt in opts.ssh_options:
cmd += ['-o', opt]
if user:
cmd += ['-l', user]
if port:
cmd += ['-p', port]
- if extra:
- cmd.extend(extra)
+ if opts.ssh_key:
+ cmd += ['-i', opts.ssh_key]
+ if opts.ssh_extra:
+ cmd.extend(opts.ssh_extra)
if cmdline:
cmd.append(cmdline)
return cmd
@@ -173,9 +176,7 @@ def call(hosts, cmdline, opts=Options()):
warn_message=opts.warn_message,
callbacks=_CallOutputBuilder())
for host, port, user in _expand_host_port_user(hosts):
- cmd = _build_call_cmd(host, port, user, cmdline,
- options=opts.ssh_options,
- extra=opts.ssh_extra)
+ cmd = _build_call_cmd(host, port, user, cmdline, opts)
t = Task(host, port, user, cmd,
stdin=opts.input_stream,
verbose=opts.verbose,
@@ -219,6 +220,8 @@ def _build_copy_cmd(host, port, user, src, dst, opts):
cmd += ['-P', port]
if opts.recursive:
cmd.append('-r')
+ if opts.ssh_key:
+ cmd += ['-i', opts.ssh_key]
if opts.ssh_extra:
cmd.extend(opts.ssh_extra)
cmd.append(src)
@@ -312,6 +315,8 @@ def _build_slurp_cmd(host, port, user, src, dst, opts):
cmd += ['-P', port]
if opts.recursive:
cmd.append('-r')
+ if opts.ssh_key:
+ cmd += ['-i', opts.ssh_key]
if opts.ssh_extra:
cmd.extend(opts.ssh_extra)
if user:
--
2.21.1

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue May 19 02:32:03 UTC 2020 - XinLiang <XLiang@suse.com>
- Add ssh_key option used by -i option of ssh and scp(bsc#1169581)
Add patch 0001-Add-ssh_key-option-used-by-i-option-of-ssh-scp.patch
-------------------------------------------------------------------
Wed Apr 1 08:54:34 UTC 2020 - Kristoffer Gronlund <kgronlund@suse.com>

View File

@@ -25,6 +25,8 @@ License: BSD-3-Clause
Group: Development/Languages/Python
URL: https://github.com/krig/parallax/
Source: https://files.pythonhosted.org/packages/source/p/parallax/parallax-%{version}.tar.gz
Patch1: 0001-Add-ssh_key-option-used-by-i-option-of-ssh-scp.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
@@ -48,6 +50,7 @@ multiple nodes using SCP.
%prep
%setup -q -n parallax-%{version}
%patch1 -p1
%build
%python_build