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

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