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

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