Use kafka-python 0.9.5 from monasca-common

To avoid version mismatch we stick we the old version of kafka-python
which is incubated in monasca-common.

Story: 2001036
Task: 4592
Change-Id: I60ac2658f8257531d524f413852c430e948cafd3
This commit is contained in:
Witold Bedyk 2017-05-26 16:38:28 +02:00 committed by Tomasz Trębski
parent 81478dd72a
commit 3025485a39
3 changed files with 15 additions and 17 deletions

View File

@ -5,12 +5,12 @@ import logging
import monasca_agent.collector.checks as checks
try:
import kafka.client as client
import kafka.common as common
import kafka.consumer as consumer
import monasca_common.kafka_lib.client as client
import monasca_common.kafka_lib.common as common
import monasca_common.kafka_lib.consumer as consumer
except ImportError:
raise Exception('Missing python dependency: kafka (https://github.com/mumrah/kafka-python)')
raise Exception('Missing python dependency: monasca-common.\n Please '
'install with: pip install monasca-agent[kafka_plugin]')
log = logging.getLogger(__name__)

View File

@ -5,18 +5,17 @@ import logging
from os import path
import re
import subprocess as sp
from subprocess import CalledProcessError
from subprocess import STDOUT
from monasca_setup import agent_config
from oslo_utils import importutils
from monasca_setup import agent_config
from monasca_setup.detection import find_process_cmdline
from monasca_setup.detection import Plugin
from monasca_setup.detection import watch_process
from monasca_setup.detection.utils import check_output
from monasca_setup.detection.utils import find_addr_listening_on_port_over_tcp
from monasca_setup.detection import watch_process
log = logging.getLogger(__name__)
@ -71,8 +70,10 @@ class Kafka(Plugin):
log.error('Kafka process does not exist.')
elif not has_dependencies:
log.error(('Kafka process exists but required '
'dependency kafka-python is '
'not installed.'))
'dependency monasca-common is '
'not installed.\n\t'
'Please install with: '
'pip install monasca-agent[kafka_plugin]'))
elif not kafka_has_scripts:
log.error(('Kafka process exists, dependencies are installed '
'but neither %s nor %s '
@ -314,9 +315,4 @@ class Kafka(Plugin):
return self.config
def dependencies_installed(self):
try:
import kafka
except ImportError:
return False
return True
return importutils.try_import('monasca_common', False)

View File

@ -47,6 +47,8 @@ d_influxdb =
toml
d_influxdb_relay =
toml
kafka_plugin =
monasca-common >= 1.4.0
[global]
setup-hooks =