Comment 2 for bug 1857468

Revision history for this message
Scott Moser (smoser) wrote : Re: Unable to set Apt config parameter during maas-enlisting-node phase

The first question/easiest answer is:
   Why is your mirror misbehaving / Fix your mirror.

You can pass apt options to cloud-init via apt_configure module
  https://cloudinit.readthedocs.io/en/latest/topics/modules.html#apt-configure

The apt flag that you're requesting (--allow-releaseinfo-change) says
that it is applied via config in apt_preferences(5) configuration
item: Acquire::AllowReleaseInfoChange.

Cloud-init does not have configuration syntax to modify apt_preferences(5).
Unfortunately it does not look like you can configure this in apt.conf.d.

write_files could be used to write a file into /etc/apt/preferences.d/
with the desired configuration.
https://cloudinit.readthedocs.io/en/latest/topics/modules.html#write-files

So, if you can convince MAAS to send cloud-config with something like the
following, then you'd be good.

    #cloud-config
    write_files:
     - path: /etc/apt/preferences.d/your.conf
       content: |
          Acquire::AllowReleaseInfoChange = yes

In order to accomplish this, you need either:

 a.) support in maas for generic user-supplied cloud-config to enlistment
environment where you could just use write_files.
 b.) specific support in maas for 'apt-preferences' configuration to the
enlistment environment and also changes to cloud-init to expose
'apt-preferences' configuration.

Both of these require some change in MAAS (or just answering "here is how you do 'a'" above.