Deprecated language features

This version of Puppet is not included in Puppet Enterprise. The latest version of PE includes Puppet 4.9.

The following features of the Puppet language are deprecated, and will be removed in a future Puppet version.

Several Hiera 3.x features

The following Hiera features are deprecated, since we replaced them with improved equivalents in Hiera 5. They’ll be removed in Puppet 6.

Old feature Replacement
The classic hiera_* functions. The lookup function.
The hiera command line tool. The puppet lookup command.
Version 3 and version 4 of the hiera.yaml file. Version 5.
Hiera 3 custom backends. Hiera 5 custom backends.
Setting a global hash merge behavior in hiera.yaml. Per-key and per-lookup merge behavior.
The calling_module, calling_class, and calling_class_path pseudo-variables. The module data layer.

Non-strict variables

Now

By default, you can access the value of a variable that was never assigned. The value of an unassigned variable is undef.

If you set the strict_variables setting to true, Puppet will instead raise an error if you try to access an unassigned variable.

In Puppet 5.0

The strict_variables setting will be removed, and Puppet will always raise an error for accessing unassigned variables.

Detecting and updating

Enable strict_variables on your Puppet master, run as normal for a while, and look for compilation errors.

Now

Puppet doesn’t validate the value of the ensure attribute in file resources. If the value is not present, absent, file, directory, or link, Puppet treats the value as an arbitrary path and creates a symbolic link to that path.

For example, these resource declarations are equivalent:

file { "/etc/inetd.conf":
  ensure => link,
  target => "/etc/inet/inetd.conf",
}

file { "/etc/inetd.conf":
  ensure => "/etc/inet/inetd.conf",
}

However, syntax errors in the ensure attribute’s value can lead to unexpected behaviors. For instance, mistyping a value can lead Puppet to create a symbolic link that treats the typo as the link’s target:

file { "/etc/inetd.conf":
  ensure => filer,
}

The above example results in Puppet creating a symbolic link at /etc/inetd.conf that points to filer—it doesn’t throw an error or produce a warning.

$ sudo /opt/puppetlabs/bin/puppet apply -e 'file { "/etc/inetd.conf": ensure => filer}'
Notice: Compiled catalog for master.example.com in environment production in 1.18 seconds
Notice: /Stage[main]/Main/File[/etc/filer]/ensure: created
Notice: Applied catalog in 0.49 seconds

$ sudo ls -la /etc/inetd.conf
lrwxrwxrwx 1 root root 10 Nov  9 20:53 /etc/inetd.conf -> filer

In Puppet 5.0

This behavior will be removed. If the value of ensure isn’t one of its allowed values, the Puppet run will fail with an error instead of attempting to create a symlink.

Detecting and updating

Confirm that the ensure attribute of your file resources has one of its allowed values. If you rely on this implicit symlinking behavior, change the value of ensure to link and add a target attribute that contains the target path as its value.

↑ Back to top