8 def _call_etckeeper(install_arg):
9 # zypper interprets the plugin's stdout as described in
10 # http://doc.opensuse.org/projects/libzypp/HEAD/zypp-plugins.html so it's
11 # important that we don't write anything to it. We therefore redirect
12 # etckeeper's stdout to the plugin's stderr. Since zypper writes the
13 # stderr of plugins to its log file, etckeeper's stdout will go there as
16 subprocess.call(['etckeeper', install_arg], stdout=2)
19 class EtckeeperPlugin(zypp_plugin.Plugin):
20 def PLUGINBEGIN(self, headers, body):
21 _call_etckeeper('pre-install')
24 def PLUGINEND(self, headers, body):
26 _call_etckeeper('post-install')
28 # if etckeeper was just removed, executing it will fail with
30 if e.errno != errno.ENOENT:
31 # reraise so that we don't hide other errors than etckeeper
37 plugin = EtckeeperPlugin()