Commit Graph

5997 Commits

Author SHA1 Message Date
Ryan Harper a8a8310a67 Don't connect hostname view yet
Hostname view/model isn't fully implemented, don't connect it
to install process yet.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-27 10:30:45 -05:00
raharper ebfb649cb5 Merge pull request #102 from CanonicalLtd/make-raid-boot-v2
Make raid boot v2
2015-10-27 10:20:18 -05:00
Ryan Harper 7042fd93f9 Filter out lxcbr0 from network autostart
Wily images and newer now contain a lxcbr0 by default.
Ignore this interface and don't attempt to dhcp autostart it.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-27 10:12:28 -05:00
Ryan Harper 9361bdbd72 Calculate installer image partition sizes
The size of the rootfs fluxuates and sometimes does not fit in the
pre-allocated sizes.  Instead, calculate the size needed for the
rootfs read-only partition (+ 100M padding) and use the remaining
space for the overlay partition as it's needed when the install
image updates it's apt repository.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-27 10:12:28 -05:00
Ryan Harper b09f273450 Handle raid installer files
Ignore and clean new target files used to test
raid features.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-27 10:12:28 -05:00
Ryan Harper 90386adcde unittests: get_empty_disks, partitions, and names
validate the empty disks/partitions.  Note that blockdev
class makes use of poking host's mounts which triggers some
transient failures.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-27 10:12:28 -05:00
Ryan Harper ba8efbe3af unittests: drop class name from test methods
Repeating the name of the class isn't needed since the test class already has
the name.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-27 10:12:28 -05:00
Ryan Harper 09c337b012 Fix blockdev mount ordering
Ensure that the / mount point is always first
but returning an explict value (0) for / mount action.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-27 10:12:28 -05:00
Ryan Harper eaa9926718 Install packages into overlay during build
Speed up install time by pre-installing required curtin packages
in the installer image.  Do this by optionally exploiting a
curtin feature which handles preparing the target for installation
of services that we don't want running during the image build.
Fallback on simple apt-get install but filter out daemon services
as this will break the image build.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-27 10:12:28 -05:00
Ryan Harper bba193efba Install curtin as a deb into installer target
Instead of packing up curtin via source, build a
deb from the source and inject that into the installer.
This also means we always are consuming an 'installed'
curtin (aka /usr/bin/curtin).

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-27 10:12:28 -05:00
Ryan Harper d048b58811 Fix install when using raid devices
RAID devices require special handling since they cannot be partitioned.
Adjust the blockdev model to accomodate this.
Fix sorting of our actions to handle proper ordering when using RAID devices
Implement whole-disk formatting view and controller
Update cloud-init configuration to ensure repeated runs of installer work

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-27 10:12:28 -05:00
Adam Stokes cf05c5edf9 Update hostname.py
Fix class name
2015-10-27 10:21:13 -04:00
Adam Stokes a93f6b8f33 Merge pull request #98 from CanonicalLtd/fix_div_by_zero
Fix div by zero in blockdev available check
2015-10-26 12:26:31 -04:00
Ryan Harper 0b3170bae8 Fix div by zero in blockdev available check
Some blockdevices make report a size of zero; don't
explode when calculating percent free.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-26 10:37:01 -05:00
Adam Stokes b148025f31 Update my desktop machine profile
Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
2015-10-26 10:53:43 -04:00
Adam Stokes f03665e67d add hostname view
Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
2015-10-26 10:50:06 -04:00
Adam Stokes 390bbdae02 Dont fail on curtin check if in dryrun
Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
2015-10-26 10:19:48 -04:00
raharper e442350213 Merge pull request #93 from CanonicalLtd/fix-disk-info-root-privs
Don't require root for disk info
2015-10-26 08:34:05 -05:00
Adam Stokes f35e3f8596 Merge pull request #96 from CanonicalLtd/identity_field_protection
Implement username field protection
2015-10-23 16:58:11 -04:00
Ryan Harper 1de06aa63e Implement username field protection
man 8 useradd says:

    It is usually recommended to only use usernames that begin with a
    lower case letter or an underscore, followed by lower case
    letters, digits, underscores, or dashes. They can end with a
    dollar sign. In regular expression terms: [a-z_][a-z0-9_-]*[$]?

    On Debian, the only constraints are that usernames must neither
    start with a dash ('-') nor plus ('+') nor tilde ('~') nor
    contain a colon (':'), a comma (','), or a whitespace (space: ' ',
    end of line: '\n', tabulation: '\t', etc.).  Note that using a
    slash ('/') may break the default algorithm for the definition
    of the user's home directory.

    Usernames may only be up to 32 characters long.

