Ask Your Question

ruby methods .map, .each, .gsub changes overview for puppet v3 & v4

asked 2016-09-22 20:09:03 -0500

cm01 gravatar image

Hey Guys

Can anyone give me a good overview of the changes between ruby in puppet v3 & v4.
In particular the methods named above.

I need to cvt our p3 (3.2.2) system to p4, whilst at the same time, ensure that our code will run against both versions of puppet until we have fully converted.

At the moment, I frequently come across msgs like

Detail: undefined method `gsub' for nil:NilClass

for the above methods, and have to recode them.
This is doubly tricky as I know nothing about ruby ;)

Any help gratefully received


edit retag flag offensive close merge delete


Is that more an artifact of the underlying ruby changing from 1.8.6 to something more modern (2.3.0) with the new puppet? Unless we know where they are occuring (custom facts? functions? types?) we won't be able to help you.

DarylW gravatar imageDarylW ( 2016-09-22 23:22:01 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2016-09-22 23:27:01 -0500

DarylW gravatar image

updated 2016-09-22 23:29:24 -0500

Directly relating to your issues above, that looks like some data isn't getting properly loaded into your ruby code, and so it is trying to apply collections to a 'nil' object, Ruby's equivalent to the 'null' object in java or c++. or the None type in python. Without knowing where it is being thrown (facts? functions? puppet itself?) we won't be able to help you track it down.

There were several talks that happened during puppetconf 2015 talking about the puppet 3 to puppet 4 migration path. Many of them referenced tools like this... catalog preview module. It allows you to see and diff your catalog between puppet3 and puppet4 syntax so you can inspect it for differences.

I'm not sure if it is feasable for you to upgrade to 3.8.7 first (and pay attention to all of the warnings that your puppet master spits out), That would make your transition to 4.x less painful.

You also could run a parallel puppet4 master, and forward all CA traffic to a single puppet master. That would allow you to migrate one node at a time, or run individual puppet agent -t --server puppet4.server --noop tests on each of your nodes.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-09-22 20:09:03 -0500

Seen: 41 times

Last updated: Sep 22 '16