Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request juju#18533 from Aflynn50/resource-state-methods
juju#18533 This change adds several domain methods to the resources domain. It adds: - StoreResource - StoreResourceAndIncrementCharmModifiedVersion - OpenResource - SetApplicationResource - SetUnitResource (this one already existed but its behvaiour changes a lot) These methods complete the foundation of the resource domain. These methods differ from their state counterparts in several ways. In state, most equivilents of these methods also returned the resource record, even if they were only setting a resource. Here they do not. They are designed to each do only one thing, the thing that their name describes. In state there was an OpenResource and OpenResourceForUniter. This seperate method also set the unit resource doc. In the new domain methods, this linking should be done via the SetUnitResource instead. In state, the SetResource method did several things. It has now been factored out into the StoreResource, StoreResourceAndIncremenetCharmModifiedVersion and SetApplicationResource. This is to make it clearer what each method does. > [!NOTE] > As a flyby, make the verbiage in resource domain errors consistent. <!-- The PR title should match: <type>(optional <scope>): <description>. Please also ensure all commits in this PR comply with our conventional commits specification: https://github.com/juju/juju/blob/main/doc/conventional-commits.md --> <!-- Why this change is needed and what it does. --> ## Checklist <!-- If an item is not applicable, use `~strikethrough~`. --> - [x] Code style: imports ordered, good names, simple structure, etc - [x] Comments saying why design decisions were made - [x] Go unit tests, with comments saying what you're testing - [ ] [Integration tests](https://github.com/juju/juju/tree/main/tests), with comments saying what you're testing - [x] [doc.go](https://discourse.charmhub.io/t/readme-in-packages/451) added or updated in changed packages ## QA steps Run unit tests, none of this has been wired up yet. <!-- Describe steps to verify that the change works. If you're changing any of the facades, you need to ensure that you've tested a model migration from 3.6 to 4.0 and from 4.0 to 4.0. The following steps are a good starting point: 1. Bootstrap a 3.6 controller and deploy a charm. ```sh $ juju bootstrap lxd src36 $ juju add-model moveme1 $ juju deploy juju-qa-test ``` 2. Bootstrap a 4.0 controller with the changes and migrate the model. ```sh $ juju bootstrap lxd dst40 $ juju migrate src36:moveme1 dst40 $ juju add-unit juju-qa-test ``` 3. Verify no errors exist in the model logs for the agents. If there are errors, this is a bug and should be fixed before merging. The fix can either be applied to the 4.0 branch (preferable) or the 3.6 branch, though that needs to be discussed with the team. ```sh $ juju debug-log -m dst40:controller $ juju debug-log -m dst40:moveme1 ``` 4. We also need to test a model migration from 4.0 to 4.0. ```sh $ juju bootstrap lxd src40 $ juju add-model moveme2 $ juju deploy juju-qa-test ``` ```sh $ juju migrate src40:moveme2 dst40 $ juju add-unit juju-qa-test ``` 5. Verify that there are no errors in the controller or model logs. ```sh $ juju debug-log -m dst40:controller $ juju debug-log -m dst40:moveme2 ``` --> ## Links <!-- Link to all relevant specification, documentation, bug, issue or JIRA card. --> **Jira card:** [JUJU-6397](https://warthogs.atlassian.net/browse/JUJU-6397) [JUJU-6397]: https://warthogs.atlassian.net/browse/JUJU-6397?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
- Loading branch information