From 6a2f0f2b24233ddfdd8672e380e697a425af3ed7 Mon Sep 17 00:00:00 2001 From: Andrew Beekhof Date: Wed, 6 Jul 2016 17:23:41 +1000 Subject: [PATCH] compute: Prevent use of undefined variable --- fence/agents/compute/fence_compute.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fence/agents/compute/fence_compute.py b/fence/agents/compute/fence_compute.py index e3d5061..0f05c12 100644 --- a/fence/agents/compute/fence_compute.py +++ b/fence/agents/compute/fence_compute.py @@ -252,17 +252,21 @@ def fix_domain(options): elif len(domains) == 1 and "--domain" not in options: options["--domain"] = last_domain + return options["--domain"] elif len(domains) == 1: logging.error("Overriding supplied domain '%s' does not match the one calculated from: %s" % (options["--domain"], hypervisor.hypervisor_hostname)) options["--domain"] = last_domain + return options["--domain"] elif len(domains) > 1: logging.error("The supplied domain '%s' did not match any used inside nova: %s" % (options["--domain"], repr(domains))) sys.exit(1) + return None + def fix_plug_name(options): if options["--action"] == "list": return @@ -270,7 +274,7 @@ def fix_plug_name(options): if "--plug" not in options: return - fix_domain(options) + calculated = fix_domain(options) short_plug = options["--plug"].split('.')[0] logging.debug("Checking target '%s' against calculated domain '%s'"% (options["--plug"], calculated))