Commit Graph

4828 Commits

Author SHA1 Message Date
Olivier Gayot 413cc87337 Revert "Move to aiohttp for GeoIP requests"
This reverts commit ebdf1db636.
2022-04-20 20:53:27 +02:00
Didier Roche 82776fdb63
Merge pull request #1277 from CarlosNihelton/deeng-216-fix-lang-tui
Sets with the prefilled language before starting controllers
2022-04-20 15:13:51 +02: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
Dan Bungert 30745e522f
Merge pull request #1275 from dbungert/v2-reformat-msdos
v2/reformat: accept ptable argument
2022-04-19 07:28:52 -06:00
Dan Bungert b8d9b5b141
Merge pull request #1273 from dbungert/snap-metadata
snapcraft: set source-code and issues fields
2022-04-18 19:14:58 -06:00
Dan Bungert f44fc5f39d
Merge pull request #1274 from dbungert/fix-guided-direct
Fix guided direct
2022-04-18 17:04:53 -06:00
Dan Bungert 3dcf213f60 partition: msdos table tests
Yes, MSDOS + BIOS does in fact boot just fine without the spacer.
2022-04-18 15:47:43 -06:00
Dan Bungert 3d8f1675a4 partition: fix offset of added partition
A scenario that should happen nearly always for guided direct, when we
add_boot_disk from partition_disk_handler we must update the gap or the
target partition is at the wrong offset.
2022-04-18 15:47:43 -06:00
Dan Bungert fbf4ea863e v2/reformat: accept ptable argument
Move storage/v2/reformat_disk to body instead of query args.
Add optional ptable arg, which can be used to format to a msdos table.
2022-04-15 13:54:26 -06:00
Dan Bungert 4418f4ebab filesystem: make it easier to create for unit test
In production use, start() will initialize this to the correct value.
2022-04-15 10:23:33 -06:00
Dan Bungert bd6647d6ec snapcraft: set source-code and issues fields 2022-04-14 14:02:21 -06:00
Dan Bungert 7310658de6 test/api: add drivers cancel test 2022-04-14 12:05:46 -06:00
Dan Bungert e9f3abc360
Merge pull request #1269 from dbungert/v2-delete
storage/v2: permit delete with storage-version=2
2022-04-14 09:45:22 -06:00
Olivier Gayot bacbe5d4bb drivers: prevent client crash if GET /drivers is closed from client side
When a HTTP client sends a query but closes the socket before an answer
is received,  aiohttp signals it on the server end by raising an
asyncio.CancelledError in the associated query handler.

By default, when a task is cancelled with asyncio, the task(s) that it
is currently awaiting on are cancelled as well.

The GET handler for /drivers?wait=true awaits on the "list drivers"
task. Therefore, if the GET handler gets cancelled, so will be the "list
drivers" task.

When that happens, any subsequent call to GET /drivers?wait=true will
make the server raise an asyncio.CancelledError because the "list
drivers" task has already been cancelled. This results in:

 * the socket being closed from the server end
 * an aiohttp.client_exceptions.ServerDisconnectedError exception raised
   on the client end. This type of exception is unhandled and makes the
   client crash.

Fixed by preventing the "list drivers" task from being cancelled when
the GET /drivers query handler gets cancelled.

