summaryrefslogtreecommitdiff
path: root/extensions/rawdisk.check
diff options
context:
space:
mode:
authorAdam Coldrick <adam.coldrick@codethink.co.uk>2015-06-04 15:17:44 +0000
committerAdam Coldrick <adam.coldrick@codethink.co.uk>2015-06-10 14:13:27 +0000
commit370a33a33f503bba02125e13a1c8f300a656d441 (patch)
tree127fc749a6262d9ef12933913de0a057424d1ff2 /extensions/rawdisk.check
parent840292841f4495a79a037f81a26d6b3f51e7cb8c (diff)
downloaddefinitions-baserock/adamcoldrick/remove-dependencies-v2.tar.gz
Remove dependencies on morphlib and cliapp from deployment extensionsbaserock/adamcoldrick/remove-dependencies-v2
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-xextensions/rawdisk.check17
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)