diff --git a/Puppetfile b/Puppetfile index a0c423856..91ad8f052 100644 --- a/Puppetfile +++ b/Puppetfile @@ -255,7 +255,7 @@ mod 'timezone', :git => 'https://github.com/saz/puppet-timezone.git' mod 'tomcat', - :commit => '019772988b39cb259bf281ab9655e8a83c7bc2d8', + :commit => '70a1b729140ee803724933edf839f5d7ae4daf39', :git => 'https://github.com/puppetlabs/puppetlabs-tomcat.git' mod 'tripleo', diff --git a/tomcat/CHANGELOG.md b/tomcat/CHANGELOG.md index 0db5d5574..5bdfce61e 100644 --- a/tomcat/CHANGELOG.md +++ b/tomcat/CHANGELOG.md @@ -1,3 +1,8 @@ +## Supported Release 1.3.3 +###Summary + +Small release for support of newer PE versions. This increments the version of PE in the metadata.json file. + ## 2015-08-11 - Supported Release 1.3.2 ### Summary This release fixes username quoting and metadata. diff --git a/tomcat/README.md b/tomcat/README.md index 0519aae94..d0a6afc53 100644 --- a/tomcat/README.md +++ b/tomcat/README.md @@ -257,7 +257,9 @@ Determines whether to create the specified user, if it doesn't exist. Uses Puppe #####`purge_connectors` -Specifies whether to purge any unmanaged Connector elements from the configuration file. Valid options: 'true' and 'false'. Default: 'false'. +Specifies whether to purge any unmanaged Connector elements that match +defined protocol but have a different port +from the configuration file. Valid options: 'true' and 'false'. Default: 'false'. #####`purge_realms` @@ -331,6 +333,10 @@ Specifies which Service element the Connector should nest under. Valid options: Specifies a protocol to use for handling incoming traffic. Maps to the [protocol XML attribute](http://tomcat.apache.org/tomcat-8.0-doc/config/http.html#Common_Attributes). Valid options: a string. Default: $name. +#####`purge_connectors` + +Specifies whether to purge any unmanaged Connector elements that match defined protocol but have a different port from the configuration file. Valid options: 'true' and 'false'. Default: 'false'. + #####`server_config` Specifies a server.xml file to manage. Valid options: a string containing an absolute path. Default: '${catalina_base}/config/server.xml'. @@ -657,6 +663,10 @@ Determines whether the specified package should be installed. Only valid if `ins *Required if `install_from_source` is set to 'false'.* Specifies the package to install. Valid options: a string containing a valid package name. +#####`package_options` + +*Unused if `install_from_source` is set to 'true'.* Specify additional options to use on the generated package resource. See the documentation of the [`package` resource type](https://docs.puppetlabs.com/references/latest/type.html#package-attribute-install_options) for possible values. + #####`source_strip_first_dir` Specifies whether to strip the topmost directory of the tarball when unpacking it. Only valid if `install_from_source` is set to 'true'. Valid options: 'true' and 'false'. Default: 'true'. diff --git a/tomcat/manifests/config/server/connector.pp b/tomcat/manifests/config/server/connector.pp index 28da4c61e..dc2438178 100644 --- a/tomcat/manifests/config/server/connector.pp +++ b/tomcat/manifests/config/server/connector.pp @@ -34,7 +34,7 @@ validate_hash($additional_attributes) validate_bool($purge_connectors) validate_re($catalina_base, '^.*[^/]$', '$catalina_base must not end in a /!') - + if $protocol { $_protocol = $protocol } else { @@ -44,7 +44,7 @@ $path = "Server/Service[#attribute/name='${parent_service}']" if $purge_connectors { - $_purge_connectors = "rm Server//Connector[#attribute/protocol='${_protocol}']" + $_purge_connectors = "rm Server//Connector[#attribute/protocol='${_protocol}'][#attribute/port!='${port}']" } else { $_purge_connectors = undef } diff --git a/tomcat/manifests/config/server/realm.pp b/tomcat/manifests/config/server/realm.pp index 60818b164..ec976a24b 100644 --- a/tomcat/manifests/config/server/realm.pp +++ b/tomcat/manifests/config/server/realm.pp @@ -46,7 +46,15 @@ } if $purge_realms { - $_purge_realms = 'rm Server//Realm' + # Perform deletions in reverse depth order as workaround for + # https://github.com/hercules-team/augeas/issues/319 + $_purge_realms = [ + 'rm //Realm//Realm', + 'rm //Context//Realm', + 'rm //Host//Realm', + 'rm //Engine//Realm', + 'rm //Server//Realm', + ] } else { $_purge_realms = undef } diff --git a/tomcat/manifests/instance.pp b/tomcat/manifests/instance.pp index 35e85142c..6a8729a00 100644 --- a/tomcat/manifests/instance.pp +++ b/tomcat/manifests/instance.pp @@ -17,6 +17,7 @@ # to in the package resource. # - $package_name is the name of the package you want to install. Required if # $install_from_source is false. +# - $package_options to pass extra options to the package resource. define tomcat::instance ( $catalina_home = undef, $catalina_base = undef, @@ -25,6 +26,7 @@ $source_strip_first_dir = undef, $package_ensure = undef, $package_name = undef, + $package_options = undef, ) { if $install_from_source { @@ -74,7 +76,8 @@ } } else { tomcat::instance::package { $package_name: - package_ensure => $package_ensure, + package_ensure => $package_ensure, + package_options => $package_options, } } diff --git a/tomcat/manifests/instance/package.pp b/tomcat/manifests/instance/package.pp index 7df73effe..493b205da 100644 --- a/tomcat/manifests/instance/package.pp +++ b/tomcat/manifests/instance/package.pp @@ -5,9 +5,11 @@ # Parameters: # - $package_ensure is the ensure passed to the package resource. # - The $package_name you want to install. +# - $package_options to pass extra options to the package resource. define tomcat::instance::package ( - $package_ensure = 'installed', - $package_name = undef, + $package_ensure = 'installed', + $package_name = undef, + $package_options = undef, ) { if $caller_module_name != $module_name { fail("Use of private class ${name} by ${caller_module_name}") @@ -20,7 +22,8 @@ } package { $_package_name: - ensure => $package_ensure + ensure => $package_ensure, + install_options => $package_options, } } diff --git a/tomcat/metadata.json b/tomcat/metadata.json index 45f3516ab..6b114212a 100644 --- a/tomcat/metadata.json +++ b/tomcat/metadata.json @@ -1,6 +1,6 @@ { "name": "puppetlabs-tomcat", - "version": "1.3.2", + "version": "1.3.3", "author": "puppetlabs", "summary": "Installs, deploys, and configures Apache Tomcat web services.", "license": "Apache 2.0", @@ -64,7 +64,7 @@ "requirements": [ { "name": "pe", - "version_requirement": ">= 3.3.0 < 2015.3.0" + "version_requirement": ">= 3.3.0 < 2015.4.0" }, { "name": "puppet", diff --git a/tomcat/spec/defines/config/server/connector_spec.rb b/tomcat/spec/defines/config/server/connector_spec.rb index ee0f639e6..b7b3f55bd 100644 --- a/tomcat/spec/defines/config/server/connector_spec.rb +++ b/tomcat/spec/defines/config/server/connector_spec.rb @@ -73,7 +73,7 @@ 'lens' => 'Xml.lns', 'incl' => '/opt/apache-tomcat/test/conf/server.xml', 'changes' => [ - 'rm Server//Connector[#attribute/protocol=\'AJP/1.3\']', + 'rm Server//Connector[#attribute/protocol=\'AJP/1.3\'][#attribute/port!=\'8180\']', 'set Server/Service[#attribute/name=\'Catalina2\']/Connector[#attribute/port=\'8180\']/#attribute/port 8180', 'set Server/Service[#attribute/name=\'Catalina2\']/Connector[#attribute/port=\'8180\']/#attribute/protocol AJP/1.3', 'set Server/Service[#attribute/name=\'Catalina2\']/Connector[#attribute/port=\'8180\']/#attribute/redirectPort \'8543\'', diff --git a/tomcat/spec/defines/config/server/realm_spec.rb b/tomcat/spec/defines/config/server/realm_spec.rb index ac30764e0..c546c3a01 100644 --- a/tomcat/spec/defines/config/server/realm_spec.rb +++ b/tomcat/spec/defines/config/server/realm_spec.rb @@ -70,7 +70,11 @@ 'lens' => 'Xml.lns', 'incl' => '/opt/apache-tomcat/test/conf/server.xml', 'changes' => [ - "rm Server//Realm", + "rm //Realm//Realm", + "rm //Context//Realm", + "rm //Host//Realm", + "rm //Engine//Realm", + "rm //Server//Realm", "set Server/Service[#attribute/name='Catalina']/Engine[#attribute/name='Catalina']/Realm/#attribute/className org.apache.catalina.realm.JNDIRealm", "set Server/Service[#attribute/name='Catalina']/Engine[#attribute/name='Catalina']/Realm[#attribute/className='org.apache.catalina.realm.JNDIRealm']/#attribute/connectionURL 'ldap://localhost'", "set Server/Service[#attribute/name='Catalina']/Engine[#attribute/name='Catalina']/Realm[#attribute/className='org.apache.catalina.realm.JNDIRealm']/#attribute/roleName 'cn'", diff --git a/tomcat/spec/defines/instance_spec.rb b/tomcat/spec/defines/instance_spec.rb index c3753c704..7c2879f9d 100644 --- a/tomcat/spec/defines/instance_spec.rb +++ b/tomcat/spec/defines/instance_spec.rb @@ -65,6 +65,21 @@ 'ensure' => 'installed', ) } + context "with additional package_options set" do + let :params do + { + :install_from_source => false, + :package_name => 'tomcat', + :package_options => [ '/S' ], + } + end + it { + is_expected.to contain_package('tomcat').with( + 'ensure' => 'installed', + 'install_options' => [ '/S' ], + ) + } + end end context "install from package, set $catalina_base" do let :facts do default_facts end