When running autoinstalls, the source model will be marked configured
automatically after apply_autoinstall_config has run. The selected
source will be the one described in the autoinstall section or will
default to the legacy server entry: Ubuntu Server.
Doing an additional POST request can only make things inconsistent in
fully automated installs.
When the POST request is handled, most of the models may already have
applied their autoinstall configuration, and are already relying on the
previous source selected.
mirror: bail if source changes after applying autoinstall config
If the source model changes, the mirror model gets a chance to apply a
new apt configuration. However, if this happens during an automated
install, this is a recipe to disaster.
Make sure we raise an exception if a POST request to /source occurs
after the mirror model has started applying its autoinstall
configuration.
mirror: avoid assertion error if the source changes at the wrong time
When the source model changes, the mirror model gets notified and
replaces the "apt configurer" instance with a new one. If this happens
in the middle of a "deploy apt configuration + run apt-get update"
operation, this leads to an assertion error.
Fixed by making sure we do the entire operation on the same "apt
configurer" instance.