From c4283495f6f5c4b2e8bfb1730fd12ffea5b26281 Mon Sep 17 00:00:00 2001 From: Arvin Schnell Date: Wed, 26 Aug 2015 12:23:50 +0200 Subject: [PATCH] - allow to disable zypp plugin via environment variable (see fate#319316) --- package/snapper.changes | 6 ++++++ scripts/zypp-plugin.py | 34 ++++++++++++++++++++++------------ 2 files changed, 28 insertions(+), 12 deletions(-) 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() -- 2.47.3