New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
apt_key: Support fetching keys over FTP. #229
Conversation
# monkeypatched to support passing in :ftp_passive_mode. | ||
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', | ||
'..', 'puppet_x', 'apt_key', | ||
'patch-openuri.rb')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't just require 'puppet_x/apt_key/patch-openuri'
(or maybe _
instead of -
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took this from the Types and Providers book, I'm not sure if the other method works, I'll try it out.
I have to wonder if there's even any ruby 1.8 users out there with Debian based distros at this point. I mean, I know if we didn't do this hack somehow SOMEONE would show up. We should seriously just consider killing 1.8 support for certain modules. |
Let me stop you right there 😄, everyone who's still on Debian Squeeze or the previous Ubuntu LTS is on Ruby 1.8 so we can't avoid it, for now. Even though support for both will end soon I don't think it's fair right now to kill 1.8 support though we could make FTP conditional on 1.9 if we really can't live with this hack. I have no idea if anyone is actually using the FTP support |
Bawww and awww. |
Fixed the |
apt_key: Support fetching keys over FTP.
This change breaks running rake spec tests. I had to back out to the 1.4.1 release to get things working: Could not autoload puppet/type/apt_key: Could not autoload puppet/provider/apt_key/apt_key: no such file to load -- puppet_x/apt_key/patch_openuri |
Yeah, something strange is going on. For some reason everything is passing on Travis yet it's breaking for just about everyone else. I don't get it. |
@diranged Can you add |
I am getting the exact error that @diranged is getting. Has there been any movement here? |
@diranged 👍 for the suggestion to back up one release. Gets me over the hump for now. |
@scotthelm @diranged: I'll push out a PR this weekend to fix it 'the ugly way' so that everyone can get back to work. Investigation will have to wait, just don't have the time right now. |
The current
apt::key
type also supports fetching key's from FTP, this commit adds it to ourapt_key
provider so we don't lose that functionality.I am extremely sorry for the
patch-openuri
hack this commit introduces, please try and not hold it against me for the rest of my life.The problem is that in Ruby 1.8.7 net/ftp defaults to using active mode for FTP which breaks just about everywhere a firewall is involved. Unfortunately it is only since Ruby 1.9.3 that net/ftp defaults to passive mode and it is only since 1.9.3 that open-uri's
open()
method accepts the:ftp_active_mode
option.So, in case this happens to be running on 1.8.7 we forcefully merge
:ftp_active_mode => false
into OpenURI'sOptions
hash and then overload the thebuffer_open()
method. I couldn't find any other way to do this. The only thing that's changed with the original implementation of this in Ruby 1.8.7 is the extraftp.passive = true if !options[:ftp_active_mode]
in the body (which I stole from the 1.9.3 implementation).