Skip to content

Commit

Permalink
Update CreateInstanceKey to use tags.
Browse files Browse the repository at this point in the history
Use Application and Model tags as args to ensure content and order.
  • Loading branch information
hmlanigan committed Oct 8, 2021
1 parent 1990ea5 commit 1a97e13
Show file tree
Hide file tree
Showing 9 changed files with 179 additions and 142 deletions.
2 changes: 1 addition & 1 deletion apiserver/facades/client/application/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -1489,7 +1489,7 @@ func (api *APIBase) GetCharmURLOrigin(args params.ApplicationGet) (params.CharmU
return result, nil
}
result.Origin = makeParamsCharmOrigin(chOrigin)
result.Origin.InstanceKey = charmhub.CreateInstanceKey(api.model.UUID(), args.ApplicationName)
result.Origin.InstanceKey = charmhub.CreateInstanceKey(oneApplication.ApplicationTag(), api.model.ModelTag())
return result, nil
}

Expand Down
2 changes: 1 addition & 1 deletion apiserver/facades/client/application/application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ func (s *applicationSuite) TestApplicationGetCharmURLOrigin(c *gc.C) {
Architecture: "amd64",
OS: "ubuntu",
Series: "focal",
InstanceKey: charmhub.CreateInstanceKey(s.Model.UUID(), app.Name()),
InstanceKey: charmhub.CreateInstanceKey(app.ApplicationTag(), s.Model.ModelTag()),
})
}

Expand Down
1 change: 1 addition & 0 deletions apiserver/facades/client/application/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ type Application interface {
AddUnit(state.AddUnitParams) (Unit, error)
AllUnits() ([]Unit, error)
ApplicationConfig() (application.ConfigAttributes, error)
ApplicationTag() names.ApplicationTag
Charm() (Charm, bool, error)
CharmURL() (*charm.URL, bool)
Channel() csparams.Channel
Expand Down
Loading

0 comments on commit 1a97e13

Please sign in to comment.