Issue #16635 has been updated by eric sorenson.

Status changed from Needs More Information to In Topic Branch Pending Review
Target version set to 3.x
Branch set to https://github.com/ahpook/puppet/tree/16635-pkgdmg-proxy

Hi Clay, sorry I didn't see your update on this -- This idea seems sound, 
though I'd probably do the code a bit more DRY. As a first step it should 
probably be something like the branch I just pushed to 
https://github.com/ahpook/puppet/tree/16635-pkgdmg-proxy -- I don't think it's 
quite ready to turn into a pull request because

* there are no tests yet; the pkgdmg http downloading is currently not in the 
unit tests so it'd be cool to add better coverage along with this change
* it may be preferable to use the general http connection handling in 
`lib/puppet/network/http/connection.rb` rather than a separate call to curl...? 
if not, maybe at a minimum the duplicate `http_proxy_env` `http_proxy_host`, 
etc, methods could be de-duplicated and put into `lib/puppet/util`. 

If you can help out with either of these items (particularly tests) it would 
help this along -- just send me pull requests against that branch or take it 
over on your own fork if you want. 
----------------------------------------
Bug #16635: pkgdmg provider doesn't honor http_proxy_host/http_proxy_port
https://projects.puppetlabs.com/issues/16635#change-81271

Author: Clay Caviness
Status: In Topic Branch Pending Review
Priority: Normal
Assignee: eric sorenson
Category: OSX
Target version: 3.x
Affected Puppet version: 
Keywords: 
Branch: https://github.com/ahpook/puppet/tree/16635-pkgdmg-proxy


The pkgdmg provider doesn't honor http_proxy_host/http_proxy_port settings. The 
actual file is downloaded using an exec to curl, no proxy information is passed:
<pre>curl "-o", cached_source, "-C", "-", "-k", "-L", "-s", "--url", 
source</pre>

I copied `http_proxy_env`, `http_proxy_host`, and `http_proxy_port` functions 
from `puppet/forge/repository.rb` and added them to `pkgdmg.rb`, and tweaked 
the call to curl in `pkgdmg.rb`:
<pre>if http_proxy_host and not http_proxy_port
  curl "-o", cached_source, "-C", "-", "-k", "-L", "-s", "--url", source, 
"--proxy", http_proxy_host
elsif http_proxy_host and http_proxy_port
  curl "-o", cached_source, "-C", "-", "-k", "-L", "-s", "--url", source, 
"--proxy", "#{http_proxy_host}:#{http_proxy_port}"
else
  curl "-o", cached_source, "-C", "-", "-k", "-L", "-s", "--url", source
end
</pre>

I attached my patched pkgdmg.rb. I don't really understand how the `commands 
:curl => "/usr/bin/curl"` and `curl 'foo', 'bar', 'baz'` stuff actually works, 
so there's probably a much smoother way to do this...


-- 
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.

Reply via email to