From a48d5db9586fcdbc89a1261e32afbe643d0c7f8c Mon Sep 17 00:00:00 2001 From: Kyle Drake Date: Sat, 30 May 2015 12:37:58 -0700 Subject: [PATCH] ensure that ssh disconnects --- models/site.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/models/site.rb b/models/site.rb index ea5096d0..65caaee5 100644 --- a/models/site.rb +++ b/models/site.rb @@ -563,9 +563,12 @@ class Site < Sequel::Model # Not ideal. An SoA version is in progress. if $config['ipfs_ssh_host'] && $config['ipfs_ssh_user'] rbox = Rye::Box.new $config['ipfs_ssh_host'], :user => $config['ipfs_ssh_user'] - response = rbox.ipfs "sites/#{self.username.gsub(/\/|\.\./, '')}" - output_array = response - rbox.disconnect + begin + response = rbox.ipfs "sites/#{self.username.gsub(/\/|\.\./, '')}" + output_array = response + ensure + rbox.disconnect + end else line = Cocaine::CommandLine.new('ipfs', 'add -r :path') response = line.run path: files_path