From 685bea1846032057cf5407e791a266c435dca15a Mon Sep 17 00:00:00 2001 From: Hisaharu Ishii Date: Tue, 18 Jan 2011 11:41:05 +0900 Subject: Fixed error message in get_my_linklocal --- nova/utils.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'nova/utils.py') diff --git a/nova/utils.py b/nova/utils.py index 6d3ddd092..5ceb0ec44 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -212,13 +212,11 @@ def get_my_linklocal(interface): if address[0] is not None: return address[0] else: + LOG.warn(_("Link Local address is not found.:%s") % if_str) return 'fe00::' - except IndexError as ex: + except Exception as ex: LOG.warn(_("Couldn't get Link Local IP of %s :%s"), interface, ex) - except ProcessExecutionError as ex: - LOG.warn(_("Couldn't get Link Local IP of %s :%s"), interface, ex) - except: - return 'fe00::' + return 'fe00::' def to_global_ipv6(prefix, mac): -- cgit From 68c9c8930038fe3af3092f3de75591146d57c9e4 Mon Sep 17 00:00:00 2001 From: Ed Leafe Date: Tue, 18 Jan 2011 21:00:28 -0500 Subject: Completed first pass at converting all localized strings with multiple format substitutions. --- nova/utils.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'nova/utils.py') diff --git a/nova/utils.py b/nova/utils.py index 6d3ddd092..2f3bd2894 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -138,7 +138,7 @@ def execute(cmd, process_input=None, addl_env=None, check_exit_code=True): result = obj.communicate() obj.stdin.close() if obj.returncode: - LOG.debug(_("Result was %s") % (obj.returncode)) + LOG.debug(_("Result was %s") % obj.returncode) if check_exit_code and obj.returncode != 0: (stdout, stderr) = result raise ProcessExecutionError(exit_code=obj.returncode, @@ -214,9 +214,11 @@ def get_my_linklocal(interface): else: return 'fe00::' except IndexError as ex: - LOG.warn(_("Couldn't get Link Local IP of %s :%s"), interface, ex) + LOG.warn(_("Couldn't get Link Local IP of %(interface)s :%(ex)s") + % locals()) except ProcessExecutionError as ex: - LOG.warn(_("Couldn't get Link Local IP of %s :%s"), interface, ex) + LOG.warn(_("Couldn't get Link Local IP of %(interface)s :%(ex)s") + % locals()) except: return 'fe00::' -- cgit From 4190d539315c50c50edcb8f7866274fe3d95d9a1 Mon Sep 17 00:00:00 2001 From: Nachi Ueno Date: Wed, 19 Jan 2011 11:13:33 +0900 Subject: get_my_linklocal raises exception --- nova/utils.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'nova/utils.py') diff --git a/nova/utils.py b/nova/utils.py index 5ceb0ec44..108824143 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -206,17 +206,17 @@ def last_octet(address): def get_my_linklocal(interface): try: if_str = execute("ip -f inet6 -o addr show %s" % interface) - condition = "\s+inet6\s+([0-9a-f:]+/\d+)\s+scope\s+link" + condition = "\s+inet6\s+([0-9a-f:]+)/\d+\s+scope\s+link" links = [re.search(condition, x) for x in if_str[0].split('\n')] address = [w.group(1) for w in links if w is not None] if address[0] is not None: return address[0] else: - LOG.warn(_("Link Local address is not found.:%s") % if_str) - return 'fe00::' + raise exception.Error(_("Link Local address is not found.:%s") + % if_str) except Exception as ex: - LOG.warn(_("Couldn't get Link Local IP of %s :%s"), interface, ex) - return 'fe00::' + raise exception.Error(_("Couldn't get Link Local IP of %s :%s") + % (interface, ex)) def to_global_ipv6(prefix, mac): -- cgit From a495294ccc40a868b79144085da38196759f699c Mon Sep 17 00:00:00 2001 From: Ed Leafe Date: Thu, 27 Jan 2011 13:52:10 -0600 Subject: Fixed formatting issues in current codebase. --- nova/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nova/utils.py') diff --git a/nova/utils.py b/nova/utils.py index f71a4d880..5f5225289 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -215,8 +215,8 @@ def get_my_linklocal(interface): raise exception.Error(_("Link Local address is not found.:%s") % if_str) except Exception as ex: - raise exception.Error(_("Couldn't get Link Local IP of %s :%s") - % (interface, ex)) + raise exception.Error(_("Couldn't get Link Local IP of %(interface)s" + " :%(ex)s") % locals()) def to_global_ipv6(prefix, mac): -- cgit