Skip to content
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

Merged
merged 1 commit into from Feb 25, 2014
Merged

apt_key: Support fetching keys over FTP. #229

merged 1 commit into from Feb 25, 2014

Conversation

daenney
Copy link

@daenney daenney commented Feb 20, 2014

The current apt::key type also supports fetching key's from FTP, this commit adds it to our apt_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's Options hash and then overload the the buffer_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 extra ftp.passive = true if !options[:ftp_active_mode] in the body (which I stole from the 1.9.3 implementation).

# monkeypatched to support passing in :ftp_passive_mode.
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..',
'..', 'puppet_x', 'apt_key',
'patch-openuri.rb'))
Copy link

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 -)?

Copy link
Author

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.

@apenney
Copy link

apenney commented Feb 20, 2014

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.

@daenney
Copy link
Author

daenney commented Feb 20, 2014

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 apt::key provided, I had a hard time even finding an FTP host with a GPG key; case in point I'm using a CentOS mirror for the tests.

@apenney
Copy link

apenney commented Feb 20, 2014

Ahhhh, didn't realize the previous LTS was still 1.8, thought they were defaulting to 1.9.

Man, 1.8 is the gift that never stops giving. Yeah, someone added ftp support to yumrepo{} just the other day, so I guess SOME people keep their repos on ftp.

image

@daenney
Copy link
Author

daenney commented Feb 20, 2014

Bawww and awww.

@daenney
Copy link
Author

daenney commented Feb 21, 2014

Fixed the require line and renamed the file to patch_openuri according to @hunner's suggestion. As far as I'm concerned this is done and ready for merge.

hunner added a commit that referenced this pull request Feb 25, 2014
apt_key: Support fetching keys over FTP.
@hunner hunner merged commit cb53175 into puppetlabs:master Feb 25, 2014
@daenney daenney deleted the apt-key-ftp branch February 25, 2014 17:29
@diranged
Copy link

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

@daenney
Copy link
Author

daenney commented Mar 13, 2014

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.

@daenney
Copy link
Author

daenney commented Mar 14, 2014

@diranged Can you add p $: to the require block and see what it spits out? We're kinda betting the loadpath is screwed somehow.

@scotthelm
Copy link

I am getting the exact error that @diranged is getting. Has there been any movement here?

@scotthelm
Copy link

@diranged 👍 for the suggestion to back up one release. Gets me over the hump for now.

@daenney
Copy link
Author

daenney commented Mar 15, 2014

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants