fix: move parse_storage_constraints to the bundle deployer#1105
Merged
fix: move parse_storage_constraints to the bundle deployer#1105
Conversation
|
+1. This is breaking our test in OpenSearch. The issue can also be solved by explicitly converting the constraints to their |
9defd9d to
518657f
Compare
dimaqq
approved these changes
Oct 15, 2024
Contributor
dimaqq
left a comment
There was a problem hiding this comment.
LGTM, but I'd appreciate a review from someone on the Juju team.
wallyworld
reviewed
Oct 15, 2024
Member
wallyworld
left a comment
There was a problem hiding this comment.
Looks good but I'd like to see a little extra validation and test coverage.
jujubot
added a commit
that referenced
this pull request
Oct 16, 2024
…pe-hint-constraints #1159 #### Description While looking into #1105, I found it useful to type annotate `juju/constraints.py` while figuring out how things work. #### QA Steps There should be no runtime changes in behaviour. Unit and integration tests should continue to pass, especially `tests/unit/test_constraints.py`. #### Notes & Discussion I also broke the longer regexes down across multiple lines and added comments to help me understand them. I don't mind cutting this PR back to use more minimal type annotations, etc if that's deemed more appropriate in review (e.g. Dict[str, Union[int, float, bool]] instead of the custom TypedDicts).
It seems a previous change for allow bundle storage constraints was done at the wrong level and affected regualr storage constraints as well. This fix moves the previous change to only affect bunlde storage constraints.
4e45bc9 to
6ad2da9
Compare
6ad2da9 to
04f9a1d
Compare
Contributor
|
/merge |
jujubot
added a commit
that referenced
this pull request
Nov 26, 2024
…fy-handling-of-storage-constraints-in-deploy #1213 #### Description This PR unifies storage constraint parsing into a single method (`juju.constraints.parse_storage_constraints`), which is called in a single place (`juju.model.Model._deploy`), allowing both bundle and model deployments to specify storage constraints using either the [juju storage constraint directive format](https://juju.is/docs/juju/storage-constraint) (e.g. `{'label': 'ebs,100G'}`) or pre-parsed dictionaries (e.g. `{'label': {'count': 1, 'pool': 'ebs', 'size': 102400}`). #### QA Steps Unit tests have been updated to reflect the new parsing location. Integration tests have been added to verify that model deployment can request storage using either format. The existing bundle integration tests should continue to pass. #### Notes & Discussion This PR resolves the issues with storage constraint parsing identified in: - #1052 - #1075 #1052 was initially addressed in #1053, which was included in the [3.5.2.0](https://github.com/juju/python-libjuju/releases/tag/3.5.2.0) release. This allowed bundle deployments (using `juju.bundle.AddApplicationChange.run`) to correctly handle storage constraints specified as strings in the [juju storage constraint directive format](https://juju.is/docs/juju/storage-constraint). Unfortunately, this erroneously required that model deployments (using `juju.model.Model.deploy`) also use this string format, instead of the parsed dictionary format that was previously accepted. This was noticed in #1075 and initially fixed in #1105, which was merged into `main` but never released. This fix moved parsing of storage constraint strings to bundle deployment exclusively. Due to the interim period in which `3.5.2` has (incorrectly) required model deployments to use the string format, I think the best fix at this point is to allow both bundle deployments and model deployments to use either format, and parse them into the parsed dictionary format in a single place in `juju.model.Model._deploy` (the private method called by both bundle and model deployments). After merging, let's look at getting these changes out in a `3.5.2.2` bugfix release.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It seems a previous change for allow bundle storage constraints was done at the wrong level and affected regular storage constraints as well. This fix moves the previous change to only affect bundle storage constraints.
QA Steps
TODO