Close SSH session before exiting

This commit is contained in:
Thibault Jouan
2014-07-01 19:54:33 +00:00
parent 9359f2e595
commit 336003d2d7
6 changed files with 31 additions and 0 deletions

View File

@@ -54,6 +54,7 @@ module Producer
def run
worker.process load_recipe.tasks
env.cleanup
end
def load_recipe

View File

@@ -44,6 +44,10 @@ module Producer
def dry_run?
@dry_run
end
def cleanup
remote.cleanup
end
end
end
end

View File

@@ -2,6 +2,7 @@ module Producer
module Core
class Remote
attr_reader :hostname
attr_writer :session
def initialize(hostname)
@hostname = hostname
@@ -43,6 +44,10 @@ module Producer
def environment
Environment.new_from_string(execute 'env')
end
def cleanup
session.close if @session
end
end
end
end