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

check_template_in_host function missing parameter #594

Closed
fgallese opened this issue Feb 26, 2019 · 1 comment · Fixed by #595
Closed

check_template_in_host function missing parameter #594

fgallese opened this issue Feb 26, 2019 · 1 comment · Fixed by #595

Comments

@fgallese
Copy link
Contributor

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 5.5.10
  • Ruby: 2.3

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

Make use of the Zabbix_userparameters resource. For example:

zabbix::userparameters { 'nginx':
      content   => "UserParameter=nginx.json[*],curl -s 'http://$1:$2/_status' | tr -d a-zA-Z\\n | tr ' :' ',' | sed -e s/',,*'/,/g -e s/'^,'/'{\"nginx\":['/g -e s/',$'/']}'/g",
      template => 'Template App Nginx',
    }

What are you seeing

Error: /Stage[main]/Zabbix::Resources::Web/Zabbix_userparameters[my.hostname_testing_nginx]: Could not evaluate: wrong number of arguments (given 2, expected 1)

What behaviour did you expect instead

It should work.

Output log

Error: /Stage[main]/Zabbix::Resources::Web/Zabbix_userparameters[my.hostname_testing_nginx]: Could not evaluate: wrong number of arguments (given 2, expected 1) /opt/puppetlabs/puppet/cache/lib/puppet/provider/zabbix.rb:93:in check_template_in_host'
/opt/puppetlabs/puppet/cache/lib/puppet/provider/zabbix_userparameters/ruby.rb:25:in exists?' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/property/ensure.rb:81:in retrieve'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type.rb:1070:in retrieve' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type.rb:1098:in retrieve_resource'`

Any additional information you'd like to impart

The issue seems to be at the file lib/puppet/provider/zabbix.rb on the line 93, the function check_template_in_host() is only expecting the parameter host, but it should also accept the parameter template.

Making that change this works as expected.

If you want, I can provide a PR with this simple fix.

@bastelfreak
Copy link
Member

hey @fgallese, thanks for rising this issue. Please provide the PR you mentioned :)

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

Successfully merging a pull request may close this issue.

2 participants