Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
WIP: stream fallback #8080
Conversation
| }, | ||
| } | ||
| - items, resolveInfo, err := simplestreams.GetMetadata(sources, params) | ||
| + if len(cons.Streams) > 0 { | ||
| + params.ValueParams.MirrorContentId = ToolsContentId(cons.Streams[0]) |
babbageclunk
Nov 15, 2017
Member
I'm a bit unsure about this part. It feels odd to rely on the knowledge that the first stream will be the one we're officially on.
wallyworld
Nov 15, 2017
Owner
It's not - the there will potentially be multiple mirror content ids. The one to use will coincide with the agent binary index actually used.
babbageclunk
Nov 15, 2017
Member
You mean it's not right? So does that mean that ValueParams.MirrorContentId needs to be a []string as well? Or hmm, I guess it needs to be a func that takes the stream name and returns the corresponding content id?
| @@ -99,18 +99,21 @@ func Fetch( | ||
| ValueTemplate: Metadata{}, | ||
| }, | ||
| } | ||
| - items, resolveInfo, err := simplestreams.GetMetadata(src, params) | ||
| + results, err := simplestreams.GetMetadata(src, params) |
wallyworld
Nov 15, 2017
Owner
GetMetadata should return NotFound if len(results) == 0
This simplifies all of the call sites to not require a separate error check
| + if len(results) < 1 { | ||
| + return nil, nil, errors.NotFoundf("simplestreams metadata results") | ||
| + } | ||
| + md := make([]*Metadata, len(results[0].Items)) |
babbageclunk
Nov 15, 2017
Member
In image downloads? We'll never pass UseAllSources=true here, why iterate through the results?
| + ids := make([]string, 0, nrArches*nrSeries*nrStreams) | ||
| + for _, stream := range streams { | ||
| + stream = idStream(stream) | ||
| + for _, arch := range ic.Arches { |
babbageclunk
Nov 15, 2017
Member
Do you mean pull the arch and ser loops into a local func? Why do that? (I guess it would reduce rightward drift?)
| +// onlySigned is false and no signed metadata is found in a source, | ||
| +// the source is used to look for unsigned metadata. Each source is | ||
| +// tried in turn - if AllResults is false then the results from the | ||
| +// first signed (or unsigned) match are returned. If AllResults is |
| + | ||
| + streams := []string{stream} | ||
| + if fallback { | ||
| + streams = streamFallbacks[stream] |
wallyworld
Nov 15, 2017
Owner
if they pass in a stream that's not in fallbacks, we need to just use that
babbageclunk commentedNov 15, 2017
Work in progress The stream fallback is done, but searching for agents across multiple datasources isn't yet.
Description of change
If someone bootstraps with a beta or with an explicitly set devel stream, we weren't then considering released agent binaries as possible candidates for upgrades (because they are on the released stream).
Change the metadata lookup so that we check the released stream if a controller is on the devel stream.
Similarly, if someone has configured an agent source, we should still be able to check the cloud datasource and the public streams for better binary versions.
QA steps
Bootstrap a controller with 2.2-beta3 (using a released 2.2 binary). Then run
juju upgrade-juju -m controller. The controller should be upgraded to 2.2.6.Documentation changes
It's possible this needs documentation? I couldn't find any documentation for how we find agent binaries in streams, but if there is we should add a mention of the fallback to it.