diff options
author | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2014-11-09 22:20:15 +0000 |
---|---|---|
committer | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2014-11-10 10:57:38 +0000 |
commit | 8b3f1e02b6c5e1d69e34b1b924681f8c408bae54 (patch) | |
tree | 42e28cd2156c2c0e426d821c2d3723ff4586af61 | |
parent | 3922c6a4f8df62b0f89d455ab7842d0cce5d29e6 (diff) | |
download | morph-baserock/pedroalvarez/rawdisk-to-device4.tar.gz |
Don't create rawdisk image if deploying to a devicebaserock/pedroalvarez/rawdisk-to-device4
-rwxr-xr-x | morphlib/exts/rawdisk.write | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/morphlib/exts/rawdisk.write b/morphlib/exts/rawdisk.write index 7d0ebaee..0e9453fb 100755 --- a/morphlib/exts/rawdisk.write +++ b/morphlib/exts/rawdisk.write @@ -43,11 +43,15 @@ class RawDiskWriteExtension(morphlib.writeexts.WriteExtension): raise cliapp.AppException('Wrong number of command line args') temp_root, location = args - if os.path.isfile(location): + # If the location exists and is a file, then try to upgrade it. + # The 'isfile' call should fail also if the location is a device, + # and the 'is_device' check shouldn't be needed here. + if os.path.isfile(location) and not self.is_device(location): self.upgrade_local_system(location, temp_root) else: try: - self.create_raw_disk_image(location) + if not self.is_device(location): + self.create_raw_disk_image(location) self.create_local_system(temp_root, location) self.status(msg='Disk image has been created at %s' % location) except Exception: |