-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the Bug
Puppet Documentation suggests that it is possible to access variables from module ERB templates via the scope['variable_name'] syntax. It is unclear whether that only works for module variables, eg:
class module_name {
$var1 = 3 # This works
}or also for hiera-defined variables, eg in module_name/data/common.yaml:
module_name::var1: 3 # This does not workExpected Behavior
This ERB template should work:
This is a value: <%= scope['module_name::var1']%>Steps to Reproduce
Steps to reproduce the behavior:
Create a puppet module with the following files:
- module_name/templates/test.erb
This is a value: <%= scope['module_name::var1']%>- module_name/hiera.yaml
---
version: 5
defaults:
datadir: data
data_hash: yaml_data
hierarchy:
- name: "common"
path: "common.yaml"- module_name/data/common.yaml:
This is a value: <%= scope['module_name::var1']%>- module_name/manifests/init.pp:
file { '/some/test':
content => template("$module_name/test.erb")
}Environment
- Version Puppetserver 8.7.0
- Platform Redhat 9
Additional Context
I have tried scope['var1'], scope.lookupvar( <full and short name>0, etc.
I can only resolve the value in a template if it is defined as an explicit variable in the manifest, eg:
$var1 = $module_name::var1
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working