Blame SOURCES/bz1568742-3-fence_aliyun-logging.patch

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