Blame SOURCES/bz1287059-1-fence_rhevm-add-filter-header.patch

09283b
From 03eee868ec5f3a07024a6b7c65572e54238106c6 Mon Sep 17 00:00:00 2001
09283b
From: Rik Theys <Rik.Theys@esat.kuleuven.be>
09283b
Date: Tue, 19 May 2015 13:24:09 +0200
09283b
Subject: [PATCH 1/2] fence_rhevm: Add Filter header
09283b
09283b
oVirt users who only have the UserRole role don't have enough privileges
09283b
to query the vm list, unless the Filter header is set to true.
09283b
09283b
See rhbz#1102801 for details.
09283b
---
09283b
 fence/agents/rhevm/fence_rhevm.py | 2 +-
09283b
 1 file changed, 1 insertion(+), 1 deletion(-)
09283b
09283b
diff --git a/fence/agents/rhevm/fence_rhevm.py b/fence/agents/rhevm/fence_rhevm.py
09283b
index 427bed5..cf85689 100644
09283b
--- a/fence/agents/rhevm/fence_rhevm.py
09283b
+++ b/fence/agents/rhevm/fence_rhevm.py
09283b
@@ -87,7 +87,7 @@ def send_command(opt, command, method="GET"):
09283b
 	conn = pycurl.Curl()
09283b
 	web_buffer = StringIO.StringIO()
09283b
 	conn.setopt(pycurl.URL, url)
09283b
-	conn.setopt(pycurl.HTTPHEADER, ["Content-type: application/xml", "Accept: application/xml", "Prefer: persistent-auth"])
09283b
+	conn.setopt(pycurl.HTTPHEADER, ["Content-type: application/xml", "Accept: application/xml", "Prefer: persistent-auth", "Filter: true"])
09283b
 
09283b
 	if opt.has_key("cookie"):
09283b
 		conn.setopt(pycurl.COOKIE, opt["cookie"])
09283b
-- 
09283b
2.5.0
09283b
09283b
09283b
From d19bb9b0e3ae285fbf36ef0fc0b76e7dccddb5d8 Mon Sep 17 00:00:00 2001
09283b
From: Rik Theys <Rik.Theys@esat.kuleuven.be>
09283b
Date: Tue, 19 May 2015 13:31:14 +0200
09283b
Subject: [PATCH 2/2] fence_rhevm: Fill in outlet status in get_list
09283b
09283b
The outlet status was set to None for all outlets. This results in a
09283b
traceback in fencing.py as it tries to execute the upper() function on
09283b
the status. This is fine when the account that tries to access the data
09283b
is an admin account as the list will be empty. If a UserRole user is
09283b
used, the vm list is not empty and the error occurs.
09283b
09283b
Fill in the status of each vm in the outlet status to prevent the
09283b
traceback.
09283b
---
09283b
 fence/agents/rhevm/fence_rhevm.py | 3 ++-
09283b
 1 file changed, 2 insertions(+), 1 deletion(-)
09283b
09283b
diff --git a/fence/agents/rhevm/fence_rhevm.py b/fence/agents/rhevm/fence_rhevm.py
09283b
index cf85689..3926f3b 100644
09283b
--- a/fence/agents/rhevm/fence_rhevm.py
09283b
+++ b/fence/agents/rhevm/fence_rhevm.py
09283b
@@ -66,7 +66,8 @@ def get_list(conn, options):
09283b
 		lines = res.split("
09283b
 		for i in range(1, len(lines)):
09283b
 			name = RE_GET_NAME.search(lines[i]).group(1)
09283b
-			outlets[name] = ("", None)
09283b
+			status = RE_STATUS.search(lines[i]).group(1)
09283b
+			outlets[name] = ("", status)
09283b
 	except AttributeError:
09283b
 		return {}
09283b
 	except IndexError:
09283b
-- 
09283b
2.5.0
09283b