updateSeriesVersions() gets called too late in the initialization process
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
juju-core |
New
|
Undecided
|
Unassigned |
Bug Description
Juju uses internal table of known ubuntu releases which is called 'ubuntuSeries'
version/
var ubuntuSeries = map[string]string{
"precise": "12.04",
<...>
"utopic": "14.10",
"vivid": "15.04",
}
This table is used to convert 'VERSION_ID' (e.g. '15.04') provided by /etc/os-release into series name (e.g. 'vivid)
version/
func readSeries() (string, error) {
<....>
switch values["ID"] {
case strings.
<....>
}
}
List of known ubuntu releases might be outdated.
To deal with that Juju tries to update this list against /usr/share/
This happens inside updateDistroInfo() which is called by updateSeriesVer
Unfortunately, 'ubuntuSeries' table seems to be first accessed *before* it gets updated agains ubuntu.csv file.
Let's reproduce the situation when ubuntuSeries list is outdated.
To do that we 'create' an aditional ubuntu release which is not available at ubuntuSeries list.
I call it 'Whacky Worm' because it seems to be the official name of the next release.
Caution!
Following commands may do some damage to your machine.
Please backup files you plan to change or run these commands on a cloud instance you can recreate easily.
$ sudo tee -a /usr/share/
15.10,Whacky Worm,whacky,
EOF
$ sudo tee /etc/os-release << EOF
NAME="Ubuntu"
VERSION="15.10 (Whacky Worm)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu Whacky Worm"
VERSION_ID="15.10"
HOME_URL="http://
SUPPORT_URL="http://
BUG_REPORT_URL="http://
EOF
$ sudo tee /etc/lsb-release << EOF
DISTRIB_ID=Ubuntu
DISTRIB_
DISTRIB_
DISTRIB_
EOF
Our machine pretends to run 15.10 now (at least from Juju's standpoint because it reads only these files to identify release).
$ juju version
panic: osVersion reported an error: Could not determine series
This happens because 'VERSION_ID' from /etc/os-release identifies release as '15.10' but hardcoded 'ubuntuSeries' table doesn't contain this entry.
We added information about '15.10' to /usr/share/
To force Juju to update 'ubuntuSeries' table earlier I added a call to updateSeriesVer
--- a/version/
+++ b/version/
@@ -72,16 +72,17 @@ func getValue(from map[string]string, val string) (string, error) {
return "unknown", errors.New("Could not determine series")
}
func readSeries() (string, error) {
values, err := readOSRelease()
if err != nil {
}
+ updateSeriesVer
switch values["ID"] {
case strings.
case strings.
default:
}
With this change our issue disappears:
$ juju version
1.24-alpha1-