diff options
author | Micah <micah@riseup.net> | 2017-02-12 15:15:04 +0000 |
---|---|---|
committer | Micah <micah@riseup.net> | 2017-02-12 15:15:04 +0000 |
commit | 23355eeeffcd9663fb974a84602aeb999653f047 (patch) | |
tree | a0fdb7e12a021f48eef810482ae11d8ff7a20169 | |
parent | 79e4c135513e6040adfdd4158d84585f6dec76a5 (diff) | |
parent | 5e39cd0c5039223f11eb548e7dca5b43229b3627 (diff) |
Merge branch 'feature/debian_codename_to_version' into 'master'
Add debian_codename_to_version parser function.
See merge request !51
-rw-r--r-- | lib/puppet/parser/functions/debian_codename_to_version.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/puppet/parser/functions/debian_codename_to_version.rb b/lib/puppet/parser/functions/debian_codename_to_version.rb new file mode 100644 index 0000000..c5cbcf4 --- /dev/null +++ b/lib/puppet/parser/functions/debian_codename_to_version.rb @@ -0,0 +1,18 @@ +begin + require 'facter/util/debian' +rescue LoadError + require "#{File.dirname(__FILE__)}/../../../facter/util/debian" +end + +module Puppet::Parser::Functions + versions = Facter::Util::Debian::CODENAMES.invert + newfunction(:debian_codename_to_version, :type => :rvalue) do |args| + codename = args[0] + if versions.has_key? codename + return versions[codename].to_i + else + raise Puppet::ParseError, + "Could not determine release from codename #{codename}" + end + end +end |