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

require 'ipaddress' breaks puppet runs #129

Closed
rski opened this issue Nov 18, 2015 · 10 comments
Closed

require 'ipaddress' breaks puppet runs #129

rski opened this issue Nov 18, 2015 · 10 comments

Comments

@rski
Copy link
Member

rski commented Nov 18, 2015

This is a follow up to issue #128, as it turned out to be more complicated than I thought.

ipaddress is a library that is not present by default, yet it is required by puppet-network/lib/puppet/type/network_config.rb. Most nodes will not have it by default.

It would be nice if it could be installed with puppet using something like
package { 'ipaddress' : ensure => present, provider => gem, }
but puppet fails to create a catalog if ipaddress is not installed so it will never be possible to install it with a package resource.

As is, the workaround is to install ipaddress somehow prior to running puppet. This will break deployments and it certainly does so with mine.

A proposed solution is to rescue the require 'ipaddress' (and maybe import something non-breaking in its place). This should allow puppet to get past the catalog stage, making it possible to install the gem using a package resource. After this, I assume that when a network_config resource is defined, puppet will reload the network_config.rb file, importing ipaddress properly.

I'll look into possibly submitting a pull request to fix this very soon.

@rski
Copy link
Member Author

rski commented Nov 18, 2015

this is not quite possible and it is probably cleaner to just install the gem some other way

@rski rski closed this as completed Nov 18, 2015
@KlavsKlavsen
Copy link

this is rather annoying.. couldn't the gem be part of the module and used with ruby by using load with full path (by making puppet transfer the ipadress gem to some temp location.. just like puppetlabs-concat does f.ex.).. If this starts to be a trend for all modules, we'll constantly need to manually update all servers, install images etc.. :(

@KlavsKlavsen
Copy link

dooh. it seems its only needed on the master.. then its no issue :)

@KlavsKlavsen
Copy link

hmm. appearently it just moved the requirement of ipaddress to fail AFTER this: Could not prefetch network_config provider 'redhat': undefined method `each_with_object' for #<Array:.. when I commented the line causing that fail out - it complained on the client.

Also.. how is this supposed to work with puppet agent.. which has a selfcontained ruby env? AFAIK the load method I suggested would be the only viable approach for that? the system won't necessarily have the same ruby versions and hence not a usable module.

@KlavsKlavsen
Copy link

and btw. I installed it on my redhat 6 host (ruby 1.8) - and with ipaddress gem on BOTH master and agent.. it still fails (with above each_with_object) and if I mask that out.. it fails 👍 Could not retrieve catalog from remote server: Error 400 on SERVER: Could not autoload puppet/type/network_config: no such file to load -- ipaddress on node

@rski
Copy link
Member Author

rski commented Dec 16, 2015

@KlavsKlavsen looks like rhel6 ruby does not have the function each_with_object, which is a whole different issue.
Try running this command on irb on one of your redhat nodes:

(1..1).each_with_object(1)

@KlavsKlavsen
Copy link

irb(main):001:0> (1..1).each_with_object(1)
NoMethodError: undefined method `each_with_object' for 1..1:Range
from (irb):1
from :0

Seems so. I'm not quite ready to switch to puppet agent (which has embedded ruby :)

@lukebigum
Copy link
Contributor

This is also affecting me, and I'm stuck with CentOS 6 Ruby for the near future. I might try code an alternative to each_with_object() just for Ruby 1.8.7. If anyone has other suggestions, let me know.

@jyaworski jyaworski reopened this Jan 28, 2016
@rski
Copy link
Member Author

rski commented Jan 28, 2016

@jyaworski my original issue is resolved, please do not reopen this. If people are affected by the lack of each_with_object() they should open a different issue.

@rski rski closed this as completed Jan 28, 2016
@jyaworski
Copy link
Member

My apologies.

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

No branches or pull requests

4 participants