https://bugs.launchpad.net/subiquity/+bug/1968729

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-04-14 15:48:25 +02:00
Michael Hudson-Doyle c101e63521
Merge pull request #1268 from mwhudson/translations-update
update translations from https://translations.launchpad.net/subiquity
2022-04-14 11:58:23 +12:00
Dan Bungert 9ba3ef52f8
Merge pull request #1263 from dbungert/lp-1968160
filesystem: going back to guided also does reset
2022-04-13 17:04:56 -06:00
Dan Bungert 569335ef81 storage/v2: permit delete with storage-version=2
On preserved disks, we can now allow partition deletes without requiring
a wholesale format of the disk, if using storage-verison=2.
2022-04-13 16:27:26 -06:00
Michael Hudson-Doyle a2dbc23a4b update from newer export 2022-04-14 10:02:51 +12:00
Olivier Gayot cb132611c2 ui: get rid of unreachable else block
The following commit added an unconditional return statement in the try
block of _move_screen, effectively making the associated else block
unreachable.

  a7bcc7fa add a way to wait for something with notification after 0.1s

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-04-13 18:34:46 +02:00
Olivier Gayot 414a2235e6 storage: fix screen sometimes not refreshing after slow probing
When we reach the storage screens on the installer, if the devices
probing operation has not finished, we:
 * display a temporary "Probing" screen.
 * create an asynchronous task (a.k.a., probing task) that will
   eventually show the "Guide Storage" screen when the probing operation
   finishes.

The probing task checks, when it finishes, that the screen currently
visible is the "Probing" screen. This is the expectation and is true in
most scenarios. But in case a different screen is visible, we skip
refreshing the display.

Unfortunately, sometimes, a "Progress" screen is shown for some time
before the "Probing" screen appears. Consequently, we do not refresh the
screen if the probing operation finishes whilst the Progress screen is
visible.

In order to keep the view returned by make_ui() up-to-date and make sure
that the right screen is shown even if the probing operation finishes
early, we use the level indirection that was implemented in make_ui.

https://bugs.launchpad.net/subiquity/+bug/1968161

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-04-13 18:34:46 +02:00
Olivier Gayot 014d9d0d01 ui: introduce an optional level of indirection in make_ui
The make_ui() function / coroutine returns a BaseView (i.e., a
screen to display to the user).

That being said, when the application calls, make_ui(), it does not come
with a guarantee that the view returned will be displayed to the user
immediately.

One of the reason is that there are multiple await statements before the
we call the ui.set_body function. Therefore, tasks running concurrently
cannot reliably expect that they execute after the display is refreshed.

Perhaps more importantly, when the make_ui() function takes more than .1
second to execute, we display a "Progress" screen that stays visible for
at least one second. This can effectively delay a lot the moment when
the view returned by make_ui() is shown to the user. A lot can happen in
the meantime.

As the result, the view returned by make_ui can be outdated by the time
we show it on the screen.

One way to work around this problem is to store in the controller a
reference to the view that it returns in make_ui(). This way, the
controller can modify the view and keep it up-to-date until it gets
shown to the user.

Unfortunately, some controllers (e.g., the storage controller) do not
modify / mutate the existing view object when a modification is needed ;
but instead instantiate a new view object.

This patch introduces a level of indirection that can be used by these
controllers. Instead of returning a view object from make_ui(), the
controllers are now allowed to return a callback ; which in turn will
return a view object.

https://bugs.launchpad.net/subiquity/+bug/1968161

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-04-13 18:34:46 +02:00
Michael Hudson-Doyle b07405a744
Merge pull request #1257 from ogayot/mypy-fixes
Some more code cleanup
2022-04-13 12:09:04 +12:00
Michael Hudson-Doyle a3d20bf291 update translations from https://translations.launchpad.net/subiquity/trunk/+pots/subiquity 2022-04-13 11:58:59 +12:00
Olivier Gayot 0217d5e468 filesystem: accept any type as the value of SetAttrPlan
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-04-12 10:04:16 +02:00
Olivier Gayot a63a3ef753 utils: accept sequences of strings as commands
We used to only accept lists of strings for commands. We now accept
sequences of strings instead ; which are lists of strings or tuple of
strings.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-04-12 10:04:16 +02:00
Olivier Gayot 9f5d6d9c08 tests: rename mock variable arun_command
Having a variable named arun_command in tests interferes with tags
generated with ctags: the default tag does not point to the actual
function definition; but to the variable in test_ubuntu_advantage.py.
Excluding the tests when generating the tags would be an option but for
now we'll just rename the variable.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-04-12 10:04:16 +02:00
Olivier Gayot dd788f9eee add assert statements following .communicate() to help type checkers
After calling .communicate() on an asyncio.subprocess.Process object,
the attribute returncode gets set to a non-None value. Type checkers are
not able to figure this out.

