Skip to content

Commit

Permalink
Downgrade pymqi
Browse files Browse the repository at this point in the history
  • Loading branch information
hithwen committed Jul 13, 2020
1 parent 7e2f890 commit ff7780a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pyasn1==0.4.6
pycryptodomex==3.9.4
pyhdb==0.3.4
pymongo==3.8.0
pymqi==1.11.1; sys_platform != 'win32'
pymqi==1.10.1; sys_platform != 'win32'
pymysql==0.9.3
pyodbc==4.0.26
pyro4==4.73; sys_platform == 'win32'
Expand Down
10 changes: 8 additions & 2 deletions ibm_mq/datadog_checks/ibm_mq/collectors/metadata_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
pymqi = None


# TODO: Use actual imports once bumping over 1.11.1 (not py2 compatible)
MQIACF_Q_MGR_ATTRS = 1001 # pymqi.CMQCFC.MQIACF_Q_MGR_ATTRS
MQCA_VERSION = 2120 # pymqi.CMQC.MQCA_VERSION


class MetadataCollector(object):
def __init__(self, log):
self.log = log
Expand All @@ -26,9 +31,10 @@ def collect_metadata(self, queue_manager):

def _get_version(self, queue_manager):
pcf = pymqi.PCFExecute(queue_manager)
resp = pcf.MQCMD_INQUIRE_Q_MGR({pymqi.CMQCFC.MQIACF_Q_MGR_ATTRS: [pymqi.CMQC.MQCA_VERSION]})
resp = pcf.MQCMD_INQUIRE_Q_MGR({MQIACF_Q_MGR_ATTRS: [MQCA_VERSION]})

try:
version = to_native_string(resp[0][pymqi.CMQC.MQCA_VERSION])
version = to_native_string(resp[0][MQCA_VERSION])
self.log.debug("IBM MQ version from response: %s", version)
except Exception as e:
self.log.debug("Error collecting IBM MQ version: %s", e)
Expand Down
2 changes: 1 addition & 1 deletion ibm_mq/requirements.in
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pymqi==1.11.1; sys_platform != 'win32'
pymqi==1.10.1; sys_platform != 'win32'
3 changes: 1 addition & 2 deletions ibm_mq/tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@

from .common import MQ_VERSION_RAW

pytestmark = pytest.mark.e2e


@pytest.mark.integration
def test_metadata(instance, datadog_agent):
check = IbmMqCheck('ibm_mq', {}, [instance])
check.check_id = 'test:123'
Expand Down

0 comments on commit ff7780a

Please sign in to comment.