Fixing the index out of bounds error in the check_if_link_up() function
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/09e05f2a Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/09e05f2a Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/09e05f2a Branch: refs/heads/master Commit: 09e05f2a06335f0413f423bfb1180e549dcf57aa Parents: d83995e Author: Wilder Rodrigues <[email protected]> Authored: Sat Sep 26 20:43:15 2015 +0200 Committer: Remi Bergsma <[email protected]> Committed: Sat Sep 26 20:43:15 2015 +0200 ---------------------------------------------------------------------- .../patches/debian/config/opt/cloud/bin/cs/CsAddress.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/09e05f2a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py ---------------------------------------------------------------------- diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py index f0b85f9..e3fa1bc 100755 --- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py +++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py @@ -97,21 +97,20 @@ class CsAddress(CsDataBag): def check_if_link_exists(self,dev): cmd="ip link show dev %s"%dev - result=CsHelper.execute(cmd) - if(len(result)!=0): + result = CsHelper.execute(cmd) + if(len(result) != 0): return True else: return False def check_if_link_up(self,dev): cmd="ip link show dev %s | tr '\n' ' ' | cut -d ' ' -f 9"%dev - result=CsHelper.execute(cmd) - if(result[0].lower()=="up"): + result = CsHelper.execute(cmd) + if(result and result[0].lower() == "up"): return True else: return False - def process(self): route = CsRoute() found_defaultroute = False
