Commit Graph

120 Commits

Author SHA1 Message Date
Michael Hudson-Doyle 246570314a pass the context object to report_start_event / report_finish_event 2020-04-07 21:51:11 +12:00
Maciej Borzecki 9bcf507b7c subiquitycore: do not assume that stdin is /proc/self/fd/0
The KeyCodesFilter assumed that /proc/self/fd/0 is actual stdin and proceeded to
toy with that fd. This broke the recovery mode chooser where console-conf is fed
a list of recovery systems over stdin. The `sys.stdin` is already correctly
updated to use the real tty and that should be used elsewhere instead of
hardcoding the fd number.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2020-04-02 13:08:16 +02:00
Maciej Borzecki 5d77d71499 subiquitycore: allow overriding input/output when creating screens
The interaction with snap-recovery-chooser happens over stdin/stdout. The early
setup code in console-conf will attempt to restore sys.stdin/sys.stdout and hook
them up to the current tty.

The patch allows passing input/output streams explicitly as parameters to the
constructors.

Also, default to sys.stdin/sys.stdout and pass both streams explicitly when
constructing urwid.raw_display.Screen(), to workaround the bug in their
constructor. THe constructor is defined as follows:

    class Screen(BaseScreen, RealTerminal):
        def __init__(self, input=sys.stdin, output=sys.stdout):

What means, that even if we override sys.stdout/sys.stdin globally in our setup
code, this will have no effect as `input` and `output` already got their values.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2020-03-24 13:32:52 +01:00
Michael Hudson-Doyle 7596e63a9f pass **kw args to arun_command in run_command_in_foreground
this makes the debug shell run in / rather than /snap/subiquity/whatever
2020-03-17 12:23:06 +13:00
Michael Hudson-Doyle b4ab4d8f1b Only mark definitively seen screens as configured.
Mark a screen as configured if:
 - last-screen is present
 - the screen was before the screen last-screen indicates
2020-03-16 16:37:25 +13:00
Michael Hudson-Doyle 94611c58e2 remove last-screen file before restarting or exiting
unless we are restarting because of a snap refresh.

ths lead to all kinds of confusion after e.g. a ui crash after a snap refresh
2020-03-16 16:37:16 +13:00
Michael Hudson-Doyle 99218fbeb4 support early and late commands 2020-02-04 14:03:59 +13:00
Michael Hudson-Doyle 963cbaaafe refactor how subiquity is exited after install
if we want to do things after install has completed (e.g.: run late
commands), we can't have the code that runs the install invoking
/sbin/reboot directly.
2019-12-20 13:54:34 +13:00
Michael Hudson-Doyle f925c3fa2a
Merge pull request #622 from mwhudson/make_screen-method
make screen behaviour more configurable
2019-12-20 13:09:57 +13:00
Michael Hudson-Doyle a40082a29b
Merge pull request #621 from mwhudson/controller-set-tweaks
tweak ControllerSet
2019-12-20 13:01:04 +13:00
Michael Hudson-Doyle 78d59de8c6 only call setraw if the screen is talking to a tty 2019-12-20 12:48:27 +13:00
Michael Hudson-Doyle 039b5313c4 move make_screen into a method 2019-12-20 12:47:37 +13:00
Michael Hudson-Doyle ab6fdeb1b5 tweak ControllerSet
* add a way to load just one controller
 * fetch the RepeatedController class from a projet specific location

