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

Fix216 #217

Merged
merged 5 commits into from
May 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/puppet/provider/zabbix.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# encoding: utf-8
# zabbix provider type for puppet
# rubocop:disable Style/ClassAndModuleChildren
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the point of that style?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would force us to use:

class Puppet
  class Provider
    class Zabbix
    end
  end
end

But it would overwrite the Puppet/Provider classes.

class Puppet::Provider::Zabbix < Puppet::Provider
# Require the zabbixapi gem
def self.require_zabbix
Expand Down
1 change: 0 additions & 1 deletion lib/puppet/provider/zabbix_application/ruby.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'zabbix'))
Puppet::Type.type(:zabbix_application).provide(:ruby, parent: Puppet::Provider::Zabbix) do
def connect
Expand Down
1 change: 0 additions & 1 deletion lib/puppet/provider/zabbix_host/ruby.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'zabbix'))
Puppet::Type.type(:zabbix_host).provide(:ruby, parent: Puppet::Provider::Zabbix) do
def create
Expand Down
1 change: 0 additions & 1 deletion lib/puppet/provider/zabbix_hostgroup/ruby.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'zabbix'))
Puppet::Type.type(:zabbix_hostgroup).provide(:ruby, parent: Puppet::Provider::Zabbix) do
def connect
Expand Down
1 change: 0 additions & 1 deletion lib/puppet/provider/zabbix_proxy/ruby.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'zabbix'))
Puppet::Type.type(:zabbix_proxy).provide(:ruby, parent: Puppet::Provider::Zabbix) do
def create
Expand Down
1 change: 0 additions & 1 deletion lib/puppet/provider/zabbix_template/ruby.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'zabbix'))
Puppet::Type.type(:zabbix_template).provide(:ruby, parent: Puppet::Provider::Zabbix) do
def create
Expand Down
1 change: 0 additions & 1 deletion lib/puppet/provider/zabbix_template_host/ruby.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'zabbix'))
Puppet::Type.type(:zabbix_template_host).provide(:ruby, parent: Puppet::Provider::Zabbix) do
def template_name
Expand Down
1 change: 0 additions & 1 deletion lib/puppet/provider/zabbix_userparameters/ruby.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'zabbix'))
Puppet::Type.type(:zabbix_userparameters).provide(:ruby, parent: Puppet::Provider::Zabbix) do
def create
Expand Down
1 change: 0 additions & 1 deletion lib/puppet/type/zabbix_application.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..'))
require 'puppet/util/zabbix'

Expand Down
1 change: 0 additions & 1 deletion lib/puppet/type/zabbix_host.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
Puppet::Type.newtype(:zabbix_host) do
ensurable do
defaultvalues
Expand Down
1 change: 0 additions & 1 deletion lib/puppet/type/zabbix_hostgroup.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..'))
require 'puppet/util/zabbix'

Expand Down
1 change: 0 additions & 1 deletion lib/puppet/type/zabbix_proxy.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
Puppet::Type.newtype(:zabbix_proxy) do
ensurable do
defaultvalues
Expand Down
1 change: 0 additions & 1 deletion lib/puppet/type/zabbix_template.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
Puppet::Type.newtype(:zabbix_template) do
ensurable do
defaultvalues
Expand Down
1 change: 0 additions & 1 deletion lib/puppet/type/zabbix_template_host.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..'))
require 'puppet/util/zabbix'

Expand Down
1 change: 0 additions & 1 deletion lib/puppet/type/zabbix_userparameters.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..'))
Puppet::Type.newtype(:zabbix_userparameters) do
ensurable do
Expand Down
1 change: 0 additions & 1 deletion lib/puppet/util/zabbix.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
# this module adds additional params to a puppet type
module Puppet::Util::Zabbix # rubocop:disable Style/ClassAndModuleChildren
def self.add_zabbix_type_methods(type)
Expand Down
3 changes: 1 addition & 2 deletions manifests/agent.pp
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,7 @@
# is set to for example "eth1" or "bond0.73".
if ($listenip != undef) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this whole thing could be turned into a case statement to a little clearer

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but lets leave that for another time maybe?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep. referenced in another issue.

