Commit Graph

4295 Commits

Author SHA1 Message Date
Didier Roche c757adce45
Merge pull request #1110 from canonical/fix_system_setup_summary_hanging
Summary page to show immediately and update once the setup is done
2021-11-03 11:01:27 +01:00
Didier Roche c74f0d464f
Merge pull request #1109 from canonical/optional_progress
Make progress controller optional.
2021-11-03 10:51:42 +01:00
Didier Roche f8e90c894d Summary page to show immediately and update once the setup is done
Shows immediately the summary page. Before, this one was making a GET
request to the server, which was stuck on any long running command in
the controller.
Now, affect correctly the identity in memory and reuse it if needed.

Show a progress message while the configuration is happening and replace
it with a "completed" text on success.

Co-authored-by: Jean-Baptiste Lallement <jean-baptiste@ubuntu.com>
2021-11-03 10:48:03 +01:00
Didier Roche 365922eb35
Merge pull request #1111 from canonical/misc_fixes_for_ci
system_setup: Many fixes for ci
2021-11-03 10:42:39 +01:00
Didier Roche fa5721ce0a Allow waiting on summary page
We previously only went on this page when DONE or in ERROR state. Allow
now to be in any state as we switch to it as soon as possible.

Co-authored-by: Jean-Baptiste Lallement <jean-baptiste@ubuntu.com>
2021-11-03 10:33:38 +01:00
Didier Roche f762f41a5b Don’t override syslog dir to prevent printing on TUI.
Co-authored-by: Jean-Baptiste Lallement <jean-baptiste@ubuntu.com>
2021-11-03 10:32:57 +01:00
Didier Roche 7cd65267e9 Fix server socket path in dry-run mode
Co-authored-by: Jean-Baptiste Lallement <jean-baptiste@ubuntu.com>
2021-11-03 10:32:11 +01:00
Didier Roche bbd0121321 Make progress controller optional.
The progress controller was already optional in
subiquity/server/controllers/cmdlist.py. However, there was one missing
place in show_progress(). Use a similar getattr strategy.
2021-11-03 10:20:58 +01:00
Didier Roche a4454c9153
Merge pull request #1106 from dbungert/workflows-jammy
workflows: +jammy
2021-11-02 15:57:01 +01:00
Dan Bungert 4c94430aab
Merge pull request #813 from Forst/merge-config
Add support for merging lists when merging user-data
2021-11-01 13:35:52 -06:00
Dan Bungert 88f88350cb
Merge pull request #1105 from CarlosNihelton/ft-prefill-deeng-85
Make subiquity server supporting prefill install files (for WSL System Setup)
2021-11-01 13:35:13 -06:00
Carlos Nihelton 1a0c3a1ef0 Prefill file checks summarized by os.path.isfile. 2021-11-01 16:20:24 -03:00
Carlos Nihelton af91bb0a6f Removing dead code.
- My bad.
2021-10-29 20:23:16 -03:00
Foster Snowhill 3d31fee2ba
common/resources: fix "ResourceWarning: unclosed file"
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.
2021-10-30 00:37:31 +02:00
Foster Snowhill 2ef5724b30
models/test_subiquity: add test for cloud-init list merging
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
2021-10-30 00:37:31 +02:00
Foster Snowhill dbf0ca2d50
models/subiquity: add support for merging lists when merging user-data
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
2021-10-30 00:37:31 +02:00
Carlos Nihelton 4c0ad44738 Moving logic form SystemSetupModel to controllers.
- In order to stay confined into system_setup,
WSLLocaleController had to be recriated.
2021-10-29 12:53:06 -03:00
Dan Bungert c30cf2d3d3 workflows: +jammy 2021-10-28 18:21:09 -06:00
Carlos Nihelton 10f209ad81 Linting issues fixed. 2021-10-28 15:54:07 -03:00
Carlos Nihelton 2125acffe6 WSL Locale controller is not needed anymore.
- 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.
2021-10-28 15:52:24 -03:00
Carlos Nihelton 168a5c13a0 SystemSetupModel handles 'prefill' data
- 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.
2021-10-28 15:52:24 -03:00
Carlos Nihelton 41a2a554ef Server CLI option '--prefill' added.
- TUI logs the args in consistency to what's been done to Flutter UI.
- Server starting code checks if prefill file exists.
2021-10-28 15:51:41 -03:00
Carlos Nihelton 7179bfb4fc Sample files for testing
Those files simulate the information generated by WSL launcher.
2021-10-28 14:16:28 -03:00
Dan Bungert f21986be88
Merge pull request #1104 from CarlosNihelton/ft-prefill-p1
LocaleController.start() check model language
2021-10-28 11:12:18 -06:00
Carlos Nihelton 08267b59de Over indentation and long line fixed (lint). 2021-10-28 09:19:05 -03:00
Carlos Nihelton 4d2117626c Corrected (is None) + added interactive() check. 2021-10-26 18:26:26 -03:00
Carlos Nihelton 9f52bd92bf LocaleController.start() check model language
- 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.
2021-10-26 15:08:04 -03:00
Didier Roche 8b996f9ba5
Merge pull request #1100 from canonical/wsl_oobe_adduser_tests
WSL OOBE: add `useradd` tests
2021-10-20 09:33:46 +02:00
Dan Bungert afe31182d1
Merge pull request #1103 from dbungert/test-warnings
Address several test warnings
2021-10-19 10:34:10 -06:00
Dan Bungert 37f855562c
Merge pull request #1102 from dbungert/schema-tz
Remove timezones from schema enforcement
2021-10-19 10:28:11 -06:00
Patrick Wu a3fce9f9c2
system_setup: add useradd tests 2021-10-20 00:27:10 +08:00
Dan Bungert 8da3df2cd2 schema: remove timezones, and tz schema check 2021-10-19 10:06:01 -06:00
Dan Bungert c37535c530 timezone: remove possible tzs from schema 2021-10-19 10:06:01 -06:00
Dan Bungert 9818ca9717
Merge pull request #1101 from dbungert/autoinstall-no-disk
filesystem: better autoinstall error when no disk
2021-10-19 10:03:05 -06:00
Dan Bungert fdc10f19be
Merge pull request #1097 from dbungert/guided-lvm-sizes
filesystem: guided_lvm code/comment consistency
2021-10-19 09:39:40 -06:00
Didier Roche ff953cb341
Merge pull request #1099 from canonical/wsl_oobe_shutdown_testing
WSL OOBE: shutdown/reboot tests
2021-10-18 12:24:42 +02:00
Patrick Wu ec04a6833a
system_setup: shutdown/reboot tests 2021-10-18 17:15:45 +08:00
Dan Bungert 6b460abaa4 several: change attr.cmp for attr.eq
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.
2021-10-15 16:27:21 -06:00
Dan Bungert 38302fd81a c/api/tests: don't prefix class with Test
Fix warning:
  subiquity/common/api/tests/test_server.py:45
    PytestCollectionWarning: cannot collect test class
    'TestControllerBase' because it has a __init__ constructor
2021-10-15 16:20:29 -06:00
Dan Bungert 0308fa49b1 core test_view: don't prefix local class w/ Test
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
2021-10-15 16:12:44 -06:00
Dan Bungert d9370ae54b filesystem: better autoinstall error when no disk
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'
2021-10-15 14:27:01 -06:00
Dan Bungert 3c32cb773c
Merge pull request #1076 from mwhudson/core20-cleanups
remove stdlib backports from Python 3.8
2021-10-14 14:57:48 -06:00
Dan Bungert e35f1848f7 filesystem: guided_lvm code/comment consistency
Update the guided lvm sizes to match the comments.
2021-10-13 06:45:55 -06:00
Dan Bungert db15b1c5c2
Merge pull request #1085 from dbungert/fr-1710-storage-v2-part2
/storage/v2: boot related fixes
2021-10-12 20:58:34 -06:00
Dan Bungert 4ec569fb74 storage/v2: refactor partition format/mount attrs
Cleanup some duplicated logic.
2021-10-12 20:05:35 -06:00
Dan Bungert 21c731f7ec storage/v2: expose boot on Partition
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.
2021-10-12 20:05:35 -06:00
Dan Bungert de4b7751c2 storage/v2: fix add_boot_partition w/ multi disks 2021-10-12 20:05:35 -06:00
Dan Bungert cc0f37fead storage/v2: fix bad operator precedence in apitest 2021-10-12 20:05:35 -06:00
Dan Bungert c62d79a1e2 storage/v2: advertise boot disk as boot_device 2021-10-12 20:05:35 -06:00
Dan Bungert f17139c4a0 storage/v2: report grub_device on disk
If a partition has grub_device, that is shown at the disk level as well.
2021-10-12 20:05:35 -06:00