Skip to content

Commit

Permalink
Adding fix for ANSISILON-2017
Browse files Browse the repository at this point in the history
  • Loading branch information
trisha-dell committed Sep 2, 2024
1 parent 57f979b commit 880dd55
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion plugins/module_utils/storage/dell/nwpool_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,17 @@ def _url_common_args_spec(self, method, api_timeout, headers=None):
}
return url_kwargs

def _args_without_session(self, method, api_timeout, headers=None):
"""Creates an argument spec in case of basic authentication"""
req_header = self._headers
if headers:
req_header.update(headers)
url_kwargs = self._url_common_args_spec(method, api_timeout, headers=headers)
url_kwargs["url_username"] = self.username
url_kwargs["url_password"] = self.password
url_kwargs["force_basic_auth"] = True
return url_kwargs

def _args_with_session(self, method, api_timeout, headers=None):
"""Creates an argument spec, in case of authentication with session"""
url_kwargs = self._url_common_args_spec(method, api_timeout, headers=headers)
Expand All @@ -125,7 +136,7 @@ def invoke_request(self, uri, method, data=None, query_param=None, headers=None,
if 'X-Auth-Token' in self._headers:
url_kwargs = self._args_with_session(method, api_timeout, headers=headers)
else:
url_kwargs = self._args_without_session(uri, method, api_timeout, headers=headers)
url_kwargs = self._args_without_session(method, api_timeout, headers=headers)
if data and dump:
data = json.dumps(data)
url = self._build_url(uri, query_param=query_param)
Expand Down

0 comments on commit 880dd55

Please sign in to comment.