Clean Up Dir..
This commit is contained in:
@ -83,7 +83,7 @@ class DockerClient
|
|||||||
Rails.logger.info('destroying container ' + container.to_s)
|
Rails.logger.info('destroying container ' + container.to_s)
|
||||||
container.stop.kill
|
container.stop.kill
|
||||||
container.port_bindings.values.each { |port| PortPool.release(port) }
|
container.port_bindings.values.each { |port| PortPool.release(port) }
|
||||||
FileUtils.rm_rf(local_workspace_path(container)) if local_workspace_path(container)
|
Pathname.new(local_workspace_path).children.each{ |p| p.rmtree} if local_workspace_path(container)
|
||||||
container.delete(force: true)
|
container.delete(force: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -94,6 +94,8 @@ class DockerClient
|
|||||||
def execute_command(command, before_execution_block, output_consuming_block)
|
def execute_command(command, before_execution_block, output_consuming_block)
|
||||||
#tries ||= 0
|
#tries ||= 0
|
||||||
@container = DockerContainerPool.get_container(@execution_environment)
|
@container = DockerContainerPool.get_container(@execution_environment)
|
||||||
|
#clear directory (it should be emtpy anyhow)
|
||||||
|
Pathname.new(local_workspace_path).children.each{ |p| p.rmtree}
|
||||||
if @container
|
if @container
|
||||||
before_execution_block.try(:call)
|
before_execution_block.try(:call)
|
||||||
send_command(command, @container, &output_consuming_block)
|
send_command(command, @container, &output_consuming_block)
|
||||||
@ -167,9 +169,7 @@ class DockerClient
|
|||||||
|
|
||||||
def return_container(container)
|
def return_container(container)
|
||||||
local_workspace_path = self.class.local_workspace_path(container)
|
local_workspace_path = self.class.local_workspace_path(container)
|
||||||
#FileUtils.rm_rf(local_workspace_path) if local_workspace_path
|
|
||||||
Pathname.new(local_workspace_path).children.each{ |p| p.rmtree}
|
Pathname.new(local_workspace_path).children.each{ |p| p.rmtree}
|
||||||
#FileUtils.mkdir(local_workspace_path)
|
|
||||||
DockerContainerPool.return_container(container, @execution_environment)
|
DockerContainerPool.return_container(container, @execution_environment)
|
||||||
end
|
end
|
||||||
private :return_container
|
private :return_container
|
||||||
@ -202,5 +202,6 @@ class DockerClient
|
|||||||
end
|
end
|
||||||
private :send_command
|
private :send_command
|
||||||
|
|
||||||
|
|
||||||
class Error < RuntimeError; end
|
class Error < RuntimeError; end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user