Fixed by adding an assert to help type checkers out.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-04-12 10:04:16 +02:00
Olivier Gayot f0ea1d16c2 network: initialize bond, vlan & wlan to None to avoid changing type
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-04-12 09:50:21 +02:00
Olivier Gayot 2cd1cf2659 Avoid redefining types NetworkModel & LogHandler
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-04-12 09:50:08 +02:00
Michael Hudson-Doyle c384d5b617
Merge pull request #1250 from mwhudson/offset-pedantry
keep partition offsets up to date as they are deleted and resized
2022-04-12 10:54:24 +12:00
Dan Bungert dac14e9724
Merge pull request #1255 from dbungert/autoinstall-vs-early-cmds
autoinstall: fix interaction with early-commands
2022-04-11 12:57:23 -06:00
Dan Bungert 8ca83aa9cf file_util: genericize copy routine 2022-04-11 12:51:26 -06:00
Dan Bungert 008b9e2f04 autoinstall: fix interaction with early-commands
Early commands is currently documented as follows:
> The autoinstall config is available at /autoinstall.yaml
> (irrespective of how it was provided) and the file will be re-read
> after the early-commands have run to allow them to alter the config
> if necessary.

The previous change to let cloud take precedence over iso location broke
this functionality.  Fix that by copying to the iso location the file of
choice.
2022-04-11 12:51:26 -06:00
Dan Bungert d69731af7a
Merge pull request #1264 from dbungert/lp-1959971-ctd
boot: further increase suggested sizing: min 1.7G
2022-04-11 10:42:53 -06:00
Dan Bungert 22fa581b66 boot: further increase suggested sizing: min 1.7G
Match the change implemented for Ubiquity 22.04.11,
commit 9d1720f9d749885eb13e4bd9e23e5a832219a3ae.
2022-04-11 10:35:29 -06:00
Dan Bungert 4b2952edb2
Merge pull request #1261 from dbungert/handle-more-app-states
install progress: handle obscure states
2022-04-11 10:18:51 -06:00
Michael Hudson-Doyle 63f32caac7 fix test/diagram discrepancy (although maybe this test should just go) 2022-04-11 14:48:29 +12:00
Michael Hudson-Doyle 134ce89159 remove unnecessary range() 2022-04-11 14:39:37 +12:00
Dan Bungert 4567f009a7 filesystem: going back to guided also does reset
Per LP: #1968160, with 2 or more disks, go to guided storage config, hit
done.  At file system summary, hit back, and choose the other disk.
While this screen does say so, one might not notice that the first disk
is still setup to be formatted.

Instead, when going back to guided storage, a reset is also done.
2022-04-08 16:57:52 -06:00
Dan Bungert fcfa2036dd install progress: handle obscure states
None of these four states should be common, but it is possible at least
to hit CLOUD_INIT_WAIT with an ill-timed server process restart.
2022-04-08 10:41:07 -06:00
Dan Bungert 2df8d4ee86
Merge pull request #1260 from ogayot/LP1968161
storage: log reason for not updating the screen after probing finishes
2022-04-07 12:13:14 -06:00
Olivier Gayot c7c0b71657 storage: log reason for not updating the screen after probing finishes
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-04-07 14:02:57 +02:00
Didier Roche 32fb73b4eb
Merge pull request #1259 from canonical/wsl_remove_systemd
Wsl remove systemd
2022-04-07 11:06:12 +02: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
Didier Roche 3deddf76ed
Merge pull request #1258 from CarlosNihelton/fix-snap-path
Ensures snap_dir='/' if not better specified.
2022-04-07 09:06:15 +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
Olivier Gayot f3634dc242 Add type hints where necessary to make mypy happy
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-04-06 11:23:34 +02:00
Olivier Gayot 56192938a9 network: fixed typo addressesses -> addresses
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-04-06 11:23:10 +02:00