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

zabbix_proxy.rb:7: syntax error #281

Closed
hikaru-noda opened this issue Sep 29, 2016 · 9 comments
Closed

zabbix_proxy.rb:7: syntax error #281

hikaru-noda opened this issue Sep 29, 2016 · 9 comments

Comments

@hikaru-noda
Copy link

hikaru-noda commented Sep 29, 2016

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 3.8.7
  • Ruby: ruby 1.9.3p484
  • Distribution: Ubuntu 14.04.4
  • Module version: 2.5.0

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

node server.example.com {
   class { 'apache':
    mpm_module => 'prefork',
  }
  include apache::mod::php
  class { 'mysql::server': }

  class { 'zabbix':
    zabbix_url       =>  $::fqdn,
    database_type    => 'mysql',
    manage_resources => true,
    zabbix_api_user => 'Admin',
    zabbix_api_pass => 'zabbix',
  }
}

node agent.example.com {
  class { 'zabbix::agent':
    server           => 'server.example.com',
    manage_resources => true,
  }
}

What are you seeing

There are some errors and puppet is unable to apply configuration.

What behaviour did you expect instead

I'm trying to setup zabbix server (without proxy) and agent using puppet-zabbix module.

Output log

root@server:~# puppet agent --test
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not autoload puppet/type/zabbix_proxy: /etc/puppet/environments/zabbix/modules/zabbix/lib/puppet/type/zabbix_proxy.rb:7: syntax error, unexpected ':', expecting ')'
  newparam(:hostname, namevar: true) do
                              ^
/etc/puppet/environments/zabbix/modules/zabbix/lib/puppet/type/zabbix_proxy.rb:46: syntax error, unexpected kEND, expecting $end on node server.example.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

The error disappears when I remove "manage_resources => true" in the server section. But I want to manage hosts using Zabbix API.
Can somebody tell me if I'm doing something wrong?
Thank you!

@bastelfreak
Copy link
Member

Hi,
this looks like a ruby187 error, are you sure you are on 193?

@hikaru-noda
Copy link
Author

Yes, I'm sure. It's default ruby installation in Ubuntu 14.04.

root@zabbix1:~# ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
root@zabbix1:~# dpkg -l | grep ruby
ii  libaugeas-ruby                   0.5.0-2                          all          Transitional package for ruby-augeas
ii  libruby1.9.1                     1.9.3.484-2ubuntu1.2             amd64        Libraries necessary to run Ruby 1.9.1
ii  ruby                             1:1.9.3.4                        all          Interpreter of object-oriented scripting language Ruby (default version)
ii  ruby-augeas                      0.5.0-2                          amd64        Augeas bindings for the Ruby language
ii  ruby-json                        1.8.0-1build1                    amd64        JSON library for Ruby
ii  ruby-shadow                      2.2.0-1                          amd64        interface of shadow password for Ruby
ii  ruby1.9.1                        1.9.3.484-2ubuntu1.2             amd64        Interpreter of object-oriented scripting language Ruby

@hikaru-noda
Copy link
Author

I've tried to update ruby to 2.1 (the later version doesn't work with Puppet 3.x). And I'm getting the same issue:

root@server:~# puppet agent --test
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not autoload puppet/type/zabbix_proxy: /etc/puppet/environments/zabbix/modules/zabbix/lib/puppet/type/zabbix_proxy.rb:7: syntax error, unexpected ':', expecting ')'
  newparam(:hostname, namevar: true) do
                              ^
/etc/puppet/environments/zabbix/modules/zabbix/lib/puppet/type/zabbix_proxy.rb:46: syntax error, unexpected kEND, expecting $end on node server.example.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
root@server:~# ruby -v
ruby 2.1.9p490 (2016-03-30 revision 54437) [x86_64-linux-gnu]

@bastelfreak
Copy link
Member

This looks really strange. Is is possible that the ruby version used by puppet is not your system ruby? Is this a self-packaged puppet or installed as gem?

@hikaru-noda
Copy link
Author

Is is possible that the ruby version used by puppet is not your system ruby?

No, the puppet uses system ruby:

root@server~# ps aux | grep puppet
root      4051 56.4  1.3 220596 53456 pts/2    Sl+  17:07   0:03 /usr/bin/ruby /usr/bin/puppet agent --test
root      4112  0.0  0.0  10460   920 pts/3    S+   17:07   0:00 grep --color=auto puppet
root@server:~# /usr/bin/ruby -v
ruby 2.1.9p490 (2016-03-30 revision 54437) [x86_64-linux-gnu]

Is this a self-packaged puppet or installed as gem?

The puppet installed from the PuppetLabs repo:

root@server:~# cat /etc/apt/sources.list.d/puppetlabs-products.list
# This file is managed by Puppet. DO NOT EDIT.
# Puppetlabs products
deb http://apt.puppetlabs.com trusty main
deb-src http://apt.puppetlabs.com trusty main

@hikaru-noda
Copy link
Author

Moreover I'm getting the same error on the Cent OS 7.2:

[root@zabbix3 ~]# cat /etc/issue
\S
Kernel \r on an \m

[root@server2 ~]# ruby -v
ruby 2.0.0p598 (2014-11-13) [x86_64-linux]
[root@server2 ~]# puppet agent --test
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not autoload puppet/type/zabbix_proxy: /etc/puppet/environments/zabbix/modules/zabbix/lib/puppet/type/zabbix_proxy.rb:7: syntax error, unexpected ':', expecting ')'
  newparam(:hostname, namevar: true) do
                              ^
/etc/puppet/environments/feature_zabbix/modules/zabbix/lib/puppet/type/zabbix_proxy.rb:46: syntax error, unexpected kEND, expecting $end on node server2.example.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

@hikaru-noda
Copy link
Author

hikaru-noda commented Oct 1, 2016

Should I install something except the puppet modules (puppet-zabbix and it's dependencies)? I looked at the list of installed gems, there wasn't a zabbixapi gem. I've successfully installed it by hands and now I'm getting another one error message:

root@server:~# puppet agent --test
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not autoload puppet/type/zabbix_template: /etc/puppet/environments/zabbix/modules/zabbix/lib/puppet/type/zabbix_template.rb:7: syntax error, unexpected ':', expecting ')'
  newparam(:template_name, namevar: true) do
                                   ^
/etc/puppet/environments/zabbix/modules/zabbix/lib/puppet/type/zabbix_template.rb:30: syntax error, unexpected kEND, expecting $end on node server.example.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
root@server:~# gem list

*** LOCAL GEMS ***

bigdecimal (1.2.4)
bundler (1.13.2)
io-console (0.4.3)
json (1.8.1)
minitest (4.7.5)
psych (2.0.5)
rake (10.1.0)
rdoc (4.1.0)
test-unit (2.1.9.0)
zabbixapi (2.4.8)

@hikaru-noda
Copy link
Author

My Puppet server is running on CentOS 6 with ruby 1.8.7. If the Puppet run "types" on the server that might be a root cause of my issues. I'll install the new Puppet server using newer ruby and check this guess.

@hikaru-noda
Copy link
Author

My fault, the Puppet's types are executed on the server side where I had ruby-1.8.7.
The issues isn't reproduced with ruby-1.9.3.

Thank you for help!

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

2 participants