From: Arvin Schnell Date: Wed, 26 Aug 2015 10:23:50 +0000 (+0200) Subject: - allow to disable zypp plugin via environment variable (see fate#319316) X-Git-Tag: v0.2.8~3^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F186%2Fhead;p=thirdparty%2Fsnapper.git - allow to disable zypp plugin via environment variable (see fate#319316) --- diff --git a/package/snapper.changes b/package/snapper.changes index e85f6a99..afc94db1 100644 --- a/package/snapper.changes +++ b/package/snapper.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Aug 26 11:58:24 CEST 2015 - aschnell@suse.de + +- allow to disable zypp plugin via environment variable (see + fate#319316) + ------------------------------------------------------------------- Tue Jul 07 12:49:16 CEST 2015 - aschnell@suse.de diff --git a/scripts/zypp-plugin.py b/scripts/zypp-plugin.py index 07eeb1f0..110ed3c4 100755 --- a/scripts/zypp-plugin.py +++ b/scripts/zypp-plugin.py @@ -1,6 +1,7 @@ #!/usr/bin/python # # Copyright (c) [2011-2014] Novell, Inc. +# Copyright (c) [2015] SUSE LLC # # All Rights Reserved. # @@ -23,7 +24,7 @@ # -from os import readlink, getppid +from os import readlink, getppid, environ from os.path import basename import sys import fnmatch @@ -236,17 +237,26 @@ class MyPlugin(Plugin): self.ack() +if "DISABLE_SNAPPER_ZYPP_PLUGIN" in environ: -config = Config() + logging.info("$DISABLE_SNAPPER_ZYPP_PLUGIN is set - disabling snapper-zypp-plugin") -try: - bus = SystemBus() - snapper = Interface(bus.get_object('org.opensuse.Snapper', '/org/opensuse/Snapper'), - dbus_interface='org.opensuse.Snapper') -except DBusException as e: - logging.error("connect to snapperd failed:") - logging.error(" %s", e) - sys.exit(1) + # a dummy Plugin is needed + plugin = Plugin() + plugin.main() -plugin = MyPlugin() -plugin.main() +else: + + config = Config() + + try: + bus = SystemBus() + snapper = Interface(bus.get_object('org.opensuse.Snapper', '/org/opensuse/Snapper'), + dbus_interface='org.opensuse.Snapper') + except DBusException as e: + logging.error("connect to snapperd failed:") + logging.error(" %s", e) + sys.exit(1) + + plugin = MyPlugin() + plugin.main()