From b4e38d71dc8e2aff8e521b74c4229a56f4defdb9 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Wed, 19 Nov 2014 17:19:40 +0000 Subject: Update rawdisk.check to support device deployments --- morphlib/exts/rawdisk.check | 18 ++++++++++-------- 1 file 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() -- cgit v1.2.1