In this patch we implement most of this.  Subset of the regular
expression suggested above is used to limit input into the username
field.  We've not yet determined how to provide a fixed width widget
so at this time, user can input more than 32 characters, but upon
selectin done, we raise and error and reset the state.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-23 15:21:13 -05:00
Adam Stokes e8fb26f982 Merge pull request #95 from CanonicalLtd/safe_load_machine_config
Introduce safer loading of machine configs
2015-10-23 11:36:45 -04:00
Ryan Harper 8a441b8301 Introduce safer loading of machine configs
- Switch to yaml.safe_load() which throws errors when fed /dev/zero.
- Add a new ProberExecption and bubble that up to the main program
- Update unit tests to mock out repeated calls to safe_load which slowed
  down the unittest run.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-23 10:03:04 -05:00
Ryan Harper ade78fc993 Add missing ui/error file
Previous merge missed the ui/error.py file.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-23 09:01:09 -05:00
Adam Stokes ef43a3d81e Merge pull request #94 from CanonicalLtd/start_env_check
Start env check
2015-10-22 17:21:50 -04:00
Ryan Harper da166e6dd1 Implement ErrorView
When we encounter an error before we invoke curtin, emit
a new signal, filesystem:error and present an error
UI for the user and return them to main, from there they
can quit.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-22 16:12:59 -05:00
Ryan Harper f43bca96a3 Add environment check on startup
Use an environment check function to test if the env is
configured for running subiquity.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-22 14:39:25 -05:00
Ryan Harper 03f8e1d438 Don't require root for disk info
The spec calls for invoking hdparm -i on the device, but not all of our
devices will display hdparm data (virtual, ceph, or other such devices).
Additionally the bulk if the data in hdparm itself is not really useful
in helping users identify a specific device.  Instead, display a short
set of helpful info about the device:
  - /dev/XXXX
  - Vendor
  - Model
  - Serial
  - Size (in human-readable and bytes)
  - devpath (/devices/XXXX)
  - rotational (true or false)