if ($listenip =~ /^(eth|bond|lxc|eno|tap|tun).*/) {
$int_name = "ipaddress_${listenip}"
$listen_ip = inline_template('<%= scope.lookupvar(int_name) %>')
$int_name = getvar("::ipaddress_${listenip}")
} elsif is_ip_address($listenip) or $listenip == '*' {
$listen_ip = $listenip
} else {
Expand Down
3 changes: 1 addition & 2 deletions manifests/proxy.pp
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,7 @@
# is set to for example "eth1" or "bond0.73".
if ($listenip != undef) {
if ($listenip =~ /^(eth|bond|lxc|eno|tap|tun).*/) {
$int_name = "ipaddress_${listenip}"
$listen_ip = inline_template('<%= scope.lookupvar(int_name) %>')
$int_name = getvar("::ipaddress_${listenip}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heck, we could even put it into a function, seeing how we've got it twice :P

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mentioned that in #212. We should track that in a further PR.

} elsif is_ip_address($listenip) {
$listen_ip = $listenip
} else {
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
{
"name": "puppetlabs/stdlib",
"version_requirement": ">= 4.1.0"
"version_requirement": ">= 4.4.0"
},
{
"name": "puppetlabs/mysql",
Expand Down
1 change: 0 additions & 1 deletion spec/classes/agent_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
require 'spec_helper'

describe 'zabbix::agent' do
Expand Down
1 change: 0 additions & 1 deletion spec/classes/coverage_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
require 'rspec-puppet'

at_exit { RSpec::Puppet::Coverage.report! }
1 change: 0 additions & 1 deletion spec/classes/database_mysql_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
require 'spec_helper'

describe 'zabbix::database::mysql' do
Expand Down
1 change: 0 additions & 1 deletion spec/classes/database_postgresql_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
require 'spec_helper'

describe 'zabbix::database::postgresql' do
Expand Down
1 change: 0 additions & 1 deletion spec/classes/database_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
require 'spec_helper'

describe 'zabbix::database' do
Expand Down
1 change: 0 additions & 1 deletion spec/classes/javagateway_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
require 'spec_helper'

describe 'zabbix::javagateway' do
Expand Down
1 change: 0 additions & 1 deletion spec/classes/proxy_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
require 'spec_helper'

describe 'zabbix::proxy' do
Expand Down
1 change: 0 additions & 1 deletion spec/classes/repo_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
require 'spec_helper'

describe 'zabbix::repo' do
Expand Down
1 change: 0 additions & 1 deletion spec/classes/sender_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
require 'spec_helper'

describe 'zabbix::sender' do
Expand Down
1 change: 0 additions & 1 deletion spec/classes/server_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
require 'spec_helper'

describe 'zabbix::server' do
Expand Down
1 change: 0 additions & 1 deletion spec/classes/userparameter_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
require 'spec_helper'

describe 'zabbix::userparameter' do
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/web_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
require 'spec_helper'

def package_provider_for_gems
Expand Down Expand Up @@ -117,7 +116,8 @@ def package_provider_for_gems
database_name: 'zabbix-server',
database_user: 'zabbix-server',
database_password: 'zabbix-server',
zabbix_server: 'localhost')
zabbix_server: 'localhost'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while you're at it, add a trailing comma

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in bd2918e

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@igalic: rubocop doesn't want the comma:
https://travis-ci.org/voxpupuli/puppet-zabbix/jobs/129740215

rubocop is here a bit stricter than in other modules. remove the cop or the commit? I vote for the commit.

)
end

it { should contain_file('/etc/zabbix/web/zabbix.conf.php').with_content(/^\$DB\['SERVER'\] = 'localhost'/) }
Expand Down
1 change: 0 additions & 1 deletion spec/defines/userparameters_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
require 'spec_helper'

describe 'zabbix::userparameters', type: :define do
Expand Down
1 change: 0 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
require 'puppetlabs_spec_helper/module_spec_helper'
require 'rspec-puppet-facts'
include RspecPuppetFacts