diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2014-10-08 10:28:23 +0000 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2014-10-08 14:41:17 +0100 |
commit | bd6bae145a4f7064caa4ee49f7e815452d4469e8 (patch) | |
tree | 50426048ae1646882a98d464b5570a9400c3801d | |
parent | 4fff47462e598d475e930893383f9c27e6f2c381 (diff) | |
download | definitions-bd6bae145a4f7064caa4ee49f7e815452d4469e8.tar.gz |
deploy: Make ssh-rsync upgrade extension handle unset VERSION_LABEL
It now gives an error message.
Previously it would fail with a backtrace like this:
2014-10-08 09:51:37 [systems/genivi-baseline-system-armv7lhf-jetson.morph][self]Removing temporary mounts
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/cliapp/app.py", line 190, in _run
self.process_args(args)
File "/src/morph/morphlib/exts/ssh-rsync.write", line 54, in process_args
self.upgrade_remote_system(location, temp_root)
File "/src/morph/morphlib/exts/ssh-rsync.write", line 107, in upgrade_remote_system
location, ['btrfs', 'subvolume', 'delete', orig_dir])
UnboundLocalError: local variable 'orig_dir' referenced before assignment
-rwxr-xr-x | ssh-rsync.check | 7 | ||||
-rwxr-xr-x | ssh-rsync.write | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/ssh-rsync.check b/ssh-rsync.check index 6a776ce9..11446c28 100755 --- a/ssh-rsync.check +++ b/ssh-rsync.check @@ -18,8 +18,9 @@ import cliapp -import morphlib.writeexts +import os +import morphlib.writeexts class SshRsyncCheckExtension(morphlib.writeexts.WriteExtension): def process_args(self, args): @@ -33,6 +34,10 @@ class SshRsyncCheckExtension(morphlib.writeexts.WriteExtension): 'Baserock machines. It cannot be used for an initial ' 'deployment.') + if os.environ.get('VERSION_LABEL', '') == '': + raise cliapp.AppException( + 'A VERSION_LABEL must be set when deploying an upgrade.') + location = args[0] self.check_ssh_connectivity(location) self.check_is_baserock_system(location) diff --git a/ssh-rsync.write b/ssh-rsync.write index 468e5a1f..775619ec 100755 --- a/ssh-rsync.write +++ b/ssh-rsync.write @@ -60,7 +60,7 @@ class SshRsyncWriteExtension(morphlib.writeexts.WriteExtension): self.complete_fstab_for_btrfs_layout(temp_root, uuid) - version_label = os.environ.get('VERSION_LABEL') + version_label = os.environ['VERSION_LABEL'] autostart = self.get_environment_boolean('AUTOSTART') self.status(msg='Creating remote mount point') |