The current UX requires us to select another disk after returning to
the list, with this patch though we enable switching between the
available disks via 'n' and 'p', or 'j' and 'k', which will be switched
to 'tab' and 'shift tab'.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-21 16:53:25 -05:00
Adam Stokes 128535179e Merge pull request #92 from CanonicalLtd/switch_quick_exit_key
Safe exit only on control-x
2015-10-21 14:07:07 -04:00
Ryan Harper e192fd1088 Safe exit only on control-x
The single key 'Q' or 'q' was a bridge too far since we take
input at anytime and can surprise users.  Instead use a key
combination, control-x.  Clean up keypress handlers to match
urwid requirements (return None when handled, otherwise False,
or pass to super.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-21 13:03:15 -05:00
Adam Stokes 4ee6a812ba Merge pull request #91 from CanonicalLtd/add_control_c_handler
Add control-c signal handler
2015-10-21 11:55:38 -04:00
Ryan Harper aba2963779 Add control-c signal handler
Control-c dumps python stack trace.  Instead, just exit cleanly by
hooking SIGINT.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-21 10:18:34 -05:00
Adam Stokes 4d8f113b10 Merge pull request #90 from CanonicalLtd/disk-no-serial-fallback-path
Use storage path if disks don't have valid serial numbers
2015-10-21 10:34:44 -04:00
Ryan Harper b5bea5110f Use storage path if disks don't have valid serial numbers
Some disk devices (virtio) don't have serial numbers by default.
This breaks curtin which requires a serial or a path to uniquely
find the target disks.  Add a fallback to device path if the
current device includes the eye catcher 'Unknown Serial' which
is set by probert for devices that do not have a serial number.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-21 09:28:51 -05:00
Ryan Harper 60af07ebf0 Release 0.0.2
Bump version for a new build.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-20 18:26:02 -05:00
raharper be1a01b94f Merge pull request #87 from CanonicalLtd/fix-geninstaller-subiquity-tar
Update geninstaller paths for tarball creation
2015-10-20 16:59:43 -05:00
Ryan Harper fa1ed52195 Update geninstaller paths for tarball creation
We're no longer packaging curtin_wrap.sh so we don't need to
tar up the bin dir.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-20 16:57:49 -05:00
raharper 453ddf473b Merge pull request #86 from CanonicalLtd/error_on_no_curtin
Ensure install progress fails with missing curtin
2015-10-20 16:25:17 -05:00
Ryan Harper 4af4394d18 Ensure install progress fails with missing curtin
If we fail to find curtin, we don't return a valid path
and this confuses the run async, so instead return
/bin/false which will return non-zero and trip the
async failure detection.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-20 16:21:32 -05:00
Adam Stokes 1785885bda Merge pull request #85 from CanonicalLtd/new_kitt
Simplify kitt spinner
2015-10-16 18:14:14 -04:00
Ryan Harper 6dc885f5ed Simplify kitt spinner
Testing this out, I never saw any of the utf-8 output.
Instead use simple ascii ala kirby.  Also replace the
try:except with a modulo operation to index the list.
Drop the futures import.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-16 13:36:46 -05:00
Adam Stokes b4ad1dded6 Stop alarm on curtin error
Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
2015-10-13 00:54:47 -04:00
Adam Stokes 12431bff20 Update progress indicator
Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
2015-10-13 00:51:06 -04:00
Adam Stokes 03c2805d45 Merge pull request #84 from CanonicalLtd/implement-md-model
Implement md model
2015-10-09 10:17:26 -04:00
Ryan Harper d6de9e097d Merge branch 'implement-md-model' of github.com:CanonicalLtd/subiquity into implement-md-model 2015-10-09 08:59:55 -05:00
Ryan Harper f60759d4ab unittest: fsm:bootable,installable
- Unittests for bootable and installable
- Fix not bootable, missing False return

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-09 08:57:38 -05:00
Ryan Harper 525ae944b6 Go ahead and sort the partition list
We were using sorted but not storing the result. Do so now.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-09 08:57:38 -05:00
Ryan Harper c652650e1c unittest: add tests, filesystemmodel, blockdev
- add blockdev tests on available_partitions
- fix type issue in Disk.partition OrderedDict keys, always use integers
- Add __repr__ for Disk related Actions
- Fix issue with available partition logic, ensure we and them together
- Filter out 'leave unformatted' fstype, set to None as needed.
- Whitespace cleanup in unittests
- add fsm test on get_partitions

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-09 08:57:38 -05:00
Ryan Harper a5362fb398 unittest: add filesystemmodel add_device
- add add_device test

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-09 08:57:38 -05:00
Ryan Harper 29d3214051 unittest: filesystemmodel
- get_disk with partition name
- get_all_disks
- get_available_disks

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-09 08:57:38 -05:00
Ryan Harper c6e1f547df Add equality for Actions, Disks and Blockdev classes
Unittest on filesystem model require equality methods for
the various storage classes.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
2015-10-09 08:57:38 -05:00