Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS S3 sync command #2146

Merged
merged 1 commit into from
Dec 5, 2023
Merged

AWS S3 sync command #2146

merged 1 commit into from
Dec 5, 2023

Conversation

Chrystinne
Copy link
Contributor

This pull request adds a prefix to the generated AWS S3 sync command, including the project slug, and version.

@bemoody
Copy link
Collaborator

bemoody commented Nov 30, 2023

We want to avoid putting logic in template files whenever we can. Use Python functions and classes to define what information should be shown, and use templates to define how it should be displayed as HTML.

Also, a <pre> element should not contain unnecessary whitespace, and must not contain block elements such as <p>.

Instead of putting more logic into published_project.html, try defining a method in the AWS class that returns the S3 URI for the project.

class AWS(models.Model):
    ...
    def s3_uri(self):
        if self.is_private:
            return f's3://{self.bucket_name}/{self.project.version}/'
        else:
            return f's3://{self.bucket_name}/{self.project.slug}/{self.project.version}/'

Then in the template file we can simply write:

              <pre class="shell-command">aws s3 sync {{ project.aws.s3_uri }} DESTINATION</pre>

@Chrystinne Chrystinne changed the title AWS S3 sync command [WIP] AWS S3 sync command Nov 30, 2023
@Chrystinne
Copy link
Contributor Author

Thanks, @bemoody!

@Chrystinne Chrystinne changed the title [WIP] AWS S3 sync command AWS S3 sync command Dec 2, 2023
@bemoody
Copy link
Collaborator

bemoody commented Dec 4, 2023

Thanks! But please don't make changes in unrelated files (physionet-django/console/templates/console/manage_published_project.html). Please make that change in a separate pull request.

@bemoody bemoody merged commit 38e0408 into dev Dec 5, 2023
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants