1

I've checked official puppet documentation on this and the syntax looks fine, but I still get a syntax error. Can someone please check what the problem is?

I am using puppet server 3.8.

class puppet {
  if $puppet_conf == 'default' {
  }
  elseif $puppet_conf == undef {
    file { '/etc/puppet/puppet.conf':
      ensure => present,
      owner  => "root",
      group  => "root",
      mode   => "644",
      source => "puppet:///modules/puppet/puppet.conf}",
      notify => Exec['puppet-restart'],
    }

    exec { 'puppet-restart':
      command     => '/usr/bin/touch /tmp/.puppet-restart',
      refreshonly => true,
    }
  }
  else {
    file { '/etc/puppet/puppet.conf':
      ensure => present,
      owner  => "root",
      group  => "root",
      mode   => "644",
      source => "puppet:///modules/puppet/${puppet_conf}",
      notify => Exec['puppet-restart'],
    }

    exec { 'puppet-restart':
      command     => '/usr/bin/touch /tmp/.puppet-restart',
      refreshonly => true,
    }
  }
}

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Syntax error at '=='; expected '}' at /etc/puppet/modules/puppet/manifests/init.pp:6 on node

1 Answer 1

2

There is no elseif conditional in Puppet DSL. You need to put elsif instead. Check the documentation here for more information: https://docs.puppet.com/puppet/3.8/lang_conditional.html#syntax.

Sign up to request clarification or add additional context in comments.

1 Comment

OMG! So much time lost because of overlooked character, Thanks a lot! :D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.