Migrate relations #4487

Merged
merged 13 commits into from Feb 22, 2016

Conversation

Projects
None yet
3 participants
Owner

howbazaar commented Feb 21, 2016

Export and import relations.

state/migration/interfaces.go
+ AddEndpoint(EndpointArgs) Endpoint
+}
+
+// Endpoint represents one end of a relation. A named end-point provided
@mjs

mjs Feb 22, 2016

Contributor

"A named endpoint is provided..." perhaps?

@@ -29,13 +30,14 @@ type ModelArgs struct {
func NewModel(args ModelArgs) Model {
m := &model{
Version: 1,
- Owner_: args.Owner.Canonical(),
+ Owner_: args.Owner.Id(),
@mjs

mjs Feb 22, 2016

Contributor

Why this change?

@howbazaar

howbazaar Feb 22, 2016

Owner

Because an empty tag does not result in an empty Canonical strings, but "@Local", which isn't useful.

I was wanting to test for an empty owner in the validation.

state/migration/model.go
+
+ // Make sure that for each endpoint in each relation has settings for all
+ // units of that service.
+ for _, relation := range m.Relations_.Relations_ {
@mjs

mjs Feb 22, 2016

Contributor

This is big and ugly enough that perhaps it should be in it's own method.

state/migration/model_test.go
+ LeadershipSettings: map[string]interface{}{},
+ })
+ service.SetStatus(minimalStatusArgs())
+ machineId := 0
@mjs

mjs Feb 22, 2016

Contributor

Aren't i and machineId basically the same? Maybe call the loop variable machineId?

@howbazaar

howbazaar Feb 22, 2016

Owner

Yeah... but it feels weird using the machineId as a unit number.

state/migration_import.go
@@ -87,6 +90,9 @@ type importer struct {
dbModel *Model
model migration.Model
logger loggo.Logger
+ // serviceUnits is populate at the end of loading the services, and is a map
@mjs

mjs Feb 22, 2016

Contributor

populated

Contributor

mjs commented Feb 22, 2016

Ship It (with some minor fixes)

Owner

howbazaar commented Feb 22, 2016

$$merge$$

Contributor

jujubot commented Feb 22, 2016

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

jujubot added a commit that referenced this pull request Feb 22, 2016

Merge pull request #4487 from howbazaar/migrate-relations
Migrate relations

Export and import relations.

@jujubot jujubot merged commit c710248 into juju:model-migration Feb 22, 2016

@howbazaar howbazaar deleted the howbazaar:migrate-relations branch Feb 22, 2016

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