Module: LVM::Attributes

Defined in:
lib/lvm/version.rb,
lib/lvm/attributes.rb

Constant Summary collapse

VERSION =
"0.4.1".freeze

Class Method Summary collapse

Class Method Details

.load(version, name) ⇒ Object



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

def load(version, name)
  cwd = __dir__

  # 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 version == "2.03.23(2)"
    version = "2.03.24(2)"
  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