When running the unit tests after introducing a new one in the previous commit, the following error appeared:
subiquity/subiquity/common/resources.py:36: ResourceWarning: unclosed file <_io.TextIOWrapper name='./users-and-groups' mode='r' encoding='UTF-8'>
groups = open(users_and_groups_path).read().split()
ResourceWarning: Enable tracemalloc to get the object allocation traceback
This commit replaces a bare open() call with a context manager.
The test case validates the following:
* Main user from subiquity config + secondary users from cloud-init userdata are merged into the same list and in the
correct order
* "users" section in cloud-init userdata is still present even if the main user is not defined
The current merge_config() function from curtin does not merge lists in any way, but overwrites them. This is generally
a good idea, but in case of user-data we may want to merge lists instead.
One of the possible use cases is defining the main user in the "identity" section, and some extra users in the
user-data "users" section.
Before, the user defined in the "identity" section overwrote any users defined in user-data. With this change, the user
list can now be automatically merged, with user-data having lower priority than autoinstall configuration.
An example of such a configuration:
#cloud-config
autoinstall:
version: 1
...
identity:
hostname: testname
realname: Real Name
username: someuser
password: "$6$..."
user-data:
users:
- name: extrauser
gecos: Extra User
ssh_authorized_keys:
- "ssh-ed25519 AAAA..."
shell: /bin/bash
- With 'prefill' working, calling Powershell to find Windows locale
is not required anymore.
- Since `f21986be` subiquity's default locale controller respects
mode.selected_language initialization.
- Init method changed to accept that data, which could be None.
- If valid, user Identity and Locale are prepopulated.
- Server parses the YAML and send valid info (or None) to the Model.
- This is just a preparation for a feature which affects system_setup.
- The proposed change enables locale controller to respect the model
selected_language if initialized before LocaleController.start().
- This will be used in the feature which will allow prefilling
installation UI screens during WSL installation with information
acquired from Windows environment.
Fix several warnings of the form:
subiquity/common/errorreport.py:83
DeprecationWarning: The usage of `cmp` is deprecated and will be
removed on or after 2021-06-01.
Please use `eq` and `order` instead.
See https://www.attrs.org/en/stable/changelog.html?highlight=cmp#id76
Minimum version needed for this is 19.2.0 of attrs, and focal has 19.3.
Fix warning:
subiquity/common/api/tests/test_server.py:45
PytestCollectionWarning: cannot collect test class
'TestControllerBase' because it has a __init__ constructor
Fix warning:
subiquitycore/tests/test_view.py:24
subiquity/subiquitycore/tests/test_view.py:24:
PytestCollectionWarning: cannot collect test class 'TestStretchy'
because it has a __init__ constructor
If no disk found was large enough for guided autoinstall, catch that
case and report it. Without this, we get a rather unhelpful error:
FAIL: 'NoneType' object has no attribute 'grub_device'
Leave current grub_device on Partiton and change nothing about it.
Add boot as an intended replacement for grub_device usage which is an
all-in-one check for the partition being the correct type of boot
partition, of which grub_device is just one scenario.