Skip to content

Commit

Permalink
Return LXD channel model setting in ContainerManagerConfig API response
Browse files Browse the repository at this point in the history
If the container type is LXD, the returned config map is augmented with
the configured channel for fetching LXD snaps for the particular model.
  • Loading branch information
achilleasa committed Apr 23, 2020
1 parent c42ffc0 commit 0909e6b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 6 additions & 4 deletions apiserver/facades/agent/provisioner/provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,15 +421,17 @@ func (api *ProvisionerAPI) ContainerManagerConfig(args params.ContainerManagerCo
cfg := make(map[string]string)
cfg[container.ConfigModelUUID] = api.st.ModelUUID()

mConfig, err := api.m.ModelConfig()
if err != nil {
return result, err
}

switch args.Type {
case instance.LXD:
cfg[config.LXDSnapChannel] = mConfig.LXDSnapChannel()
// TODO(jam): DefaultMTU needs to be handled here
}

mConfig, err := api.m.ModelConfig()
if err != nil {
return result, err
}
if url, set := mConfig.ContainerImageMetadataURL(); set {
cfg[config.ContainerImageMetadataURLKey] = url
}
Expand Down
1 change: 1 addition & 0 deletions apiserver/facades/agent/provisioner/provisioner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1842,6 +1842,7 @@ func (s *withImageMetadataSuite) TestContainerManagerConfigImageMetadata(c *gc.C
container.ConfigModelUUID: coretesting.ModelTag.Id(),
config.ContainerImageStreamKey: "daily",
config.ContainerImageMetadataURLKey: "https://images.linuxcontainers.org/",
config.LXDSnapChannel: "latest/stable",
})
}

Expand Down

0 comments on commit 0909e6b

Please sign in to comment.