1 Star 0 Fork 16

bixiaoyan/fence-agents

forked from src-openEuler/fence-agents 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
bz1677327-1-fence_redfish-use-ipport-parameter.patch 1.83 KB
一键复制 编辑 原始数据 按行查看 历史
liqiuyu 提交于 2020-11-20 11:45 . Resolve agent redfish compilation fail
From 9ebd2e2e36ae0de5c9164f4ac3fd29bdac0cab61 Mon Sep 17 00:00:00 2001
From: Oyvind Albrigtsen <[email protected]>
Date: Thu, 14 Feb 2019 10:03:33 +0100
Subject: [PATCH] fence_redfish: use "ipport" parameter and improve logging
---
agents/redfish/fence_redfish.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/agents/redfish/fence_redfish.py b/agents/redfish/fence_redfish.py
index 5b719d4b..28840058 100644
--- a/agents/redfish/fence_redfish.py
+++ b/agents/redfish/fence_redfish.py
@@ -22,7 +22,10 @@ def get_power_status(conn, options):
fail_usage("Couldn't get power information")
data = response['data']
- logging.debug("PowerState is: " + data[u'PowerState'])
+ try:
+ logging.debug("PowerState is: " + data[u'PowerState'])
+ except Exception:
+ fail_usage("Unable to get PowerState: " + "https://" + options["--ip"] + ":" + str(options["--ipport"]) + options["--systems-uri"])
if data[u'PowerState'].strip() == "Off":
return "off"
@@ -52,7 +55,7 @@ def set_power_status(conn, options):
return
def send_get_request(options, uri):
- full_uri = "https://" + options["--ip"] + uri
+ full_uri = "https://" + options["--ip"] + ":" + str(options["--ipport"]) + uri
try:
resp = requests.get(full_uri, verify=not "--ssl-insecure" in options,
auth=(options["--username"], options["--password"]))
@@ -62,7 +65,7 @@ def send_get_request(options, uri):
return {'ret': True, 'data': data}
def send_post_request(options, uri, payload, headers):
- full_uri = "https://" + options["--ip"] + uri
+ full_uri = "https://" + options["--ip"] + ":" + str(options["--ipport"]) + uri
try:
requests.post(full_uri, data=json.dumps(payload),
headers=headers, verify=not "--ssl-insecure" in options,
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/bixiaoyan1/fence-agents.git
[email protected]:bixiaoyan1/fence-agents.git
bixiaoyan1
fence-agents
fence-agents
master

搜索帮助