Migrate local charm no resource #7387

Merged
merged 4 commits into from May 27, 2017

Conversation

Projects
None yet
4 participants
Owner

howbazaar commented May 25, 2017

Description of change

If a model deployed a local charm that has resources defined, but did not define any resources for that application, the model would fail to migrate. Also a local charm with local resources would migrate one time, but fail on subsequent attempts.

This branch fixes both of those problems. Firstly, resource definitions for an application where there is no actual resource are now handled by the model import code in the state package, rather in the binary upload process where it attempted to push empty placeholders. Also validation of the resource fingerprint was loosened so it doesn't try to validate an empty string.

QA steps

Long... firstly make sure you have juju-ci-tools charms repo available, as I'm using their local charm. The resource itself is a simple index.html file that contains a string that you can validate came from the resource.

Bootstrap a controller and add two models, one for the local charm with a resource, and one with a local charm without a resource.

juju bootstrap lxd source
juju add-model resource
juju deploy ~/canonical/juju-ci-tools/repository/charms/simple-resource-http --resource index=~/sandbox/index.html
juju add-model no-resource
juju deploy ~/canonical/juju-ci-tools/repository/charms/simple-resource-http

Ensure that the resource is being used by using a web browser to look at the ip address of the machine that the app is deployed to.

Wait for the models to be fully deployed then bootstrap another controller to migrate the models to.

juju bootstrap lxd target
juju switch source
juju migrate resource target
juju migrate no-resource target

Wait for the migration to complete then ensure they are in the target controller. Add a unit to the resource model to make sure the resource is available.

juju models -c target
juju add-unit -m target:resource simple-resource-http

Ensure it is used by looking at the IP address of machine-1 from the resource model.
Now migrate the models back

juju switch target
juju migrate resource source
juju migrate no-resource source

Wait for the migration to complete, then add another unit to the resource model and check again.

juju add-unit -m source:resource simple-resource-http

Documentation changes

No docs needed, just fixing migration bugs.

Bug reference

https://bugs.launchpad.net/juju/+bug/1692610
https://bugs.launchpad.net/juju/+bug/1692646

howbazaar added some commits May 24, 2017

Have the import add pending resources rather than trying to push thro…
…ugh resource POST endpoint. Also update factory to create pending resouces for applications that use charms with resources.
api/migrationmaster/client.go
+ var fp charmresource.Fingerprint
+ if rev.FingerprintHex != "" {
+ fp, err = charmresource.ParseFingerprint(rev.FingerprintHex)
+ if err != nil {
@wallyworld

wallyworld May 25, 2017

Owner

can we inline the error check

@howbazaar

howbazaar May 25, 2017

Owner

sure, but doesn't add much

resource/resourcetesting/resource.go
@@ -1,4 +1,3 @@
-// Copyright 2016 Canonical Ltd.
@wallyworld

wallyworld May 25, 2017

Owner

This is an accident?

Owner

howbazaar commented May 25, 2017

$$merge$$

Contributor

jujubot commented May 25, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

Contributor

jujubot commented May 25, 2017

Build failed: Tests failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/10973

Owner

wallyworld commented May 25, 2017

$$merge$$

Contributor

jujubot commented May 25, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

Contributor

jujubot commented May 25, 2017

Build failed: Tests failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/10987

Owner

howbazaar commented May 25, 2017

$$merge$$

Contributor

jujubot commented May 25, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

Contributor

jujubot commented May 25, 2017

Build failed: Tests failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/10993

Owner

howbazaar commented May 25, 2017

Error: retrieving gpg key timed out.

$$try-again$$

Contributor

jujubot commented May 25, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

Contributor

jujubot commented May 25, 2017

Build failed: Tests failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/10996

Owner

howbazaar commented May 25, 2017

$$try-again$$

Contributor

jujubot commented May 25, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

Contributor

jujubot commented May 25, 2017

Build failed: Tests failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/10999

Member

axw commented May 26, 2017

$$merge$$

Contributor

jujubot commented May 26, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

Contributor

jujubot commented May 26, 2017

Build failed: Tests failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/11008

Owner

howbazaar commented May 27, 2017

$$merge$$

Contributor

jujubot commented May 27, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot jujubot merged commit 776f6f4 into juju:develop May 27, 2017

1 check passed

github-check-merge-juju Built PR, ran unit tests, and tested LXD deploy. Use !!.*!! to request another build. IE, !!build!!, !!retry!!
Details

@howbazaar howbazaar deleted the howbazaar:migrate-local-charm-no-resource branch May 27, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment