Skip to content

Commit

Permalink
[redhat|policy] get_upload_url return for s3 protocol
Browse files Browse the repository at this point in the history
Signed-off-by: Trevor Benson <[email protected]>
  • Loading branch information
TrevorBenson committed Dec 23, 2024
1 parent ace5715 commit 5e10fe9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions sos/policies/distros/redhat.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,17 @@ def get_upload_url(self):
return self.commons['cmdlineopts'].upload_url
if self.commons['cmdlineopts'].upload_protocol == 'sftp':
return RH_SFTP_HOST
if self.commons['cmdlineopts'].upload_protocol == 's3':
if self.commons['cmdlineopts'].case_id:
endpoint = self.get_upload_s3_endpoint()
bucket = self.get_upload_s3_bucket()
rh_case_api = "/support/v1/cases/%s/attachments"
return f"{endpoint}/{bucket}" + rh_case_api % self.case_id
else:
endpoint = self.get_upload_s3_endpoint()
bucket = self.get_upload_s3_bucket()
prefix = self.get_upload_s3_object_prefix()
return f"{endpoint}/{bucket}/{prefix}"
if not self.commons['cmdlineopts'].case_id:
self.ui_log.info("No case id provided, uploading to SFTP")
return RH_SFTP_HOST
Expand Down

0 comments on commit 5e10fe9

Please sign in to comment.