Migration fails with different metadata name to charm URL name

Bug #1921722 reported by Simon Richardson
6
This bug affects 1 person
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://jaas.ai/u/logrotate-charmers/logrotate-charm/5 the name for the charm in the URL is "logrotate-charm", but the metadata name is "logrotated".

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-charmers/logrotate-charm-5 unexpectedly assigned cs:~logrotate-charmers/logrotated-5

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!

Revision history for this message
Simon Richardson (simonrichardson) wrote :
Changed in juju:
milestone: none → 2.9-rc8
status: Triaged → In Progress
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
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.