Commit 99dcd1f
authored
Merge pull request #1213 from james-garner-canonical/2024-11/feat/unify-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.6 files changed
Lines changed: 148 additions & 132 deletions
File tree
- juju
- tests
- integration
- unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | | - | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | | - | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
| |||
599 | 603 | | |
600 | 604 | | |
601 | 605 | | |
602 | | - | |
| 606 | + | |
| 607 | + | |
603 | 608 | | |
604 | 609 | | |
605 | 610 | | |
| |||
610 | 615 | | |
611 | 616 | | |
612 | 617 | | |
613 | | - | |
| 618 | + | |
614 | 619 | | |
615 | 620 | | |
616 | 621 | | |
| |||
627 | 632 | | |
628 | 633 | | |
629 | 634 | | |
630 | | - | |
| 635 | + | |
| 636 | + | |
631 | 637 | | |
632 | 638 | | |
633 | 639 | | |
| |||
637 | 643 | | |
638 | 644 | | |
639 | 645 | | |
640 | | - | |
| 646 | + | |
641 | 647 | | |
642 | | - | |
| 648 | + | |
643 | 649 | | |
644 | 650 | | |
645 | 651 | | |
| |||
676 | 682 | | |
677 | 683 | | |
678 | 684 | | |
679 | | - | |
| 685 | + | |
680 | 686 | | |
681 | 687 | | |
682 | 688 | | |
683 | | - | |
| 689 | + | |
684 | 690 | | |
685 | 691 | | |
686 | 692 | | |
687 | 693 | | |
688 | 694 | | |
689 | 695 | | |
690 | 696 | | |
691 | | - | |
692 | | - | |
693 | | - | |
694 | | - | |
| 697 | + | |
695 | 698 | | |
696 | 699 | | |
697 | 700 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
193 | 212 | | |
194 | 213 | | |
195 | 214 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| 65 | + | |
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
| |||
1788 | 1790 | | |
1789 | 1791 | | |
1790 | 1792 | | |
1791 | | - | |
| 1793 | + | |
1792 | 1794 | | |
1793 | 1795 | | |
1794 | 1796 | | |
| |||
1813 | 1815 | | |
1814 | 1816 | | |
1815 | 1817 | | |
1816 | | - | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
1817 | 1823 | | |
1818 | 1824 | | |
1819 | 1825 | | |
| |||
1829 | 1835 | | |
1830 | 1836 | | |
1831 | 1837 | | |
1832 | | - | |
1833 | | - | |
1834 | 1838 | | |
1835 | 1839 | | |
1836 | 1840 | | |
| |||
2251 | 2255 | | |
2252 | 2256 | | |
2253 | 2257 | | |
2254 | | - | |
| 2258 | + | |
2255 | 2259 | | |
2256 | 2260 | | |
2257 | 2261 | | |
| |||
2261 | 2265 | | |
2262 | 2266 | | |
2263 | 2267 | | |
2264 | | - | |
| 2268 | + | |
| 2269 | + | |
| 2270 | + | |
| 2271 | + | |
| 2272 | + | |
| 2273 | + | |
| 2274 | + | |
| 2275 | + | |
2265 | 2276 | | |
2266 | 2277 | | |
| 2278 | + | |
| 2279 | + | |
2267 | 2280 | | |
2268 | 2281 | | |
2269 | 2282 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
48 | 84 | | |
49 | 85 | | |
50 | 86 | | |
| |||
0 commit comments