~free.ekanayaka/landscape-client/jaunty-updates-1.4.4-0ubuntu0.9.04

« back to all changes in this revision

Viewing changes to landscape/plugin.py

  • Committer: Bazaar Package Importer
  • Author(s): Free Ekanayaka
  • Date: 2009-09-21 17:59:31 UTC
  • mfrom: (1.2.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090921175931-4ucv40j9ro26i3lm
Tags: 1.3.2.3-0ubuntu0.9.04.0
* New upstream release (LP: #347983):
  - Don't clear the hash_id_requests table upon resynchronize (LP #417122)
  - Include the README file in landscape-client (LP: #396260)
  - Fix client capturing stderr from run_command when constructing
    hash-id-databases url (LP: #397480)
  - Use substvars to conditionally depend on update-motd or
    libpam-modules (LP: #393454)
  - Fix reporting wrong version to the server (LP: #391225)
  - The init script does not wait for the network to be available
    before checking for EC2 user data (LP: #383336)
  - When the broker is restarted by the watchdog, the state of the client
    is inconsistent (LP: #380633)
  - Package stays unknown forever in the client with hash-id-databases
    support (LP: #381356)
  - Standard error not captured when calling smart-update (LP: #387441)
  - Changer calls reporter without switching groups, just user (LP: #388092)
  - Run smart update in the package-reporter instead of having a cronjob (LP: #362355)
  - Package changer does not inherit proxy settings (LP: #381241)
  - The ./test script doesn't work in landscape-client (LP: #381613)
  - The source package should build on all supported releases (LP: #385098)
  - Strip smart update's output (LP: #387331)
  - The fetch() timeout isn't based on activity (#389224)
  - Client can use a UUID of "None" when fetching the hash-id-database (LP: #381291)
  - Registration should use the fqdn rather than just the hostname (LP: #385730)

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
    def __init__(self):
20
20
        self._plugins = []
21
21
        self._plugin_names = {}
22
 
        self._registered_messages = {}
23
22
 
24
23
    def add(self, plugin):
25
24
        """Register a plugin.
55
54
 
56
55
    def __init__(self, broker):
57
56
        super(BrokerClientPluginRegistry, self).__init__()
 
57
        self._registered_messages = {}
58
58
        self.broker = broker
59
59
 
60
60
    def register_message(self, type, handler):
65
65
        self._registered_messages[type] = handler
66
66
        return self.broker.register_client_accepted_message_type(type)
67
67
 
 
68
    def broker_started(self):
 
69
        """
 
70
        Re-register any previously registered message types when the broker
 
71
        restarts.
 
72
        """
 
73
        for type in self._registered_messages:
 
74
            self.broker.register_client_accepted_message_type(type)
 
75
 
68
76
    def dispatch_message(self, message):
 
77
        """Run the handler registered for the type of the given message."""
69
78
        type = message["type"]
70
79
        handler = self._registered_messages.get(type)
71
80
        if handler is not None:
115
124
    of its clients.
116
125
    """
117
126
    def __init__(self, bus, registry):
 
127
        """
 
128
        @param bus: a DBus connection, typically a C{dbus.SystemBus} object.
 
129
        @param registry: an instance of L{PluginRegistry} or of a subclass of it.
 
130
        """
118
131
        Object.__init__(self, bus)
119
132
        self.registry = registry
120
133
        bus.add_signal_receiver(self.notify_exchange, "impending_exchange")