From a3fdc9e52c3028d489e135ae1fc86d0327cab1e9 Mon Sep 17 00:00:00 2001 From: Sergiy Markin Date: Wed, 10 May 2023 21:38:01 +0000 Subject: [PATCH] [focal] Fix requests.body attribute deprecation This PS updates calls to body attribute of requests module with new text attribute. Change-Id: I8f69d18a0ac5a0065072642a58364584392bde37 --- promenade/control/api.py | 2 +- promenade/control/join_scripts.py | 2 +- promenade/control/node_labels.py | 2 +- promenade/exceptions.py | 2 +- promenade/utils/validation_message.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/promenade/control/api.py b/promenade/control/api.py index 726ff792..96c135ac 100644 --- a/promenade/control/api.py +++ b/promenade/control/api.py @@ -72,7 +72,7 @@ class VersionsResource(BaseResource): """ def on_get(self, req, resp): - resp.body = self.to_json( + resp.text = self.to_json( {'v1.0': { 'path': '/api/v1.0', 'status': 'stable' diff --git a/promenade/control/join_scripts.py b/promenade/control/join_scripts.py index ca5948c3..3b647dcb 100644 --- a/promenade/control/join_scripts.py +++ b/promenade/control/join_scripts.py @@ -89,7 +89,7 @@ class JoinScriptsResource(BaseResource): builder = Builder(config) script = builder.build_node_script(hostname) - resp.body = script + resp.text = script resp.content_type = 'text/x-shellscript' resp.status = falcon.HTTP_200 diff --git a/promenade/control/node_labels.py b/promenade/control/node_labels.py index 55f23cf9..41862921 100644 --- a/promenade/control/node_labels.py +++ b/promenade/control/node_labels.py @@ -40,5 +40,5 @@ class NodeLabelsResource(BaseResource): kubeclient = KubeClient() response = kubeclient.update_node_labels(node_name, json_data) - resp.body = response + resp.text = response resp.status = falcon.HTTP_200 diff --git a/promenade/exceptions.py b/promenade/exceptions.py index 8e4316c3..5e1da895 100644 --- a/promenade/exceptions.py +++ b/promenade/exceptions.py @@ -105,7 +105,7 @@ def format_error_resp(req, 'retry': retry } - resp.body = json.dumps(error_response, default=str) + resp.text = json.dumps(error_response, default=str) resp.content_type = 'application/json' resp.status = status_code diff --git a/promenade/utils/validation_message.py b/promenade/utils/validation_message.py index 530581fc..a2609113 100644 --- a/promenade/utils/validation_message.py +++ b/promenade/utils/validation_message.py @@ -78,4 +78,4 @@ class ValidationMessage(Message): def update_response(self, resp): output = self.get_output() resp.status = output['code'] - resp.body = json.dumps(output) + resp.text = json.dumps(output)