Bug #4357

Use of Puppet::Node::Environment.current in template headers breaks on Puppet 3.5/master

Added by Dominic Cleal over 3 years ago. Updated over 3 years ago.

Status:Closed
Priority:High
Assigned To:Dmitri Dolguikh
Category:Foreman modules
Target version:Foreman - Sprint 21
Difficulty: Bugzilla link:
Found in release: Pull request:
Story points-
Velocity based estimate-
Release1.5.0Release relationshipAuto

Description

e.g. /usr/share/foreman-installer/modules/foreman/templates/_header.erb

module_paths = Puppet::Node::Environment.current[:modulepath].split(':').map{|i| File.expand_path(i) }.join('|')

Produces this error:

[ERROR 2014-02-17 12:45:01 main]  Failed to parse template foreman/settings.yaml.erb:
[ INFO 2014-02-17 12:45:01 main] Filepath: (erb)
[ INFO 2014-02-17 12:45:01 main] Line: 4
[ INFO 2014-02-17 12:45:01 main] Detail: undefined method `current' for Puppet::Node::Environment:Class
[ INFO 2014-02-17 12:45:01 main] at /usr/share/foreman-installer/modules/foreman/manifests/config.pp:8 on node foreman-el6.example.com

Affected paths:

  • /usr/share/foreman-installer/modules/foreman/templates/_header.erb
  • /usr/share/foreman-installer/modules/foreman_proxy/templates/settings.yml.erb
  • /usr/share/foreman-installer/modules/puppet/templates/_header.erb
  • /usr/share/foreman-installer/modules/puppet/templates/agent/puppet.conf.erb
  • /usr/share/foreman-installer/modules/puppet/templates/server/config.ru.erb
  • /usr/share/foreman-installer/modules/puppet/templates/server/puppet.conf.erb

Related issues

Blocks Installer - Tracker #4359: Puppet 3.5.0 support Closed 02/17/2014 02/28/2014

Associated revisions

Revision c8e1f3b6
Added by Dmitri Dolguikh over 3 years ago

fixes #4357: Removed template source from the header

Revision 67b71374
Added by Dmitri Dolguikh over 3 years ago

fixes #4357: Removed template source from the header

Revision 13d061e6
Added by Dmitri Dolguikh over 3 years ago

fixes #4357: Removed template source from the header

History

#1 Updated by Dominic Cleal over 3 years ago

  • Description updated (diff)

#2 Updated by Dominic Cleal over 3 years ago

#3 Updated by Dominic Cleal over 3 years ago

Puppet::Context.lookup(:current_environment) appears to be the way to get the current environment from 3.5.0 onwards.

If we want to keep these headers, that is.

#4 Updated by Dominic Cleal over 3 years ago

  • Due date set to 02/28/2014
  • Release set to 1.4.2

#5 Updated by Ewoud Kohl van Wijngaarden over 3 years ago

Does that also work on puppet 2.7? If not, I don't mind dropping the headers.

#6 Updated by Dominic Cleal over 3 years ago

Ewoud Kohl van Wijngaarden wrote:

Does that also work on puppet 2.7? If not, I don't mind dropping the headers.

No, we'd need to check if the new method is available and fall back otherwise. For example: https://github.com/theforeman/kafo/blob/v0.3.16/lib/kafo/validator.rb#L73-L75

I've had a change committed to Puppet master to keep the existing method, but it prints a deprecation warning, so we should still change.

#7 Updated by Dominic Cleal over 3 years ago

  • Target version set to Sprint 21

#8 Updated by Dmitri Dolguikh over 3 years ago

  • Status changed from New to Assigned
  • Assigned To set to Dmitri Dolguikh

#11 Updated by Dmitri Dolguikh over 3 years ago

  • Status changed from Ready For Testing to Closed

#12 Updated by Dominic Cleal over 3 years ago

  • Release changed from 1.4.2 to 1.5.0

There's now a deprecated compatibility method in Puppet so the installer continues to work, will release instead in 1.5.

Also available in: Atom PDF