puppetlabs-tomcat
puppetlabs-tomcat copied to clipboard
Missing dependency on File['server.xml'] when connector, host or valve classes are used
Describe the Bug
It appears that the following classes act on the server.xml
file before that file is actually copied to the instance's config directory from the home config directory. The result is a mis-formatted server.xml
file that includes the connector, host and valve sections only, preventing tomcat from starting.
- tomcat::config::server::connector
- tomcat::config::server::host
- tomcat::config::server::valve
The only way to successfully deploy is using
require => File["${catalina_base}/conf/server.xml"], # Added to solve a dependency problem in tomcat module
This file resource comes from tomcat::instance::copy_from_home
, which suggests that the dependency is missing in this module.
Expected Behavior
Manipulation of server.xml
(as well as other config files) should occur only after the tomcat::instance
class has completed copying these files from the home config directory.
Steps to Reproduce
- create tomcat:;instance
- attempt to manipulate
server.xml
usingtomcat::config::server::connector
- Result is a
server.xml
file that only contains this stanza, instead of editing a previously-existingserver.xml
file
Environment
- Puppet 8
- mod 'puppetlabs-tomcat', '7.1.0'
- Ubuntu 22
Additional Context
This excerpt from my tomcat server configuration demonstrates the workaround.
...
### MINGLE INSTANCE
tomcat::instance { 'mingle':
catalina_home => $catalina_home,
catalina_base => $catalina_base,
require => File['Mingle Unit File'],
service_name => 'mingle',
use_init => true,
manage_service => true,
manage_copy_from_home => true, # Copy initial config files from tomcat to this instance
user => $t['user'],
group => $t['user'],
}
...
# Listen Socket
# - removes 'redirectPort' because this instance only listens on http
# - adds 'relaxed' attributes to allow mingle to use '[]' in urls, which is now bad practice
tomcat::config::server::connector { "mingle-http-${port['http']}":
catalina_base => $catalina_base,
port => $port['http'], # Server socket port
protocol => 'HTTP/1.1',
purge_connectors => true,
attributes_to_remove => ['redirectPort'], # This instance is behind a reverse proxy and only listens on http
additional_attributes => {
'relaxedPathChars' => '[ ]', # Mingle requires "relaxed path" characters
'relaxedQueryChars' => '[ ]',
},
require => File["${catalina_base}/conf/server.xml"], # Added to solve a dependency problem in tomcat module
}
...