/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos

  • Committer: Teddy Hogeborn
  • Date: 2014-08-10 14:13:02 UTC
  • Revision ID: teddy@recompile.se-20140810141302-8q1xaaxlh8ho5joz
Emit D-Bus "org.freedesktop.DBus.Properties.PropertiesChanged" signal.

This deprecates the "se.recompile.Mandos.Client.PropertyChanged"
signal.  The new signal also adds support for noticing changes to the
"se.recompile.Mandos.Client.Secret" write-only property.

* mandos (dbus_annotations): Fix usage example in doc string.
  (DBusObjectWithProperties.PropertiesChanged): New; from D-Bus
                                                standard.
  (ClientDBus._interface): Set early instead of later.
  (ClientDBus.notifychangeproperty): Take new "invalidate_only"
                                     parameter, and pass in _interface
                                     as a default keyword argument.
  (ClientDBus.notifychangeproperty/setter): Also emit
                                            PropertiesChanged signal;
                                            emit new value or
                                            invalidation depending on
                                            "invalidate_only".
  (ClientDBus.secret): Apply notifychangeproperty with
                       "invalidate_only=True".
  (ClientDBus._foo): Removed defunct interface annotation.
  (ClientDBus.PropertyChanged): Add annotation; this method is now
                                deprecated.
  (main/MandosDBusService.GetAllClientsWithProperties): Use dictionary
                                                        comprehension.
* DBUS-API (Mandos Client Interface/Signals/PropertyChanged): Removed.
* mandos-monitor: Use standard "PropertiesChanged" signal instead of
                  old signal "PropertyChanged".
  (MandosClientPropertyCache.__init__): Connect to signal
                                        PropertiesChanged instead of
                                        PropertyChanged.
  (MandosClientPropertyCache._property_changed): Removed.
  (MandosClientPropertyCache.property_changed): Renamed to
                                                "properties_changed"
                                                and adapted to new
                                                call signature.
  (MandosClientWidget.properties_changed): - '' -

Show diffs side-by-side

added added

removed removed

Lines of Context:
91
91
if sys.version_info.major == 2:
92
92
    str = unicode
93
93
 
94
 
version = "1.6.9"
 
94
version = "1.6.8"
95
95
stored_state_file = "clients.pickle"
96
96
 
97
97
logger = logging.getLogger()
275
275
        self.bus = bus
276
276
        self.entry_group_state_changed_match = None
277
277
    
278
 
    def rename(self, remove=True):
 
278
    def rename(self):
279
279
        """Derived from the Avahi example code"""
280
280
        if self.rename_count >= self.max_renames:
281
281
            logger.critical("No suitable Zeroconf service name found"
284
284
            raise AvahiServiceError("Too many renames")
285
285
        self.name = str(self.server
286
286
                        .GetAlternativeServiceName(self.name))
287
 
        self.rename_count += 1
288
287
        logger.info("Changing Zeroconf service name to %r ...",
289
288
                    self.name)
290
 
        if remove:
291
 
            self.remove()
 
289
        self.remove()
292
290
        try:
293
291
            self.add()
294
292
        except dbus.exceptions.DBusException as error:
295
 
            if (error.get_dbus_name()
296
 
                == "org.freedesktop.Avahi.CollisionError"):
297
 
                logger.info("Local Zeroconf service name collision.")
298
 
                return self.rename(remove=False)
299
 
            else:
300
 
                logger.critical("D-Bus Exception", exc_info=error)
301
 
                self.cleanup()
302
 
                os._exit(1)
 
293
            logger.critical("D-Bus Exception", exc_info=error)
 
294
            self.cleanup()
 
295
            os._exit(1)
 
296
        self.rename_count += 1
303
297
    
304
298
    def remove(self):
305
299
        """Derived from the Avahi example code"""
397
391
 
398
392
 
399
393
class AvahiServiceToSyslog(AvahiService):
400
 
    def rename(self, *args, **kwargs):
 
394
    def rename(self):
401
395
        """Add the new name to the syslog messages"""
402
 
        ret = AvahiService.rename(self, *args, **kwargs)
 
396
        ret = AvahiService.rename(self)
403
397
        syslogger.setFormatter(logging.Formatter
404
398
                               ('Mandos ({}) [%(process)d]:'
405
399
                                ' %(levelname)s: %(message)s'