Sha256: aa8d8e03f8a3b9cd92646f67634be911a3eff94967531b8df6f853670c74ac57

Contents?: true

Size: 846 Bytes

Versions: 1

Compression:

Stored size: 846 Bytes

Contents

require "yaml"

module LVM
  module Attributes
    VERSION = "0.2.3"

    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
        return 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
    module_function :load
  end # module Attributes
end # module LVM

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chef-ruby-lvm-attrib-0.2.3 lib/lvm/attributes.rb