Commit Graph

3738 Commits

Author SHA1 Message Date
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 9e9d29f698
Merge pull request #901 from mwhudson/server-side-guided
create and use an API for guided disk usage
2021-03-30 14:53:30 +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 c6185075c7 update curtin 2021-03-30 09:30:03 +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 7451f362b2
Merge pull request #919 from mwhudson/lp-1919076
fix submitting error reports
2021-03-26 09:56:40 +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 159523204c
Merge pull request #917 from mwhudson/lp-1919420
handle pers="auto" in lszdev output
2021-03-19 11:11:24 +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 4e423d5b7d trivial DESIGN.md updates 2021-03-18 16:25:41 +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
Michael Hudson-Doyle 84844c2a44
Merge pull request #912 from mwhudson/server-side-keyboard-api
move most keyboard logic to server
2021-03-18 10:01:16 +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
Michael Hudson-Doyle 697949c1d2 move code aroud now only the server calls set_keyboard 2021-03-16 16:02:23 +13:00
Michael Hudson-Doyle 449de0f374 move setting of keyboard to server side 2021-03-16 16:02:23 +13:00
Michael Hudson-Doyle 744e53b76b move checking if a layout needs a toggle to server side
subiquity inherits this behavior from d-i where if a the user selects a
layout that does not allow typing latin characters, the user is prompted
to choose a key to toggle between the one they selected and a related
one that does allow latin characters. This change moves the handling of
this to the server side, so the client just sees the keyboard layout the
user selects, and calls an API method to know if to ask the user about a
toggle key.
2021-03-16 16:02:23 +13:00
Michael Hudson-Doyle 7d98a77434 move keyboard detection to server side 2021-03-16 16:02:23 +13:00
Michael Hudson-Doyle 1b70a57d97 commit generated file 2021-03-16 16:02:23 +13:00
Michael Hudson-Doyle fb649bf7d5 pre-process keyboard auto detection steps into API friendly format
Continuing the theme of previous work, this branch parses pc105.tree
into API-friendly attr-based classes at snap build time (which also lets
us check some constraints then and not at run time).
2021-03-16 16:02:23 +13:00
Michael Hudson-Doyle 252ec6d11e commit keyboard data in new format 2021-03-16 16:02:23 +13:00
Michael Hudson-Doyle 5d93eb824a process keyboard data into api friendly format when building snap
This is a bit sideways from the real thing I'm working on which is
moving most of the logic of keyboard handling to the server side but
anyway. This also lets me check some assumptions while processing the
data rather than in the view code.
2021-03-16 16:02:23 +13:00
Michael Hudson-Doyle da14af1c65 add serialization support for unions of attr classes
unions are serialized as a tagged union by adding a '$type' field
indicating which member of the set of types is present.
2021-03-16 16:02:23 +13:00
Michael Hudson-Doyle 85ed9826e4 add support for serializing typing.Dict 2021-03-16 16:02:23 +13:00
Michael Hudson-Doyle 0526b150c3 enforce that the serialization module rejects non-string-key dicts
I tend to forget that json dictionaries can only have string keys. I'll
add support for explicitly typed, non-string-keyed, dicts at some
point...
2021-03-16 16:02:23 +13:00
Michael Hudson-Doyle d77419e5c8
Merge pull request #905 from mwhudson/quick-test
add a couple of super hacky scripts for quickly testing subiquity changes
2021-03-16 16:01:23 +13:00
Michael Hudson-Doyle 7b954869ad
Merge pull request #906 from mwhudson/compact-serialization
add a more compact way of serializing objects
2021-03-16 09:32:38 +13:00
Michael Hudson-Doyle 663f54231e
Merge pull request #907 from mfoliveira/lp1919053
lvm_partition: align down all remaining space to chunk size
2021-03-15 13:35:53 +13:00
Mauricio Faria de Oliveira 0205a74fc6 lvm_partition: align down all remaining space to chunk size
If an autoinstall storage config with the last lvm_partition
is set to use all remaining space in the volgroup (size: -1)
and it is not aligned with the lvm chunk size, lvcreate will
round it up, and that will not fit into the actual free size.

That might happen depending on the size used by the previous
(lvm) partitions (e.g., may use percentage) and size of disk.

Fix that by rounding it down to the LVM chunk size.
This passed 'make check' and 'make lint' with exit code 0.

LP: #1919053

Before:

    Running command ['lvcreate', 'vg', '--name', 'lv-root', '--zero=y',
    '--wipesignatures=y', '--size', '6435110912.0B'] with allowed return
    codes [0] (capture=False)
      Rounding up size to full physical extent <6.00 GiB
      Volume group "vg" has insufficient free space (1534 extents): 1535
    required.
    An error occured handling 'lvm-lv-root': ProcessExecutionError -
    Unexpected error while running command.

After:

    Running command ['lvcreate', 'vg', '--name', 'lv-root', '--zero=y',
    '--wipesignatures=y', '--size', '6434062336.0B'] with allowed return
    codes [0] (capture=False)
    Logical volume "lv-root" created.

Check:

    $ python3 -q
    >>> 6435110912 / (4*1024**2)
    1534.25

    >>> 6435110912 & ~(4*1024**2-1)
    6434062336
    >>> _ / (4*1024**2)
    1534.0

Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>
2021-03-13 21:46:24 -03:00
Michael Hudson-Doyle 4fc042ce1f add a more compact way of serializing objects
This adds a way of serializing objects to lists, which makes the results
much less self-documenting but also much smaller.  (I want to ship
keyboard data serialized with this code with the snap, but do not really
want to ship JSON data that is way bigger than it needs to be.)
2021-03-11 16:01:40 +13:00
Michael Hudson-Doyle 6d091b054a
Merge pull request #904 from mwhudson/lp-1905412
do not try to reuse a name of an existing vg in guided_lvm
2021-03-10 09:11:31 +13:00
Michael Hudson-Doyle b25d899f7c use rsync instead of git archive to get uncommitted changes 2021-03-10 09:05:15 +13:00
Michael Hudson-Doyle d645ca1642 add a couple of super hacky scripts for quickly testing subiquity changes
The first of these scripts mashes the current branch's code over that of
a pre-existing subiquity snap.

The second uses the first to mash the current branch's code over the
subiquity snap from an ISO and then creates a new ISO with this new
snap.

It's all a bit terrifying but being able to get your changes into a
bootable ISO in about 30s is quite a large improvement on building the
snap from scratch.
2021-03-09 17:34:59 +13:00
Michael Hudson-Doyle 41e42e0f39 improve lvm name validation message a bit 2021-03-09 17:30:32 +13:00
Michael Hudson-Doyle 7f7866919a support deleting a VG and creating one with the same name 2021-03-09 17:27:20 +13:00
Michael Hudson-Doyle 3a54e8b107 do not try to reuse a name of an existing vg in guided_lvm
for https://bugs.launchpad.net/bugs/1905412
2021-03-09 16:13:29 +13:00