diff options
author | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2014-11-19 17:19:40 +0000 |
---|---|---|
committer | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2014-11-28 18:26:15 +0000 |
commit | a5b1baf5a4493e2bce663d5ee4d11483e581b618 (patch) | |
tree | 29b43598ee7bbece735f7bd1e8a0b3629f549204 | |
parent | 2141b7d7739d64708232dde2f9c5b594baae9687 (diff) | |
download | morph-a5b1baf5a4493e2bce663d5ee4d11483e581b618.tar.gz |
Update rawdisk.check to support device deployments
-rwxr-xr-x | morphlib/exts/rawdisk.check | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/morphlib/exts/rawdisk.check b/morphlib/exts/rawdisk.check index acdc4de1..094adb72 100755 --- a/morphlib/exts/rawdisk.check +++ b/morphlib/exts/rawdisk.check @@ -33,10 +33,11 @@ class RawdiskCheckExtension(morphlib.writeexts.WriteExtension): location = args[0] upgrade = self.get_environment_boolean('UPGRADE') if upgrade: - if not os.path.isfile(location): - raise cliapp.AppException( - 'Cannot upgrade %s: it is not an existing disk image' % - location) + if not self.is_device(location): + if not os.path.isfile(location): + raise cliapp.AppException( + 'Cannot upgrade %s: it is not an existing disk image' % + location) version_label = os.environ.get('VERSION_LABEL') if version_label is None: @@ -44,9 +45,10 @@ class RawdiskCheckExtension(morphlib.writeexts.WriteExtension): 'VERSION_LABEL was not given. It is required when ' 'upgrading an existing system.') else: - if os.path.exists(location): - raise cliapp.AppException( - 'Target %s already exists. Use `morph upgrade` if you ' - 'want to update an existing image.' % location) + if not self.is_device(location): + if os.path.exists(location): + raise cliapp.AppException( + 'Target %s already exists. Use `morph upgrade` if you ' + 'want to update an existing image.' % location) RawdiskCheckExtension().run() |