Jira (PUP-11218) require metaparam cannot be assinged to defined resource if inside var is named $require

12 views
Skip to first unread message

Tim Meusel (Jira)

unread,
Aug 23, 2021, 10:24:16 AM8/23/21
to puppe...@googlegroups.com
Tim Meusel created an issue
 
Puppet / Task PUP-11218
require metaparam cannot be assinged to defined resource if inside var is named $require
Issue Type: Task Task
Affects Versions: PUP 6.23.0
Assignee: Unassigned
Components: Compiler
Created: 2021/08/23 7:23 AM
Priority: Normal Normal
Reporter: Tim Meusel

Hi,
if I'm using a variable named `$require` within a defined resource,I cannot add the $require metaparameter to it. Failing code:

package { 'htop':
  ensure => 'insalled'
}
define bla {
  $require = 'a string'
  notify { $require:}
}
 
bla {'foobar':
  require => Package['htop'],
}

this fails during a puppet apply with:

Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Cannot reassign variable '$require'

I can reproduce this on Puppet 6.23.0 on Arch Linux. I checked https://puppet.com/docs/puppet/6/lang_reserved.html and require isn't listed as reserved keyword.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)
Atlassian logo

Ciprian Badescu (Jira)

unread,
Aug 23, 2021, 10:41:03 AM8/23/21
to puppe...@googlegroups.com

Ciprian Badescu (Jira)

unread,
Oct 4, 2021, 4:03:01 AM10/4/21
to puppe...@googlegroups.com

Ciprian Badescu (Jira)

unread,
Oct 4, 2021, 4:04:01 AM10/4/21
to puppe...@googlegroups.com

Ciprian Badescu (Jira)

unread,
Oct 4, 2021, 7:21:02 AM10/4/21
to puppe...@googlegroups.com
 
Re: require metaparam cannot be assinged to defined resource if inside var is named $require

I reproduces this also with class:

exec { 'hello':
  command => 'echo Hi',
}
class bla {
  $require = 'a string'
  notify { $require:}
} 
class {'bla':
  require => Exec['hello'],
}

 Error: Evaluation Error: Cannot reassign variable '$require' (file: bla.pp, line: 6, column: 12) on node localhost

 

On both cases the `require` metaparameter from bla resource/class creates a `require` variable that cannot be overwritten from resource/class definition

Ciprian Badescu (Jira)

unread,
Oct 7, 2021, 5:26:02 AM10/7/21
to puppe...@googlegroups.com

Ciprian Badescu (Jira)

unread,
Dec 13, 2021, 7:36:02 AM12/13/21
to puppe...@googlegroups.com
Ciprian Badescu updated an issue
Change By: Ciprian Badescu
Labels: needs_repro
This message was sent by Atlassian Jira (v8.20.2#820002-sha1:829506d)
Atlassian logo

Ciprian Badescu (Jira)

unread,
Dec 15, 2021, 4:54:01 AM12/15/21
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages