summaryrefslogtreecommitdiff
path: root/extensions/writeexts.py
Commit message (Collapse)AuthorAgeFilesLines
* writeexts: Fix some errors the `pep8` tool foundSam Thursfield2016-02-251-7/+6
| | | | | | | | | | This includes a crash if DISK_SIZE isn't specified (due to missing 'writeexts' import). There are still various indent/formatting issues that `pep8` complains about. Change-Id: Ida805ad829eeee62768ac54313417d4c9a4a94d9
* writeexts: Clarify a few docstringsSam Thursfield2016-02-251-3/+19
| | | | Change-Id: I742825726280656d5834817c8a0b496fa6aedaae
* Opearate on the temp root when looking for menu.c32James Thomas2016-02-251-4/+4
| | | | | | | | It's possible we'll be generating the bootloader configuration on a partition that doesn't have the root filing system, so grap this file from the extracted rootfs instead Change-Id: I7a599654c2686f554e54aee069dd38200ab9e915
* Correctly setup /boot partition if availibleJames Thomas2016-02-251-10/+45
| | | | | | | | | | | | | | | Treat the prescence of a /boot partition as the partition where the bootloader configuration should live. By maintaining the baserock system layout, and installing the bootloader configuration to /boot in this manner, we can allow boot syslinux and u-boot systems to be upgraded Additionally move the installation of the MBR for x86 systems to where the partitioned system is created, since we only need to do it when deploying a partitioned system Change-Id: I39c90f73f22da209eefc1c408bd6d6c0ab6fd048
* Move extlinux.conf to /extlinux/James Thomas2016-02-251-1/+9
| | | | | | | | U-boot's sysboot command generally looks for the config in /extlinux rather than /, so move it there and create a symlink to maintain comptability with syslinux Change-Id: I19173e284993f364cc8892ba44b8f5d7bc394ec3
* Split btrfs filesystem functions in layout and rootfs creationJames Thomas2016-02-251-8/+13
| | | | | | | This will allow us to mirror the baserock btrfs layout on a non btrfs partition Change-Id: If5dbba133a187eeb26eae671da7dd71495127c8e
* Split creation of the bootloader config/install into separate functionJames Thomas2016-02-251-28/+46
| | | | | | | This will allow us to use the existing btfs layout function on other partitions (namely /boot) Change-Id: I6d43e6eb25c263f7c18eb06b96fa6076483f8e67
* Fix bug in fstab layout generationRichard Ipsum2015-11-021-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a bug in our fstab layout generation, currently we fail to generate the complete fstab layout, so /etc/fstab in any newly deployed or upgraded baserocks contains just: # Morph default system layout UUID=<uuid> / btrfs defaults,rw,noatime 0 1 This is actually a pretty bad problem because it breaks system-version-manager, since systemd creates a btrfs subvolume and mounts it to /var/lib/machines if /var/lib/machines doesn't already exist[1]. As a result system-version-manager when asked to remove an image will fail to do so, since it will fail to remove the /run subvolume because of the subvolume created at /run/var/lib/machines. The result is a partially removed image that cannot be removed with system-version-manager. The fstab layout we use currently: UUID=<uuid> / btrfs defaults,rw,noatime 0 1 UUID=<uuid> /var btrfs subvol=/state/var,defaults,rw,noatime 0 2 UUID=<uuid> /opt btrfs subvol=/state/opt,defaults,rw,noatime 0 2 UUID=<uuid> /srv btrfs subvol=/state/srv,defaults,rw,noatime 0 2 UUID=<uuid> /root btrfs subvol=/state/root,defaults,rw,noatime 0 2 UUID=<uuid> /home btrfs subvol=/state/home,defaults,rw,noatime 0 2 ensures that anything created under /var goes into a shared /state/var subvolume, so when systemd creates its 'machines' subvolume it will be under state/ which doesn't cause any problems when we try to remove a system. To reproduce, deploy an upgrade to your machine, reboot into the upgraded system, when you cat /etc/fstab you should see only one entry, mounting /. Now switch back to the previous image with, system-version-manager set-default <previous image name> reboot remove the newly deployed image with, system-version-manager remove <upgraded image name> after some time this will fail with an error message similar to this: Removing system: faultylayout Delete subvolume (no-commit): '/tmp/tmp1gdIL2/systems/faultylayout/run' ERROR: cannot delete '/tmp/tmp1gdIL2/systems/faultylayout/run' - Directory not empty Delete subvolume (no-commit): '/tmp/tmp1gdIL2/systems/faultylayout/orig' Traceback (most recent call last): File "/usr/bin/system-version-manager", line 421, in <module> SystemVersionManager(sys.argv, mount_dir).run() File "/usr/bin/system-version-manager", line 401, in run self.cmd_remove(args.system_name) File "/usr/bin/system-version-manager", line 363, in cmd_remove shutil.rmtree(system_root) File "/usr/lib/python2.7/shutil.py", line 247, in rmtree rmtree(fullname, ignore_errors, onerror) File "/usr/lib/python2.7/shutil.py", line 247, in rmtree rmtree(fullname, ignore_errors, onerror) File "/usr/lib/python2.7/shutil.py", line 247, in rmtree rmtree(fullname, ignore_errors, onerror) File "/usr/lib/python2.7/shutil.py", line 247, in rmtree rmtree(fullname, ignore_errors, onerror) File "/usr/lib/python2.7/shutil.py", line 256, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/usr/lib/python2.7/shutil.py", line 254, in rmtree os.rmdir(path) OSError: [Errno 1] Operation not permitted: '/tmp/tmp1gdIL2/systems/faultylayout/run/var/lib/machines [1]: http://cgit.freedesktop.org/systemd/systemd/commit/?id=113b3fc1a8061f4a24dd0db74e9a3cd0083b2251 Change-Id: I9c160d1fdd75fbbf9a3336d1ce35e4ce8ed7787d
* Rawdisk partitioning v2: Add partitioning functionsEdward Cragg2015-10-241-40/+283
| | | | | | Add partitioning functions to the rawdisk.write deployment extension Change-Id: I45bcabc191951d086b8f4ae028a248f95a5e6f2e
* writeexts.py: Capture stderr so that errors are capturedEdward Cragg2015-07-301-1/+1
| | | | | | | | The conversion from cliapp to the direct use of subprocess left a call which did not capture stderr, so `stderr=subprocess.STDOUT` is added to maintain the expected behaviour. Change-Id: I3ee0c064f9813d15004234d4daea81dc8219fc42
* Remove dependencies on morphlib and cliapp from deployment extensionsbaserock/adamcoldrick/remove-dependencies-v3Adam Coldrick2015-06-111-56/+167
| | | | | | | | | | | | | | | | This is done by either copying some utility functions from morph into writeexts.py, and using the `subprocess` module rather than cliapp's runcmd and ssh_runcmd. Note that this means that these extensions will require "$definitions_checkout/extensions" in PYTHONPATH when they are run. This commit also updates VERSION to 5, since the PYTHONPATH requirement means that this change is incompatible with old versions of morph. Change-Id: Iec6fa7e3c7219619ce55e18493e5c37c36e97816
* Stop writeexts.py depending on morphlibAdam Coldrick2015-06-101-6/+17
| | | | Change-Id: I7f3702e80678aeee89dd22116510a6d8d7e04841
* Put writeexts.py in extensions subdirectoryAdam Coldrick2015-06-101-0/+624
Change-Id: I6eb8fe69416bbf483ffa8c1c317c8f8cea56ef0e