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

Syntax error at '{'; expected '}' at /etc/puppet/modules/zabbix/manifests/server.pp:340 on node zabbix #115

Closed
ghost opened this issue Aug 24, 2015 · 3 comments

Comments

@ghost
Copy link

ghost commented Aug 24, 2015

After installing the 1.6.0 version of the module, I'm getting a syntax error in server.pp on line 340. I'm not doing anything special, just the bare minimum configuration. The same config works in version 1.5.0 of the module.

Environment Information.

[root@zabbix ~]# cat /etc/redhat-release
CentOS release 6.7 (Final)
[root@zabbix ~]# uname -a
Linux zabbix 2.6.32-573.3.1.el6.x86_64 #1 SMP Thu Aug 13 22:55:16 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@zabbix ~]# puppet --version
2.7.26
[root@zabbix ~]# puppet module install wdijkerman-zabbix
Preparing to install into /etc/puppet/modules ...
Downloading from http://forge.puppetlabs.com ...
Installing -- do not interrupt ...
/etc/puppet/modules
└── wdijkerman-zabbix (v1.6.0)

Puppet Module

[root@zabbix ~]# cat zabbix.pp
class { 'apache':
    mpm_module => 'prefork',
  }
  include apache::mod::php

  class { 'mysql::server': }

  class { 'zabbix':
    zabbix_url    => 'localhost',
    database_type => 'mysql',
  }

Here is the error I'm receiving. As you can see, the same actions work in version 1.5.0.

[root@zabbix ~]# puppet apply ./zabbix.pp
Syntax error at '{'; expected '}' at /etc/puppet/modules/zabbix/manifests/server.pp:340 on node zabbix
[root@zabbix ~]#

[root@zabbix ~]# puppet module uninstall wdijkerman-zabbix
Preparing to uninstall 'wdijkerman-zabbix' ...
Removed 'wdijkerman-zabbix' (v1.6.0) from /etc/puppet/modules
[root@zabbix ~]# puppet module install wdijkerman-zabbix --version 1.5.0
Preparing to install into /etc/puppet/modules ...
Downloading from http://forge.puppetlabs.com ...
Installing -- do not interrupt ...
/etc/puppet/modules
└── wdijkerman-zabbix (v1.5.0)
[root@zabbix ~]# puppet apply ./zabbix.pp
notice: /File[/var/lib/puppet/concat]/ensure: created
--- snip ---
notice: /Stage[main]/Apache::Service/Service[httpd]/ensure: ensure changed 'stopped' to 'running'
notice: Finished catalog run in 133.37 seconds
[root@zabbix ~]#
@dj-wasabi
Copy link
Contributor

Hi,

Thank you for making time to create this issue.
It seems that puppet 2.7 doesn't know what "unless" is: http://stackoverflow.com/questions/26337352/string-comparison-using-in-doesnt-work-with-unless

  unless defined(Class['Zabbix::Repo']) {
    class { 'zabbix::repo':
      zabbix_version => $zabbix_version,
      manage_repo    => $manage_repo,
    }
  }

This part is used on the following files:

  • server.pp
  • agent.pp
  • javagateway.pp
  • proxy.pp

You could edit the files, so it would like this:

  if ! defined(Class['Zabbix::Repo']) {
    class { 'zabbix::repo':
      zabbix_version => $zabbix_version,
      manage_repo    => $manage_repo,
    }
  }

@ghost
Copy link
Author

ghost commented Aug 25, 2015

That resolved the issue. Thank you for your quick response.

[root@zabbix ~]# puppet module install wdijkerman-zabbix
Preparing to install into /etc/puppet/modules ...
Downloading from http://forge.puppetlabs.com ...
Installing -- do not interrupt ...
/etc/puppet/modules
└── wdijkerman-zabbix (v1.6.0)
[root@zabbix ~]# ls
anaconda-ks.cfg  install.log  install.log.syslog  zabbix.pp
[root@zabbix ~]# puppet apply zabbix.pp
Syntax error at '{'; expected '}' at /etc/puppet/modules/zabbix/manifests/server.pp:340 on node zabbix
[root@zabbix ~]# cd /etc/puppet/modules/zabbix/manifests/
[root@zabbix manifests]# grep 'unless defined' *.pp
agent.pp:  unless defined(Class['Zabbix::Repo']) {
javagateway.pp:  unless defined(Class['Zabbix::Repo']) {
proxy.pp:  unless defined(Class['Zabbix::Repo']) {
server.pp:  unless defined(Class['Zabbix::Repo']) {
web.pp:  unless defined(Class['Zabbix::Repo']) {
[root@zabbix manifests]#
[root@zabbix manifests]# sed -i 's/unless defined(/if ! defined(/g' *.pp
[root@zabbix manifests]# grep 'if ! defined' *.pp
agent.pp:  if ! defined(Class['Zabbix::Repo']) {
javagateway.pp:  if ! defined(Class['Zabbix::Repo']) {
proxy.pp:  if ! defined(Class['Zabbix::Repo']) {
server.pp:  if ! defined(Class['Zabbix::Repo']) {
web.pp:  if ! defined(Class['Zabbix::Repo']) {
[root@zabbix manifests]# cd /vagrant
[root@zabbix vagrant]# puppet apply zabbix.pp
notice: /Stage[main]/Zabbix::Web/File[/etc/zabbix/web]/owner: owner changed 'apache' to 'zabbix'
notice: /Stage[main]/Zabbix::Web/File[/etc/zabbix/web]/group: group changed 'apache' to 'zabbix'
notice: /Stage[main]/Zabbix::Web/File[/etc/zabbix/web]/mode: mode changed '0750' to '0755'
notice: /Stage[main]/Apache/Apache::Vhost[default]/Concat[15-default.conf]/File[15-default.conf]/ensure: defined content as '{md5}5848ba87051ecdbfd5031b5c530b5c7e'
notice: /Stage[main]/Apache::Service/Service[httpd]: Triggered 'refresh' from 1 events
notice: Finished catalog run in 3.33 seconds
[root@zabbix vagrant]# puppet apply zabbix.pp
notice: Finished catalog run in 2.67 seconds
[root@zabbix vagrant]#

@ghost ghost closed this as completed Aug 25, 2015
@dj-wasabi
Copy link
Contributor

Please be aware that you should make the same change when you install an newer version of the module on your environment. "Unless" ;-) you upgrade your puppet..

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant