]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
node-proxy: address a typing issue in agent.NodeProxy.query()
authorGuillaume Abrioux <gabrioux@ibm.com>
Wed, 6 Dec 2023 12:27:46 +0000 (12:27 +0000)
committerGuillaume Abrioux <gabrioux@ibm.com>
Thu, 25 Jan 2024 16:01:04 +0000 (16:01 +0000)
The current logic supports str and bytes types for parameter
`data`. This doesn't make sense, let's drop this logic.

Signed-off-by: Guillaume Abrioux <gabrioux@ibm.com>
(cherry picked from commit 6cdb6f65b4ab84fcc5484ee7c6b940dd27b29587)

src/pybind/mgr/cephadm/agent.py

index b760fcfb93d16571aef51ae1c6e8dc95b9363f2e..49f45bffef4235efd6a8dcb67f2300e9469ff462 100644 (file)
@@ -281,7 +281,7 @@ class NodeProxy:
         try:
             _status_code, _data, _headers = self.query(addr=addr,
                                                        port=port,
-                                                       data=oob_credentials,
+                                                       data=bytes(oob_credentials, 'ascii'),
                                                        headers=headers,
                                                        endpoint="/redfish/v1/SessionService/Sessions/",
                                                        method="POST")
@@ -345,9 +345,9 @@ class NodeProxy:
         if not _headers.get('Content-Type'):
             # default to application/json if nothing provided
             _headers['Content-Type'] = 'application/json'
-        _data = bytes(data, 'ascii') if data else None
+
         try:
-            req = Request(url, _data, _headers, method=method)
+            req = Request(url, data, _headers, method=method)
             with urlopen(req, context=ssl_ctx, timeout=timeout) as response:
                 response_str = response.read()
                 response_headers = response.headers