libzypp  13.10.6
Commit plugin
Author
Michael Andres ma@su.nosp@m.se.d.nosp@m.e

Introduction

This is a statefull plugin executed during zypp::ZYpp::commit. At the beginning of a commit all plugins found in /usr/lib/zypp/plugins/commit are launched. The plugins will receive messages as commit proceeds. Unless otherwise specified messages received need to be confirmed by sending an ACC message. Sending back an ERROR message execution of the plugin will be canceled.

If you have e.g. zypp-plugin-python installed a basic commit plugin could look like this:

#!/usr/bin/env python
#
# zypp commit plugin
#
import os
import sys
from zypp_plugin import Plugin

class MyPlugin(Plugin):

  def PLUGINBEGIN(self, headers, body):
    # commit is going to start.
    if headers.has_key('userdata'):
      print "Commit starts with TID '%s'" % headers['userdata']
    self.ack()

  def PLUGINEND(self, headers, body):
    # commit ended
    self.ack()

plugin = MyPlugin()
plugin.main()
See Also
Writing plugins

PLUGINBEGIN

PLUGINBEGIN
userdata:TIDfoo42

^@

Sent as 1st message after the plugin was launched. Prepare your plugin and send an ACC message when you are done. Commit will start after all plugins are initialized.

PLUGINEND

PLUGINEND

^@

This message is sent at the end of commit. You should receive this message even if commit was aborted by some unexpected exception.