spaceman117X
spaceman117X

Reputation: 251

Puppet 3 break function

I am using puppet server 3.8 and I would like to use conditional statement and when this statement is true that exit or break function that is do nothing I've tried like this

class puppet {

 if $puppet_conf == 'default' {
  break()
 }
}

but I got error

 Error 400 on SERVER: Unknown function break at /etc/puppet/modules/puppet/manifests/init.pp:4 on node

anyone knows how can I solve this? Thanks!

Upvotes: 0

Views: 1545

Answers (1)

Peter Souter
Peter Souter

Reputation: 5190

The break function was only added in Puppet 4.8, so it won't work in 3.8

https://docs.puppet.com/puppet/4.8/function.html#break

However, what are you trying to achieve? The break() function simply quits the logic block, so that if statement would doesn't really have a point.

If you want to fail the Puppet run if that variable is present, you can just do

if $puppet_conf == 'default' {
  fail('Error message')
}

Upvotes: 1

Related Questions