summaryrefslogtreecommitdiff
path: root/extensions/rawdisk.write
diff options
context:
space:
mode:
authorAdam Coldrick <adam.coldrick@codethink.co.uk>2015-06-19 15:33:22 +0000
committerAdam Coldrick <adam.coldrick@codethink.co.uk>2015-06-19 15:33:22 +0000
commit53a5919884b98613a99fe7a8397e9f2f01190b8f (patch)
tree1422b88cbba6ca6da5e45bf50690d152ceb529ab /extensions/rawdisk.write
parentcd9e3ba567a704af2585ad5b46d5b1eb9609fdd4 (diff)
parente4c6b8a69f0df2d0b3beac46865a66e0de527151 (diff)
downloaddefinitions-53a5919884b98613a99fe7a8397e9f2f01190b8f.tar.gz
Merge branch 'baserock/adamcoldrick/remove-dependencies-v3'
This stops the deployment extensions from depending on morphlib and cliapp, as well as setting the definitions version to 5. Reviewed-by: Sam Thursfield <sam.thursfield@codethink.co.uk> Reviewed-by: Paul Sherwood <paul.sherwood@codethink.co.uk>
Diffstat (limited to 'extensions/rawdisk.write')
-rwxr-xr-xextensions/rawdisk.write18
1 files changed, 9 insertions, 9 deletions
diff --git a/extensions/rawdisk.write b/extensions/rawdisk.write
index 6f2d45ba..cdeb5018 100755
--- a/extensions/rawdisk.write
+++ b/extensions/rawdisk.write
@@ -17,22 +17,22 @@
'''A Morph deployment write extension for raw disk images.'''
-import cliapp
import os
import sys
import time
import tempfile
-import morphlib.writeexts
+import writeexts
-class RawDiskWriteExtension(morphlib.writeexts.WriteExtension):
+class RawDiskWriteExtension(writeexts.WriteExtension):
'''See rawdisk.write.help for documentation'''
def process_args(self, args):
if len(args) != 2:
- raise cliapp.AppException('Wrong number of command line args')
+ raise writeexts.ExtensionError(
+ 'Wrong number of command line args')
temp_root, location = args
upgrade = self.get_environment_boolean('UPGRADE')
@@ -69,10 +69,10 @@ class RawDiskWriteExtension(morphlib.writeexts.WriteExtension):
old_orig = os.path.join(mp, 'systems', 'default', 'orig')
new_orig = os.path.join(version_root, 'orig')
- cliapp.runcmd(
+ subprocess.check_call(
['btrfs', 'subvolume', 'snapshot', old_orig, new_orig])
- cliapp.runcmd(
+ subprocess.check_call(
['rsync', '-a', '--checksum', '--numeric-ids', '--delete',
temp_root + os.path.sep, new_orig])
@@ -96,11 +96,11 @@ class RawDiskWriteExtension(morphlib.writeexts.WriteExtension):
version_label = os.environ.get('VERSION_LABEL')
if version_label is None:
- raise cliapp.AppException('VERSION_LABEL was not given')
+ raise writeexts.ExtensionError('VERSION_LABEL was not given')
if os.path.exists(os.path.join(mp, 'systems', version_label)):
- raise cliapp.AppException('VERSION_LABEL %s already exists'
- % version_label)
+ raise writeexts.ExtensionError('VERSION_LABEL %s already exists'
+ % version_label)
return version_label