Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-parallax for openSUSE:Factory 
checked in at 2022-07-28 20:58:59
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-parallax (Old)
 and      /work/SRC/openSUSE:Factory/.python-parallax.new.1533 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-parallax"

Thu Jul 28 20:58:59 2022 rev:18 rq:991499 version:1.0.6

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-parallax/python-parallax.changes  
2020-08-06 10:42:07.070119968 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-parallax.new.1533/python-parallax.changes    
    2022-07-28 20:59:26.931705108 +0200
@@ -1,0 +2,6 @@
+Thu Jul 28 01:42:06 UTC 2022 - XinLiang <xli...@suse.com>
+
+- Don't use ssh if command running on local (bsc#1200833)
+  Add patch 0003-Fix-task-Don-t-use-ssh-if-command-running-on-local-b.patch 
+
+-------------------------------------------------------------------

New:
----
  0003-Fix-task-Don-t-use-ssh-if-command-running-on-local-b.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-parallax.spec ++++++
--- /var/tmp/diff_new_pack.93qIPj/_old  2022-07-28 20:59:27.395706415 +0200
+++ /var/tmp/diff_new_pack.93qIPj/_new  2022-07-28 20:59:27.399706425 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-parallax
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -27,6 +27,7 @@
 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
 Patch2:         0002-Change-format-of-scp-command-for-ipv6-compatible.patch
+Patch3:         0003-Fix-task-Don-t-use-ssh-if-command-running-on-local-b.patch
 
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  fdupes
@@ -37,10 +38,10 @@
 BuildArch:      noarch
 %if 0%{?suse_version}
 Requires(post): update-alternatives
-Requires(postun): update-alternatives
+Requires(postun):update-alternatives
 %else
 Requires(post): %{_sbindir}/update-alternatives
-Requires(postun): %{_sbindir}/update-alternatives
+Requires(postun):%{_sbindir}/update-alternatives
 %endif
 %python_subpackages
 
@@ -53,6 +54,7 @@
 %setup -q -n parallax-%{version}
 %patch1 -p1
 %patch2 -p1
+%patch3 -p1
 
 %build
 %python_build

++++++ 0003-Fix-task-Don-t-use-ssh-if-command-running-on-local-b.patch ++++++
>From 22cd571ceb360c66279512af3690347e1d6a768d Mon Sep 17 00:00:00 2001
From: liangxin1300 <xli...@suse.com>
Date: Tue, 12 Jul 2022 10:06:06 +0800
Subject: [PATCH] Fix: task: Don't use ssh if command running on local
 (bsc#1200833)

** Problem
When a command is running on local, it will failed if local ssh service stopped
** Solution
Run this command directly, without ssh
---
 parallax/__init__.py | 22 ++++++++++++++++++++--
 parallax/task.py     |  6 ++++--
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/parallax/__init__.py b/parallax/__init__.py
index 50a2268..aa6ebd9 100644
--- a/parallax/__init__.py
+++ b/parallax/__init__.py
@@ -27,6 +27,7 @@
 
 import os
 import sys
+import socket
 
 DEFAULT_PARALLELISM = 32
 DEFAULT_TIMEOUT = 0  # "infinity" by default
@@ -176,7 +177,11 @@ 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, opts)
+        is_local = is_local_host(host)
+        if is_local:
+            cmd = [cmdline]
+        else:
+            cmd = _build_call_cmd(host, port, user, cmdline, opts)
         t = Task(host, port, user, cmd,
                  stdin=opts.input_stream,
                  verbose=opts.verbose,
@@ -184,7 +189,8 @@ def call(hosts, cmdline, opts=Options()):
                  print_out=opts.print_out,
                  inline=opts.inline,
                  inline_stdout=opts.inline_stdout,
-                 default_user=opts.default_user)
+                 default_user=opts.default_user,
+                 is_local=is_local)
         manager.add_task(t)
     try:
         return manager.run()
@@ -366,3 +372,15 @@ def slurp(hosts, src, dst, opts=Options()):
         return manager.run()
     except FatalError as err:
         raise IOError(str(err))
+
+
+def is_local_host(host):
+    """
+    Check if the host is local
+    """
+    try:
+        socket.inet_aton(host)
+        hostname = socket.gethostbyaddr(host)[0]
+    except:
+        hostname = host
+    return hostname == socket.gethostname()
diff --git a/parallax/task.py b/parallax/task.py
index 5e05f30..5307b06 100644
--- a/parallax/task.py
+++ b/parallax/task.py
@@ -39,7 +39,8 @@ class Task(object):
                  print_out=False,
                  inline=False,
                  inline_stdout=False,
-                 default_user=None):
+                 default_user=None,
+                 is_local=False):
 
         # Backwards compatibility:
         if not isinstance(verbose, bool):
@@ -66,6 +67,7 @@ class Task(object):
         self.pretty_host = host
         self.port = port
         self.cmd = cmd
+        self.is_local = is_local
 
         if user and user != default_user:
             self.pretty_host = '@'.join((user, self.pretty_host))
@@ -126,7 +128,7 @@ class Task(object):
                     close_fds=False, preexec_fn=os.setsid, env=environ)
         else:
             self.proc = Popen(self.cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE,
-                    close_fds=False, start_new_session=True, env=environ)
+                    close_fds=False, start_new_session=True, env=environ, 
shell=self.is_local)
 
         self.timestamp = time.time()
         if self.inputbuffer:
-- 
2.34.1

Reply via email to