lib/testlab/container/io.rb in testlab-1.4.4 vs lib/testlab/container/io.rb in testlab-1.5.0
- old
+ new
@@ -9,11 +9,11 @@
#
# @return [Boolean] True if successful.
def export(compression=9, local_file=nil)
@ui.logger.debug { "Container Export: #{self.id} " }
- (self.lxc.state == :not_created) and return false
+ (self.state == :not_created) and raise ContainerError, 'You must create a container before you can export it!'
# 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!'
@@ -47,13 +47,11 @@
please_wait(:ui => @ui, :message => format_object_action(self, 'Export', :cyan)) do
File.exists?(local_file) and FileUtils.rm_f(local_file)
self.node.download(remote_file, local_file)
end
- @ui.stdout.puts
- @ui.stdout.puts("Your shipping container is now exported and available at '#{local_file}'!".green.bold)
- @ui.stdout.puts
+ @ui.stdout.puts(format_message("Your shipping container is now exported and available at '#{local_file}'!".green.bold))
true
end
# Import the container
@@ -61,11 +59,11 @@
# @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.persistent
self.down
self.destroy
self.create
@@ -95,12 +93,10 @@
du -sh #{self.lxc.container_root}
EOF
end
- @ui.stdout.puts
- @ui.stdout.puts("Your shipping container is now imported and available for use!".green.bold)
- @ui.stdout.puts
+ @ui.stdout.puts(format_message("Your shipping container is now imported and available for use!".green.bold))
true
end
# Copy the container