summaryrefslogtreecommitdiff
path: root/lib/puppet/parser/functions
diff options
context:
space:
mode:
authorTravis Fields <cyberious@users.noreply.github.com>2014-11-07 13:42:48 -0800
committerTravis Fields <cyberious@users.noreply.github.com>2014-11-07 13:42:48 -0800
commit406e9dbda2fe3378ba624b8297e3209c3298e515 (patch)
treef83624db06aac7887e56c66ff26f4ee704595259 /lib/puppet/parser/functions
parent4bff0d2d61b8b31cd132fdc7896f115ef2b96770 (diff)
parent9295d0d5cae91f8c9b3b4b4fd891661666ab9e13 (diff)
Merge pull request #343 from zacharyalexstern/fix_to_bytes
Added correct converstions for PB and EB.
Diffstat (limited to 'lib/puppet/parser/functions')
-rw-r--r--lib/puppet/parser/functions/to_bytes.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/puppet/parser/functions/to_bytes.rb b/lib/puppet/parser/functions/to_bytes.rb
index 8ff73d1..df490ea 100644
--- a/lib/puppet/parser/functions/to_bytes.rb
+++ b/lib/puppet/parser/functions/to_bytes.rb
@@ -2,6 +2,8 @@ module Puppet::Parser::Functions
newfunction(:to_bytes, :type => :rvalue, :doc => <<-EOS
Converts the argument into bytes, for example 4 kB becomes 4096.
Takes a single string value as an argument.
+ These conversions reflect a layperson's understanding of
+ 1 MB = 1024 KB, when in fact 1 MB = 1000 KB, and 1 MiB = 1024 KiB.
EOS
) do |arguments|
@@ -21,7 +23,8 @@ module Puppet::Parser::Functions
when 'M' then return (value*(1<<20)).to_i
when 'G' then return (value*(1<<30)).to_i
when 'T' then return (value*(1<<40)).to_i
- when 'E' then return (value*(1<<50)).to_i
+ when 'P' then return (value*(1<<50)).to_i
+ when 'E' then return (value*(1<<60)).to_i
else raise Puppet::ParseError, "to_bytes(): Unknown prefix #{prefix}"
end
end