From 09bf3f5d4478a89dc8e74bf2c096b5b9680bd5b2 Mon Sep 17 00:00:00 2001 From: bom Date: Thu, 3 Aug 2023 13:33:57 +0200 Subject: [PATCH] Switch some quotes and brackets --- .../infrastructure/infrastructure.py | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/main/python/ddadevops/infrastructure/infrastructure.py b/src/main/python/ddadevops/infrastructure/infrastructure.py index 2c27fb1..95b5105 100644 --- a/src/main/python/ddadevops/infrastructure/infrastructure.py +++ b/src/main/python/ddadevops/infrastructure/infrastructure.py @@ -213,16 +213,24 @@ class ArtifactDeploymentApi: self.execution_api = ExecutionApi() def post_release(self, target_url: str, token: str, tag: str): - self.execution_api.execute_secure(f"curl -X 'POST' '{target_url}' -H 'accept: application/json' -H 'Content-Type: application/json' -d " + - "'{ \"body\": \"Provides files for release " + tag + "\\nAttention: The \\\"Source Code\\\"-files below are not up-to-date!\", " + f"\"tag_name\": \"{tag}\"" + "}'" + - f"-H \"Authorization: token {token}\"") + self.execution_api.execute_secure(f'curl -X "POST" "{target_url}" ' + + '-H "accept: application/json" -H "Content-Type: application/json" ' + + f'-d "{{ "body": "Provides files for release {tag} Attention: The "Source Code"-files below are not up-to-date!", "tag_name": "{tag}"}}" ' # noqa: E501 + + f'-H "Authorization: token {token}"', + sanitized_command=f'curl -X "POST" "{target_url}" ' + + '-H "accept: application/json" -H "Content-Type: application/json" ' + + f'-d "{{ "body": "Provides files for release {tag} Attention: The "Source Code"-files below are not up-to-date!", "tag_name": "{tag}"}}" ') # noqa: E501 + + def post_asset(self, target_url: str, release_id: str, token: str, attachment: str, attachment_type: str): + self.execution_api.execute_secure(f'curl -X "POST" "{target_url}/{release_id}/assets" ' + + f'-H "accept: application/json" -H "Authorization: token {token}" ' + + '-H "Content-Type: multipart/form-data" ' + + f'-F "attachment=@{attachment};type={attachment_type}"', + sanitized_command=f'curl -X "POST" "{target_url}/{release_id}/assets" ' + + '-H "accept: application/json" ' + + '-H "Content-Type: multipart/form-data" ' + + f'-F "attachment=@{attachment};type={attachment_type}"') - def post_asset(self, target_url: str, release_id: str, token: str, attachment: str, type: str): - self.execution_api.execute_secure(f"curl -X 'POST' '{target_url}/{release_id}/assets' -H 'accept: application/json' -H \"Authorization: token {token}\" -H 'Content-Type: multipart/form-data' -F 'attachment=@{attachment};type={type}'") - def calculate_checksums(self, build_path: str): - self.execution_api.execute("find " + build_path + " -type f -exec sha256sum {} \\; | sort > " + build_path + "sha256sum.lst") - self.execution_api.execute("find " + build_path + " -type f -exec sha512sum {} \\; | sort > " + build_path + "sha512sum.lst") - - - \ No newline at end of file + self.execution_api.execute(f"find {build_path} -type f -exec sha256sum {{}}; | sort > {build_path} sha256sum.lst") + self.execution_api.execute(f"find {build_path} -type f -exec sha512sum {{}}; | sort > {build_path} sha512sum.lst")