summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Bourdon <obourdon@mirantis.com>2016-03-02 18:57:20 +0100
committerOlivier Bourdon <obourdon@mirantis.com>2016-03-03 08:20:05 +0100
commit277206f54052dc7cf8260de411e18a558a019357 (patch)
treed558cddb6d7554710eab6862ba7b3d84fc5d63d0
parent7d22f3b812daf693e1e515e06fde74750d0ff3e2 (diff)
Configure tox environments
Notes
Notes (review): Code-Review+2: Swann Croiset <scroiset@mirantis.com> Code-Review+2: Olivier Bourdon <obourdon@mirantis.com> Workflow+1: Olivier Bourdon <obourdon@mirantis.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Wed, 16 Mar 2016 16:44:21 +0000 Reviewed-on: https://review.openstack.org/287352 Project: openstack/fuel-plugin-zabbix-monitoring-emc Branch: refs/heads/master
-rw-r--r--.gitignore4
-rw-r--r--deployment_scripts/puppet/manifests/Gemfile23
-rw-r--r--deployment_scripts/puppet/manifests/Rakefile13
-rw-r--r--deployment_scripts/puppet/modules/plugin_zabbix_monitoring_emc/Gemfile23
-rw-r--r--deployment_scripts/puppet/modules/plugin_zabbix_monitoring_emc/Rakefile17
-rw-r--r--deployment_scripts/puppet/modules/plugin_zabbix_monitoring_emc/manifests/emc_host.pp12
-rw-r--r--deployment_scripts/puppet/modules/plugin_zabbix_monitoring_emc/manifests/init.pp17
-rw-r--r--deployment_scripts/puppet/modules/plugin_zabbix_monitoring_emc/manifests/snmptt_config.pp36
-rw-r--r--test-requirements.txt2
-rw-r--r--tox.ini51
10 files changed, 165 insertions, 33 deletions
diff --git a/.gitignore b/.gitignore
index c9dabe2..907c3cf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,7 @@
3repositories/centos/*.rpm 3repositories/centos/*.rpm
4repositories/ubuntu/*.deb 4repositories/ubuntu/*.deb
5deployment_scripts/puppet/modules/snmp 5deployment_scripts/puppet/modules/snmp
6.bundled_gems/
7.bundle/
8Gemfile.lock
9.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 @@
1# Copyright 2015 Mirantis, Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14source 'https://rubygems.org'
15
16group :development, :test do
17 gem 'rake'
18 gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.4.0'
19 gem 'puppetlabs_spec_helper'
20 # Need to use master branch of puppet-lint because of
21 # https://github.com/rodjek/puppet-lint/issues/355
22 gem 'puppet-lint', :git => 'https://github.com/rodjek/puppet-lint.git'
23end
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 @@
1require 'puppet-lint/tasks/puppet-lint'
2require 'puppet-syntax/tasks/puppet-syntax'
3
4PuppetLint.configuration.fail_on_warnings = true
5PuppetLint.configuration.send('disable_80chars')
6PuppetLint.configuration.send('disable_class_inherits_from_params_class')
7PuppetLint.configuration.send('disable_class_parameter_defaults')
8
9desc "Run lint, and syntax tests."
10task :test => [
11 :lint,
12 :syntax,
13]
diff --git a/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_emc/Gemfile b/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_emc/Gemfile
new file mode 100644
index 0000000..0562406
--- /dev/null
+++ b/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_emc/Gemfile
@@ -0,0 +1,23 @@
1# Copyright 2015 Mirantis, Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14source 'https://rubygems.org'
15
16group :development, :test do
17 gem 'rake'
18 gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.4.0'
19 gem 'puppetlabs_spec_helper'
20 # Need to use master branch of puppet-lint because of
21 # https://github.com/rodjek/puppet-lint/issues/355
22 gem 'puppet-lint', :git => 'https://github.com/rodjek/puppet-lint.git'
23end
diff --git a/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_emc/Rakefile b/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_emc/Rakefile
new file mode 100644
index 0000000..d18b786
--- /dev/null
+++ b/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_emc/Rakefile
@@ -0,0 +1,17 @@
1require 'puppetlabs_spec_helper/rake_tasks'
2require 'puppet-lint/tasks/puppet-lint'
3require 'puppet-syntax/tasks/puppet-syntax'
4
5PuppetLint.configuration.fail_on_warnings = true
6PuppetLint.configuration.send('disable_80chars')
7PuppetLint.configuration.send('disable_class_inherits_from_params_class')
8PuppetLint.configuration.send('disable_class_parameter_defaults')
9PuppetLint.configuration.send('disable_autoloader_layout')
10
11desc "Run lint, and syntax and spec tests."
12task :test => [
13 :lint,
14 :syntax,
15 :spec,
16]
17
diff --git a/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_emc/manifests/emc_host.pp b/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_emc/manifests/emc_host.pp
index 0c64fe5..46c88f3 100644
--- a/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_emc/manifests/emc_host.pp
+++ b/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_emc/manifests/emc_host.pp
@@ -21,12 +21,12 @@ define plugin_zabbix_monitoring_emc::emc_host(
21 21
22 if size($host) == 2 { 22 if size($host) == 2 {
23 plugin_zabbix_host { $host[0]: 23 plugin_zabbix_host { $host[0]:
24 host => $host[0], 24 host => $host[0],
25 type => 2, 25 type => 2,
26 ip => $host[1], 26 ip => $host[1],
27 port => '161', 27 port => '161',
28 api => $plugin_zabbix::params::api_hash, 28 api => $plugin_zabbix::params::api_hash,
29 groups => $host_group, 29 groups => $host_group,
30 } 30 }
31 plugin_zabbix_template_link { "${host[0]} Template EMC VNX": 31 plugin_zabbix_template_link { "${host[0]} Template EMC VNX":
32 host => $host[0], 32 host => $host[0],
diff --git a/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_emc/manifests/init.pp b/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_emc/manifests/init.pp
index 37aa4f6..68aa53b 100644
--- a/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_emc/manifests/init.pp
+++ b/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_emc/manifests/init.pp
@@ -21,20 +21,20 @@ class plugin_zabbix_monitoring_emc(
21 include plugin_zabbix::params 21 include plugin_zabbix::params
22 22
23 file { '/etc/zabbix/import/Template_EMC_VNX.xml': 23 file { '/etc/zabbix/import/Template_EMC_VNX.xml':
24 ensure => present, 24 ensure => present,
25 source => 'puppet:///modules/plugin_zabbix_monitoring_emc/Template_EMC_VNX.xml', 25 source => 'puppet:///modules/plugin_zabbix_monitoring_emc/Template_EMC_VNX.xml',
26 } 26 }
27 27
28 plugin_zabbix_configuration_import { 'Template_EMC_VNX.xml Import': 28 plugin_zabbix_configuration_import { 'Template_EMC_VNX.xml Import':
29 ensure => present, 29 ensure => present,
30 xml_file => '/etc/zabbix/import/Template_EMC_VNX.xml', 30 xml_file => '/etc/zabbix/import/Template_EMC_VNX.xml',
31 api => $plugin_zabbix::params::api_hash, 31 api => $plugin_zabbix::params::api_hash,
32 require => File['/etc/zabbix/import/Template_EMC_VNX.xml'], 32 require => File['/etc/zabbix/import/Template_EMC_VNX.xml'],
33 } 33 }
34 34
35 plugin_zabbix_hostgroup {$host_group: 35 plugin_zabbix_hostgroup {$host_group:
36 ensure => present, 36 ensure => present,
37 api => $plugin_zabbix::params::api_hash, 37 api => $plugin_zabbix::params::api_hash,
38 } 38 }
39 39
40 $zabbix_monitoring_emc_hash = hiera('zabbix_monitoring_emc') 40 $zabbix_monitoring_emc_hash = hiera('zabbix_monitoring_emc')
@@ -42,7 +42,6 @@ class plugin_zabbix_monitoring_emc(
42 42
43 if $hosts_string { 43 if $hosts_string {
44 $hosts = split($hosts_string,',') 44 $hosts = split($hosts_string,',')
45
46 if size($hosts) > 0 { 45 if size($hosts) > 0 {
47 plugin_zabbix_monitoring_emc::emc_host { $hosts: 46 plugin_zabbix_monitoring_emc::emc_host { $hosts:
48 host_group => $host_group, 47 host_group => $host_group,
diff --git a/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_emc/manifests/snmptt_config.pp b/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_emc/manifests/snmptt_config.pp
index fd47320..bd1daec 100644
--- a/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_emc/manifests/snmptt_config.pp
+++ b/deployment_scripts/puppet/modules/plugin_zabbix_monitoring_emc/manifests/snmptt_config.pp
@@ -16,33 +16,33 @@
16class plugin_zabbix_monitoring_emc::snmptt_config { 16class plugin_zabbix_monitoring_emc::snmptt_config {
17 17
18 file { '/etc/snmp/snmptt.conf.d': 18 file { '/etc/snmp/snmptt.conf.d':
19 ensure => directory, 19 ensure => directory,
20 owner => 'root', 20 owner => 'root',
21 group => 'root', 21 group => 'root',
22 mode => '0755', 22 mode => '0755',
23 } 23 }
24 24
25 file { '/etc/snmp/snmptt.conf.d/emc.conf': 25 file { '/etc/snmp/snmptt.conf.d/emc.conf':
26 ensure => present, 26 ensure => present,
27 owner => 'root', 27 owner => 'root',
28 group => 'root', 28 group => 'root',
29 mode => '0644', 29 mode => '0644',
30 source => 'puppet:///modules/plugin_zabbix_monitoring_emc/snmptt_emc.conf', 30 source => 'puppet:///modules/plugin_zabbix_monitoring_emc/snmptt_emc.conf',
31 require => File['/etc/snmp/snmptt.conf.d'], 31 require => File['/etc/snmp/snmptt.conf.d'],
32 } 32 }
33 33
34 file_line { 'add emc.conf config to snmptt.ini': 34 file_line { 'add emc.conf config to snmptt.ini':
35 path => '/etc/snmp/snmptt.ini', 35 path => '/etc/snmp/snmptt.ini',
36 after => 'snmptt_conf_files = <<END', 36 after => 'snmptt_conf_files = <<END',
37 line => '/etc/snmp/snmptt.conf.d/emc.conf', 37 line => '/etc/snmp/snmptt.conf.d/emc.conf',
38 require => File['/etc/snmp/snmptt.conf.d/emc.conf'], 38 require => File['/etc/snmp/snmptt.conf.d/emc.conf'],
39 notify => Service['snmptt'], 39 notify => Service['snmptt'],
40 } 40 }
41 41
42 service { 'snmptt': 42 service { 'snmptt':
43 ensure => running, 43 ensure => running,
44 enable => true, 44 enable => true,
45 hasstatus => false, 45 hasstatus => false,
46 } 46 }
47 47
48} 48}
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 @@
1Sphinx
2fuel-plugin-builder>=2.0.4
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..25081fd
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,51 @@
1[tox]
2envlist = manifests,plugin_zabbix_monitoring_emc,build_plugin
3skipsdist = True
4
5[testenv]
6deps = -r{toxinidir}/test-requirements.txt
7passenv = HOME
8
9[testenv:manifests]
10changedir = {toxinidir}/deployment_scripts/puppet/manifests
11whitelist_externals =
12 bundle
13 mkdir
14commands =
15 mkdir -p {toxinidir}/.bundled_gems
16 bundle install --path {toxinidir}/.bundled_gems
17 bundle exec rake test
18
19[testenv:plugin_zabbix_monitoring_emc]
20changedir = {toxinidir}/deployment_scripts/puppet/modules/{envname}
21whitelist_externals =
22 bundle
23 mkdir
24commands =
25 mkdir -p {toxinidir}/.bundled_gems
26 bundle install --path {toxinidir}/.bundled_gems
27 bundle exec rake test
28
29[testenv:build_plugin]
30changedir = {toxinidir}
31whitelist_externals=
32 fpb
33 rm
34commands =
35 rm -rf .build
36 rm -rf repositories/ubuntu/*.deb
37 rm -rf repositories/centos/*.rpm
38 fpb --check {toxinidir} --debug
39 fpb --build {toxinidir} --debug
40
41[testenv:docs]
42changedir = {toxinidir}/doc/plugin-guide
43whitelist_externals = make
44commands =
45 make clean html SPHINXOPTS=-W
46
47[testenv:qa_docs]
48changedir = {toxinidir}/doc/qa
49whitelist_externals = make
50commands =
51 make clean html SPHINXOPTS=-W