|
13 | 13 | # See the License for the specific language governing permissions and
|
14 | 14 | # limitations under the License.
|
15 | 15 | # -----------------------------------------------------------------------------
|
16 |
| -class jira::config inherits jira { |
| 16 | +class jira::config { |
| 17 | + # This class should be used from init.pp with a dependency on jira::install |
| 18 | + # and sending a refresh to jira::service |
| 19 | + assert_private() |
| 20 | + |
17 | 21 | File {
|
18 | 22 | owner => $jira::user,
|
19 | 23 | group => $jira::group,
|
|
27 | 31 | # can't use pick_default: https://tickets.puppetlabs.com/browse/MODULES-11018
|
28 | 32 | $dbschema = if $jira::dbschema { $jira::dbschema } else { $dbschema_default }
|
29 | 33 |
|
| 34 | + if $jira::java_opts { |
| 35 | + deprecation('jira::java_opts', 'jira::java_opts is deprecated. Please use jira::jvm_extra_args') |
| 36 | + $jvm_extra_args_real = "${jira::java_opts} ${jira::jvm_extra_args}" |
| 37 | + } else { |
| 38 | + $jvm_extra_args_real = $jira::jvm_extra_args |
| 39 | + } |
| 40 | + |
| 41 | + # Allow some backwards compatibility; |
| 42 | + if $jira::poolsize { |
| 43 | + deprecation('jira::poolsize', 'jira::poolsize is deprecated and simply sets max-pool-size. Please use jira::pool_max_size instead and remove this configuration') |
| 44 | + $pool_max_size_real = pick($jira::pool_max_size, $jira::poolsize) |
| 45 | + } else { |
| 46 | + $pool_max_size_real = $jira::pool_max_size |
| 47 | + } |
| 48 | + |
| 49 | + if $jira::tomcat_redirect_https_port { |
| 50 | + unless $jira::tomcat_native_ssl { |
| 51 | + fail('You need to set jira::tomcat_native_ssl to true when using jira::tomcat_redirect_https_port') |
| 52 | + } |
| 53 | + } |
| 54 | + |
| 55 | + if $jira::dbport { |
| 56 | + $dbport_real = $jira::dbport |
| 57 | + } else { |
| 58 | + $dbport_real = $jira::db ? { |
| 59 | + 'postgresql' => '5432', |
| 60 | + 'mysql' => '3306', |
| 61 | + 'oracle' => '1521', |
| 62 | + 'sqlserver' => '1433', |
| 63 | + 'h2' => '', |
| 64 | + } |
| 65 | + } |
| 66 | + |
| 67 | + if $jira::dbdriver { |
| 68 | + $dbdriver_real = $jira::dbdriver |
| 69 | + } else { |
| 70 | + $dbdriver_real = $jira::db ? { |
| 71 | + 'postgresql' => 'org.postgresql.Driver', |
| 72 | + 'mysql' => 'com.mysql.jdbc.Driver', |
| 73 | + 'oracle' => 'oracle.jdbc.OracleDriver', |
| 74 | + 'sqlserver' => 'com.microsoft.sqlserver.jdbc.SQLServerDriver', |
| 75 | + 'h2' => 'org.h2.Driver', |
| 76 | + } |
| 77 | + } |
| 78 | + |
| 79 | + if $jira::dbtype { |
| 80 | + $dbtype_real = $jira::dbtype |
| 81 | + } else { |
| 82 | + $dbtype_real = $jira::db ? { |
| 83 | + 'postgresql' => 'postgres72', |
| 84 | + 'mysql' => 'mysql', |
| 85 | + 'oracle' => 'oracle10g', |
| 86 | + 'sqlserver' => 'mssql', |
| 87 | + 'h2' => 'h2', |
| 88 | + } |
| 89 | + } |
| 90 | + |
| 91 | + if $jira::dburl { |
| 92 | + $dburl_real = $jira::dburl |
| 93 | + } |
| 94 | + else { |
| 95 | + $dburl_real = $jira::db ? { |
| 96 | + 'postgresql' => "jdbc:${jira::db}://${jira::dbserver}:${dbport_real}/${jira::dbname}", |
| 97 | + 'mysql' => "jdbc:${jira::db}://${jira::dbserver}:${dbport_real}/${jira::dbname}?useUnicode=true&characterEncoding=UTF8&sessionVariables=default_storage_engine=InnoDB", |
| 98 | + 'oracle' => "jdbc:${jira::db}:thin:@${jira::dbserver}:${dbport_real}:${jira::dbname}", |
| 99 | + 'sqlserver' => "jdbc:jtds:${jira::db}://${jira::dbserver}:${dbport_real}/${jira::dbname}", |
| 100 | + 'h2' => "jdbc:h2:file:/${jira::homedir}/database/${jira::dbname}", |
| 101 | + } |
| 102 | + } |
| 103 | + |
| 104 | + if $jira::tomcat_protocol_ssl { |
| 105 | + $tomcat_protocol_ssl_real = $jira::tomcat_protocol_ssl |
| 106 | + } else { |
| 107 | + if versioncmp($jira::version, '7.3.0') >= 0 { |
| 108 | + $tomcat_protocol_ssl_real = 'org.apache.coyote.http11.Http11NioProtocol' |
| 109 | + } else { |
| 110 | + $tomcat_protocol_ssl_real = 'org.apache.coyote.http11.Http11Protocol' |
| 111 | + } |
| 112 | + } |
| 113 | + |
| 114 | + $jira_properties = { |
| 115 | + 'jira.websudo.is.disabled' => !$jira::enable_secure_admin_sessions, |
| 116 | + } |
| 117 | + $merged_jira_config_properties = jira::sort_hash($jira_properties + $jira::jira_config_properties) |
| 118 | + |
| 119 | + # Configuration logic ends, resources begin: |
| 120 | + |
30 | 121 | file { "${jira::webappdir}/bin/user.sh":
|
31 |
| - content => template('jira/user.sh.erb'), |
| 122 | + content => epp('jira/user.sh.epp'), |
32 | 123 | mode => '0755',
|
33 |
| - require => [ |
34 |
| - Class['jira::install'], |
35 |
| - File[$jira::webappdir], |
36 |
| - File[$jira::homedir], |
37 |
| - ], |
38 | 124 | }
|
39 | 125 |
|
40 |
| - -> file { "${jira::webappdir}/bin/setenv.sh": |
41 |
| - content => template('jira/setenv.sh.erb'), |
| 126 | + file { "${jira::webappdir}/bin/setenv.sh": |
| 127 | + content => epp('jira/setenv.sh.epp'), |
42 | 128 | mode => '0755',
|
43 |
| - require => Class['jira::install'], |
44 |
| - notify => Class['jira::service'], |
45 | 129 | }
|
46 | 130 |
|
47 |
| - -> file { "${jira::homedir}/dbconfig.xml": |
| 131 | + file { "${jira::homedir}/dbconfig.xml": |
48 | 132 | content => epp('jira/dbconfig.xml.epp'),
|
49 | 133 | mode => '0600',
|
50 |
| - require => [Class['jira::install'],File[$jira::homedir]], |
51 |
| - notify => Class['jira::service'], |
52 | 134 | }
|
53 | 135 |
|
54 | 136 | if $jira::script_check_java_manage {
|
55 | 137 | file { "${jira::webappdir}/bin/check-java.sh":
|
56 | 138 | content => template($jira::script_check_java_template),
|
57 | 139 | mode => '0755',
|
58 |
| - require => [ |
59 |
| - Class['jira::install'], |
60 |
| - File["${jira::webappdir}/bin/setenv.sh"], |
61 |
| - ], |
62 |
| - notify => Class['jira::service'], |
| 140 | + require => File["${jira::webappdir}/bin/setenv.sh"], |
63 | 141 | }
|
64 | 142 | }
|
65 | 143 |
|
66 | 144 | file { "${jira::webappdir}/conf/server.xml":
|
67 |
| - content => template('jira/server.xml.erb'), |
| 145 | + content => epp('jira/server.xml.epp'), |
68 | 146 | mode => '0600',
|
69 |
| - require => Class['jira::install'], |
70 |
| - notify => Class['jira::service'], |
71 | 147 | }
|
72 |
| - -> file { "${jira::webappdir}/conf/context.xml": |
73 |
| - content => template('jira/context.xml.erb'), |
| 148 | + |
| 149 | + file { "${jira::webappdir}/conf/context.xml": |
| 150 | + content => epp('jira/context.xml.epp'), |
74 | 151 | mode => '0600',
|
75 |
| - require => Class['jira::install'], |
76 |
| - notify => Class['jira::service'], |
77 | 152 | }
|
78 | 153 |
|
79 | 154 | file { "${jira::homedir}/jira-config.properties":
|
80 |
| - content => template('jira/jira-config.properties.erb'), |
| 155 | + content => inline_epp(@(EOF) |
| 156 | + <% $merged_jira_config_properties.each |$key, $val| { -%> |
| 157 | + <%= $key %> = <%= $val %> |
| 158 | + <%- } -%> |
| 159 | + | EOF |
| 160 | + ), |
81 | 161 | mode => '0600',
|
82 |
| - require => [Class['jira::install'],File[$jira::homedir]], |
83 |
| - notify => Class['jira::service'], |
84 | 162 | }
|
85 | 163 |
|
86 | 164 | if $jira::datacenter {
|
87 | 165 | file { "${jira::homedir}/cluster.properties":
|
88 |
| - content => template('jira/cluster.properties.erb'), |
| 166 | + content => epp('jira/cluster.properties.epp'), |
89 | 167 | mode => '0600',
|
90 |
| - require => [Class['jira::install'],File[$jira::homedir]], |
91 |
| - notify => Class['jira::service'], |
92 | 168 | }
|
93 | 169 | }
|
94 | 170 | }
|
0 commit comments