summaryrefslogtreecommitdiff
path: root/extensions/rawdisk.write
diff options
context:
space:
mode:
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