Class: Lxc::OverlayDirectory

Inherits:
Object
  • Object
show all
Defined in:
lib/elecksee/storage/overlay_directory.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, args = {}) ⇒ OverlayDirectory

Returns a new instance of OverlayDirectory.



9
10
11
12
13
# File 'lib/elecksee/storage/overlay_directory.rb', line 9

def initialize(name, args={})
  @name = name
  @tmp_dir = args[:tmp_dir] || '/tmp/lxc/ephemerals'
  create
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/elecksee/storage/overlay_directory.rb', line 6

def name
  @name
end

#tmp_dirObject (readonly)

Returns the value of attribute tmp_dir.



7
8
9
# File 'lib/elecksee/storage/overlay_directory.rb', line 7

def tmp_dir
  @tmp_dir
end

Instance Method Details

#createObject



20
21
22
23
24
# File 'lib/elecksee/storage/overlay_directory.rb', line 20

def create
  unless(File.directory?(overlay_path))
    FileUtils.mkdir_p(overlay_path)
  end
end

#destroyObject



26
27
28
# File 'lib/elecksee/storage/overlay_directory.rb', line 26

def destroy
  FileUtils.rm_rf(overlay_path) if File.directory?(overlay_path)
end

#overlay_pathObject Also known as: target_path



15
16
17
# File 'lib/elecksee/storage/overlay_directory.rb', line 15

def overlay_path
  File.join(tmp_dir, 'virt-overlays', name)
end