Skip to content

Commit

Permalink
Merge pull request #19 from zenoss/feature/#18
Browse files Browse the repository at this point in the history
Please review branch feature/#18
  • Loading branch information
cluther committed Sep 13, 2013
2 parents 109f2a2 + 812016f commit f6f40f8
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 14 deletions.
21 changes: 21 additions & 0 deletions ZenPacks/zenoss/CloudStack/locallibs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
##############################################################################
#
# Copyright (C) Zenoss, Inc. 2013, all rights reserved.
#
# This content is made available according to terms specified in
# License.zenoss under the directory where your Zenoss product is installed.
#
##############################################################################


def add_local_lib_path():
'''
Helper to add the ZenPack's lib directory to sys.path.
'''
import os
import site

site.addsitedir(os.path.join(os.path.dirname(__file__), 'lib'))


add_local_lib_path()
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
from Products.DataCollector.plugins.CollectorPlugin import PythonPlugin
from Products.DataCollector.plugins.DataMaps import ObjectMap, RelationshipMap

from ZenPacks.zenoss.CloudStack.utils import add_local_lib_path
add_local_lib_path()
# Imported or side effect of adding ZenPack's lib directory to sys.path.
import ZenPacks.zenoss.CloudStack.locallibs

# Requires that locallibs first be imported.
import txcloudstack


Expand Down
5 changes: 3 additions & 2 deletions ZenPacks/zenoss/CloudStack/poll_cloudstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@
from twisted.internet import reactor
from twisted.internet.defer import DeferredList

from utils import add_local_lib_path
add_local_lib_path()
# Imported or side effect of adding ZenPack's lib directory to sys.path.
import locallibs

# Requires that locallibs first be imported.
import txcloudstack

# Map of listEvents level response parameter to Zenoss severity.
Expand Down
6 changes: 4 additions & 2 deletions ZenPacks/zenoss/CloudStack/tests/testTXCloudStack.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@

from Products.ZenTestCase.BaseTestCase import BaseTestCase

from ZenPacks.zenoss.CloudStack.utils import add_local_lib_path
from ZenPacks.zenoss.CloudStack.tests.utils import mockGetPage

add_local_lib_path()
# Imported or side effect of adding ZenPack's lib directory to sys.path.
import ZenPacks.zenoss.CloudStack.locallibs

# Requires that locallibs first be imported.
import txcloudstack


Expand Down
8 changes: 0 additions & 8 deletions ZenPacks/zenoss/CloudStack/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@
from Products.ZenUtils.guid.interfaces import IGlobalIdentifier


def add_local_lib_path():
"""Helper to add the ZenPack's lib directory to PYTHONPATH."""
import os
import site

site.addsitedir(os.path.join(os.path.dirname(__file__), 'lib'))


def guid(obj):
'''
Return GUID for obj.
Expand Down

0 comments on commit f6f40f8

Please sign in to comment.