Hello community, here is the log from the commit of package cmpi-provider-register for openSUSE:Factory checked in at 2018-01-17 21:57:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/cmpi-provider-register (Old) and /work/SRC/openSUSE:Factory/.cmpi-provider-register.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "cmpi-provider-register" Wed Jan 17 21:57:56 2018 rev:19 rq:566406 version:1.1.0 Changes: -------- --- /work/SRC/openSUSE:Factory/cmpi-provider-register/cmpi-provider-register.changes 2017-07-11 08:27:43.879486791 +0200 +++ /work/SRC/openSUSE:Factory/.cmpi-provider-register.new/cmpi-provider-register.changes 2018-01-17 21:59:09.324839790 +0100 @@ -1,0 +2,12 @@ +Mon Jan 15 16:29:37 UTC 2018 - adam.ma...@suse.de + +- Fix upgrade paths from SLE11 (bnc#1072564) + + Adapt cmpi-provider-register to continue to function and + maintain sblim-sfcb's providers irrespective if sblim-sfcb is + present or not. This prevents dangling symlinks and subsequent + failures in registration/deregistration RPM scriptlets. + + Adapt sfcb_init_script to function with all supported + codestreams. +- Adapt to python3 + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ cmpi-provider-register.spec ++++++ --- /var/tmp/diff_new_pack.4JuFoO/_old 2018-01-17 21:59:09.980809043 +0100 +++ /var/tmp/diff_new_pack.4JuFoO/_new 2018-01-17 21:59:09.984808856 +0100 @@ -1,7 +1,7 @@ # # spec file for package cmpi-provider-register # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,9 +17,8 @@ Name: cmpi-provider-register -Version: 1.0.1 +Version: 1.1.0 Release: 0 -BuildRoot: %{_tmppath}/%{name}-%{version}-build Summary: CIMOM neutral provider registration utility License: BSD-3-Clause Group: System/Management @@ -28,7 +27,8 @@ BuildRequires: cim-schema BuildRequires: python-pywbem BuildArch: noarch -Source0: %{name}.py +Source0: cmpi-provider-register.py +BuildRoot: %{_tmppath}/%{name}-%{version}-build %description A utility allowing CMPI provider packages to register with whatever @@ -40,10 +40,10 @@ %install %{__mkdir} -p $RPM_BUILD_ROOT/usr/sbin -install -m 755 %{S:0} $RPM_BUILD_ROOT/usr/sbin/%{name} +install -m 755 %{S:0} $RPM_BUILD_ROOT/usr/sbin/cmpi-provider-register %files %defattr(-,root,root) -/usr/sbin/* +/usr/sbin/cmpi-provider-register %changelog ++++++ cmpi-provider-register.py ++++++ --- /var/tmp/diff_new_pack.4JuFoO/_old 2018-01-17 21:59:10.020807169 +0100 +++ /var/tmp/diff_new_pack.4JuFoO/_new 2018-01-17 21:59:10.024806982 +0100 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python #******************************************************************************* # Copyright (C) 2008 Novell, Inc. All rights reserved. # @@ -39,7 +39,16 @@ from getpass import getpass import pywbem -sfcb_init_script = '/usr/sbin/rcsblim-sfcb' +sfcb_init_script = None + +for filename in ['rcsblim-sfcb', 'rcsfcb']: + try: + os.lstat('/usr/sbin/' + filename) + sfcb_init_script = '/usr/sbin/' + filename + break + except OSError: + # doesn't exist, continue to next filename + pass pegasus_init_script = '/etc/init.d/tog-pegasus' pegasus_cimserver_exe = '/usr/sbin/cimserver' @@ -103,10 +112,10 @@ return self.rval self.rval.append((ns, filename)) - + def process_sfcb(mof, stage, remove=False): - mofcomp = SimpleCompiler() + mofcomp = SimpleCompiler() files = [] files = mofcomp.compile_file(mof, None) for file_ in files: @@ -119,7 +128,7 @@ if remove: try: os.unlink(dest) - except OSError, e: + except OSError as e: if e.errno != errno.ENOENT: raise else: @@ -128,17 +137,17 @@ os.unlink(dest) try: os.symlink(src, dest) - except OSError, e: + except OSError as e: if e.errno != errno.EEXIST: raise if os.readlink(dest) != src: - print 'Warning: %s already exists' % dest + print('Warning: %s already exists' % dest) for src in sfcb_regs: dest = stage + '/regs/' + os.path.basename(src) if remove: try: os.unlink(dest) - except OSError, e: + except OSError as e: if e.errno != errno.ENOENT: raise else: @@ -147,11 +156,11 @@ os.unlink(dest) try: os.symlink(src, dest) - except OSError, e: + except OSError as e: if e.errno != errno.EEXIST: raise if os.readlink(dest) != src: - print 'Warning: %s already exists' % dest + print('Warning: %s already exists' % dest) if g_restart: @@ -161,6 +170,10 @@ run([sfcb_init_script, 'stop']) try: run_check(['sfcbrepos','-f']) + except OSError as e: + if e.errno != errno.EEXIST: + raise + print("Warning: `sfcbrepos` doesn't exist. Ignoring.") finally: if sfcb_running: run([sfcb_init_script, 'start']) @@ -181,9 +194,13 @@ err = Error("Error running '%s', returned %s" %(command, rc)) err.last_output = output raise err - return rc + return 0 def run(command, *args, **kwargs): + if command == None or (isinstance(command, list) and command[0] == None): + # No command to execute + return 1 + global g_last_output if g_verbose: return call(command, *args, **kwargs) @@ -212,7 +229,7 @@ peg_running = False run_check([cimserver_exe, 'enableIndicationService=false', - 'enableHttpsConnection=false', + 'enableHttpsConnection=false', 'enableHttpConnection=false'], env=env) try: @@ -243,14 +260,14 @@ if not os.path.exists(dest): try: os.symlink(reg, dest) - except OSError, e: - print e + except OSError as e: + print(e) else: if os.path.islink(dest): try: os.unlink(dest) - except OSError, e: - print e + except OSError as e: + print(e) for provider in providers: libname = 'lib' + provider + '.so' @@ -260,8 +277,8 @@ if os.path.exists(src) and not os.path.exists(dest): try: os.symlink(src, dest) - except OSError, e: - print e + except OSError as e: + print(e) # don't remove, in case the provider is shared with other # packages (like pyCmpiProvider) # @@ -269,8 +286,8 @@ # if os.path.islink(dest): # try: # os.unlink(dest) - # except OSError, e: - # print e + # except OSError as e: + # print(e) @@ -326,12 +343,12 @@ oparser.error('No directory given') options.dir = os.path.abspath(options.dir) if not os.path.isdir(options.dir): - print 'Error: %s is not a directory' % options.dir + print('Error: %s is not a directory' % options.dir) sys.exit(1) moffile = options.dir + '/deploy.mof' if not os.path.exists(moffile): - print 'Error: missing file:', moffile + print('Error: missing file:', moffile) sys.exit(1) elems = os.listdir(options.dir) @@ -344,7 +361,6 @@ g_verbose = options.verbose g_restart = not options.no_restart - do_sfcb = sfcb_installed() and sfcb_regs do_pegasus = pegasus_installed() and peg_regs do_scx = scx_installed() and peg_regs @@ -352,7 +368,7 @@ do_pegasus = do_pegasus and (options.url == ':tog-pegasus:' or not options.url) - if do_sfcb: + if sfcb_regs: process_sfcb(moffile, options.stage, options.remove) search = options.search @@ -362,10 +378,10 @@ pegs = [] if not pegasus_installed() and options.url == ':tog-pegasus:': - print 'Error: tog-pegasus is not installed' + print('Error: tog-pegasus is not installed') sys.exit(1) if not scx_installed() and options.url == ':scx:': - print 'Error: SCX is not installed' + print('Error: SCX is not installed') sys.exit(1) if do_pegasus: @@ -429,16 +445,14 @@ process_pegasus(moffile, mofcomp, peg['init'], peg['exe'], remove=options.remove, provider_dir=peg['provider_dir'], env=peg['env']) - except MOFParseError, pe: + except MOFParseError as pe: sys.exit(1) - except pywbem.CIMError, ce: + except pywbem.CIMError as ce: sys.exit(1) - except Error, e: - print str(e) + except Error as e: + print(str(e)) if hasattr(e, 'last_output'): - print e.last_output + print(e.last_output) sys.exit(1) - -