Skip to content

Commit

Permalink
Send controller UUID when checking charm revisions
Browse files Browse the repository at this point in the history
  • Loading branch information
Menno Smits committed Mar 14, 2017
1 parent 8c8aa39 commit 7063f69
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apiserver/charmrevisionupdater/updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ func retrieveLatestCharmInfo(st *state.State) ([]latestCharmInfo, error) {
if curl.Schema == "local" {
continue
}

cid := charmstore.CharmID{
URL: curl,
Channel: application.Channel(),
Expand All @@ -137,6 +136,7 @@ func retrieveLatestCharmInfo(st *state.State) ([]latestCharmInfo, error) {

metadata := map[string]string{
"environment_uuid": model.UUID(),
"controller_uuid": st.ControllerUUID(),
"cloud": model.Cloud(),
"cloud_region": model.CloudRegion(),
}
Expand Down
1 change: 1 addition & 0 deletions apiserver/charmrevisionupdater/updater_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ func (s *charmVersionSuite) TestJujuMetadataHeaderIsSent(c *gc.C) {
c.Assert(err, jc.ErrorIsNil)
expected_header := []string{
"environment_uuid=" + model.UUID(),
"controller_uuid=" + s.State.ControllerUUID(),
"cloud=" + model.Cloud(),
"cloud_region=" + model.CloudRegion(),
"provider=" + cloud.Type,
Expand Down
1 change: 1 addition & 0 deletions charmstore/latest.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func LatestCharmInfo(client Client, charms []CharmID, metadata map[string]string
revResults, err := client.LatestRevisions(charms, map[string][]string{
jujuMetadataHTTPHeader: []string{
"environment_uuid=" + metadata["environment_uuid"],
"controller_uuid=" + metadata["controller_uuid"],
"cloud=" + metadata["cloud"],
"cloud_region=" + metadata["cloud_region"],
"provider=" + metadata["provider"],
Expand Down
10 changes: 9 additions & 1 deletion charmstore/latest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,22 @@ func (s *LatestCharmInfoSuite) TestSuccess(c *gc.C) {

metadata := map[string]string{
"environment_uuid": "foouuid",
"controller_uuid": "controlleruuid",
"cloud": "foocloud",
"cloud_region": "fooregion",
"provider": "fooprovider",
}
results, err := LatestCharmInfo(client, charms, metadata)
c.Assert(err, jc.ErrorIsNil)

header := []string{"environment_uuid=foouuid", "cloud=foocloud", "cloud_region=fooregion", "provider=fooprovider", "controller_version=" + version.Current.String()}
header := []string{
"environment_uuid=foouuid",
"controller_uuid=controlleruuid",
"cloud=foocloud",
"cloud_region=fooregion",
"provider=fooprovider",
"controller_version=" + version.Current.String(),
}
s.lowLevel.stableStub.CheckCall(c, 0, "Latest", params.StableChannel, []*charm.URL{spam}, map[string][]string{"Juju-Metadata": header})
s.lowLevel.stableStub.CheckCall(c, 1, "Latest", params.StableChannel, []*charm.URL{eggs}, map[string][]string{"Juju-Metadata": header})
s.lowLevel.stableStub.CheckCall(c, 2, "Latest", params.StableChannel, []*charm.URL{ham}, map[string][]string{"Juju-Metadata": header})
Expand Down

0 comments on commit 7063f69

Please sign in to comment.