X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Farchive%2Flib%2Fpuppet%2Fparser%2Ffunctions%2Fgo_md5.rb;fp=3rdparty%2Fmodules%2Farchive%2Flib%2Fpuppet%2Fparser%2Ffunctions%2Fgo_md5.rb;h=0000000000000000000000000000000000000000;hb=f89d8091bbf5a7bd8f86ee80abb03c729cea8d74;hp=668cf2d12833a2f7c9c9d92f2ecf10bd18035488;hpb=ce70d6baf887ae03a2a6a7f5e73eb2e2c3dea208;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/archive/lib/puppet/parser/functions/go_md5.rb b/3rdparty/modules/archive/lib/puppet/parser/functions/go_md5.rb deleted file mode 100644 index 668cf2d12..000000000 --- a/3rdparty/modules/archive/lib/puppet/parser/functions/go_md5.rb +++ /dev/null @@ -1,28 +0,0 @@ -require 'puppet_x/bodeco/util' - -module Puppet::Parser::Functions - # Public: go file md5 checksum - # - # args[0] - username - # args[1] - password - # args[2] - file_name - # args[3] - go md5 checksum url - # - # http://www.thoughtworks.com/products/docs/go/12.4/help/Artifacts_API.html - # - # Returns specific file's md5 from go server md5 checksum file - newfunction(:go_md5, type: :rvalue) do |args| - raise(ArgumentError, "Invalid go md5 info url #{args}") unless args.size == 4 - - username, password, file, url = args - - uri = URI(url) - response = PuppetX::Bodeco::Util.content(uri, username: username, password: password) - - checksums = response.split("\n") - line = checksums.find { |x| x =~ %r{#{file}=} } - md5 = line.match(%r{\b[0-9a-f]{5,40}\b}) - raise("Could not parse md5 from url#{url} response: #{response.body}") unless md5 - md5[0] - end -end