summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alvarez <pedro.alvarez@codethink.co.uk>2014-11-19 16:21:47 +0000
committerPedro Alvarez <pedro.alvarez@codethink.co.uk>2014-11-19 18:37:48 +0000
commit5ca9d086feef92c38cff3c613f930a79c4ae2f88 (patch)
treece35111dba1e37c83399a15d0be6793da4fb99f9
parent49d8be1a98db4724c290c8556bfa0968097ac246 (diff)
downloadmorph-5ca9d086feef92c38cff3c613f930a79c4ae2f88.tar.gz
Modify rawdisk.write to allow the deployment to devices
This patch also modifies rawdisk.write to use the UPGRADE environment variable to figure out when is doing an upgrade or a fresh deployment. This change is important because os.path.isfile doesn't work with devices.
-rwxr-xr-xmorphlib/exts/rawdisk.write9
1 files changed, 7 insertions, 2 deletions
diff --git a/morphlib/exts/rawdisk.write b/morphlib/exts/rawdisk.write
index 12db4398..29322ded 100755
--- a/morphlib/exts/rawdisk.write
+++ b/morphlib/exts/rawdisk.write
@@ -43,11 +43,16 @@ class RawDiskWriteExtension(morphlib.writeexts.WriteExtension):
raise cliapp.AppException('Wrong number of command line args')
temp_root, location = args
- if os.path.isfile(location):
+ upgrade = self.get_environment_boolean('UPGRADE')
+
+ if upgrade:
self.upgrade_local_system(location, temp_root)
else:
try:
- self.create_local_system(temp_root, location)
+ if not self.is_device(location):
+ self.create_filesytem(location)
+ self.format_btrfs(location)
+ self.create_system(temp_root, location)
self.status(msg='Disk image has been created at %s' % location)
except Exception:
self.status(msg='Failure to create disk image at %s' %