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