Hello community,

here is the log from the commit of package crmsh for openSUSE:Factory checked 
in at 2020-07-17 20:49:22
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/crmsh (Old)
 and      /work/SRC/openSUSE:Factory/.crmsh.new.3592 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "crmsh"

Fri Jul 17 20:49:22 2020 rev:187 rq:821329 version:4.2.0+git.1594286044.7a596d12

Changes:
--------
--- /work/SRC/openSUSE:Factory/crmsh/crmsh.changes      2020-07-08 
19:18:55.556167918 +0200
+++ /work/SRC/openSUSE:Factory/.crmsh.new.3592/crmsh.changes    2020-07-17 
20:50:10.372877903 +0200
@@ -1,0 +2,6 @@
+Thu Jul 09 09:33:15 UTC 2020 - xli...@suse.com
+
+- Update to version 4.2.0+git.1594286044.7a596d12:
+  * Low: hb_report: Fix collecting of binary data (bsc#1166962)
+
+-------------------------------------------------------------------

Old:
----
  crmsh-4.2.0+git.1594199184.309141ea.tar.bz2

New:
----
  crmsh-4.2.0+git.1594286044.7a596d12.tar.bz2

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

Other differences:
------------------
++++++ crmsh.spec ++++++
--- /var/tmp/diff_new_pack.zxDmwS/_old  2020-07-17 20:50:11.632879217 +0200
+++ /var/tmp/diff_new_pack.zxDmwS/_new  2020-07-17 20:50:11.632879217 +0200
@@ -36,7 +36,7 @@
 Summary:        High Availability cluster command-line interface
 License:        GPL-2.0-or-later
 Group:          %{pkg_group}
-Version:        4.2.0+git.1594199184.309141ea
+Version:        4.2.0+git.1594286044.7a596d12
 Release:        0
 Url:            http://crmsh.github.io
 Source0:        %{name}-%{version}.tar.bz2

++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.zxDmwS/_old  2020-07-17 20:50:11.680879267 +0200
+++ /var/tmp/diff_new_pack.zxDmwS/_new  2020-07-17 20:50:11.684879272 +0200
@@ -5,4 +5,4 @@
                 <param 
name="url">https://github.com/liangxin1300/crmsh.git</param>
               <param 
name="changesrevision">d8dc51b4cb34964aa72e918999ebc7f03b48f3c9</param></service><service
 name="tar_scm">
                 <param 
name="url">https://github.com/ClusterLabs/crmsh.git</param>
-              <param 
name="changesrevision">7a1d008b1ffef8f266afc845f361f5e47e367e40</param></service></servicedata>
\ No newline at end of file
+              <param 
name="changesrevision">78ce77e47b195fc2ef4a21d5d83886b178bbc0e1</param></service></servicedata>
\ No newline at end of file

++++++ crmsh-4.2.0+git.1594199184.309141ea.tar.bz2 -> 
crmsh-4.2.0+git.1594286044.7a596d12.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/crmsh-4.2.0+git.1594199184.309141ea/crmsh/utils.py 
new/crmsh-4.2.0+git.1594286044.7a596d12/crmsh/utils.py
--- old/crmsh-4.2.0+git.1594199184.309141ea/crmsh/utils.py      2020-07-08 
11:06:24.000000000 +0200
+++ new/crmsh-4.2.0+git.1594286044.7a596d12/crmsh/utils.py      2020-07-09 
11:14:04.000000000 +0200
@@ -725,7 +725,7 @@
     return rc
 
 
-def get_stdout(cmd, input_s=None, stderr_on=True, shell=True):
+def get_stdout(cmd, input_s=None, stderr_on=True, shell=True, raw=False):
     '''
     Run a cmd, return stdout output.
     Optional input string "input_s".
@@ -743,10 +743,12 @@
                             stdout=subprocess.PIPE,
                             stderr=stderr)
     stdout_data, stderr_data = proc.communicate(input_s)
+    if raw:
+        return proc.returncode, stdout_data
     return proc.returncode, to_ascii(stdout_data).strip()
 
 
-def get_stdout_stderr(cmd, input_s=None, shell=True):
+def get_stdout_stderr(cmd, input_s=None, shell=True, raw=False):
     '''
     Run a cmd, return (rc, stdout, stderr)
     '''
@@ -758,6 +760,8 @@
                             stdout=subprocess.PIPE,
                             stderr=subprocess.PIPE)
     stdout_data, stderr_data = proc.communicate(input_s)
+    if raw:
+        return proc.returncode, stdout_data, stderr_data
     return proc.returncode, to_ascii(stdout_data).strip(), 
to_ascii(stderr_data).strip()
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/crmsh-4.2.0+git.1594199184.309141ea/hb_report/constants.py 
new/crmsh-4.2.0+git.1594286044.7a596d12/hb_report/constants.py
--- old/crmsh-4.2.0+git.1594199184.309141ea/hb_report/constants.py      
2020-07-08 11:06:24.000000000 +0200
+++ new/crmsh-4.2.0+git.1594286044.7a596d12/hb_report/constants.py      
2020-07-09 11:14:04.000000000 +0200
@@ -8,6 +8,7 @@
 B_CONF = None
 CIB_DIR = None
 COMPRESS = config.report.compress
+COMPRESS_DATA_FLAG = "COMPRESS HB_REPORT DATA:::"
 COMPRESS_PROG = ""
 COMPRESS_EXT = ""
 CORES_DIRS = None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/crmsh-4.2.0+git.1594199184.309141ea/hb_report/hb_report.in 
new/crmsh-4.2.0+git.1594286044.7a596d12/hb_report/hb_report.in
--- old/crmsh-4.2.0+git.1594199184.309141ea/hb_report/hb_report.in      
2020-07-08 11:06:24.000000000 +0200
+++ new/crmsh-4.2.0+git.1594286044.7a596d12/hb_report/hb_report.in      
2020-07-09 11:14:04.000000000 +0200
@@ -280,13 +280,10 @@
     #     problem description template, and prints final notes
     #
     if is_collector():
-        import io
-        sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
-
         utillib.collect_info()
         cmd = r"cd %s/.. && tar -h -cf - %s" % (constants.WORKDIR, 
constants.WE)
-        code, out, err = crmutils.get_stdout_stderr(cmd)
-        print(out)
+        code, out, err = crmutils.get_stdout_stderr(cmd, raw=True)
+        print("{}{}".format(constants.COMPRESS_DATA_FLAG, out))
     else:
         p_list = []
         p_list.append(multiprocessing.Process(target=utillib.analyze))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/crmsh-4.2.0+git.1594199184.309141ea/hb_report/utillib.py 
new/crmsh-4.2.0+git.1594286044.7a596d12/hb_report/utillib.py
--- old/crmsh-4.2.0+git.1594199184.309141ea/hb_report/utillib.py        
2020-07-08 11:06:24.000000000 +0200
+++ new/crmsh-4.2.0+git.1594286044.7a596d12/hb_report/utillib.py        
2020-07-09 11:14:04.000000000 +0200
@@ -1548,14 +1548,17 @@
                     log_warning(err)
                 break
 
+    compress_data = ""
+    for data in out.split('\n'):
+        if data.startswith(constants.COMPRESS_DATA_FLAG):
+            # hb_report data from collector
+            compress_data = data.lstrip(constants.COMPRESS_DATA_FLAG)
+        else:
+            # log data from collector
+            print(data)
+
     cmd = r"(cd {} && tar xf -)".format(constants.WORKDIR)
-    # typeof out here will always "str"
-    # input_s of get_stdout will always need bytes
-    # different situation depend on whether found pe file
-    if out.startswith("b'"):
-        crmutils.get_stdout(cmd, input_s=eval(out))
-    else:
-        crmutils.get_stdout(cmd, input_s=out.encode('utf-8'))
+    crmutils.get_stdout(cmd, input_s=eval(compress_data))
 
 
 def str_to_bool(v):


Reply via email to