summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-11-05 17:49:36 -0600
committerLuke Kanies <luke@madstop.com>2008-11-05 17:49:36 -0600
commitf4800e8aeb6196aebc43d36f69b2e2a182d1bf5c (patch)
tree5710c5a59bb6956ca04db6e9cbef3186c8352bcf /lib/puppet
parent44fadd1847e477b713ab2d0de5633ae446a3642e (diff)
downloadpuppet-f4800e8aeb6196aebc43d36f69b2e2a182d1bf5c.tar.gz
puppet-f4800e8aeb6196aebc43d36f69b2e2a182d1bf5c.tar.xz
puppet-f4800e8aeb6196aebc43d36f69b2e2a182d1bf5c.zip
Adding a method to Checksums to extract the sum type
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/util/checksums.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/puppet/util/checksums.rb b/lib/puppet/util/checksums.rb
index 15d2eadd1..4b51789f6 100644
--- a/lib/puppet/util/checksums.rb
+++ b/lib/puppet/util/checksums.rb
@@ -1,6 +1,15 @@
# A stand-alone module for calculating checksums
# in a generic way.
module Puppet::Util::Checksums
+ # Strip the checksum type from an existing checksum
+ def sumtype(checksum)
+ if checksum =~ /^\{(\w+)\}/
+ return $1
+ else
+ return nil
+ end
+ end
+
# Calculate a checksum using Digest::MD5.
def md5(content)
require 'digest/md5'