Enable H904 check
H904 allows the logging package to skip creating the formatted log message if the message is not going to be emitted because of the current log level. Change-Id: Ib736990696cdcbec360303e744aab9fa4cf82c91 See: https://docs.openstack.org/oslo.i18n/latest/user/guidelines.html#adding-variables-to-log-messages
This commit is contained in:
parent
d06b1adbb9
commit
b5530677f4
|
@ -349,9 +349,11 @@ class AmbariClient(object):
|
||||||
context.sleep(20)
|
context.sleep(20)
|
||||||
while True:
|
while True:
|
||||||
status = self.check_request_status(cluster_name, request_id)
|
status = self.check_request_status(cluster_name, request_id)
|
||||||
LOG.debug("Task %s in %s state. Completed %.1f%%" % (
|
LOG.debug("Task %(context)s in %(status)s state. "
|
||||||
status["request_context"], status["request_status"],
|
"Completed %(percent).1f%%",
|
||||||
status["progress_percent"]))
|
{'context': status["request_context"],
|
||||||
|
'status': status["request_status"],
|
||||||
|
'percent': status["progress_percent"]})
|
||||||
if status["request_status"] == "COMPLETED":
|
if status["request_status"] == "COMPLETED":
|
||||||
return
|
return
|
||||||
if status["request_status"] in ["IN_PROGRESS", "PENDING"]:
|
if status["request_status"] in ["IN_PROGRESS", "PENDING"]:
|
||||||
|
|
|
@ -577,9 +577,9 @@ def restart_service(cluster, service_name):
|
||||||
@cpo.event_wrapper(True, step=_("Remove hosts"), param=('cluster', 0))
|
@cpo.event_wrapper(True, step=_("Remove hosts"), param=('cluster', 0))
|
||||||
def remove_services_from_hosts(cluster, instances):
|
def remove_services_from_hosts(cluster, instances):
|
||||||
for inst in instances:
|
for inst in instances:
|
||||||
LOG.debug("Stopping and removing processes from host %s" % inst.fqdn())
|
LOG.debug("Stopping and removing processes from host %s", inst.fqdn())
|
||||||
_remove_services_from_host(cluster, inst)
|
_remove_services_from_host(cluster, inst)
|
||||||
LOG.debug("Removing the host %s" % inst.fqdn())
|
LOG.debug("Removing the host %s", inst.fqdn())
|
||||||
_remove_host(cluster, inst)
|
_remove_host(cluster, inst)
|
||||||
|
|
||||||
|
|
||||||
|
@ -587,12 +587,12 @@ def _remove_services_from_host(cluster, instance):
|
||||||
with _get_ambari_client(cluster) as client:
|
with _get_ambari_client(cluster) as client:
|
||||||
hdp_processes = client.list_host_processes(cluster.name, instance)
|
hdp_processes = client.list_host_processes(cluster.name, instance)
|
||||||
for proc in hdp_processes:
|
for proc in hdp_processes:
|
||||||
LOG.debug("Stopping process %s on host %s " %
|
LOG.debug("Stopping process %(proc)s on host %(fqdn)s ",
|
||||||
(proc, instance.fqdn()))
|
{'proc': proc, 'fqdn': instance.fqdn()})
|
||||||
client.stop_process_on_host(cluster.name, instance, proc)
|
client.stop_process_on_host(cluster.name, instance, proc)
|
||||||
|
|
||||||
LOG.debug("Removing process %s from host %s " %
|
LOG.debug("Removing process %(proc)s from host %(fqdn)s ",
|
||||||
(proc, instance.fqdn()))
|
{'proc': proc, 'fqdn': instance.fqdn()})
|
||||||
client.remove_process_from_host(cluster.name, instance, proc)
|
client.remove_process_from_host(cluster.name, instance, proc)
|
||||||
|
|
||||||
_wait_all_processes_removed(cluster, instance)
|
_wait_all_processes_removed(cluster, instance)
|
||||||
|
|
|
@ -209,7 +209,7 @@ class LabelHandler(object):
|
||||||
|
|
||||||
if plb.get('deprecated', {}).get('status', False):
|
if plb.get('deprecated', {}).get('status', False):
|
||||||
LOG.warning("Plugin %s is deprecated and can be removed in "
|
LOG.warning("Plugin %s is deprecated and can be removed in "
|
||||||
"the next release" % plugin_name)
|
"the next release", plugin_name)
|
||||||
|
|
||||||
vlb = details.get(VERSION_LABELS_SCOPE, {}).get(version, {})
|
vlb = details.get(VERSION_LABELS_SCOPE, {}).get(version, {})
|
||||||
if not vlb.get('enabled', {}).get('status'):
|
if not vlb.get('enabled', {}).get('status'):
|
||||||
|
@ -219,5 +219,5 @@ class LabelHandler(object):
|
||||||
|
|
||||||
if vlb.get('deprecated', {}).get('status', False):
|
if vlb.get('deprecated', {}).get('status', False):
|
||||||
LOG.warning("Using version %(version)s of plugin %(plugin)s is "
|
LOG.warning("Using version %(version)s of plugin %(plugin)s is "
|
||||||
"deprecated and can removed in next release"
|
"deprecated and can removed in next release",
|
||||||
% {'version': version, 'plugin': plugin_name})
|
{'version': version, 'plugin': plugin_name})
|
||||||
|
|
|
@ -118,7 +118,7 @@ class Service(object):
|
||||||
def _set_service_dir_owner(self, cluster_context, instances):
|
def _set_service_dir_owner(self, cluster_context, instances):
|
||||||
service_instances = cluster_context.filter_instances(instances,
|
service_instances = cluster_context.filter_instances(instances,
|
||||||
service=self)
|
service=self)
|
||||||
LOG.debug("Changing %s service dir owner" % self.ui_name)
|
LOG.debug("Changing %s service dir owner", self.ui_name)
|
||||||
for instance in service_instances:
|
for instance in service_instances:
|
||||||
cmd.chown(instance, 'mapr:mapr', self.service_dir(cluster_context))
|
cmd.chown(instance, 'mapr:mapr', self.service_dir(cluster_context))
|
||||||
|
|
||||||
|
|
|
@ -147,7 +147,7 @@ class AllInstancesAccessible(BasicHealthCheck):
|
||||||
if inst_ips_or_names:
|
if inst_ips_or_names:
|
||||||
insts = ', '.join(inst_ips_or_names)
|
insts = ', '.join(inst_ips_or_names)
|
||||||
LOG.exception(
|
LOG.exception(
|
||||||
"Instances (%s) are not available in the cluster" % insts)
|
"Instances (%s) are not available in the cluster", insts)
|
||||||
raise RedHealthError(
|
raise RedHealthError(
|
||||||
_("Instances (%s) are not available in the cluster.") % insts)
|
_("Instances (%s) are not available in the cluster.") % insts)
|
||||||
return _("All instances are available")
|
return _("All instances are available")
|
||||||
|
|
|
@ -240,7 +240,7 @@ def _make_periodic_tasks():
|
||||||
api.update_cluster(cluster.id, start_dict)
|
api.update_cluster(cluster.id, start_dict)
|
||||||
except vb.CannotVerifyError:
|
except vb.CannotVerifyError:
|
||||||
LOG.debug("Skipping running verification "
|
LOG.debug("Skipping running verification "
|
||||||
"on the cluster %s" % cluster.name)
|
"on the cluster %s", cluster.name)
|
||||||
|
|
||||||
return SaharaPeriodicTasks()
|
return SaharaPeriodicTasks()
|
||||||
|
|
||||||
|
|
2
tox.ini
2
tox.ini
|
@ -99,6 +99,8 @@ commands = bandit -c bandit.yaml -r sahara -n5 -p sahara_default -x tests
|
||||||
show-source = true
|
show-source = true
|
||||||
builtins = _
|
builtins = _
|
||||||
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,tools
|
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,tools
|
||||||
|
# [H904] Delay string interpolations at logging calls.
|
||||||
|
enable-extensions=H904
|
||||||
|
|
||||||
[hacking]
|
[hacking]
|
||||||
import_exceptions = sahara.i18n
|
import_exceptions = sahara.i18n
|
||||||
|
|
Loading…
Reference in New Issue