Migration fails with different metadata name to charm URL name
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Canonical Juju |
Fix Released
|
Medium
|
Simon Richardson |
Bug Description
Migration fails when attempting to upload a charm with a different name in the URL that in the metadata. A real world example being: https:/
You end up with an error message like the following:
migrating: aborted, removing model from target controller: model data transfer failed, failed to migrate binaries: charm cs:~logrotate-
Notice that it thinks the charm name is "logrotated" and not "logrotate-charm".
In reality the fix for this is to update processPost in apiserver/charms.go and ensure that it doesn't take the name from the metadata yaml IF it's doing a cs: (or soon to be ch:) upload. Essentially we should be passing in the charm URL (or all it's parts) into the POST request and returning that directly if it's a migration. The URLs have to be the same otherwise the migration will fail. The check in the client is correct and prevents anything untoward happening during the request.
This is 5-7 year old code and it's clear that the "cs:" and importing code has been added. It might be worth refactoring this to ensure that the importing code is different than just the upload code.
Also interesting, the way this request code works is that you can upload a "cs:" charm and open, read and parse the charm to be only told later on in the code that we don't accept "cs:" charms when not importing!
Changed in juju: | |
milestone: | 2.9-rc8 → 2.9-rc9 |
Changed in juju: | |
assignee: | nobody → Simon Richardson (simonrichardson) |
status: | In Progress → Fix Committed |
Changed in juju: | |
status: | Fix Committed → Fix Released |
PR https:/ /github. com/juju/ juju/pull/ 12835