lib/elecksee/storage/overlay_directory.rb in elecksee-1.0.8 vs lib/elecksee/storage/overlay_directory.rb in elecksee-1.0.10

- old
+ new

@@ -1,6 +1,6 @@ -require 'elecksee/helpers' +require 'elecksee/helpers/base' class Lxc class OverlayDirectory attr_reader :name @@ -29,7 +29,22 @@ if(File.directory?(overlay_path)) command("rm -rf #{overlay_path}", :sudo => true) end end + end + + # Clone directory does the same as the overlay, just in + # a persistent place + class CloneDirectory < OverlayDirectory + def initialize(name, args={}) + args[:tmp_dir] = args[:dir] if args[:dir] + args[:tmp_dir] || '/var/lib/lxc' + super + end + + def overlay_path + File.join(tmp_dir, name) + end + alias_method :target_path, :overlay_path end end