Commit Graph

2013 Commits

Author SHA1 Message Date
Michael Hudson-Doyle f339620a50 include the traceback in the response when a server method fails
example:

$ curl  --unix-socket .subiquity/socket a/dry_run/crash
Traceback (most recent call last):
  File "/home/mwhudson/src/subiquity/subiquity/common/api/server.py", line 122, in handler
    result = await implementation(**args)
  File "/home/mwhudson/src/subiquity/subiquity/server/dryrun.py", line 24, in crash_GET
    1/0
ZeroDivisionError: division by zero
2021-05-13 05:44:47 +12:00
Michael Hudson-Doyle 1da1ead19c add a integation test for non-rich mode 2021-05-04 12:44:41 +12:00
Michael Hudson-Doyle 447e192fee mark the locale model as configured at start up
The subiquity client does not ask about language in non-rich mode on a
serial port, and that's OK. But we still need the install to complete :)

There are other ways to fix this I guess -- we could not wait on the
locale model to get configured, for example, or explicitly select a
C.UTF-8 locale when "Continue in basic mode" is selected, or probably
some other things. But this works and seems OK.
2021-05-04 12:22:38 +12:00
Michael Hudson-Doyle d617445190
Merge pull request #945 from mwhudson/lp-1926132
fix crash on network apply failure
2021-05-04 10:39:42 +12:00
Michael Hudson-Doyle d31a150f06 fix crash on network apply failure
https://bugs.launchpad.net/subiquity/+bug/1926132
2021-05-03 11:40:49 +12:00
Michael Hudson-Doyle 7465e2ccb2 fix logging unconfigured models
debugging Launchpad bug 1926616 would have been much easier if this was
working!
2021-05-03 11:18:09 +12:00
Dan Bungert 2719c57c1b
locale - let it check interactive-sections again (#937)
* locale - let it check interactive-sections again

* Turn Serial into a whole new screen

When in serial, first offer the rich/basic choice (or SSH button),
and only show the current welcome screen if we choose rich mode.
Add a back button on Welcome if we are on serial.

LP: #1919251
2021-04-21 10:11:27 -06:00
Dan Bungert 046949f087
Drop the confirm_ssh_keys call if UI not as expected (#941)
* Drop the confirm_ssh_keys call if UI not as expected

There is a larger problem here of the UI body changing underneath of us,
but this is at least a baby step in the right direction.
Also this matches existing client/controllers/ssh.py behavior.
At least log the event when it happens.
LP: #1925048

* lint
2021-04-19 17:21:12 -06:00
Michael Hudson-Doyle 4b5fd536aa
Merge pull request #940 from mwhudson/lp-1925068
avoid situation where overlays can be shown twice
2021-04-20 11:17:00 +12:00
Michael Hudson-Doyle 4de7f39c52 avoid situation where overlays can be shown twice
https://bugs.launchpad.net/subiquity/+bug/1925068 reports a crash that
fails with the "self.global_overlays.remove(overlay)" in
remove_global_overlay failing because the overlay is not in the list. I
don't know how it happened but staring at the code I did guess one way
this could happen: if you have two non-interactive screens in a row
where the requests both take long enough to trip the 0.1s threshold to
show the progress screen, app.ui.set_body will get called twice with the
same view. Each call will layer all global overlays over the view, so
doing it twice will show the views twice.

This all makes me thing that the way global overlays are shown is a bit
wrong -- they should be "outside" the controller-supplied view! -- but,
well, it's easy enough to make sure that calling set_body twice with the
same view doesn't cause this particular problem.
2021-04-20 10:18:38 +12:00
Michael Hudson-Doyle eacae45fb5 make sure freshly allocated action ids are really unique
Because the server and any clients can create action objects now,
per-process global counters are not going to cut it.

For https://bugs.launchpad.net/subiquity/+bug/1925063.
2021-04-20 09:32:17 +12:00
Michael Hudson-Doyle 32ed9d146c
Merge pull request #936 from dbungert/keyerror-updates
fix keyerror: updates
2021-04-13 11:54:36 +12:00
Dan Bungert 4609f8b86b
guided_GET: allow caller to specify min size (#935)
Caller to guided_GET can now specify a minimum size disk that is
acceptable for guided partitioning.  The unit is bytes.
The default value if this is unspecified is 6GiB.

Note that this default value is wholly inadequate for Desktop, which by
my measurements needs at least 8GiB to get the install completed if you
tell it to install everything, even though later it settles to a lower
installed size of 6.6GiB.
2021-04-12 17:38:40 -06:00
Dan Bungert 8e6728e3c9 fix keyerror: updates 2021-04-12 17:22:39 -06:00
Michael Hudson-Doyle 346785dcb7 wait for proxy configuration to complete when autoinstalling
This should fix the remaining part of
https://bugs.launchpad.net/subiquity/+bug/1879678.
2021-04-13 09:41:43 +12:00
Michael Hudson-Doyle f81d39f8a0 set http{,s}_proxy in server environment when proxy is set
This used be done before the client server split, oops. It probably only
affects geoip lookups though.
2021-04-13 09:41:43 +12:00
Michael Hudson-Doyle bc2ae6199a asyncify pubsub a bit 2021-04-13 09:41:43 +12:00
Michael Hudson-Doyle dab04bcb3a simple replacement for urwid signals wrapper as used in server
I think this removes all use of urwid from the server code.
2021-04-13 09:41:43 +12:00
Michael Hudson-Doyle ddf9baf19c remove emission of signal that nothing listens to any more 2021-04-12 22:53:37 +12:00
Michael Hudson-Doyle 98eb11c3b1 remove source command line line and SubiquityModel argument
nothing has used this value for some considerable time.
2021-04-12 22:52:56 +12:00
Michael Hudson-Doyle 3b60666495
Merge pull request #925 from mwhudson/lp-1885644-again
add all documented fields to filesystem model classes
2021-04-12 11:24:23 +12:00
Dan Bungert d783b9f2ff
Leverage code from Ubiquity to get rst presence (#930)
* Leverage code from Ubiquity to get rst presence

Example:
curl --silent --unix-socket .subiquity/socket a/storage/has_rst ->
false

Origin commit:
https://git.launchpad.net/ubiquity/commit/?id=e5c7a06d97f017296bedf593c5966e931e9a8aec
2021-04-05 16:46:42 -06:00
Michael Hudson-Doyle b0af11ad02 kill any foreground subprocess before restarting
This fixes a problem where you drop to a shell and refresh subiquity
from that shell -- the client tries to restart but it is running in the
background and so crashes trying to modify the terminal settings. So
this kills the subprocess before restarting. This required the extremely
angry PR I sent before: forcefully killing the subprocess also crashes
the client before restart in a similar way.
2021-04-01 17:24:49 +13:00
Dan Bungert a0e2e244bd
add setting policy for post-install updates via autoinstall (#920)
* Add element updates (non-UI)

This can be controlled with autoinstall
updates: security or all

Also an API for controlling this:
curl --silent --unix-socket .subiquity/socket a/updates ->
"security"
curl -d '"all"' --unix-socket .subiquity/socket a/updates

* Automated tests - log grep for default/none/all states

* Enforce possible values on Updates controller

Route all the various get/set thru 2 common functions.
Validate incoming data.
2021-03-31 13:57:53 -06:00
Michael Hudson-Doyle afe21993d9 fix --ssh option to client 2021-03-31 20:18:22 +13:00
Michael Hudson-Doyle a3623e6051 add all documented fields to filesystem model classes
This lets autoinstall configs set them, even though nothing in subiquity
can set them yet.
2021-03-31 16:04:22 +13:00
Michael Hudson-Doyle 26593f4c16
Merge pull request #924 from mwhudson/lp-1921820-2
more reliably restart client when server restarts
2021-03-31 13:30:56 +13:00
Michael Hudson-Doyle 132440451d more reliably restart client when server restarts
Splitting subiquity into server and client means that in general
old versions of the client can still be running when the server is
updated (the client running on tty1 will be restarted by snapd/systemd
when the snap is updated but clients running via e.g. ssh will not). I
implemented a way for the client to detect this and restart itself: the
server sets a header in all responses that indicates if it has been
updated. So far so good. But the way it knows that it has been updated
is to check the presence of a file that is only created when subiquity
itself triggers the refresh, so it's not there in the case of manual
refresh, and as reported in https://bugs.launchpad.net/bugs/1921820 this
can lead to the client crashing because it cannot parse the new server's
response. This simply changes to creating the marker file in the snap
post-refresh hook, which will be executed for manual snap refreshes as
well.

While I'm at it, remove the rest of the post-install hook that restarted
subiquity clients running on the serial line as the generic machinery
will work for these too.
2021-03-31 13:15:06 +13:00
Michael Hudson-Doyle 83823515ca
Merge pull request #921 from mwhudson/no-mount-run
remove curtin hook to bind mount /run into target now curtin does this
2021-03-31 11:47:20 +13:00
Michael Hudson-Doyle 65e0984243
Merge pull request #923 from mwhudson/curtin-update
update curtin
2021-03-31 11:47:02 +13:00
Michael Hudson-Doyle 764a4eeae8 move decision about whether a disk is "ok for guided" to server 2021-03-30 14:24:23 +13:00
Michael Hudson-Doyle db49d40f94 move implementations of guided options into server code 2021-03-30 14:24:21 +13:00
Michael Hudson-Doyle 64ac97aafe make subiquity client use new API for guided disk usage 2021-03-30 14:22:28 +13:00
Michael Hudson-Doyle f8a99721bc add server side API for guided storage configuration 2021-03-30 14:22:28 +13:00
Michael Hudson-Doyle 1f671db844 stop coalescing disks with the same multipath id
curtin now produces a single disk action for a multipathed disk
2021-03-30 09:30:26 +13:00
Michael Hudson-Doyle b0ac3960be
Merge pull request #918 from mwhudson/set-installer-password
have subiquity set password for installer user in live session
2021-03-29 15:46:36 +13:00
Michael Hudson-Doyle fac360b8e7 remove curtin hook to bind mount /run into target now curtin does this
Curtin added this in version 19.3 so we can stop doing it.
2021-03-29 14:49:59 +13:00
Michael Hudson-Doyle b44adfb022 fix submitting error reports
this is a bit embarassing!
2021-03-26 09:50:21 +13:00
Michael Hudson-Doyle e3361aa51c do not set installer user password if it has password or authorized keys
dearie me making a nice UI can involve a lot of typing.
2021-03-25 14:26:49 +13:00
Michael Hudson-Doyle 47eefa42fe do not re-set installer user password if it can be found in cloud-init.log
To avoid re-setting the password when refreshing from a subiquity that
does not have this change
2021-03-24 14:42:22 +13:00
Michael Hudson-Doyle 87c2e7539e only re-set installer password once per boot
Otherwise refreshing the snap would lead to a new password!
2021-03-24 14:26:43 +13:00
Michael Hudson-Doyle f641284d1f have the server re-set the installer user's password
cloud-init does a better job of hiding what it set it to now!
2021-03-24 14:26:43 +13:00
Michael Hudson-Doyle d1e43eb27e move most of the work of computing live session ssh info to server 2021-03-24 13:59:35 +13:00
Michael Hudson-Doyle b8eb88f7ce
Merge pull request #915 from mwhudson/lp-1919075
fix rebooting after a partially interactive install
2021-03-19 11:24:42 +13:00
Michael Hudson-Doyle 1c39ab90fd handle pers="auto" in lszdev output
I checked the lszdev source and for all the other fields that we are
assume are boolean, it can only output "yes" or "no". Today, at least --
not sure how to make sure this is not broken by future changes. Still
this is a help.

for https://bugs.launchpad.net/subiquity/+bug/1919420
2021-03-19 10:38:07 +13:00
Michael Hudson-Doyle 78856b3752 fix rebooting after a partially interactive install
If the install is part-interactive, the client still runs and still
POSTs to the /reboot endpoint, so do not reject all requests to its
methods
2021-03-18 16:06:06 +13:00
Michael Hudson-Doyle 32ee93e797
Merge pull request #914 from jmhunter/jmhunter-nameregex-1
Update NAME_REGEX as per bug #1916325
2021-03-18 15:56:12 +13:00
Jonathan Hunter c65c322fc6 Add variables to hold username and hostname regex
Also adjust displayed message to match.

Tested locally using 'make dryrun'
2021-03-17 20:09:41 +00:00
jmhunter 9cdd829299
Update NAME_REGEX as per bug #1916325
The NAME_REGEX currently used is "[a-z_][a-z0-9_-]*" which does correctly prevent hostnames starting with a hyphen.. but also prevents otherwise perfectly valid hostnames that start with a number. (Interestingly, an underscore is not defined as a valid hostname character, but is included as valid in the regex, I'm not sure why this is included but am leaving it in for backwards compatibility)

This patch adds 0-9 as valid characters at the start of a hostname, as per https://man7.org/linux/man-pages/man7/hostname.7.html#:~:text=Valid%20characters%20for%20hostnames%20are,to%20an%20address%20for%20use.
       Each element of the hostname must be from 1 to 63 characters long
       and the entire hostname, including the dots, can be at most 253
       characters long. Valid characters for hostnames are ASCII(7)
       letters from a to z, the digits from 0 to 9, and the hyphen (-).
       A hostname may not start with a hyphen.
2021-03-17 09:36:27 +00:00
Michael Hudson-Doyle 622aec8abf load keyboard layouts on the server side
this means decoding a fairly large (40k) blob of JSON in the client, but
it seems to be OK.
2021-03-16 16:02:23 +13:00