Browse Source

Configure tox environments

Change-Id: I1ae791666ff1c1a11659f4154d33bbaac47c5dee
Olivier Bourdon 3 years ago
parent
commit
277206f540

+ 4
- 0
.gitignore View File

@@ -3,3 +3,7 @@
3 3
 repositories/centos/*.rpm
4 4
 repositories/ubuntu/*.deb
5 5
 deployment_scripts/puppet/modules/snmp
6
+.bundled_gems/
7
+.bundle/
8
+Gemfile.lock
9
+.tox/

+ 23
- 0
deployment_scripts/puppet/manifests/Gemfile View File

@@ -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.
14
+source 'https://rubygems.org'
15
+
16
+group :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'
23
+end

+ 13
- 0
deployment_scripts/puppet/manifests/Rakefile View File

@@ -0,0 +1,13 @@
1
+require 'puppet-lint/tasks/puppet-lint'
2
+require 'puppet-syntax/tasks/puppet-syntax'
3
+
4
+PuppetLint.configuration.fail_on_warnings = true
5
+PuppetLint.configuration.send('disable_80chars')
6
+PuppetLint.configuration.send('disable_class_inherits_from_params_class')
7
+PuppetLint.configuration.send('disable_class_parameter_defaults')
8
+
9
+desc "Run lint, and syntax tests."
10
+task :test => [
11
+  :lint,
12
+  :syntax,
13
+]

+ 23
- 0
deployment_scripts/puppet/modules/plugin_zabbix_monitoring_emc/Gemfile View File

@@ -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.
14
+source 'https://rubygems.org'
15
+
16
+group :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'
23
+end

+ 17
- 0
deployment_scripts/puppet/modules/plugin_zabbix_monitoring_emc/Rakefile View File

@@ -0,0 +1,17 @@
1
+require 'puppetlabs_spec_helper/rake_tasks'
2
+require 'puppet-lint/tasks/puppet-lint'
3
+require 'puppet-syntax/tasks/puppet-syntax'
4
+
5
+PuppetLint.configuration.fail_on_warnings = true
6
+PuppetLint.configuration.send('disable_80chars')
7
+PuppetLint.configuration.send('disable_class_inherits_from_params_class')
8
+PuppetLint.configuration.send('disable_class_parameter_defaults')
9
+PuppetLint.configuration.send('disable_autoloader_layout')
10
+
11
+desc "Run lint, and syntax and spec tests."
12
+task :test => [
13
+  :lint,
14
+  :syntax,
15
+  :spec,
16
+]
17
+

+ 6
- 6
deployment_scripts/puppet/modules/plugin_zabbix_monitoring_emc/manifests/emc_host.pp View File

@@ -21,12 +21,12 @@ define plugin_zabbix_monitoring_emc::emc_host(
21 21
 
22 22
   if size($host) == 2 {
23 23
     plugin_zabbix_host { $host[0]:
24
-      host     => $host[0],
25
-      type     => 2,
26
-      ip       => $host[1],
27
-      port     => '161',
28
-      api      => $plugin_zabbix::params::api_hash,
29
-      groups   => $host_group,
24
+      host   => $host[0],
25
+      type   => 2,
26
+      ip     => $host[1],
27
+      port   => '161',
28
+      api    => $plugin_zabbix::params::api_hash,
29
+      groups => $host_group,
30 30
     }
31 31
     plugin_zabbix_template_link { "${host[0]} Template EMC VNX":
32 32
       host     => $host[0],

+ 8
- 9
deployment_scripts/puppet/modules/plugin_zabbix_monitoring_emc/manifests/init.pp View File

@@ -21,20 +21,20 @@ class plugin_zabbix_monitoring_emc(
21 21
   include plugin_zabbix::params
22 22
 
23 23
   file { '/etc/zabbix/import/Template_EMC_VNX.xml':
24
-    ensure     => present,
25
-    source     => 'puppet:///modules/plugin_zabbix_monitoring_emc/Template_EMC_VNX.xml',
24
+    ensure => present,
25
+    source => 'puppet:///modules/plugin_zabbix_monitoring_emc/Template_EMC_VNX.xml',
26 26
   }
27 27
 
28 28
   plugin_zabbix_configuration_import { 'Template_EMC_VNX.xml Import':
29
-    ensure     => present,
30
-    xml_file   => '/etc/zabbix/import/Template_EMC_VNX.xml',
31
-    api        => $plugin_zabbix::params::api_hash,
32
-    require    => File['/etc/zabbix/import/Template_EMC_VNX.xml'],
29
+    ensure   => present,
30
+    xml_file => '/etc/zabbix/import/Template_EMC_VNX.xml',
31
+    api      => $plugin_zabbix::params::api_hash,
32
+    require  => File['/etc/zabbix/import/Template_EMC_VNX.xml'],
33 33
   }
34 34
 
35 35
   plugin_zabbix_hostgroup {$host_group:
36
-    ensure     => present,
37
-    api        => $plugin_zabbix::params::api_hash,
36
+    ensure => present,
37
+    api    => $plugin_zabbix::params::api_hash,
38 38
   }
39 39
 
40 40
   $zabbix_monitoring_emc_hash = hiera('zabbix_monitoring_emc')
@@ -42,7 +42,6 @@ class plugin_zabbix_monitoring_emc(
42 42
 
43 43
   if $hosts_string {
44 44
     $hosts = split($hosts_string,',')
45
-
46 45
     if size($hosts) > 0 {
47 46
       plugin_zabbix_monitoring_emc::emc_host { $hosts:
48 47
         host_group => $host_group,

+ 18
- 18
deployment_scripts/puppet/modules/plugin_zabbix_monitoring_emc/manifests/snmptt_config.pp View File

@@ -16,33 +16,33 @@
16 16
 class plugin_zabbix_monitoring_emc::snmptt_config {
17 17
 
18 18
   file { '/etc/snmp/snmptt.conf.d':
19
-    ensure     => directory,
20
-    owner      => 'root',
21
-    group      => 'root',
22
-    mode       => '0755',
19
+    ensure => directory,
20
+    owner  => 'root',
21
+    group  => 'root',
22
+    mode   => '0755',
23 23
   }
24 24
 
25 25
   file { '/etc/snmp/snmptt.conf.d/emc.conf':
26
-    ensure     => present,
27
-    owner      => 'root',
28
-    group      => 'root',
29
-    mode       => '0644',
30
-    source     => 'puppet:///modules/plugin_zabbix_monitoring_emc/snmptt_emc.conf',
31
-    require    => File['/etc/snmp/snmptt.conf.d'],
26
+    ensure  => present,
27
+    owner   => 'root',
28
+    group   => 'root',
29
+    mode    => '0644',
30
+    source  => 'puppet:///modules/plugin_zabbix_monitoring_emc/snmptt_emc.conf',
31
+    require => File['/etc/snmp/snmptt.conf.d'],
32 32
   }
33 33
 
34 34
   file_line { 'add emc.conf config to snmptt.ini':
35
-    path       => '/etc/snmp/snmptt.ini',
36
-    after      => 'snmptt_conf_files = <<END',
37
-    line       => '/etc/snmp/snmptt.conf.d/emc.conf',
38
-    require    => File['/etc/snmp/snmptt.conf.d/emc.conf'],
39
-    notify     => Service['snmptt'],
35
+    path    => '/etc/snmp/snmptt.ini',
36
+    after   => 'snmptt_conf_files = <<END',
37
+    line    => '/etc/snmp/snmptt.conf.d/emc.conf',
38
+    require => File['/etc/snmp/snmptt.conf.d/emc.conf'],
39
+    notify  => Service['snmptt'],
40 40
   }
41 41
 
42 42
   service { 'snmptt':
43
-    ensure     => running,
44
-    enable     => true,
45
-    hasstatus  => false,
43
+    ensure    => running,
44
+    enable    => true,
45
+    hasstatus => false,
46 46
   }
47 47
 
48 48
 }

+ 2
- 0
test-requirements.txt View File

@@ -0,0 +1,2 @@
1
+Sphinx
2
+fuel-plugin-builder>=2.0.4

+ 51
- 0
tox.ini View File

@@ -0,0 +1,51 @@
1
+[tox]
2
+envlist = manifests,plugin_zabbix_monitoring_emc,build_plugin
3
+skipsdist = True
4
+
5
+[testenv]
6
+deps = -r{toxinidir}/test-requirements.txt
7
+passenv = HOME
8
+
9
+[testenv:manifests]
10
+changedir = {toxinidir}/deployment_scripts/puppet/manifests
11
+whitelist_externals =
12
+    bundle
13
+    mkdir
14
+commands =
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]
20
+changedir = {toxinidir}/deployment_scripts/puppet/modules/{envname}
21
+whitelist_externals =
22
+    bundle
23
+    mkdir
24
+commands =
25
+    mkdir -p {toxinidir}/.bundled_gems
26
+    bundle install --path {toxinidir}/.bundled_gems
27
+    bundle exec rake test
28
+
29
+[testenv:build_plugin]
30
+changedir = {toxinidir}
31
+whitelist_externals=
32
+    fpb
33
+    rm
34
+commands =
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]
42
+changedir = {toxinidir}/doc/plugin-guide
43
+whitelist_externals = make
44
+commands =
45
+    make clean html SPHINXOPTS=-W
46
+
47
+[testenv:qa_docs]
48
+changedir = {toxinidir}/doc/qa
49
+whitelist_externals = make
50
+commands =
51
+    make clean html SPHINXOPTS=-W

Loading…
Cancel
Save