I've written a parser function to scrape a website looking for the newest version of a package I want loaded on my laptop. I'm getting really wonky results.
Here's the function in all its glory completely un-edited: require 'net/https' require "rexml/document" require 'sanitize' module Puppet::Parser::Functions newfunction(:latest_makehuman_unstable, :type => :rvalue, :doc => <<-EOS This function interrogates the MakeHuman nightly builds site to detect the newest version of MakeHuman for download. Returns the deb package name EOS ) do |args| stripped=Sanitize.clean(fetch_download_list()) lines = stripped.split(/\n/); deblist=lines.grep(/x-debian/) wanted = deblist.last.split(/.deb/).first + ".deb" end end def fetch_download_list begin http = Net::HTTP.new("download.tuxfamily.org",80) http.use_ssl = false http.start do |http| req = Net::HTTP::Get.new("makehuman/nightly/", {"User-Agent" => "juretta.com RubyLicious 0.2"}) response = http.request(req) response.body end end It is supposed to return the name of the latest .deb file listed on the website. This (I thought) should be a no-brainer. Instead I get this: Error: Could not retrieve catalog from remote server: Error 400 on SERVER: undefined local variable or method `resp' for Scope(Class[Apps::Modelling::Makehuman]):Puppet::Parser::Scope at /etc/puppet/environments/production/modules/apps/manifests/modelling/makehuman.pp:41 on node saltycowdawg.tfl.berghold.net Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run The variable it is complaining about does not exist! What the heck? Any thoughts? -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAArvnv1nHpn6RoY5F%3DcNM_%3DzU2ft1Gir_3QL-McYcBOaTGzpmA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.