Issue #5126 has been updated by Nick Fagerlund.
Matt and I were working on this this afternoon. Here's an alternate patch that just parses the URL --- if it looks like http://puppet:[email protected]:3000, it'll use auth; otherwise, not. --- a/bin/external_node +++ b/bin/external_node @@ -29,6 +29,8 @@ url = ENV['PUPPET_DASHBOARD_URL'] || DASHBOARD_URL uri = URI.parse("#{url}/nodes/#{NODE}") require 'net/https' if uri.scheme == 'https' +request = Net::HTTP::Get.new(uri.path, initheader = {'Accept' => 'text/yaml'}) +request.basic_auth uri.user, uri.password if uri.user http = Net::HTTP.new(uri.host, uri.port) if uri.scheme == 'https' cert = File.read(cert_path) @@ -39,7 +41,8 @@ if uri.scheme == 'https' http.ca_file = ca_path http.verify_mode = OpenSSL::SSL::VERIFY_PEER end -result = http.start { http.request_get(uri.path, 'Accept' => 'text/yaml') } +result = http.start {|http| http.request(request)} + case result when Net::HTTPSuccess; puts result.body; exit 0 ---------------------------------------- Feature #5126: Support Basic Auth in external_node registration script https://projects.puppetlabs.com/issues/5126 Author: Stephen Sadowski Status: Accepted Priority: High Assignee: Category: Target version: Keywords: Branch: 1.0.4 Affected URL: Affected Dashboard version: bin/external_node doesn't work with basic auth in 1.0.3 or 1.0.4 - patch below. Perhaps also consider that url parse should be used for user/password and host could be set via ARGV. --- external_node.old 2010-10-27 19:51:50.000000000 +0000 +++ external_node.new 2010-10-27 19:55:32.000000000 +0000 @@ -12,11 +12,17 @@ require 'uri' require 'net/http' +USER="" +PASSWORD="" BASE="http://localhost:3000" NODE = ARGV.first url = URI.parse("#{BASE}/nodes/#{NODE}") + req = Net::HTTP::Get.new(url.path, 'Accept' => 'text/yaml') +if (USER != "") then + req.basic_auth USER,PASSWORD +end res = Net::HTTP.start(url.host, url.port) {|http| http.request(req) } case res ~ -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
