Skip to content

Commit

Permalink
updated check_blue_talon_version.py
Browse files Browse the repository at this point in the history
  • Loading branch information
HariSekhon committed Dec 6, 2016
1 parent 7e50a4b commit 731c161
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion check_blue_talon_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
sys.path.append(libdir)
try:
# pylint: disable=wrong-import-position
from harisekhon.utils import log, qquit, support_msg_api, isVersion
from harisekhon.utils import log, qquit, support_msg_api, isVersion, isList, isDict
from harisekhon.utils import validate_host, validate_port, validate_user, validate_password, validate_regex
from harisekhon import VersionNagiosPlugin
except ImportError as _:
Expand Down Expand Up @@ -120,7 +120,11 @@ def get_version(self):
qquit('CRITICAL', '{0}: {1}'.format(req.status_code, req.reason))
try:
json_list = json.loads(req.content)
if not isList(json_list):
raise ValueError("non-list returned by API (is type '{0}')".format(type(json_list)))
json_dict = json_list[0]
if not isDict(json_dict):
raise ValueError("non-dict found inside returned list (is type '{0}')".format(type(json_dict)))
company_name = json_dict['company_name']
company_website = json_dict['company_website']
regex = re.compile(r'Blue\s*Talon', re.I)
Expand Down

0 comments on commit 731c161

Please sign in to comment.