Specifying a mirror URI and no template directs curtin to load the on-disk /etc/apt/sources.list file to be used as the template. The process of turning the apt/sources.list contents into a template uses curtin's default mirror values:
which include a trailing slash for the mirror value.
Curtin then attempts to match the primary mirror url in the apt/sources.list file and if found, will replace the url with the literal string: $MIRROR which will then later get replaced with the uri value specifed in the yaml.
Since curtin's default primary mirror url included the trailing slash, but the trusty apt/sources.list did not, curtin failed to create a template file which would inject the supplied value.
The fix in the proposed branch relaxes the trailing slash restriction to handle the specific case where the on-disk sources.list is missing a trailing slash.
To document my understanding of what happened:
Specifying a mirror URI and no template directs curtin to load the on-disk /etc/apt/ sources. list file to be used as the template. The process of turning the apt/sources.list contents into a template uses curtin's default mirror values:
# Default archive mirrors ARCH_MIRRORS = {"PRIMARY": "http:// archive. ubuntu. com/ubuntu/",
"SECURITY" : "http:// security. ubuntu. com/ubuntu/"}
PRIMARY_
which include a trailing slash for the mirror value.
Curtin then attempts to match the primary mirror url in the apt/sources.list file and if found, will replace the url with the literal string: $MIRROR which will then later get replaced with the uri value specifed in the yaml.
Since curtin's default primary mirror url included the trailing slash, but the trusty apt/sources.list did not, curtin failed to create a template file which would inject the supplied value.
The fix in the proposed branch relaxes the trailing slash restriction to handle the specific case where the on-disk sources.list is missing a trailing slash.