Module: LVM::Attributes

Defined in:
lib/lvm/attributes.rb

Constant Summary collapse

VERSION =
"0.3.3".freeze

Class Method Summary collapse

Class Method Details

.load(version, name) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/lvm/attributes.rb', line 7

def load(version, name)
  cwd = File.dirname(__FILE__)

  # was going to be symlinks, but rubygems didn't seem to want to package
  # them
  if version == "2.02.28"
    version = "2.02.27"
  elsif ((31..39).map { |x| "2.02.#{x}" }).include?(version)
    version = "2.02.30"
  end

  file = File.join(cwd, "attributes", version, name)

  begin
    YAML.load_file(file)
  rescue Errno::ENOENT => e
    raise ArgumentError.new("Unable to load lvm attributes [#{name}] for version [#{version}]. " \
      "The version/object may not be supported or you may need to upgrade the chef-ruby-lvm-attrib gem. Error [#{e.message}]")
  end
end