Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of deferred function fails due to complex types in epp #513

Closed
traylenator opened this issue Apr 12, 2024 · 2 comments · Fixed by #515 · May be fixed by puppetlabs/puppetlabs-stdlib#1425
Closed

Use of deferred function fails due to complex types in epp #513

traylenator opened this issue Apr 12, 2024 · 2 comments · Fixed by #515 · May be fixed by puppetlabs/puppetlabs-stdlib#1425

Comments

@traylenator
Copy link
Contributor

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 7.24.0
  • Module version:

How to reproduce (e.g Puppet code you use)

Needs to be run on a puppet server and distinct agent setup, i.e not rspec or puppet apply.

redis::instance{String($port):
  service_enable => true,
  service_ensure => 'running',
  requirepass    => Deferred('secret::get',['redis_password']),
  port           => $port,                                      
  bind           => [], # all interfaces
}

What are you seeing

It compiles fine but during the stdlib::deferable_epp part in the apply

Error: Failed to apply catalog: Evaluation Error: Resource type not found: Stdlib::Absolutepath (file: inlined-epp-text, line: 3, column: 3)

What behaviour did you expect instead

Should be possible to set password as a deferred to be late evaluated on the agent however it fails due to lack of rich
data types being available on the agent nodes.

Any additional information you'd like to impart

The only way I know to "fix" this is to strip back the data types in the template to core data types e..g

Stdlib::Absolutepath -> String[1]

would be very happy to hear if other options are available.

@traylenator traylenator changed the title Use of deferred function fails due to complex in epp types. Use of deferred function fails due to complex types in epp Apr 12, 2024
@traylenator
Copy link
Contributor Author

redis.conf supports include /path/to/local.conf so placing password in own file is one possibility.

@traylenator
Copy link
Contributor Author

Another alternative process the template twice once with epp and once as a deferred epp with suitable escaping on the first pass. Cleaner if works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants