Commit Graph

198 Commits

Author SHA1 Message Date
Michael Hudson-Doyle 85b3cd0724 switch from loop.create_task to asyncio.create_task
mostly done with sed
2022-11-08 10:08:46 +13:00
Olivier Gayot fa351ed7bc
Merge pull request #1446 from ogayot/pr/event-loop-rework
Stop calling deprecated asyncio.get_event_loop() function
2022-10-28 17:50:24 +02:00
Olivier Gayot 638e2cbfbf loop: fix setuptools entry-points not using asyncio.run
setuptools declares a certain number of entry points that use the main
function of the associated component. That said, now that main is an
async function, it does not work. There seems to be no way to tell
setuptools to wrap the call to the entry point with asyncio.run so we
need to revert to a synchronous main function.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-10-28 17:05:54 +02:00
Olivier Gayot a62a0b6002 loop: start running the event loop before doing anything else
This allows us to use asyncio.run() and to avoid many pitfalls.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-10-28 17:05:54 +02:00
Olivier Gayot 561fff1d5b
Merge pull request #1336 from ogayot/password-passphrase
Refactor how we handle confirmation fields - use passphrase instead of password where relevant
2022-10-28 14:06:54 +02:00
Edu Gómez Escandell b939b0e552 Fix 2022-09-27 14:13:36 +02:00
Carlos Nihelton ef5984b1be
Merge pull request #1427 from CarlosNihelton/2stage-snap-wsl-87
[WSL] Two stage snap launching
2022-09-21 21:05:29 -03:00
Carlos Nihelton 09bc1b7386
Ensures this script only runs in WSL
To prevent issues with desktop or server.
2022-09-21 09:26:13 -03:00
Carlos Nihelton c0c4b3c7fe
Adds a bootstrapping script for WSL
Where we don't have a proper snapd support.
Approach similar to the one used in UDI.
For the case where we have Subiquity snap, but not UDI.
The script added is a stripped version of the UDI one.

Removed code related to:
 - GTK and GDK;
 - GI repository;
 - Xkb;

 Preserved:
 - Python;
 - XDG directory definitions;
 - font config;
2022-09-19 14:39:39 -03:00
Carlos Nihelton 2a598a8b5d
[WSL] Fixes wrong paramters being passed ...
to the WSLSetupOptions controller.

Misuse of the default_loader().
That's meant for loading /etc/wsl.conf.
WSLSetupOptions is by design not related to that config file.
2022-09-15 17:12:03 -03:00
Carlos Nihelton b4734ad587
Makes the default_loader for wsl.conf testable 2022-09-15 16:24:18 -03:00
Carlos Nihelton 08d4c39387
Fix the missing `system_setup.common` error.
When Subiquity is packaged as its own snap, that subdirectory is not
present.
That is due the lack of an `__init__.py` file.
2022-09-13 15:56:37 -03:00
Carlos Nihelton c08ebef9df
Removes the controller name from the required set
INSTALL_MODEL_NAMES
2022-08-29 12:15:52 -03:00
Carlos Nihelton 86d19c6259
Sets WslSetupOptions as an optional controller
We have strong defaults, so the clients should only need to POST if
the desired options are not the default ones.
2022-08-29 12:15:29 -03:00
Carlos Nihelton 69934729da
Removes forgotten log statement. 2022-08-26 16:09:02 -03:00
Carlos Nihelton 912b9dd416
Sets the help colors to gray
Per Design's recommendation:
See https://github.com/canonical/ubuntu-desktop-installer/issues/1073#issuecomment-1224493840
2022-08-24 09:07:30 -03:00
Carlos Nihelton 1fab813d8a
DEENG-378 Uses the cached native lang descript...
...tion to format the checkbox caption
2022-08-23 11:30:12 -03:00
Carlos Nihelton 1d9b7449d3
Fixes linting warnings 2022-08-23 10:45:34 -03:00
Carlos Nihelton 20b60d6f98
Connects the new controllers to server and client.
Higher level constructs are now aware of the new endpoint.
2022-08-23 10:45:34 -03:00
Carlos Nihelton fdc43496f5
Implements client and server ...
... for WSL Setup Options

Both controllers and UI
2022-08-23 10:45:34 -03:00
Carlos Nihelton 6dd157dac7
Adding WSLSetupOptions API endpoint
Intended to receive options that affect the setup process.
and won't be written to /etc/wsl.conf
Options relative to that conf file are handled by WslConfBase and
WslConfAdvanced.
Currently only the option for skip installing language packs is
available.
2022-08-23 10:45:29 -03:00
Olivier Gayot 91870c8214 meta/status: replace POST_WAIT and POST_RUNNING by generic states
With the plan to call curtin multiple times where each invocation has a
specific purpose, we want the client to have a simple way to monitor the
status of the installation.

Instead of defining new application states for each stage, we will
report the more generic WAITING / RUNNING states in a loop until we get
to the final stages of the installation.

To start with, we are dropping POST_WAIT and POST_RUNNING in favor or
WAITING and RUNNING.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-07-22 10:51:01 +02:00
Olivier Gayot 384e4b62ac ui: move confirmation mechanism in subiquitycore.ui
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-06-24 17:24:20 +02:00
Olivier Gayot d63b44c014 storage: use fields named passphrase for passphrases
Because the storage views lean on the implementation of
setup_password_validation from the identity screen, we were forced to
use a form with fields named "password" and "password_confirm".

This makes the code confusing because we use the "passphrase"
terminology in the storage forms.

