lib/testlab/container/io.rb in testlab-1.1.0 vs lib/testlab/container/io.rb in testlab-1.2.0

- old
+ new

@@ -11,10 +11,15 @@ def export(compression=9, local_file=nil) @ui.logger.debug { "Container Export: #{self.id} " } (self.lxc.state == :not_created) and return false + # Throw an exception if we are attempting to export a container in a + # ephemeral state. + self.lxc_clone.exists? and raise ContainerError, 'You can not export ephemeral containers!' + + # Ensure the container is stopped before we attempt to export it. self.down export_tempfile = Tempfile.new('export') remote_filename = File.basename(export_tempfile.path.dup) export_tempfile.close! @@ -54,9 +59,12 @@ # Import the container # # @return [Boolean] True if successful. def import(local_file) @ui.logger.debug { "Container Import: #{self.id} " } + + # Ensure we are not in ephemeral mode. + self.to_static self.down self.destroy self.create