Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing dependency on File['server.xml'] when connector, host or valve classes are used #547

Open
jjarokergc opened this issue Oct 13, 2023 · 0 comments

Comments

@jjarokergc
Copy link

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

  1. create tomcat:;instance
  2. attempt to manipulate server.xml using tomcat::config::server::connector
  3. Result is a server.xml file that only contains this stanza, instead of editing a previously-existing server.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
  }

...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants