On Tuesday, 3 January 2017 10:59:42 UTC, R.I. Pienaar wrote:
>
>
>
> ----- Original Message ----- 
> > From: "Paul Seymour" <paul.s...@ig.com <javascript:>> 
> > To: "puppet-users" <puppet...@googlegroups.com <javascript:>> 
> > Sent: Tuesday, 3 January, 2017 11:57:02 
> > Subject: [Puppet Users] Trouble with future parser ? 
>
> > Hi, 
> > 
> > OK trying to evaluate how much work and effort it's going to be to move 
> to 
> > Puppet v4.x I have switched on the future parser in our Dev environment. 
> > 
> > I am now getting this kind of thing:- 
> > 
> > $ puppet agent -t --trace 
> > Info: Retrieving pluginfacts 
> > Info: Retrieving plugin 
> > Info: Loading facts 
> > Error: Could not retrieve catalog from remote server: Error 400 on 
> SERVER: 
> > Evaluation Error: Error while evaluating a Function Call, Failed to 
> parse 
> > template grub2/default_grub.erb: 
> >  Filepath: 
> > /etc/puppet/environments/dev/modules/grub2/templates/default_grub.erb 
> >  Line: 15 
> >  Detail: undefined method `empty?' for nil:NilClass 
>
> I'm guessing it's due to the empty? call on the @cmdline_linux variable? 
> You'll have to show the class code etc. 
>
> My guess would be that particular variable is not known within the scope 
> of 
> the class where you use the template, older puppet had dynamic scope for 
> templates 
> and that's been removed. 
>
>
Thanks. Slightly cut down 

class grub2::params {
  $config_template       = 'grub2/default_grub.erb'
  $cmdline_linux         = 'vconsole.font=latarcyrheb-sun16 
rd.lvm.lv=vg01/root crashkernel=auto vconsole.keymap=uk zswap.enabled=1 
net.ifnames=0 ipv6.disable=1'
  $cmdline_linux_default = ''
  $default_entry         = '0'
  $device_install        = ''
  $update_binary         = '/usr/sbin/grub2-mkconfig'
  $grub2_options         = hiera('grub2::options', $cmdline_linux)
...
}

class grub2 (
  $cmdline_linux         = $grub2::params::cmdline_linux,
  $grub2_options         = $grub2::params::grub2_options,
  $cmdline_linux_default = $grub2::params::cmdline_linux_default,
  $config_file           = $grub2::params::config_file,
  $build_file            = $grub2::params::build_file,
  $config_template       = $grub2::params::config_template,
  $update_binary         = $grub2::params::update_binary,
  $update_grub           = $grub2::params::update_grub,
  $transparent_hugepages = $grub2::params::transparent_hugepages,
...
) inherits grub2::params {

class grub2::config {
  file { $::grub2::config_file:
    ensure  => 'file',
    owner   => '0',
    group   => '0',
    mode    => '0644',
    content => template($::grub2::config_template),
    require => Class['grub2::install'],
  }

The scoping thing is more than likely I would say.

Thanks,

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/9b2571eb-5b23-4663-8471-fc2cdc24915d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to