Commit Graph

125 Commits

Author SHA1 Message Date
Dan Bungert 50c7ff3d36 shutdown: add pre-shutdown pubsub channel 2023-06-08 12:06:45 -06:00
Carlos Nihelton 2e67005403
Fixed paths for lsc and locales commands
Subiquity snap doesn't stage language-selector-common nor locales
packages.
Attempting to run those commands require respecting the env previously
prepared by the caller, as well as fixing the commands paths
(or changing the PATH env var in the env preparation step).
Since the apt commands were already ran with a fixed path,
I'm applying the same principle in here.
Yet, for now, Jammy doesn't ship the l-s-c package seeded,
so a condition was preserved to avoid future crashes.
2023-04-13 16:11:05 -03:00
Carlos Nihelton 1105da2368
Falls back to seeded l-s-c
UDI snap ships the package, thus its data dir is part of the snap
subiquity snap does not.
This tries l-s-c data dir in the base system, outside of the snap
and gives up if the dir does not exits.
2023-03-24 11:54:44 -03:00
Dan Bungert 9d12871f15 many: s/create_task/run_bg_task/
create_task has the following note:
  Important: Save a reference to the result of this function, to avoid a
  task disappearing mid-execution.

Convert existing usage of create_task to run_bg_task, if that
create_task is not actually storing the result.
2023-02-13 14:56:07 -07:00
Carlos Nihelton d3099728ea
Merge pull request #1534 from CarlosNihelton/fix-none-wslsetupoptions
Fix wslsetupotions being None
2023-01-13 06:56:14 -03:00
Carlos Nihelton 41a2427704
Fix wslsetupotions being None
Recent changes in GUI turned possible to have that field as None,
leading to a crash.
This avoids the crash while preserving the default behavior of
installing the language packs.
2023-01-12 16:57:52 -03:00
Carlos Nihelton 3e04dab619
Interactive wsl_setup no longer writes wsl.conf
That variant would only apply configs if in autoinstall.
There are no more screens available related to those settings in
wsl_setup.
Reconfiguration variant is the only one able to write that file.
2022-12-16 13:28:10 +00:00
Carlos Nihelton 0540c521fe
Moves WslConfBase to the reconfiguration workflow 2022-12-16 13:28:10 +00:00
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
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 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 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
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
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
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 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
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 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 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
Didier Roche d17cd6fc38 System-Setup: Add systemd experimental support to WSL
Grow a new API for enabling/disabling systemd experimental support. We
do this by chaining a specific command= in the boot section.
We preserve the user customized command= content when systemd
experimental support is not enabled.

Co-authored-by: Jean-Baptiste Lallement <jean-baptiste@ubuntu.com>
2022-03-16 12:24:18 +01:00
Didier Roche 5695da5699 system-setup: Remove ubuntu-wsl-integration from API and TUI.
This project is no longer supported under WSL. Remove integration in the TUI
and API for it. Adapted tests and schema.
2022-03-14 15:58:03 +01:00
Olivier Gayot 812bba1de1 Use logger names consistent with directory structure
Refreshed name of loggers to make them consistent with the directory
structure.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-02-25 17:35:45 +01:00
Carlos Nihelton e79e4ea9a9
Removes unnecessary check `sourceDirs is None` 2022-02-17 07:07:19 -03:00
Carlos Nihelton a7fd83a384
Fixes missing dir on system_setup integration test
By providing alternative directories to find LC_* locale definitions.
2022-02-16 22:59:05 -03:00
Dan Bungert 0f9c9eef3f options: add output_base for dryrun use
To enable parallel API testing, add an output_base argument to replace
the default '.subiquity' that is sprinkled everywhere.
2022-01-26 10:39:23 -07:00
Didier Roche 34b621ee66
Merge pull request #1165 from CarlosNihelton/fix-wsl-snap-env
[SystemSetup] Fix L-S-C behavior under WSL snap environment
2022-01-21 15:56:42 +01:00
Carlos Nihelton 0d30deac7f
Promotes the "--no-checks" to outside of dry-run
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.
2022-01-18 10:18:45 -03:00
Carlos Nihelton a14a143d55 Fix l-s-c behavior under SNAP environment.
- By passing the datadir command line option.
2022-01-17 11:57:04 -03:00
Carlos Nihelton 957d56a52f FIx unbound variable in live run 2022-01-17 10:48:58 -03:00
Olivier Gayot 3d3994f3f3 Fix return type of __recommended_languages_pack
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-01-14 13:02:25 +01:00
Carlos Nihelton e429babb03 Fixes potential false positive UID findings
Also, splits part of the configure() method:
-  `__query_uid()` finds the username UID
- `_create_user()` creates the user set in IdentityModel
- Both methods accept a fake root path under dryrun.
2021-12-17 10:35:38 -03:00
Carlos Nihelton b17c3d3db9 Cleanup complete.
- No user setup in wsl.conf
- Shutdown controller creates the launcher-command file
2021-12-14 12:13:00 -03:00
Carlos Nihelton 22a8219cb3 Dryrun won't stop configure controller due C-L-S
- Also noticed a possible unbound var in IOError handler.
2021-11-24 11:35:31 -03:00
Carlos Nihelton a88fcdb8b3 Explicit case for c-l-s failure by returning None 2021-11-22 13:42:45 -03:00
Carlos Nihelton 37758047f2 Improved control over lang packs on integration
- Dryrun should never return empty packages list unless under failure.
- runtests check if the mimic-installed files match the proper language.
2021-11-22 12:16:01 -03:00
Carlos Nihelton 1e6c4472a5 Complementary to 1127 on integration side 2021-11-17 13:26:41 -03:00