diff options
author | Adam Coldrick <adam.coldrick@codethink.co.uk> | 2015-06-04 15:17:44 +0000 |
---|---|---|
committer | Adam Coldrick <adam.coldrick@codethink.co.uk> | 2015-06-11 08:55:05 +0000 |
commit | e4c6b8a69f0df2d0b3beac46865a66e0de527151 (patch) | |
tree | d837a9768fe2a15557d400301ed8b6588504eb55 /extensions/rawdisk.check | |
parent | 840292841f4495a79a037f81a26d6b3f51e7cb8c (diff) | |
download | definitions-e4c6b8a69f0df2d0b3beac46865a66e0de527151.tar.gz |
Remove dependencies on morphlib and cliapp from deployment extensionsbaserock/adamcoldrick/remove-dependencies-v3
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
Diffstat (limited to 'extensions/rawdisk.check')
-rwxr-xr-x | extensions/rawdisk.check | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/extensions/rawdisk.check b/extensions/rawdisk.check index 9be0ce91..61619a21 100755 --- a/extensions/rawdisk.check +++ b/extensions/rawdisk.check @@ -15,17 +15,16 @@ '''Preparatory checks for Morph 'rawdisk' write extension''' -import cliapp - -import morphlib.writeexts - import os +import writeexts + -class RawdiskCheckExtension(morphlib.writeexts.WriteExtension): +class RawdiskCheckExtension(writeexts.WriteExtension): def process_args(self, args): if len(args) != 1: - raise cliapp.AppException('Wrong number of command line args') + raise writeexts.ExtensionError( + 'Wrong number of command line args') self.require_btrfs_in_deployment_host_kernel() @@ -34,19 +33,19 @@ class RawdiskCheckExtension(morphlib.writeexts.WriteExtension): if upgrade: if not self.is_device(location): if not os.path.isfile(location): - raise cliapp.AppException( + raise writeexts.ExtensionError( 'Cannot upgrade %s: it is not an existing disk image' % location) version_label = os.environ.get('VERSION_LABEL') if version_label is None: - raise cliapp.AppException( + raise writeexts.ExtensionError( 'VERSION_LABEL was not given. It is required when ' 'upgrading an existing system.') else: if not self.is_device(location): if os.path.exists(location): - raise cliapp.AppException( + raise writeexts.ExtensionError( 'Target %s already exists. Use `morph upgrade` if you ' 'want to update an existing image.' % location) |