Skip to content

Commit 147efd3

Browse files
Merge pull request #429 from diLLec/master
2 parents 2c403e4 + a8f6015 commit 147efd3

File tree

7 files changed

+42
-15
lines changed

7 files changed

+42
-15
lines changed

REFERENCE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ The following parameters are available in the `jira` class:
8080
* [`jndi_ds_name`](#-jira--jndi_ds_name)
8181
* [`db`](#-jira--db)
8282
* [`dbname`](#-jira--dbname)
83+
* [`change_dbpassword`](#-jira--change_dbpassword)
8384
* [`dbuser`](#-jira--dbuser)
8485
* [`dbpassword`](#-jira--dbpassword)
8586
* [`dbserver`](#-jira--dbserver)
@@ -383,6 +384,14 @@ The database name to connect to
383384

384385
Default value: `'jira'`
385386

387+
##### <a name="-jira--change_dbpassword"></a>`change_dbpassword`
388+
389+
Data type: `Boolean`
390+
391+
Set to true to actually generate a dbconfig.xml with the password - otherwise write "{ATL_SECURED}"
392+
393+
Default value: `false`
394+
386395
##### <a name="-jira--dbuser"></a>`dbuser`
387396

388397
Data type: `String`

manifests/config.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
}
4949
}
5050

51+
$change_dbpassword = $jira::change_dbpassword
52+
5153
if $jira::dbport {
5254
$dbport = $jira::dbport
5355
} else {

manifests/init.pp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@
6868
# The kind of database to use.
6969
# @param dbname
7070
# The database name to connect to
71+
# @param change_dbpassword
72+
# Set to true to actually generate a dbconfig.xml with the password - otherwise write "{ATL_SECURED}"
7173
# @param dbuser
7274
# Database username
7375
# @param dbpassword
@@ -313,6 +315,7 @@
313315
Boolean $use_jndi_ds = false,
314316
String[1] $jndi_ds_name = 'JiraDS',
315317
Enum['postgresql','mysql','sqlserver','oracle','h2'] $db = 'postgresql',
318+
Boolean $change_dbpassword = false,
316319
String $dbuser = 'jiraadm',
317320
String $dbpassword = 'mypassword',
318321
String $dbserver = 'localhost',

spec/acceptance/default_parameters_spec.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class { 'jira':
5454
java_package => $java_package,
5555
javahome => $java_home,
5656
script_check_java_manage => true,
57+
change_dbpassword => true,
5758
}
5859
EOS
5960

@@ -94,7 +95,11 @@ class { 'jira':
9495
it { is_expected.to have_login_shell '/bin/true' }
9596
end
9697

97-
describe command('wget -q --tries=24 --retry-connrefused --read-timeout=10 -O- localhost:8080') do
98+
describe command('tail -100 ~jira/log/atlassian-jira.log') do
99+
its(:stdout) { is_expected.to include('INFO') }
100+
end
101+
102+
describe command('wget -q --tries=54 --retry-connrefused --read-timeout=10 -O- localhost:8080') do
98103
its(:stdout) { is_expected.to include('8.16.0') }
99104
end
100105

spec/acceptance/mysql_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ class { 'jira':
7777
dbport => 3306,
7878
dbdriver => 'com.mysql.jdbc.Driver',
7979
dbtype => 'mysql',
80+
change_dbpassword => true,
8081
tomcat_port => 8081,
8182
tomcat_native_ssl => true,
8283
tomcat_keystore_file => '/tmp/jira.ks',

spec/classes/jira_config_spec.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@
172172
dbserver: 'TheSQLServer',
173173
dbname: 'TheJiraDB',
174174
dbuser: 'TheDBUser',
175-
dbpassword: 'TheDBPassword'
175+
dbpassword: 'TheDBPassword',
176+
change_dbpassword: true
176177
)
177178
end
178179

@@ -195,7 +196,8 @@
195196
dbserver: 'TheSQLServer',
196197
dbname: 'TheJiraDB',
197198
dbuser: 'TheDBUser',
198-
dbpassword: 'TheDBPassword'
199+
dbpassword: 'TheDBPassword',
200+
change_dbpassword: true
199201
)
200202
end
201203

@@ -237,7 +239,8 @@
237239
dbserver: 'TheSQLServer',
238240
dbname: 'TheJiraDB',
239241
dbuser: 'TheDBUser',
240-
dbpassword: 'TheDBPassword'
242+
dbpassword: 'TheDBPassword',
243+
change_dbpassword: true
241244
)
242245
end
243246

templates/dbconfig.xml.epp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,44 +12,48 @@
1212
<url><%= $jira::config::dburl %></url>
1313
<driver-class><%= $jira::config::dbdriver %></driver-class>
1414
<username><%= $jira::dbuser %></username>
15+
<%- if $jira::config::change_dbpassword { -%>
1516
<password><%= $jira::dbpassword %></password>
17+
<%- } else { -%>
18+
<password>{ATL_SECURED}</password>
19+
<%- } -%>
1620
<%# For most of these, Jira defaults are better... -%>
1721
<% if $jira::config::pool_min_size != undef { -%>
1822
<pool-min-size><%= $jira::config::pool_min_size %></pool-min-size>
1923
<% } -%>
2024
<% if $jira::config::pool_max_size != undef { -%>
2125
<pool-max-size><%= $jira::config::pool_max_size %></pool-max-size>
2226
<% } -%>
23-
<% if $jira::config::pool_max_idle != undef { -%>
24-
<pool-max-idle><%= $jira::config::pool_max_idle %></pool-max-idle>
25-
<% } -%>
2627
<% if $jira::config::pool_max_wait != undef { -%>
2728
<pool-max-wait><%= $jira::config::pool_max_wait %></pool-max-wait>
2829
<% } -%>
30+
<% if $jira::config::validation_query != undef { -%>
31+
<validation-query><%= $jira::config::validation_query %></validation-query>
32+
<% } -%>
2933
<% if $jira::config::min_evictable_idle_time != undef { -%>
3034
<min-evictable-idle-time-millis><%= $jira::config::min_evictable_idle_time %></min-evictable-idle-time-millis>
3135
<% } -%>
36+
<% if $jira::config::time_between_eviction_runs != undef { -%>
37+
<time-between-eviction-runs-millis><%= $jira::config::time_between_eviction_runs %></time-between-eviction-runs-millis>
38+
<% } -%>
39+
<% if $jira::config::pool_max_idle != undef { -%>
40+
<pool-max-idle><%= $jira::config::pool_max_idle %></pool-max-idle>
41+
<% } -%>
3242
<% if $jira::config::pool_remove_abandoned != undef { -%>
3343
<pool-remove-abandoned><%= $jira::config::pool_remove_abandoned %></pool-remove-abandoned>
3444
<% } -%>
3545
<% if $jira::config::pool_remove_abandoned_timeout != undef { -%>
3646
<pool-remove-abandoned-timeout><%= $jira::config::pool_remove_abandoned_timeout %></pool-remove-abandoned-timeout>
3747
<% } -%>
38-
<% if $jira::config::pool_test_while_idle != undef { -%>
39-
<pool-test-while-idle><%= $jira::config::pool_test_while_idle %></pool-test-while-idle>
40-
<% } -%>
4148
<% if $jira::config::pool_test_on_borrow != undef { -%>
4249
<pool-test-on-borrow><%= $jira::config::pool_test_on_borrow %></pool-test-on-borrow>
4350
<% } -%>
44-
<% if $jira::config::validation_query != undef { -%>
45-
<validation-query><%= $jira::config::validation_query %></validation-query>
51+
<% if $jira::config::pool_test_while_idle != undef { -%>
52+
<pool-test-while-idle><%= $jira::config::pool_test_while_idle %></pool-test-while-idle>
4653
<% } -%>
4754
<% if $jira::config::validation_query_timeout != undef { -%>
4855
<validation-query-timeout><%= $jira::config::validation_query_timeout %></validation-query-timeout>
4956
<% } -%>
50-
<% if $jira::config::time_between_eviction_runs != undef { -%>
51-
<time-between-eviction-runs-millis><%= $jira::config::time_between_eviction_runs %></time-between-eviction-runs-millis>
52-
<% } -%>
5357
<% if $jira::config::connection_settings { -%>
5458
<connection-properties><%= $jira::config::connection_settings %></connection-properties>
5559
<% } -%>

0 commit comments

Comments
 (0)