When running an autoinstallation with no ssh: field (which is valid),
the output autoinstall-user-data file would end up with None for the
key ssh:authorized-keys, as shown below:
ssh:
authorized-keys: null
Unfortunately, null is not a valid value according to the schema (which
expects a string).
Fixed by initializing the authorized_keys variable to [] instead of None
so that it yields an empty list instead of null when no autoinstall data
is loaded.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
If no UA token is provided, the UbuntuAdvantageController will generate
autoinstall data that contains an empty string:
ubuntu-advantage:
token: ""
Unfortunately, this is not valid according to the JSON schema.
Fixed by not returning a token: key if the token is an empty string.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
The script can be used to validate autoinstall user data against the
schema. By default, it expects a #cloud-config header and the user-data
to be under the autoinstall: key.
By passing the --no-expect-cloudconfig, it validates the data directly.
We can use this option to validate the YAML files under
examples/autoinstall-*.yaml
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
When running an autoinstallation with only “network” as an interactive
section, the installation hanged after the following steps:
finalizing installation
running 'curtin hook'
curtin command hook
executing late commands
where in normal conditions, the next step is:
final system configuration
Also, querying the meta/status endpoint at this point shows that the app
is in POST_WAIT state.
The problem is:
the network model is declared as both an “install” model and a
“postinstall” model (it is the only one we have AFAIK)
when calling .configured() for a given model, we only trigger /at max/
one event. Either:
* install_event (if the model is an “install” model - and it is the
last one configured)
* postinstall_event (if the model is a “postinstall” model but not an
“install” model - and it is the last one configured)
* no event (as in most cases)
So when we call .configured() for the network model, we /can/ trigger
the install_event but can never trigger the postinstall event.
Therefore Subiquity, will wait forever until something triggers the
postinstall_event
Fixed by accepting to trigger the install_event and the
postinstall_event in a single call to .configured.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Passing --use-fuse to scripts/kvm-test.py allows to run as non-root.
It requires installation of the package fuseiso so the switch is
disabled by default.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Tests in real WSL2 environment revealed that update-locale checks fails but with the "--no-checks" option it updates the locale files accordingly and when the image restarts the locale is correctly set.
When comparing two snap versions that meet the following conditions, a
TypeError was raised:
* a.major == b.major
* a.minor == b.minor
* a.git_build_id is None and b.git_build_id is None
Fixed by first converting the git_build_id of both variables to a float
before comapring them.
Also added a unit-test to cover this scenario.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Since 06ac3f92, we invoke kvm directly through subprocess.run.
Therefore, we must not add extra quotes around the -append options,
otherwise they persist and are passed in the kernel command line:
$ cat /proc/cmdline
"autoinstall subiquity-channel=stable" initrd=initrd
Later on, we fail to parse "autoinstall" and "subiquity-channel=stable"
as two distinct options.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
The function drive() used to return a string in the following format:
"-drive file=/path/to/iso,..."
However, qemu/kvm expects "-drive" to be an argument and
"file=/path/to/iso,..." to be another argument.
The command was constructed as below since the beginning:
kvm = [
"kvm",
"-cdrom", "custom.iso", # <- OK
"-drive file=/path/to/iso,...", # <- NOK
]
Before 06ac3f92, we would join all the arguments using spaces before
executing the kvm command. Therefore we would luckily end up with a
correct command:
" ".join(kvm) -> "kvm -cdrom custom.iso -drive file=/path/to/iso,..."
However, now that we supply the command to subprocess.run directly, the
problem shows up.
Fixed by returning a tuple("-drive", "file=/path/to/iso,...") from
the drive() function.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
* select the relevant button by default when applicable
* make the list of services scroll properly
* add empty lines consistently
* mention that services can be enabled through `ua` (after installation)
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
The UAClientUAInterfaceStrategy can now optionally be initialized with
the path to the ubuntu-advantage entry point. Additionally, one can also
specify which Python interpreter should run it.
We leverage on this to force the use of:
* the Python installation from the Subiquity snap
* the ubuntu-advantage-tools integrated to the Subiquity snap
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>