summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2017-11-01 21:40:31 -0400
committerNagaraju Goruganti <ngorugan@in.ibm.com>2017-11-27 02:34:26 -0600
commitb9b3ed5e4347898bc0e969c1e7a3ca99261d4cc9 (patch)
tree589839ab5d494661cee6ea704baed119be6354e4
parent734b2c34bdf6846b57c94022112dfe58f16cc577 (diff)
downloadphosphor-objmgr-b9b3ed5e4347898bc0e969c1e7a3ca99261d4cc9.tar.gz
phosphor-objmgr-b9b3ed5e4347898bc0e969c1e7a3ca99261d4cc9.zip
server: Remove Association.__getattr__
Refactor the Association class in preparation for inheriting from obmc.dbuslib.DbusProperties. - Remove the __getattr__ override and its usage. It does not appear to be necessary. - Store endpoints in an interface/properties dictionary named properties in alignment with obmc.dbuslib.DbusProperties. - Refactor methods to use properties dictionary rather than the endpoints list. Change-Id: I4b8befa0d2e69a9f2266fa2818e0f81ae4cdcf56 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
-rw-r--r--obmc/mapper/server.py20
1 files changed, 8 insertions, 12 deletions
diff --git a/obmc/mapper/server.py b/obmc/mapper/server.py
index 8befd0e..03400d6 100644
--- a/obmc/mapper/server.py
+++ b/obmc/mapper/server.py
@@ -175,6 +175,8 @@ def find_dbus_interfaces(conn, service, path, callback, error_callback, **kw):
class Association(dbus.service.Object):
"""Implementation of org.openbmc.Association."""
+ iface = obmc.dbuslib.enums.OBMC_ASSOC_IFACE
+
def __init__(self, bus, path, endpoints):
"""Construct an Association.
@@ -184,20 +186,13 @@ class Association(dbus.service.Object):
endpoints -- A list of the initial association endpoints
"""
super(Association, self).__init__(conn=bus, object_path=path)
- self.endpoints = endpoints
-
- def __getattr__(self, name):
- if name == 'properties':
- return {
- obmc.dbuslib.enums.OBMC_ASSOC_IFACE: {
- 'endpoints': self.endpoints}}
- return super(Association, self).__getattr__(name)
+ self.properties = {self.iface: {'endpoints': endpoints}}
def emit_signal(self, old):
- if old != self.endpoints:
+ new = self.properties[self.iface]['endpoints']
+ if old != new:
self.PropertiesChanged(
- obmc.dbuslib.enums.OBMC_ASSOC_IFACE,
- {'endpoints': self.endpoints}, ['endpoints'])
+ self.iface, self.properties[self.iface], ['endpoints'])
def append(self, endpoints):
old = self.endpoints
@@ -698,7 +693,8 @@ class ObjectMapper(dbus.service.Object):
assoc.remove(removed)
delete = []
- if assoc and not assoc.endpoints:
+ endpoints = assoc.properties[iface]['endpoints']
+ if assoc and not endpoints:
self.manager.remove(path)
delete = [iface]
OpenPOWER on IntegriCloud