ceph-manager: fix tox issues

Fix pep8 issues and remove py27 section because there is no test
defined.

Depends-On: I7c6bff4d8986c1fd75c3c9d353557c5eafcdcde0
Change-Id: I7b534e31868e53ec479c2321d6883604c12aa6d3
Signed-off-by: Daniel Badea <daniel.badea@windriver.com>
This commit is contained in:
Daniel Badea 2019-04-09 08:02:55 +00:00
parent ac35cc5dc9
commit d45193bf25
3 changed files with 14 additions and 16 deletions

View File

@ -48,7 +48,8 @@ class HandleUpgradesMixin(object):
and state != constants.UPGRADE_COMPLETED and state != constants.UPGRADE_COMPLETED
and from_version == constants.TITANIUM_SERVER_VERSION_18_03): and from_version == constants.TITANIUM_SERVER_VERSION_18_03):
LOG.info(_LI("Wait for ceph upgrade to complete before monitoring cluster.")) LOG.info(_LI("Wait for ceph upgrade to complete "
"before monitoring cluster."))
self.wait_for_upgrade_complete = True self.wait_for_upgrade_complete = True
def set_flag_require_jewel_osds(self): def set_flag_require_jewel_osds(self):
@ -90,7 +91,8 @@ class HandleUpgradesMixin(object):
reason = reason.strip() reason = reason.strip()
if len(reason) == 0: if len(reason) == 0:
continue continue
if constants.CEPH_HEALTH_WARN_REQUIRE_JEWEL_OSDS_NOT_SET in reason: if constants.CEPH_HEALTH_WARN_REQUIRE_JEWEL_OSDS_NOT_SET \
in reason:
continue continue
reasons_list.append(reason) reasons_list.append(reason)
if len(reasons_list) == 0: if len(reasons_list) == 0:
@ -168,8 +170,9 @@ class Monitor(HandleUpgradesMixin):
try: try:
self.ceph_get_fsid() self.ceph_get_fsid()
except Exception: except Exception:
LOG.exception("Error getting fsid, " LOG.exception(
"will retry in %ss" % constants.CEPH_HEALTH_CHECK_INTERVAL) "Error getting fsid, will retry in %ss"
% constants.CEPH_HEALTH_CHECK_INTERVAL)
if self.service.entity_instance_id: if self.service.entity_instance_id:
break break
time.sleep(constants.CEPH_HEALTH_CHECK_INTERVAL) time.sleep(constants.CEPH_HEALTH_CHECK_INTERVAL)
@ -180,8 +183,10 @@ class Monitor(HandleUpgradesMixin):
self.ceph_poll_status() self.ceph_poll_status()
self.ceph_poll_quotas() self.ceph_poll_quotas()
except Exception: except Exception:
LOG.exception("Error running periodic monitoring of ceph status, " LOG.exception(
"will retry in %ss" % constants.CEPH_HEALTH_CHECK_INTERVAL) "Error running periodic monitoring of ceph status, "
"will retry in %ss"
% constants.CEPH_HEALTH_CHECK_INTERVAL)
time.sleep(constants.CEPH_HEALTH_CHECK_INTERVAL) time.sleep(constants.CEPH_HEALTH_CHECK_INTERVAL)
def ceph_get_fsid(self): def ceph_get_fsid(self):
@ -705,7 +710,8 @@ class Monitor(HandleUpgradesMixin):
return ( return (
msg['head'] + msg['head'] +
(health['health'] + lbracket + parsed_reasons_text)[:max_size - 1] + (health['health'] + lbracket
+ parsed_reasons_text)[:max_size - 1] +
rbracket + msg['tail']) rbracket + msg['tail'])
def _report_fault(self, health, alarm_id): def _report_fault(self, health, alarm_id):

View File

@ -24,14 +24,11 @@ from oslo_log import log as logging
from oslo_service import service from oslo_service import service
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
from oslo_service.periodic_task import PeriodicTasks from oslo_service.periodic_task import PeriodicTasks
# noinspection PyUnresolvedReferences
from oslo_service import loopingcall
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
from cephclient import wrapper from cephclient import wrapper
from ceph_manager.monitor import Monitor from ceph_manager.monitor import Monitor
from ceph_manager import exception
from ceph_manager import constants from ceph_manager import constants
from ceph_manager.i18n import _LI from ceph_manager.i18n import _LI

View File

@ -10,17 +10,12 @@ toxworkdir = /tmp/{env:USER}_ceph_manager_tox
[testenv] [testenv]
setenv = VIRTUAL_ENV={envdir} setenv = VIRTUAL_ENV={envdir}
usedevelop = True usedevelop = True
install_command = pip install --no-use-wheel -U --force-reinstall {opts} {packages} install_command = pip install -U --force-reinstall {opts} {packages}
deps = -r{toxinidir}/test-requirements.txt deps = -r{toxinidir}/test-requirements.txt
commands = py.test {posargs} commands = py.test {posargs}
whitelist_externals = bash whitelist_externals = bash
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
[testenv:py27]
basepython = python2.7
setenv =
PYTHONPATH={toxinidir}/../../../../sysinv/recipes-common/sysinv/sysinv:{toxinidir}/../../../../config/recipes-common/tsconfig/tsconfig
[testenv:pep8] [testenv:pep8]
commands = commands =
flake8 {posargs} flake8 {posargs}