Ask Your Question
2

what are some common gotchas re-writing manifests from 2.7.x to 3.x?

asked 2013-10-21 12:55:38 -0500

law gravatar image

updated 2013-10-25 04:07:35 -0500

I'm probably several months behind in upgrading from 2.7, but what are some common gotchas when upgrading my manifests from the 2.7-style to the 3.x style? Here's an example of a simple module that works great in 2.7.x, what can I expect to have to re-write going into 3.x?
http://pastebin.com/hCEPxbsD

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
4

answered 2013-10-21 17:55:41 -0500

Ancillas gravatar image

updated 2013-10-21 17:56:23 -0500

Here's a good list of breaking changes.

Your biggest "gotcha" is going to be variable scoping. Dynamic scoping has been removed, so you have to fully-qualify variables.

For example, $ntpd_loc would become $ntpd::ntpd_loc.

class ntpd::config {
  file { $ntpd::ntpd_loc:
    content => template("ntpd/ntp.conf.erb"),
    require => Class["ntpd::install"]
  }

} # End class

This also changes $environment to $::environment since $::environment is a top-level variable.

edit flag offensive delete link more
2

answered 2013-10-24 08:44:23 -0500

The biggest "gotcha" for me when I migrated my code from puppet 2.6 to 3.x - was "mysterious" errors that appeared because of explicit usage of import 'file.pp' statements. The errors I observed because of it, looked like "class not found" error messages for classes/modules that 100% existed in the same module. Errors disappeared, after removing all the import statements from all module's classes.

See official notes on import.

The other "gotcha" was related to using camelCase in puppet module names. Sometime the classes in files with MixedCase filename were not found, I had to convert ... (more)

edit flag offensive delete link more

Comments

1

This is good information. 3.x is much stricter than earlier versions.

ramindk gravatar imageramindk ( 2013-10-25 12:39:06 -0500 )edit
1

answered 2013-10-21 19:19:20 -0500

ramindk gravatar image

updated 2013-10-21 21:49:35 -0500

Ancillas gravatar image

If your modules are working under 2.7 and not spitting out depreciation messages you shouldn't need to do much. Keep in mind that 2.7 may issue depreciation notices for problems in your modules that will break in 3.x.

I highly recommend setting up a second master that is running 3.x and testing your 2.7 clients against it rather than upgrading your current master in place. Additionally you will may need to change puppet.conf, config.ru, and auth.conf to work with a 3.x master. If you've made custom changes to those ... (more)

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

Stats

Asked: 2013-10-21 12:55:38 -0500

Seen: 198 times

Last updated: Oct 24 '13