diff --git a/.gitignore b/.gitignore index 0dfd567..c7ad3c9 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,7 @@ *.noarch.rpm repositories/centos/*.rpm repositories/ubuntu/*.deb +.bundled_gems/ +.bundle/ +Gemfile.lock +.tox/ diff --git a/deployment_scripts/puppet/manifests/Gemfile b/deployment_scripts/puppet/manifests/Gemfile new file mode 100644 index 0000000..0562406 --- /dev/null +++ b/deployment_scripts/puppet/manifests/Gemfile @@ -0,0 +1,23 @@ +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +source 'https://rubygems.org' + +group :development, :test do + gem 'rake' + gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.4.0' + gem 'puppetlabs_spec_helper' + # Need to use master branch of puppet-lint because of + # https://github.com/rodjek/puppet-lint/issues/355 + gem 'puppet-lint', :git => 'https://github.com/rodjek/puppet-lint.git' +end diff --git a/deployment_scripts/puppet/manifests/Rakefile b/deployment_scripts/puppet/manifests/Rakefile new file mode 100644 index 0000000..c124220 --- /dev/null +++ b/deployment_scripts/puppet/manifests/Rakefile @@ -0,0 +1,13 @@ +require 'puppet-lint/tasks/puppet-lint' +require 'puppet-syntax/tasks/puppet-syntax' + +PuppetLint.configuration.fail_on_warnings = true +PuppetLint.configuration.send('disable_80chars') +PuppetLint.configuration.send('disable_class_inherits_from_params_class') +PuppetLint.configuration.send('disable_class_parameter_defaults') + +desc "Run lint, and syntax tests." +task :test => [ + :lint, + :syntax, +] diff --git a/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_extreme_networks/Gemfile b/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_extreme_networks/Gemfile new file mode 100644 index 0000000..0562406 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_extreme_networks/Gemfile @@ -0,0 +1,23 @@ +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +source 'https://rubygems.org' + +group :development, :test do + gem 'rake' + gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.4.0' + gem 'puppetlabs_spec_helper' + # Need to use master branch of puppet-lint because of + # https://github.com/rodjek/puppet-lint/issues/355 + gem 'puppet-lint', :git => 'https://github.com/rodjek/puppet-lint.git' +end diff --git a/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_extreme_networks/Rakefile b/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_extreme_networks/Rakefile new file mode 100644 index 0000000..d18b786 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_extreme_networks/Rakefile @@ -0,0 +1,17 @@ +require 'puppetlabs_spec_helper/rake_tasks' +require 'puppet-lint/tasks/puppet-lint' +require 'puppet-syntax/tasks/puppet-syntax' + +PuppetLint.configuration.fail_on_warnings = true +PuppetLint.configuration.send('disable_80chars') +PuppetLint.configuration.send('disable_class_inherits_from_params_class') +PuppetLint.configuration.send('disable_class_parameter_defaults') +PuppetLint.configuration.send('disable_autoloader_layout') + +desc "Run lint, and syntax and spec tests." +task :test => [ + :lint, + :syntax, + :spec, +] + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_extreme_networks/manifests/extreme_host.pp b/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_extreme_networks/manifests/extreme_host.pp index d4bb722..e95e1b6 100644 --- a/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_extreme_networks/manifests/extreme_host.pp +++ b/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_extreme_networks/manifests/extreme_host.pp @@ -18,15 +18,14 @@ define plugin_zabbix_monitoring_extreme_networks::extreme_host( ) { $host = split($name,':') - if size($host) == 2 { plugin_zabbix_host { $host[0]: - host => $host[0], - type => 2, - ip => $host[1], - port => '161', - api => $plugin_zabbix::params::api_hash, - groups => $host_group, + host => $host[0], + type => 2, + ip => $host[1], + port => '161', + api => $plugin_zabbix::params::api_hash, + groups => $host_group, } plugin_zabbix_template_link { "${host[0]} Template Extreme Networks": host => $host[0], diff --git a/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_extreme_networks/manifests/init.pp b/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_extreme_networks/manifests/init.pp index 1536c89..56c06fe 100644 --- a/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_extreme_networks/manifests/init.pp +++ b/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_extreme_networks/manifests/init.pp @@ -21,20 +21,20 @@ class plugin_zabbix_monitoring_extreme_networks( include plugin_zabbix::params file { '/etc/zabbix/import/Template_Extreme_Networks.xml': - ensure => present, - source => 'puppet:///modules/plugin_zabbix_monitoring_extreme_networks/Template_Extreme_Networks.xml', + ensure => present, + source => 'puppet:///modules/plugin_zabbix_monitoring_extreme_networks/Template_Extreme_Networks.xml', } plugin_zabbix_configuration_import { 'Template_Extreme_Networks.xml Import': - ensure => present, - xml_file => '/etc/zabbix/import/Template_Extreme_Networks.xml', - api => $plugin_zabbix::params::api_hash, - require => File['/etc/zabbix/import/Template_Extreme_Networks.xml'], + ensure => present, + xml_file => '/etc/zabbix/import/Template_Extreme_Networks.xml', + api => $plugin_zabbix::params::api_hash, + require => File['/etc/zabbix/import/Template_Extreme_Networks.xml'], } plugin_zabbix_hostgroup {$host_group: - ensure => present, - api => $plugin_zabbix::params::api_hash, + ensure => present, + api => $plugin_zabbix::params::api_hash, } $zabbix_monitoring_extreme_hash = hiera('zabbix_monitoring_extreme_networks') diff --git a/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_extreme_networks/manifests/snmptt_config.pp b/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_extreme_networks/manifests/snmptt_config.pp index daa3b54..31decd8 100644 --- a/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_extreme_networks/manifests/snmptt_config.pp +++ b/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_extreme_networks/manifests/snmptt_config.pp @@ -16,33 +16,33 @@ class plugin_zabbix_monitoring_extreme_networks::snmptt_config { file { '/etc/snmp/snmptt.conf.d': - ensure => directory, - owner => 'root', - group => 'root', - mode => '0755', + ensure => directory, + owner => 'root', + group => 'root', + mode => '0755', } file { '/etc/snmp/snmptt.conf.d/extreme_networks.conf': - ensure => present, - owner => 'root', - group => 'root', - mode => '0644', - source => 'puppet:///modules/plugin_zabbix_monitoring_extreme_networks/snmptt_extreme_networks.conf', - require => File['/etc/snmp/snmptt.conf.d'], + ensure => present, + owner => 'root', + group => 'root', + mode => '0644', + source => 'puppet:///modules/plugin_zabbix_monitoring_extreme_networks/snmptt_extreme_networks.conf', + require => File['/etc/snmp/snmptt.conf.d'], } file_line { 'add extreme_networks.conf config to snmptt.ini': - path => '/etc/snmp/snmptt.ini', - after => 'snmptt_conf_files = < '/etc/snmp/snmptt.conf.d/extreme_networks.conf', - require => File['/etc/snmp/snmptt.conf.d/extreme_networks.conf'], - notify => Service['snmptt'], + path => '/etc/snmp/snmptt.ini', + after => 'snmptt_conf_files = < '/etc/snmp/snmptt.conf.d/extreme_networks.conf', + require => File['/etc/snmp/snmptt.conf.d/extreme_networks.conf'], + notify => Service['snmptt'], } service { 'snmptt': - ensure => running, - enable => true, - hasstatus => false, + ensure => running, + enable => true, + hasstatus => false, } } diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..ce17585 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,2 @@ +Sphinx +fuel-plugin-builder>=2.0.4 diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..6f7af28 --- /dev/null +++ b/tox.ini @@ -0,0 +1,51 @@ +[tox] +envlist = manifests,plugin_zabbix_monitoring_extreme_networks,build_plugin +skipsdist = True + +[testenv] +deps = -r{toxinidir}/test-requirements.txt +passenv = HOME + +[testenv:manifests] +changedir = {toxinidir}/deployment_scripts/puppet/manifests +whitelist_externals = + bundle + mkdir +commands = + mkdir -p {toxinidir}/.bundled_gems + bundle install --path {toxinidir}/.bundled_gems + bundle exec rake test + +[testenv:plugin_zabbix_monitoring_extreme_networks] +changedir = {toxinidir}/deployment_scripts/puppet/modules/{envname} +whitelist_externals = + bundle + mkdir +commands = + mkdir -p {toxinidir}/.bundled_gems + bundle install --path {toxinidir}/.bundled_gems + bundle exec rake test + +[testenv:build_plugin] +changedir = {toxinidir} +whitelist_externals= + fpb + rm +commands = + rm -rf .build + rm -rf repositories/ubuntu/*.deb + rm -rf repositories/centos/*.rpm + fpb --check {toxinidir} --debug + fpb --build {toxinidir} --debug + +[testenv:docs] +changedir = {toxinidir}/doc/plugin-guide +whitelist_externals = make +commands = + make clean html SPHINXOPTS=-W + +[testenv:qa_docs] +changedir = {toxinidir}/doc/qa +whitelist_externals = make +commands = + make clean html SPHINXOPTS=-W