Skip to content
This repository was archived by the owner on Feb 21, 2020. It is now read-only.

Commit 977197f

Browse files
committed
Merge pull request #62 from maestrodev/fix_SonarQube_quality_flaws
Fix SonarQube quality flaws
2 parents bc8ae3b + dc952eb commit 977197f

File tree

5 files changed

+48
-41
lines changed

5 files changed

+48
-41
lines changed

manifests/init.pp

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@
5454
) inherits sonarqube::params {
5555
validate_absolute_path($download_dir)
5656
Exec {
57-
path => '/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin'
57+
path => '/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin',
5858
}
5959
File {
6060
owner => $user,
61-
group => $group
61+
group => $group,
6262
}
6363

6464
# wget from https://github.com/maestrodev/puppet-wget
@@ -68,8 +68,7 @@
6868

6969
if $home != undef {
7070
$real_home = $home
71-
}
72-
else {
71+
} else {
7372
$real_home = '/var/local/sonar'
7473
}
7574
Sonarqube::Move_to_home {
@@ -86,7 +85,7 @@
8685
if ! defined(Package[unzip]) {
8786
package { 'unzip':
8887
ensure => present,
89-
before => Exec[untar]
88+
before => Exec[untar],
9089
}
9190
}
9291

@@ -95,18 +94,18 @@
9594
home => $real_home,
9695
managehome => false,
9796
system => $user_system,
98-
} ->
97+
}
98+
->
9999
group { $group:
100100
ensure => present,
101101
system => $user_system,
102-
} ->
103-
wget::fetch {
104-
'download-sonar':
105-
source => "${download_url}/${package_name}-${version}.zip",
106-
destination => $tmpzip,
107-
} ->
108-
109-
102+
}
103+
->
104+
wget::fetch { 'download-sonar':
105+
source => "${download_url}/${package_name}-${version}.zip",
106+
destination => $tmpzip,
107+
}
108+
->
110109
# ===== Create folder structure =====
111110
# so uncompressing new sonar versions at update time use the previous sonar home,
112111
# installing new extensions and plugins over the old ones, reusing the db,...
@@ -115,31 +114,38 @@
115114
file { $real_home:
116115
ensure => directory,
117116
mode => '0700',
118-
} ->
117+
}
118+
->
119119
file { "${installroot}/${package_name}-${version}":
120120
ensure => directory,
121-
} ->
121+
}
122+
->
122123
file { $installdir:
123124
ensure => link,
124125
target => "${installroot}/${package_name}-${version}",
125126
notify => Service['sonarqube'],
126-
} ->
127-
sonarqube::move_to_home { 'data': } ->
128-
sonarqube::move_to_home { 'extras': } ->
129-
sonarqube::move_to_home { 'extensions': } ->
130-
sonarqube::move_to_home { 'logs': } ->
131-
127+
}
128+
->
129+
sonarqube::move_to_home { 'data': }
130+
->
131+
sonarqube::move_to_home { 'extras': }
132+
->
133+
sonarqube::move_to_home { 'extensions': }
134+
->
135+
sonarqube::move_to_home { 'logs': }
136+
->
132137
# ===== Install SonarQube =====
133-
134138
exec { 'untar':
135139
command => "unzip -o ${tmpzip} -d ${installroot} && chown -R ${user}:${group} ${installroot}/${package_name}-${version} && chown -R ${user}:${group} ${real_home}",
136140
creates => "${installroot}/${package_name}-${version}/bin",
137141
notify => Service['sonarqube'],
138-
} ->
142+
}
143+
->
139144
file { $script:
140145
mode => '0755',
141146
content => template('sonarqube/sonar.sh.erb'),
142-
} ->
147+
}
148+
->
143149
file { "/etc/init.d/${service}":
144150
ensure => link,
145151
target => $script,
@@ -151,15 +157,14 @@
151157
source => $config,
152158
require => Exec['untar'],
153159
notify => Service['sonarqube'],
154-
mode => '0600'
160+
mode => '0600',
155161
}
156-
}
157-
else {
162+
} else {
158163
file { "${installdir}/conf/sonar.properties":
159164
content => template('sonarqube/sonar.properties.erb'),
160165
require => Exec['untar'],
161166
notify => Service['sonarqube'],
162-
mode => '0600'
167+
mode => '0600',
163168
}
164169
}
165170

@@ -189,7 +194,7 @@
189194
sonarqube::plugin { 'sonar-ldap-plugin' :
190195
ensure => empty($ldap) ? {
191196
true => absent,
192-
false => present
197+
false => present,
193198
},
194199
artifactid => 'sonar-ldap-plugin',
195200
version => '1.4',
@@ -198,7 +203,7 @@
198203
sonarqube::plugin { 'sonar-pam-plugin' :
199204
ensure => empty($pam) ? {
200205
true => absent,
201-
false => present
206+
false => present,
202207
},
203208
artifactid => 'sonar-pam-plugin',
204209
version => '0.2',
@@ -207,7 +212,7 @@
207212
sonarqube::plugin { 'sonar-crowd-plugin' :
208213
ensure => empty($crowd) ? {
209214
true => absent,
210-
false => present
215+
false => present,
211216
},
212217
artifactid => 'sonar-crowd-plugin',
213218
version => '1.0',

manifests/move_to_home.pp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# copy folders susceptible to change from installation folder to /var/local/sonar and symlink
2-
define sonarqube::move_to_home($home) {
2+
define sonarqube::move_to_home (
3+
$home,
4+
) {
35
file { "${home}/${name}":
4-
ensure => directory,
5-
} ->
6-
6+
ensure => directory,
7+
}
8+
->
79
file { "${sonarqube::installdir}/${name}":
810
ensure => link,
911
target => "${home}/${name}",

manifests/params.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Class: sonarqube::params
2-
class sonarqube::params() {
2+
class sonarqube::params {
33

44
# calculate in what folder is the binary to use for this architecture
55
$arch1 = $::kernel ? {

manifests/runner.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
validate_absolute_path($installroot)
1818

1919
Exec {
20-
path => '/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin'
20+
path => '/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin',
2121
}
2222

2323
anchor { 'sonarqube::runner::begin': } ->

manifests/runner/install.pp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
if ! defined(Package[unzip]) {
1111
package { 'unzip':
1212
ensure => present,
13-
before => Exec[unzip-sonar-runner]
13+
before => Exec[unzip-sonar-runner],
1414
}
1515
}
1616

@@ -38,10 +38,10 @@
3838

3939
# Sonar settings for terminal sessions.
4040
file { '/etc/profile.d/sonarhome.sh':
41-
content => 'export SONAR_RUNNER_HOME=/usr/local/sonar-runner'
41+
content => 'export SONAR_RUNNER_HOME=/usr/local/sonar-runner',
4242
}
4343
file { '/usr/bin/sonar-runner':
44-
ensure => 'link',
44+
ensure => link,
4545
target => '/var/lib/sonar-runner/bin/sonar-runner',
4646
}
4747
}

0 commit comments

Comments
 (0)