summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2014-02-17 13:31:47 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2014-03-04 14:47:24 +0000
commit9b9a6151aa262f748a286f72819242c2a118a7f9 (patch)
tree07a95332a076fe5153afa8886c0625f32d3afa1e
parentd2168a0fe0bc7f05caaeaf81681d0c3d17731e14 (diff)
downloadmorph-9b9a6151aa262f748a286f72819242c2a118a7f9.tar.gz
deploy: Honour AUTOSTART in ssh-rsync extension
Now you can deploy an upgrade, set it to be the default version and reboot into it all with one call to `morph deploy`.
-rwxr-xr-xmorphlib/exts/ssh-rsync.write5
1 files changed, 5 insertions, 0 deletions
diff --git a/morphlib/exts/ssh-rsync.write b/morphlib/exts/ssh-rsync.write
index 8dc0fe35..509520ae 100755
--- a/morphlib/exts/ssh-rsync.write
+++ b/morphlib/exts/ssh-rsync.write
@@ -59,6 +59,7 @@ class SshRsyncWriteExtension(morphlib.writeexts.WriteExtension):
root_disk = self.find_root_disk(location)
version_label = os.environ.get('VERSION_LABEL')
+ autostart = self.get_environment_boolean('AUTOSTART')
self.status(msg='Creating remote mount point')
remote_mnt = cliapp.ssh_runcmd(location, ['mktemp', '-d']).strip()
@@ -110,6 +111,10 @@ class SshRsyncWriteExtension(morphlib.writeexts.WriteExtension):
cliapp.ssh_runcmd(location, ['umount', remote_mnt])
cliapp.ssh_runcmd(location, ['rmdir', remote_mnt])
+ if autostart:
+ self.status(msg="Rebooting into new system ...")
+ ssh_runcmd_ignore_failure(location, ['reboot'])
+
def create_remote_orig(self, location, version_root, remote_mnt,
temp_root):
'''Create the subvolume version_root/orig on location'''