puppet-standalone-mashup/shared/lib/puppet/parser/functions/dir_size.rb

7 lines
165 B
Ruby
Raw Normal View History

2012-07-05 21:05:53 +00:00
module Puppet::Parser::Functions
newfunction(:dir_size, :type => :rvalue) do |path|
%x{df -m #{path}}.lines.to_a.last.strip.split(/ +/)[1].to_i / 4
end
end