neither used yet, but soon
2019-12-20 12:43:42 +13:00
Michael Hudson-Doyle cb52ab75a2 use the asyncio loop object rather than the urwid loop almost everywhere 2019-12-20 12:04:38 +13:00
Michael Hudson-Doyle 1f1937b03f report progress through screens via context 2019-12-20 09:46:26 +13:00
Michael Hudson-Doyle 5961b68b7d introduce a Context object for logging start/stop events 2019-12-20 09:46:26 +13:00
Dimitri John Ledkov 4bcb0e5fd1
Merge pull request #609 from mwhudson/less-signalling
stop some pointless use of urwid signals
2019-12-16 19:38:45 +00:00
Dimitri John Ledkov c067e5e741
Merge pull request #606 from mwhudson/prober-fail-lower
push debug_flag block probe crashing into Prober
2019-12-16 12:27:16 +00:00
Michael Hudson-Doyle 33af65bde1 make --screen command line option do something again 2019-12-16 23:17:21 +13:00
Michael Hudson-Doyle 324dddac94 push debug_flag block probe crashing into Prober 2019-12-16 23:15:48 +13:00
Michael Hudson-Doyle 01e5261b3f kill off other top level signals 2019-12-16 23:09:17 +13:00
Michael Hudson-Doyle 2765e6a773 replace next-screen/prev-screen signals with method calls 2019-12-16 23:02:03 +13:00
Michael Hudson-Doyle ae5cd6268a kill off run_in_bg and some related hacks 2019-12-15 08:53:37 +13:00
Michael Hudson-Doyle a92b88ed9d asyncioify run_command_in_foreground 2019-12-15 08:53:36 +13:00
Michael Hudson-Doyle 285eeee0ed
Merge pull request #598 from mwhudson/repeatedcontroller-index
fix RepeatedController
2019-12-14 22:16:07 +13:00
Michael Hudson-Doyle 0090aec3be fix RepeatedController
a snap update was offered the second time even if it had been
offered already
2019-12-14 21:44:10 +13:00
Michael Hudson-Doyle 5571e1fab3 add a class for controllers with no ui
there will be a bunch of these coming for autoinstall
2019-12-14 21:27:39 +13:00
Michael Hudson-Doyle eb228ab7f3 introduce a helper for a restartable task
(there are going to be a few of these)
2019-12-13 10:03:32 +13:00
Michael Hudson-Doyle f549883f80 tweak some log levels 2019-12-12 21:57:20 +13:00
Michael Hudson-Doyle 297d7c2060 add Application.select_screen
SubiquityUI will want to override this for autoinstally things
2019-12-12 10:38:04 +13:00
Michael Hudson-Doyle fb2f322544 tidy up next/prev_screen 2019-12-12 10:38:04 +13:00
Michael Hudson-Doyle 64378cdb95 refactor how controllers are stored a bit 2019-12-12 10:38:03 +13:00
Michael Hudson-Doyle b3c013907b
Merge pull request #586 from mwhudson/restart-after-update
remove last-screen file before restarting subiquity
2019-12-12 09:19:54 +13:00
Michael Hudson-Doyle 411a78ccb3 steal the fix for https://github.com/urwid/urwid/issues/235
the symptom of the bug fixed is that exceptions that crash the process
do not get reported sensibly.
2019-12-11 23:21:11 +13:00
Michael Hudson-Doyle 932f703c7a remove last-screen file before restarting subiquity
this fixes a crash loop when the users updates the subiquity snap
then hits an install failure and selects restart
2019-12-11 23:17:16 +13:00
Michael Hudson-Doyle 864e09cc99 use asyncio event loop and a little asyncio api 2019-12-11 14:39:25 +13:00
Michael Hudson-Doyle 615dc1b1dd show an unseen ui crash on startup 2019-11-08 13:36:30 +13:00
Michael Hudson-Doyle 74ef2ad8f6 add a way to create a crash report 2019-11-07 14:47:18 +13:00
Michael Hudson-Doyle 54823e364c remove signal sent after debug shell exits 2019-11-04 23:52:49 +13:00
Michael Hudson-Doyle f2918fa30b
Merge pull request #550 from mwhudson/reprobe-block-devices-on-shell-exit
Reprobe block devices on debug shell exit
2019-10-09 15:37:23 +13:00
Dimitri John Ledkov 3e39db4013 Asciify color pallete 2019-10-07 22:30:23 +01:00
Dimitri John Ledkov 3f548665e1 Add ASCII mode 2019-10-04 17:17:26 +01:00
Michael Hudson-Doyle 7a3a88ab0c add a signal that is fired when a debug shell exits 2019-10-04 15:10:11 +13:00
Michael Hudson-Doyle 36cdf0effd some better names 2019-10-04 13:39:39 +13:00
Michael Hudson-Doyle 415db68e36 always use vt100 codes for white/black/default
For maximum compatibility in mono mode.
2019-10-04 13:39:39 +13:00
Michael Hudson-Doyle cea3a65ca1 refactor how palettes and colors and screens are set up 2019-10-04 13:39:39 +13:00
Michael Hudson-Doyle 29c9e0c984 add a hot key (f4) for turning color on and off 2019-10-04 13:39:39 +13:00
Michael Hudson-Doyle 93732dfb73 fix run_command_in_foreground to disconnect from stdin while in backgound
Not sure how I didn't notice this when implementing it for the first
time but well. This is all fairly confusing.
2019-09-30 16:26:24 +13:00
Michael Hudson-Doyle b6bf3fcc42 a bit too much effort making one particular log statement look nice 2019-09-09 15:32:49 +12:00
Michael Hudson-Doyle 0eb4dcfdfb more logging tweaks 2019-09-09 15:27:56 +12:00