Blame SOURCES/bz2092385-fence_ibm_vpc-add-proxy-support.patch

3012c9
From be409554bbc99df2bba22cb01e8a6df634af896d Mon Sep 17 00:00:00 2001
3012c9
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
3012c9
Date: Tue, 31 May 2022 15:46:40 +0200
3012c9
Subject: [PATCH] fence_ibm_vpc: add proxy support
3012c9
3012c9
---
3012c9
 agents/ibm_vpc/fence_ibm_vpc.py       | 11 +++++++++++
3012c9
 tests/data/metadata/fence_ibm_vpc.xml |  5 +++++
3012c9
 2 files changed, 16 insertions(+)
3012c9
3012c9
diff --git a/agents/ibm_vpc/fence_ibm_vpc.py b/agents/ibm_vpc/fence_ibm_vpc.py
3012c9
index 9e38e8301..3da3ce056 100755
3012c9
--- a/agents/ibm_vpc/fence_ibm_vpc.py
3012c9
+++ b/agents/ibm_vpc/fence_ibm_vpc.py
3012c9
@@ -88,6 +88,7 @@ def connect(opt):
3012c9
 	conn.setopt(pycurl.TIMEOUT, int(opt["--shell-timeout"]))
3012c9
 	conn.setopt(pycurl.SSL_VERIFYPEER, 1)
3012c9
 	conn.setopt(pycurl.SSL_VERIFYHOST, 2)
3012c9
+	conn.setopt(pycurl.PROXY, "{}".format(opt["--proxy"]))
3012c9
 
3012c9
 	# get bearer token
3012c9
 	bearer_token = get_bearer_token(conn, opt)
3012c9
@@ -169,6 +170,15 @@ def define_new_opts():
3012c9
 		"shortdesc" : "Region",
3012c9
 		"order" : 0
3012c9
 	}
3012c9
+	all_opt["proxy"] = {
3012c9
+                "getopt" : ":",
3012c9
+                "longopt" : "proxy",
3012c9
+                "help" : "--proxy=[http://<URL>:<PORT>]          Proxy: 'http://<URL>:<PORT>'",
3012c9
+                "required" : "0",
3012c9
+		"default": "",
3012c9
+                "shortdesc" : "Network proxy",
3012c9
+                "order" : 0
3012c9
+        }
3012c9
 	all_opt["limit"] = {
3012c9
 		"getopt" : ":",
3012c9
 		"longopt" : "limit",
3012c9
@@ -185,6 +195,7 @@ def main():
3012c9
 		"apikey",
3012c9
 		"region",
3012c9
 		"limit",
3012c9
+		"proxy",
3012c9
 		"port",
3012c9
 		"no_password",
3012c9
 	]
3012c9
diff --git a/tests/data/metadata/fence_ibm_vpc.xml b/tests/data/metadata/fence_ibm_vpc.xml
3012c9
index ee7151673..09da0e303 100644
3012c9
--- a/tests/data/metadata/fence_ibm_vpc.xml
3012c9
+++ b/tests/data/metadata/fence_ibm_vpc.xml
3012c9
@@ -13,6 +13,11 @@
3012c9
 		<content type="string" default="50"  />
3012c9
 		<shortdesc lang="en">Number of nodes returned by API</shortdesc>
3012c9
 	</parameter>
3012c9
+	<parameter name="proxy" unique="0" required="0">
3012c9
+		<getopt mixed="--proxy=[http://<URL>:<PORT>]" />
3012c9
+		<content type="string" default=""  />
3012c9
+		<shortdesc lang="en">Network proxy</shortdesc>
3012c9
+	</parameter>
3012c9
 	<parameter name="region" unique="0" required="1">
3012c9
 		<getopt mixed="--region=[region]" />
3012c9
 		<content type="string"  />