Hashar has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/331329 )
Change subject: Introduce linters using rake
......................................................................
Introduce linters using rake
Add a Rakefile and depends on puppet-syntax/puppet-lint. That lets one
easily check syntax of manifests and templates as well as puppet style
recommandation (puppet-lint).
Ignore puppet-lint 80 chars line limit.
Instruct puppet-lint to threat module with relative path or it fails
under Jenkins which checkout the source code in a directory named after
the job.
Fix a few puppet-lint issues:
manifests/init.pp - class not documented on line 1
manifests/monitor_replication.pp
variable not enclosed in {} on line 49
manifests/service.pp - string containing only a variable on line 30
Bug: T154894
Change-Id: Id8e19ee14cc1673e84278b30a5e4eddf5192ea77
---
A .puppet-lint.rc
A Gemfile
A Gemfile.lock
A Rakefile
M manifests/init.pp
M manifests/monitor_replication.pp
M manifests/service.pp
7 files changed, 55 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet/mariadb
refs/changes/29/331329/1
diff --git a/.puppet-lint.rc b/.puppet-lint.rc
new file mode 100644
index 0000000..b0d12b7
--- /dev/null
+++ b/.puppet-lint.rc
@@ -0,0 +1 @@
+--no-80chars-check
diff --git a/Gemfile b/Gemfile
new file mode 100644
index 0000000..fa76f85
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,6 @@
+source 'https://rubygems.org'
+
+gem 'rake'
+gem 'puppet', '~> 3.7.0'
+gem 'puppet-lint', '1.1.0'
+gem 'puppet-syntax'
diff --git a/Gemfile.lock b/Gemfile.lock
new file mode 100644
index 0000000..9642ca1
--- /dev/null
+++ b/Gemfile.lock
@@ -0,0 +1,24 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ facter (2.4.6)
+ hiera (1.3.4)
+ json_pure
+ json_pure (2.0.2)
+ puppet (3.7.5)
+ facter (> 1.6, < 3)
+ hiera (~> 1.0)
+ json_pure
+ puppet-lint (1.1.0)
+ puppet-syntax (2.2.0)
+ rake
+ rake (12.0.0)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ puppet (~> 3.7.0)
+ puppet-lint (= 1.1.0)
+ puppet-syntax
+ rake
diff --git a/Rakefile b/Rakefile
new file mode 100644
index 0000000..a15ba1a
--- /dev/null
+++ b/Rakefile
@@ -0,0 +1,19 @@
+require 'bundler/setup'
+require 'puppet-lint/tasks/puppet-lint'
+require 'puppet-syntax/tasks/puppet-syntax'
+
+# To please Jenkins
+# https://github.com/rodjek/puppet-lint/issues/361
+PuppetLint.configuration.relative = true
+
+task :default => [:help]
+
+desc 'Run all build/tests commands (CI entry point)'
+task :test => [
+ :syntax,
+ :lint,
+]
+
+task :help do
+ system "rake -T"
+end
diff --git a/manifests/init.pp b/manifests/init.pp
index 20fb7b3..3fff3d5 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -1,7 +1,9 @@
+# == Class mariadb
+#
class mariadb {
include mariadb::config
include mariadb::packages
include mariadb::monitor_disk
include mariadb::monitor_process
-}
\ No newline at end of file
+}
diff --git a/manifests/monitor_replication.pp b/manifests/monitor_replication.pp
index 2be774f..12dff0a 100644
--- a/manifests/monitor_replication.pp
+++ b/manifests/monitor_replication.pp
@@ -46,7 +46,7 @@
nrpe::monitor_service { "mariadb_slave_sql_lag_${name}":
description => "MariaDB Slave Lag: ${name}",
nrpe_command => "${check_mariadb} --check=slave_sql_lag \
- --shard=${name} --datacenter=$::mw_primary \
+ --shard=${name} --datacenter=${::mw_primary} \
--sql-lag-warn=${lag_warn} \
--sql-lag-crit=${lag_crit}",
retries => 10,
diff --git a/manifests/service.pp b/manifests/service.pp
index bf711ec..7543978 100644
--- a/manifests/service.pp
+++ b/manifests/service.pp
@@ -27,7 +27,7 @@
group => 'root',
mode => '0755',
content => template('mariadb/mariadb.server.erb'),
- require => Package["${package}"],
+ require => Package[$package],
}
file { '/etc/init.d/mysql':
--
To view, visit https://gerrit.wikimedia.org/r/331329
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id8e19ee14cc1673e84278b30a5e4eddf5192ea77
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet/mariadb
Gerrit-Branch: master
Gerrit-Owner: Hashar <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits