lib/testlab/container/io.rb in testlab-1.18.1 vs lib/testlab/container/io.rb in testlab-1.19.0
- old
+ new
@@ -112,11 +112,11 @@
end
# Import the container
#
# @return [Boolean] True if successful.
- def import(local_file)
+ def import(local_file=nil)
@ui.logger.debug { "Container Import: #{self.id}" }
self.node.alive? or return false
import_tempfile = Tempfile.new('import')
@@ -139,11 +139,11 @@
end
# Ensure we are not in ephemeral mode.
self.persistent
- self.down
- self.destroy
+ (self.state == :running) and self.down
+ self.exists? and self.destroy
self.create
self.node.exec(%(sudo rm -fv #{remote_file}), :silence => true, :ignore_exit_status => true)
self.node.upload(local_file, remote_file, :on_progress => method(:progress_callback), :read_size => READ_SIZE, :use_scp => true)