Blob Blame History Raw
--- a/agents/vmware_rest/fence_vmware_rest.py	2020-07-03 15:09:59.307198567 +0200
+++ b/agents/vmware_rest/fence_vmware_rest.py	2020-07-03 15:09:52.331210984 +0200
@@ -8,10 +8,13 @@
 from fencing import *
 from fencing import fail, run_delay, EC_LOGIN_DENIED, EC_STATUS
 
+if sys.version_info[0] > 2: import urllib.parse as urllib
+else: import urllib
+
 state = {"POWERED_ON": "on", 'POWERED_OFF': "off"}
 
 def get_power_status(conn, options):
-	res = send_command(conn, "vcenter/vm?filter.names={}".format(options["--plug"]))["value"]
+	res = send_command(conn, "vcenter/vm?filter.names={}".format(urllib.quote(options["--plug"])))["value"]
 
 	if len(res) == 0:
 		fail(EC_STATUS)
@@ -36,7 +39,7 @@
 	res = send_command(conn, "vcenter/vm")
 
 	for r in res["value"]:
-		outlets[r["name"]] = ("", state[r["power_state"]])
+		outlets[r["name"].encode("UTF-8")] = ("", state[r["power_state"]])
 
 	return outlets