本文整理汇总了Python中mcv_consoler.logger.LOG.debug方法的典型用法代码示例。如果您正苦于以下问题:Python LOG.debug方法的具体用法?Python LOG.debug怎么用?Python LOG.debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mcv_consoler.logger.LOG
的用法示例。
在下文中一共展示了LOG.debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_individual_task
# 需要导入模块: from mcv_consoler.logger import LOG [as 别名]
# 或者: from mcv_consoler.logger.LOG import debug [as 别名]
def run_individual_task(self, task, *args, **kwargs):
try:
task_failed = self._run_rally_on_docker(task, *args, **kwargs)
except subprocess.CalledProcessError as e:
LOG.error("Task %s has failed with: %s" % (task, e))
self.test_failures.append(task)
LOG.info(" * FAILED")
return False
if task_failed is True:
LOG.warning("Task %s has failed for some "
"instrumental issues" % task)
self.test_failures.append(task)
LOG.info(" * FAILED")
return False
elif self.skip:
LOG.debug("Skipped test %s" % task)
LOG.info(" * SKIPPED")
return False
LOG.debug("Retrieving task results for %s" % task)
task_result = self._get_task_result_from_docker()
if task_result is None:
self.test_failures.append(task)
LOG.info(" * FAILED")
return False
return self._evaluate_task_result(task, task_result)
示例2: start_container
# 需要导入模块: from mcv_consoler.logger import LOG [as 别名]
# 或者: from mcv_consoler.logger.LOG import debug [as 别名]
def start_container(self):
LOG.debug("Bringing up Shaker container with credentials")
add_host = ""
# TODO(albartash): Refactor this place!
if self.config.get("auth", "auth_fqdn") != '':
add_host = "--add-host={fqdn}:{endpoint}".format(
fqdn=self.access_data["auth_fqdn"],
endpoint=self.access_data["ips"]["endpoint"])
network_name = utils.GET(
self.config, 'network_ext_name', 'network_speed') or ""
res = subprocess.Popen(
["docker", "run", "-d", "-P=true"] +
[add_host] * (add_host != "") +
["-p", "5999:5999",
"-e", "OS_AUTH_URL=" + self.access_data["auth_url"],
"-e", "OS_TENANT_NAME=" + self.access_data["tenant_name"],
"-e", "OS_USERNAME=" + self.access_data["username"],
"-e", "OS_PASSWORD=" + self.access_data["password"],
"-e", "OS_REGION_NAME=" + self.access_data["region_name"],
"-e", "SHAKER_EXTERNAL_NET=" + str(network_name),
"-e", "KEYSTONE_ENDPOINT_TYPE=publicUrl",
"-e", "OS_INSECURE=" + str(self.access_data["insecure"]),
# TODO(vokhrimenko): temporarily not used
#"-e", "OS_CACERT=" + self.access_data["fuel"]["ca_cert"],
"-v", "%s:%s" % (self.homedir, self.home), "-w", self.home,
"-t", "mcv-shaker"],
stdout=subprocess.PIPE,
preexec_fn=utils.ignore_sigint).stdout.read()
LOG.debug('Finish bringing up Shaker container. '
'ID = %s' % str(res))
示例3: check_and_fix_access_data
# 需要导入模块: from mcv_consoler.logger import LOG [as 别名]
# 或者: from mcv_consoler.logger.LOG import debug [as 别名]
def check_and_fix_access_data(self):
if not self.verify_access_data_is_set():
return False
LOG.debug("Trying to authenticate with OpenStack "
"using provided credentials...")
self.make_sure_controller_name_could_be_resolved()
try:
self.novaclient.authenticate()
except nexc.ConnectionRefused:
LOG.error("Apparently authentication endpoint address is invalid."
" Current value is %s" % self.os_data["ips"]["endpoint"])
return False
except nexc.Unauthorized:
LOG.error("Apparently OS user credentials are incorrect.\n"
"Current os-username is: %s\n"
"Current os-password is: %s \n"
"Current os-tenant is: %s \n"
% (self.os_data["username"],
self.os_data["password"],
self.os_data["tenant_name"]
))
return False
except (Timeout, ConnectionError) as conn_e:
LOG.error("Apparently auth endpoint address is not valid."
" %s" % str(conn_e))
return False
LOG.debug("Access data looks valid.")
return True
示例4: _evaluate_task_result
# 需要导入模块: from mcv_consoler.logger import LOG [as 别名]
# 或者: from mcv_consoler.logger.LOG import debug [as 别名]
def _evaluate_task_result(self, task, resulting_dict):
status = True
errors = ''
if type(resulting_dict) != dict:
LOG.debug("Task %s has failed with the following error: %s" %
(task, resulting_dict))
return False
if resulting_dict == []:
errors = 'Timeout Error with shaker. Process was killed.'
LOG.warning("Task %s has failed with the following error: %s" %
(task, errors))
return False
for i in resulting_dict['records']:
try:
if resulting_dict['records'][i]['status'] == 'error':
status = False
errors += '\n' + resulting_dict['records'][i]['stderr']
except KeyError:
pass
if status:
LOG.debug("Task %s has completed successfully." % task)
else:
LOG.warning("Task %s has failed with the following error: %s" %
(task, errors))
return status
return status
示例5: delete_floating_ips
# 需要导入模块: from mcv_consoler.logger import LOG [as 别名]
# 或者: from mcv_consoler.logger.LOG import debug [as 别名]
def delete_floating_ips(self):
LOG.debug("Removing created floating IPs")
for floating_ip in self.fresh_floating_ips:
try:
floating_ip.delete()
except Exception as e:
LOG.debug("Error removing floating IP: %s" % e.message)
示例6: init_clients
# 需要导入模块: from mcv_consoler.logger import LOG [as 别名]
# 或者: from mcv_consoler.logger.LOG import debug [as 别名]
def init_clients(self, access_data):
LOG.debug("Trying to obtain authenticated OS clients")
self.novaclient = Clients.get_nova_client(access_data)
self.cinderclient = Clients.get_cinder_client(access_data)
self.glanceclient = Clients.get_glance_client(access_data)
self.neutronclient = Clients.get_neutron_client(access_data)
LOG.debug("Finish obtaining OS clients.")
示例7: stop_forwarding
# 需要导入模块: from mcv_consoler.logger import LOG [as 别名]
# 或者: from mcv_consoler.logger.LOG import debug [as 别名]
def stop_forwarding(self):
LOG.debug("Reverting changes needed for access to admin network")
ssh = client.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
ssh.connect(hostname=self.os_data["ips"]["controller"],
username=self.os_data['auth']['controller_uname'],
password=self.os_data['auth']['controller_pwd'])
except Exception:
LOG.critical("SSH is broken! Please revert port forwarding on your"
" controller manually")
LOG.debug(traceback.format_exc())
return
ssh.exec_command("ps aux | grep '[s]sh -o Preferred' | "
"awk '{ print $2 }'| xargs kill")
ssh.exec_command("iptables -L -n --line-numbers | grep MCV_tunnel | "
"awk '{print $1}' | xargs iptables -D INPUT")
subprocess.call("sudo iptables -L -n -t nat --line-numbers | "
"grep MCV_instance | awk '{print $1}' | tac | "
"xargs -l sudo iptables -t nat -D PREROUTING",
shell=True)
示例8: _run_rally
# 需要导入模块: from mcv_consoler.logger import LOG [as 别名]
# 或者: from mcv_consoler.logger.LOG import debug [as 别名]
def _run_rally(self, task):
LOG.debug("Running task %s" % task)
# warning: at this point task must be transformed to a full path
path_to_task = self._get_task_path(task)
p = utils.run_cmd("rally task start " + path_to_task)
out = p.split('\n')[-4].lstrip('\t')
return out
示例9: check_computes
# 需要导入模块: from mcv_consoler.logger import LOG [as 别名]
# 或者: from mcv_consoler.logger.LOG import debug [as 别名]
def check_computes(self):
# TODO(albartash): Do we really need this method?
services = self.novaclient.services.list()
self.compute = 0
for service in services:
if service.binary == 'nova-compute':
self.compute += 1
LOG.debug("Found " + str(self.compute) + " computes.")
示例10: fix_shaker
# 需要导入模块: from mcv_consoler.logger import LOG [as 别名]
# 或者: from mcv_consoler.logger.LOG import debug [as 别名]
def fix_shaker(file_location):
LOG.debug('Fixing Shaker report')
if not os.path.isfile(file_location):
return LOG.debug('File not found %s' % file_location)
cmd = ("sed -i '/<div\ class=\"container\"\ id=\"container\">/"
" a\ <li class=\"active\" style=\"list-style-type: none;\"><a "
"href=\"../index.html\">Back to Index</a></li>' "
"%s" % file_location)
utils.run_cmd(cmd)
示例11: generate_report
# 需要导入模块: from mcv_consoler.logger import LOG [as 别名]
# 或者: from mcv_consoler.logger.LOG import debug [as 别名]
def generate_report(self, html, task):
# TODO(ekudryashova): Append last run to existing file for now.
# Not sure how to fix this properly
LOG.debug('Generating report in resources.html file')
report = file('%s/%s.html' % (self.path, task), 'w')
report.write(html)
report.close()
示例12: _get_task_result_from_docker
# 需要导入模块: from mcv_consoler.logger import LOG [as 别名]
# 或者: from mcv_consoler.logger.LOG import debug [as 别名]
def _get_task_result_from_docker(self):
cmd = 'docker exec -t {cid} /bin/sh -c ' \
'"rally task results 2>/dev/null"'.format(cid=self.container_id)
p = utils.run_cmd(cmd, quiet=True)
try:
return json.loads(p)[0] # actual test result as a dictionary
except ValueError:
LOG.error("Gotten not-JSON object. Please see mcv-log")
LOG.debug("Not-JSON object: %s, After command: %s", p, cmd)
示例13: _run_shaker
# 需要导入模块: from mcv_consoler.logger import LOG [as 别名]
# 或者: from mcv_consoler.logger.LOG import debug [as 别名]
def _run_shaker(self, task):
LOG.debug("Running task %s" % task)
# warning: at this point task must be transformed to a full path
path_to_task = self._get_task_path(task)
p = utils.run_cmd("rally task start " + path_to_task)
# here out is in fact a command which can be run to obtain task results
# thus it is returned directly.
out = p.split('\n')[-4].lstrip('\t')
return out
示例14: validate_conf
# 需要导入模块: from mcv_consoler.logger import LOG [as 别名]
# 或者: from mcv_consoler.logger.LOG import debug [as 别名]
def validate_conf(config, run_args):
cv = ConfigValidator(config, run_args)
LOG.debug('Validating config: %s' % cv.conf_path)
cv.validate()
all_good = cv.status
if all_good:
LOG.debug('Config looks fine')
else:
cv.format_errors()
return all_good
示例15: brew_a_report
# 需要导入模块: from mcv_consoler.logger import LOG [as 别名]
# 或者: from mcv_consoler.logger.LOG import debug [as 别名]
def brew_a_report(stuff, name="mcv_result.html"):
result = ""
good, bad, notfound = 0, 0, 0
location = name.rstrip("/index.html")
for key, value in stuff.iteritems():
if not validate_section(value):
LOG.debug('Error: no results for %s' % key)
continue
res = ""
for el in value['results']['test_success']:
res += test_string % {"fontcolor": "green",
"testname": el,
"key": key}
fix_dispatcher(key, "{loc}/{key}/{testname}.html".format(
loc=location, testname=el, key=key))
good += 1
for el in value['results']['test_not_found']:
res += test_string % {"fontcolor": "magenta",
"testname": el,
"key": key}
fix_dispatcher(key, "{loc}/{key}/{testname}.html".format(
loc=location, testname=el, key=key))
notfound += 1
for el in value['results']['test_failures']:
res += test_string % {"fontcolor": "red",
"testname": el,
"key": key}
fix_dispatcher(key, "{loc}/{key}/{testname}.html".format(
loc=location, testname=el, key=key))
bad += 1
threshold = value['results'].get('threshold', '')
if threshold:
threshold = '(threshold is %s)' % threshold
result += general_report % {"component_name": key,
"component_list": res,
"threshold": threshold}
out = header % {
"datetime_of_run": datetime.now().strftime("%a, %d %b %Y %H:%M:%S"),
"quapla": str(good),
"failure": str(bad)
} + result + footer
with open(name, "w") as f:
f.write(out)