Skip to content

Commit

Permalink
more init
Browse files Browse the repository at this point in the history
  • Loading branch information
alienth committed Apr 18, 2012
1 parent 60c9329 commit 306bd24
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions ZenPacks/community/HAProxy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,32 @@
)


class ZenPack(ZenPackBase):
"""
ZenPack loader that handles custom installation and removal tasks.
"""

def install(self, app):
super(ZenPack, self).install(app)
self._buildDeviceRelations()

def remove(self, app, leaveObjects=False):
if not leaveObjects:
# Remove our Device relations additions.
Device._relations = tuple(
[x for x in Device._relations \
if x[0] not in NEW_DEVICE_RELATIONS])

self._buildDeviceRelations()

def _buildDeviceRelations(self):
log.info("Rebuilding relations for existing devices")
for d in self.dmd.Devices.getSubDevicesGen():
d.buildRelations()


# We need to filter HAProxy components by id instead of name.
EventManagerBase.ComponentIdWhere = (
"\"(device = '%s' and component = '%s')\""
" % (me.device().getDmdKey(), me.id)")

0 comments on commit 306bd24

Please sign in to comment.