We now leave up to the caller to specify which fields he wants to be
part of the validation ; instead of making him provide the full form.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-06-24 11:37:54 +02:00
Carlos Nihelton 347e6e640e
Better help message for system setup 2022-06-16 16:15:16 -03:00
Carlos Nihelton 7e94f78c0a
Enhance comment and fix typo on it. 2022-06-07 13:27:15 -03:00
Carlos Nihelton 061efddec2
Missed linter warnings. 2022-06-06 17:57:00 -03:00
Carlos Nihelton eff558c8ad
Enables TCPSite for WSL
It listens on 127.0.0.1 only.
2022-06-06 17:42:49 -03:00
Michael Hudson-Doyle 3d1c8fd6cf convert SubiquityServer.kernel_params to an overengineered class 2022-06-02 08:56:32 +12:00
Didier Roche 95bee59dee
Merge pull request #1303 from CarlosNihelton/wsl-locgen-speedup
[system_setup] Allow skipping locale-gen command
2022-05-31 14:08:07 +02:00
Carlos Nihelton 5a8e2f2835
Allow skipping locale-gen command.
lang-packs post-install hook executes locale-gen.
For certain languages a matrix of locales is generated.
Re-running locale-gen regenerates not only the locale we wanted,
but the whole matrix, causing further delays.

We can save up to 40s (tested on my laptop) by skipping locale-gen if
apt succeeded.

Still useful to run it unconditionally i dry-run since apt won't execute
any post-install hook.
2022-05-31 08:22:41 -03:00
Carlos Nihelton 87112ebecf
Sets TUI about help message on super init. 2022-05-26 07:37:35 -03:00
Carlos Nihelton 3c27982939
Programmatic manipulation of the lsb fields
For better message composition.
2022-05-24 14:25:34 -03:00
Carlos Nihelton 2adc001693
Customises WSL system_setup Help/About message. 2022-05-24 13:58:13 -03:00
Carlos Nihelton dbe131fb59
Initializes `existing_usernames` for system_setup.
Since in WSL the target system is already mounted when Subiquity runs
its safe to Initialize that field with the target existing passwd
database.
2022-05-12 17:04:19 -03:00
Carlos Nihelton 0dba0722ab
WSL Validates the username with the endpoint. 2022-05-10 09:17:36 -03:00
Didier Roche 6d669b12d1
Merge pull request #1281 from CarlosNihelton/deeng-217-fix-syslog-wsl
Fix WSL crash on autoinstall due attempts to log to systemd journal
2022-04-21 14:15:11 +02:00
Carlos Nihelton f5e8fafdd4
Fix WSL crash on autoinstall due systemd-cat
EarlyController was still logging to systemd journal for WSL.
2022-04-21 08:51:06 -03:00
Carlos Nihelton 940fceac33
Removes empty line in the end of file 2022-04-20 09:16:40 -03:00
Carlos Nihelton 8201e917c3
Sets with the prefilled language before starting controllers
TUI client was able to GET() the language before it was set with the prefilled option in production
2022-04-20 09:10:21 -03:00
Jean-Baptiste Lallement a3a21da408 Removed systemd from the UI
We won't ship systemd officially in 22.04, hence remove it from the UI.
However it's still there and distributed and can be enabled manually.

Co-authored-by: Didier Roche <didrocks@ubuntu.com>
2022-04-07 10:55:30 +02:00
Jean-Baptiste Lallement 9ff8e10ef5 Do not run apt update in dry-run mode
update requires root access to the machine and there is no --simulate
option so skip it in dry-run mode.

Co-authored-by: Didier Roche <didrocks@ubuntu.com>
2022-04-07 10:54:18 +02:00
Carlos Nihelton d3e2544875
Ensures snap_dir='/' if not better specified.
UDI sets the SNAP env var to '.' for development purposes.

See: https://github.com/canonical/ubuntu-desktop-installer/commit/9eb6f04

It is unlikely that under test or production that env var will
ever by just '.'. On the other hand in dry-run we want this controller
to interpret it as '/' if not properly set, thus discarding the '.'.
2022-04-06 13:25:35 -03:00
Carlos Nihelton c2b6be3cd3
Enables passing the autoinstall CLI to the server.
The server was prepared to receive this CLI option.
TUI was not. When not in dry-run that option had no effect.
2022-04-05 18:12:47 -03:00
Carlos Nihelton ef18564eca
Cleans comments and adresses test.
- Under dry-run apt is run with --simulate.
- That can still fail if a package does not exist, for instance.
- If so, a file will not be written.
2022-03-22 19:41:37 -03:00
Carlos Nihelton c9f90dffb3
Fix stylistic flake8 warnings. 2022-03-22 18:04:37 -03:00
Carlos Nihelton f4a2b916a7
Removes dependency on apt python lib.
It seemed far too much complicated find the proper way to deal with
apt Python library under the snap environment.

Opted for running the system apt command without the LD_*
customisations, similar to what an installer does when chroot into the
taget system.
2022-03-22 17:50:54 -03:00
Carlos Nihelton a950d9e98f
Removes __recomended_language_packs() env argument
That function will not require a custom environment.
Also simplified snap_dir variable assignment.
2022-03-22 17:47:53 -03:00
Carlos Nihelton a36120e0bb
apply_locale() and create_user() accept custom env
This allows for running subprocess outside of the snap environment.
Both functions now receive a custom env without the LD_ related vars.
Renamed _create_user() to create_user() to make explicit that it has the
same semantic level as apply_locale().
2022-03-22 17:46:25 -03:00
Dan Bungert e59078c74e system-setup: inform server proc of output_base 2022-03-21 10:50:59 -06:00