Skip to content

Commit

Permalink
fix parsing of empty results
Browse files Browse the repository at this point in the history
  • Loading branch information
epuzanov committed May 23, 2012
1 parent f05751a commit 9dce66d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
9 changes: 5 additions & 4 deletions ZenPacks/community/SQLDataSource/SQLClient.py
Expand Up @@ -12,9 +12,9 @@
Gets performance data over python DB-API.
$Id: SQLClient.py,v 3.6 2012/05/10 20:47:48 egor Exp $"""
$Id: SQLClient.py,v 3.7 2012/05/23 20:27:21 egor Exp $"""

__version__ = "$Revision: 3.6 $"[11:-2]
__version__ = "$Revision: 3.7 $"[11:-2]

import logging
log = logging.getLogger("zen.SQLClient")
Expand Down Expand Up @@ -113,8 +113,9 @@ def _convert(val, type):
ex = TimeoutError('Query Timeout')
raise ex
t.cancel()
header, ct = zip(*[(h[0].lower(), h[1]) for h in txn.description or []])
if not header: return res
if not txn.description:
return res
header, ct = zip(*[(h[0].lower(), h[1]) for h in txn.description])
if set(columns).intersection(set(header)):
varVal = False
else:
Expand Down
Expand Up @@ -15,9 +15,9 @@
Provides configuration to zenperfsql clients.
$Id: SqlPerformanceConfig.py,v 3.2 2012/05/18 17:28:14 egor Exp $"""
$Id: SqlPerformanceConfig.py,v 3.3 2012/05/23 20:44:58 egor Exp $"""

__version__ = "$Revision: 3.2 $"[11:-2]
__version__ = "$Revision: 3.3 $"[11:-2]

import logging
log = logging.getLogger('zen.HubService.SqlPerformanceConfig')
Expand All @@ -28,6 +28,7 @@

from Products.ZenCollector.services.config import CollectorConfigService
from Products.ZenUtils.ZenTales import talesEval
from Products.ZenModel.Device import Device
from ZenPacks.community.SQLDataSource.SQLClient import DataSourceConfig,\
DataPointConfig
from ZenPacks.community.SQLDataSource.datasources.SQLDataSource \
Expand All @@ -47,7 +48,9 @@ def _getDsDatapoints(self, comp, ds, perfServer):
Given a component a data source, gather its data points
"""
points = []
component_name = getattr(comp, 'id', '')
component_name = ''
if not isinstance(comp, Device):
component_name = getattr(comp, 'id', '')
basepath = comp.rrdPath()
for dp in ds.getRRDDataPoints():
alias = (dp.aliases() or [dp])[0]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -3,7 +3,7 @@
# or saved. Do not modify them directly here.
# NB: PACKAGES is deprecated
NAME = "ZenPacks.community.SQLDataSource"
VERSION = "2.1"
VERSION = "2.2"
AUTHOR = "Egor Puzanov"
LICENSE = ""
NAMESPACE_PACKAGES = ['ZenPacks', 'ZenPacks.community']
Expand Down

0 comments on commit 9dce66d

Please sign in to comment.