From 923fd5c40b77624da14a5db5dab398ec93dcd739 Mon Sep 17 00:00:00 2001 From: Redouane Kachach Date: Tue, 3 Oct 2023 13:30:59 +0200 Subject: [PATCH] ci: fixing linter error Fixing linter error (using variable 'urllib' before assignment) Adding logic to properly import urlencode depending on python version closes: https://github.com/rook/rook/issues/12985 Signed-off-by: Redouane Kachach (cherry picked from commit aa59e3bb86d9eff81c7e618fa5554b5b76fbba0f) --- deploy/examples/create-external-cluster-resources.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/deploy/examples/create-external-cluster-resources.py b/deploy/examples/create-external-cluster-resources.py index 8beeead57c5c..81c30d677231 100644 --- a/deploy/examples/create-external-cluster-resources.py +++ b/deploy/examples/create-external-cluster-resources.py @@ -58,9 +58,11 @@ try: # for 2.7.x from urlparse import urlparse + from urllib import urlencode as urlencode except ModuleNotFoundError: # for 3.x from urllib.parse import urlparse + from urllib.parse import urlencode as urlencode try: from base64 import encodestring @@ -1363,7 +1365,7 @@ def get_rgw_fsid(self, base_url, verify): rgw_endpoint = self._arg_parser.rgw_endpoint base_url = base_url + "://" + rgw_endpoint + "/admin/info?" params = {"format": "json"} - request_url = base_url + urllib.parse.urlencode(params) + request_url = base_url + urlencode(params) try: r = requests.get(