Blame SOURCES/fence_aliyun-3-logging.patch

21d5fd
From 790cbaa66f3927a84739af4a1f0e8bba295cdc36 Mon Sep 17 00:00:00 2001
21d5fd
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
21d5fd
Date: Mon, 30 Jul 2018 10:43:04 +0200
21d5fd
Subject: [PATCH] fence_aliyun: add logging
21d5fd
21d5fd
---
21d5fd
 agents/aliyun/fence_aliyun.py | 16 ++++++++++++----
21d5fd
 1 file changed, 12 insertions(+), 4 deletions(-)
21d5fd
21d5fd
diff --git a/agents/aliyun/fence_aliyun.py b/agents/aliyun/fence_aliyun.py
21d5fd
index aa6c0acf..2cda6b7f 100644
21d5fd
--- a/agents/aliyun/fence_aliyun.py
21d5fd
+++ b/agents/aliyun/fence_aliyun.py
21d5fd
@@ -23,9 +23,10 @@ def _send_request(conn, request):
21d5fd
 	try:
21d5fd
 		response_str = conn.do_action_with_exception(request)
21d5fd
 		response_detail = json.loads(response_str)
21d5fd
+		logging.debug("_send_request reponse: %s" % response_detail)
21d5fd
 		return response_detail
21d5fd
 	except Exception as e:
21d5fd
-		fail_usage("Failed: _send_request failed")
21d5fd
+		fail_usage("Failed: _send_request failed: %s" % e)
21d5fd
 
21d5fd
 def start_instance(conn, instance_id):
21d5fd
 	request = StartInstanceRequest()
21d5fd
@@ -69,15 +70,22 @@ def get_nodes_list(conn, options):
21d5fd
 
21d5fd
 def get_power_status(conn, options):
21d5fd
 	state = get_status(conn, options["--plug"])
21d5fd
+
21d5fd
 	if state == "Running":
21d5fd
-		return "on"
21d5fd
+		status = "on"
21d5fd
 	elif state == "Stopped":
21d5fd
-		return "off"
21d5fd
+		status = "off"
21d5fd
 	else:
21d5fd
-		return "unknown"
21d5fd
+		status = "unknown"
21d5fd
+
21d5fd
+	logging.info("get_power_status: %s" % status)
21d5fd
+
21d5fd
+	return status
21d5fd
 
21d5fd
 
21d5fd
 def set_power_status(conn, options):
21d5fd
+	logging.info("set_power_status: %s" % options["--action"])
21d5fd
+
21d5fd
 	if (options["--action"]=="off"):
21d5fd
 		stop_instance(conn, options["--plug"])
21d5fd
 	elif (options["--action"]=="on"):