Skip to content

Revert "Remove usage of deprecated django storage settings (#581)"#600

Merged
decko merged 1 commit intomainfrom
revert_new_storage_config
Jul 24, 2025
Merged

Revert "Remove usage of deprecated django storage settings (#581)"#600
decko merged 1 commit intomainfrom
revert_new_storage_config

Conversation

@decko
Copy link
Member

@decko decko commented Jul 24, 2025

This reverts commit 7775beb.

Summary by Sourcery

Revert the removal of deprecated Django storage settings by updating the ClowdApp deployment manifest to use direct AWS_* environment variables, streamlining S3 configuration, and renaming Pulp storage-related variables.

Enhancements:

  • Replace the STORAGES dictionary with AWS_S3_* environment variables and DEFAULT_FILE_STORAGE in clowdapp.yaml
  • Update the storage initialization script to use settings.AWS_* attributes instead of settings.storages.default.options
  • Rename Pulp storage environment variables from PULP_STORAGES__* to PULP_AWS_* naming and introduce PULP_S3_USE_SIGV4 parameter

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jul 24, 2025

Reviewer's Guide

This PR reverts the prior removal of deprecated Django storage settings by restoring AWS_* environment variable mappings in deploy configurations, updating the domain storage script to use AWS_* attributes, and renaming related PULP environment variables and parameters accordingly.

Class diagram for reverted Django storage settings usage

classDiagram
    class settings {
        +AWS_S3_ENDPOINT_URL
        +AWS_S3_REGION_NAME
        +AWS_ACCESS_KEY_ID
        +AWS_SECRET_ACCESS_KEY
        +AWS_STORAGE_BUCKET_NAME
        +AWS_DEFAULT_ACL
        +S3_USE_SIGV4
        +AWS_S3_SIGNATURE_VERSION
        +AWS_S3_ADDRESSING_STYLE
        +DEFAULT_FILE_STORAGE
    }
    %% Previously, settings.storages.default.options was used
    class storages_default_options {
        +endpoint_url
        +region_name
        +access_key
        +secret_key
        +bucket_name
        +default_acl
        +signature_version
        +addressing_style
    }
    settings <|-- storages_default_options : (previous usage)
    %% Now, direct AWS_* attributes are used in settings
    %% The diagram shows the reverted structure
Loading

Class diagram for domain-storage-script config (reverted)

classDiagram
    class settings {
        +AWS_ACCESS_KEY_ID
        +AWS_SECRET_ACCESS_KEY
        +AWS_STORAGE_BUCKET_NAME
    }
    class domain_storage_script {
        +config : str
        +print(config)
    }
    settings <.. domain_storage_script : uses
    %% The script now directly accesses AWS_* attributes from settings
Loading

File-Level Changes

Change Details Files
Domain storage script now uses AWS_* settings attributes
  • Import django.conf.settings as alias s instead of accessing settings.storages.default
  • Replace settings.storages.default.options fields with AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_STORAGE_BUCKET_NAME
deploy/clowdapp.yaml
Replaced nested STORAGES block with individual AWS_* environment variables
  • Removed STORAGES dict and its OPTIONS/BACKEND definitions
  • Added AWS_S3_ENDPOINT_URL, AWS_S3_REGION_NAME, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_STORAGE_BUCKET_NAME, AWS_DEFAULT_ACL, S3_USE_SIGV4, AWS_S3_SIGNATURE_VERSION, AWS_S3_ADDRESSING_STYLE, DEFAULT_FILE_STORAGE
deploy/clowdapp.yaml
Renamed PULP storage-related environment variables to AWS_* conventions
  • Replaced PULP_STORAGES__default__OPTIONS__* and PULP_STORAGES__default__BACKEND with PULP_AWS_* and PULP_DEFAULT_FILE_STORAGE
  • Introduced PULP_S3_USE_SIGV4 alongside signature version and addressing style variables
deploy/clowdapp.yaml
Added new PULP_S3_USE_SIGV4 parameter
  • Defined PULP_S3_USE_SIGV4 with description and default value "true"
deploy/clowdapp.yaml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @decko - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `deploy/clowdapp.yaml:134` </location>
<code_context>
+      AWS_ACCESS_KEY_ID = '$S3_ACCESS_KEY_ID'
+      AWS_SECRET_ACCESS_KEY = '$S3_SECRET_ACCESS_KEY'
+      AWS_STORAGE_BUCKET_NAME = '$S3_BUCKET_NAME'
+      AWS_DEFAULT_ACL = "@none None"
+      S3_USE_SIGV4 = True
+      AWS_S3_SIGNATURE_VERSION = "s3v4"
+      AWS_S3_ADDRESSING_STYLE = "path"
</code_context>

<issue_to_address>
The value '@none None' for AWS_DEFAULT_ACL is non-standard and may not be recognized by boto3 or Django-Storages.

Use standard values like 'private', 'public-read', or None (without quotes) for AWS_DEFAULT_ACL. '@none None' may cause errors. Refer to the storage backend documentation for correct configuration.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
      AWS_DEFAULT_ACL = "@none None"
=======
      AWS_DEFAULT_ACL = None
>>>>>>> REPLACE

</suggested_fix>

### Comment 2
<location> `deploy/clowdapp.yaml:130` </location>
<code_context>
-          },
-      }
+      AWS_S3_ENDPOINT_URL = "http://${S3_HOSTNAME}:9000"
+      AWS_S3_REGION_NAME = "east"
+      AWS_ACCESS_KEY_ID = '$S3_ACCESS_KEY_ID'
+      AWS_SECRET_ACCESS_KEY = '$S3_SECRET_ACCESS_KEY'
+      AWS_STORAGE_BUCKET_NAME = '$S3_BUCKET_NAME'
</code_context>

<issue_to_address>
The region name is set to 'east', which is not a valid AWS region.

Consider using a standard AWS region name (e.g., 'us-east-1') or clarify if 'east' is intended for a local or mock service to prevent confusion and potential connection issues.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

AWS_ACCESS_KEY_ID = '$S3_ACCESS_KEY_ID'
AWS_SECRET_ACCESS_KEY = '$S3_SECRET_ACCESS_KEY'
AWS_STORAGE_BUCKET_NAME = '$S3_BUCKET_NAME'
AWS_DEFAULT_ACL = "@none None"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): The value '@none None' for AWS_DEFAULT_ACL is non-standard and may not be recognized by boto3 or Django-Storages.

Use standard values like 'private', 'public-read', or None (without quotes) for AWS_DEFAULT_ACL. '@none None' may cause errors. Refer to the storage backend documentation for correct configuration.

Suggested change
AWS_DEFAULT_ACL = "@none None"
AWS_DEFAULT_ACL = None

Comment on lines +130 to +131
AWS_S3_REGION_NAME = "east"
AWS_ACCESS_KEY_ID = '$S3_ACCESS_KEY_ID'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): The region name is set to 'east', which is not a valid AWS region.

Consider using a standard AWS region name (e.g., 'us-east-1') or clarify if 'east' is intended for a local or mock service to prevent confusion and potential connection issues.

@decko decko merged commit 90373d9 into main Jul 24, 2025
2 of 3 checks passed
@decko decko deleted the revert_new_storage_config branch July 24, 2025 23:59
decko added a commit that referenced this pull request Jul 25, 2025
decko added a commit that referenced this pull request Jul 28, 2025
* Reapply "Remove usage of deprecated django storage settings (#581)" (#600)

This reverts commit 90373d9.

* Update region_name

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>

---------

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
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.

1 participant