33 changes: 25 additions & 8 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,36 @@
name: Mark stale issues and pull requests
name: Audit aging issues/PRs

on:
schedule:
- cron: "30 1 * * *"

jobs:
stale:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-stale: 60
days-before-close: 7
stale-issue-message: 'This issue has been marked as stale because it has been open for a while and has had no recent activity. If this issue is still important to you please drop a comment below and we will add this to our backlog to complete. Otherwise, it will be closed in 7 days.'
stale-issue-label: 'stale'
stale-pr-message: 'This PR has been marked as stale because it has been open for a while and has had no recent activity. If this PR is still important to you please drop a comment below and we will add this to our backlog to complete. Otherwise, it will be closed in 7 days.'
stale-pr-label: 'stale'
days-before-issue-stale: 90
days-before-pr-stale: 60
days-before-pr-close: 7
stale-issue-message: |
Hello! 👋
This issue has been open for a while and has had no recent activity. We've labelled it with `attention-needed` so that we can get a clear view of which issues need our attention.
If you are waiting on a response from us we will try and address your comments on a future Community Day.
Alternatively, if it is no longer relevant to you please close the issue with a comment.
stale-issue-label: 'attention-needed'
stale-pr-message: |
Hello! 👋
This pull request has been open for a while and has had no recent activity. We've labelled it with `attention-needed` so that we can get a clear view of which PRs need our attention.
If you are waiting on a response from us we will try and address your comments on a future Community Day.
Alternatively, if it is no longer relevant to you please close the PR with a comment.
Please note that if a pull request receives no update for 7 after it has been labelled, it will be closed. We are always happy to re-open pull request if they have been closed in error.
stale-pr-label: 'attention-needed'
14 changes: 10 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org).

## [v6.3.0](https://github.com/puppetlabs/puppetlabs-tomcat/tree/v6.3.0) (2022-09-12)

[Full Changelog](https://github.com/puppetlabs/puppetlabs-tomcat/compare/v6.2.0...v6.3.0)

### Added

- pdksync - \(GH-cat-11\) Certify Support for Ubuntu 22.04 [\#493](https://github.com/puppetlabs/puppetlabs-tomcat/pull/493) ([david22swan](https://github.com/david22swan))
- pdksync - \(GH-cat-12\) Add Support for Redhat 9 [\#492](https://github.com/puppetlabs/puppetlabs-tomcat/pull/492) ([david22swan](https://github.com/david22swan))
- Allow usage of Context/Resources [\#491](https://github.com/puppetlabs/puppetlabs-tomcat/pull/491) ([tuxmea](https://github.com/tuxmea))

## [v6.2.0](https://github.com/puppetlabs/puppetlabs-tomcat/tree/v6.2.0) (2022-05-16)

[Full Changelog](https://github.com/puppetlabs/puppetlabs-tomcat/compare/v6.1.0...v6.2.0)
Expand All @@ -11,13 +21,9 @@ All notable changes to this project will be documented in this file. The format
- Update puppet-archive dependency [\#477](https://github.com/puppetlabs/puppetlabs-tomcat/pull/477) ([h4l](https://github.com/h4l))
- pdksync - \(IAC-1753\) - Add Support for AlmaLinux 8 [\#476](https://github.com/puppetlabs/puppetlabs-tomcat/pull/476) ([david22swan](https://github.com/david22swan))
- pdksync - \(IAC-1751\) - Add Support for Rocky 8 [\#475](https://github.com/puppetlabs/puppetlabs-tomcat/pull/475) ([david22swan](https://github.com/david22swan))
- pdksync - \(MAINT\) - Add Labeller and Stale GHA Workflows [\#481](https://github.com/puppetlabs/puppetlabs-tomcat/pull/481) ([chelnak](https://github.com/chelnak))

### Fixed

- pdk - \(MAINT\) - Update PDK [\#488](https://github.com/puppetlabs/puppetlabs-tomcat/pull/488) ([david22swan](https://github.com/david22swan))
- pdksync - \(MAINT\) - Update Labeller Trigger [\#486](https://github.com/puppetlabs/puppetlabs-tomcat/pull/486) ([chelnak](https://github.com/chelnak))
- pdksync - \(GH-C&T-7\) - Remove code specific to unsupported OSs [\#482](https://github.com/puppetlabs/puppetlabs-tomcat/pull/482) ([david22swan](https://github.com/david22swan))
- pdksync - \(GH-iac-334\) Remove Support for Ubuntu 14.04/16.04 [\#480](https://github.com/puppetlabs/puppetlabs-tomcat/pull/480) ([david22swan](https://github.com/david22swan))
- pdksync - \(IAC-1787\) Remove Support for CentOS 6 [\#478](https://github.com/puppetlabs/puppetlabs-tomcat/pull/478) ([david22swan](https://github.com/david22swan))
- pdksync - \(IAC-1598\) - Remove Support for Debian 8 [\#474](https://github.com/puppetlabs/puppetlabs-tomcat/pull/474) ([david22swan](https://github.com/david22swan))
Expand Down
78 changes: 78 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* [`tomcat::config::context::parameter`](#tomcatconfigcontextparameter): Configure Parameter elements in $CATALINA_BASE/conf/context.xml.
* [`tomcat::config::context::resource`](#tomcatconfigcontextresource): Configure Resource elements in $CATALINA_BASE/conf/context.xml
* [`tomcat::config::context::resourcelink`](#tomcatconfigcontextresourcelink): Configure a ResourceLink element in the designated xml config.
* [`tomcat::config::context::resources`](#tomcatconfigcontextresources): Configure Resources elements in $CATALINA_BASE/conf/context.xml
* [`tomcat::config::context::valve`](#tomcatconfigcontextvalve): Specifies Valve elements in `${catalina_base}/conf/context.xml`
* [`tomcat::config::properties::property`](#tomcatconfigpropertiesproperty): Manage additional entries for the properties file, typically catalina.properties
* [`tomcat::config::server`](#tomcatconfigserver): Configure attributes for the Server element in $CATALINA_BASE/conf/server.xml
Expand Down Expand Up @@ -566,6 +567,83 @@ Specifies display differences when augeas changes files, defaulting to true. Val

Default value: ``true``

### <a name="tomcatconfigcontextresources"></a>`tomcat::config::context::resources`

Configure Resources elements in $CATALINA_BASE/conf/context.xml

#### Parameters

The following parameters are available in the `tomcat::config::context::resources` defined type:

* [`ensure`](#ensure)
* [`resources_name`](#resources_name)
* [`name`](#name)
* [`resources_type`](#resources_type)
* [`catalina_base`](#catalina_base)
* [`additional_attributes`](#additional_attributes)
* [`attributes_to_remove`](#attributes_to_remove)
* [`show_diff`](#show_diff)

##### <a name="ensure"></a>`ensure`

Data type: `Enum['present','absent']`

Specifies whether you are trying to add or remove the Resources element.

Default value: `'present'`

##### <a name="resources_name"></a>`resources_name`

Data type: `Any`

The name of the Resources to be created, relative to the `java:comp/env` context. `$name`.

Default value: `$name`

##### <a name="name"></a>`name`

`$resources_name`

##### <a name="resources_type"></a>`resources_type`

Data type: `Any`

The fully qualified Java class name expected by the web application when it performs a lookup for this resources. Required to create the resource.

Default value: ``undef``

##### <a name="catalina_base"></a>`catalina_base`

Data type: `Any`

Specifies the root of the Tomcat installation.

Default value: `$::tomcat::catalina_home`

##### <a name="additional_attributes"></a>`additional_attributes`

Data type: `Hash`

Specifies any additional attributes to add to the Valve. Should be a hash of the format 'attribute' => 'value'. Optional

Default value: `{}`

##### <a name="attributes_to_remove"></a>`attributes_to_remove`

Data type: `Array`

Specifies an array of attributes to remove from the element. Valid options: an array of strings. `[]`.

Default value: `[]`

##### <a name="show_diff"></a>`show_diff`

Data type: `Boolean`

Specifies display differences when augeas changes files, defaulting to true. Valid options: true or false.

Default value: ``true``

### <a name="tomcatconfigcontextvalve"></a>`tomcat::config::context::valve`

Specifies Valve elements in `${catalina_base}/conf/context.xml`
Expand Down
77 changes: 77 additions & 0 deletions manifests/config/context/resources.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# @summary Configure Resources elements in $CATALINA_BASE/conf/context.xml
#
# @param ensure
# Specifies whether you are trying to add or remove the Resources element.
# @param resources_name
# The name of the Resources to be created, relative to the `java:comp/env` context. `$name`.
# @param name
# `$resources_name`
# @param resources_type
# The fully qualified Java class name expected by the web application when it performs a lookup for this resources. Required to create the resource.
# @param catalina_base
# Specifies the root of the Tomcat installation.
# @param additional_attributes
# Specifies any additional attributes to add to the Valve. Should be a hash of the format 'attribute' => 'value'. Optional
# @param attributes_to_remove
# Specifies an array of attributes to remove from the element. Valid options: an array of strings. `[]`.
# @param show_diff
# Specifies display differences when augeas changes files, defaulting to true. Valid options: true or false.
#
define tomcat::config::context::resources (
Enum['present','absent'] $ensure = 'present',
$resources_name = $name,
$resources_type = undef,
$catalina_base = $::tomcat::catalina_home,
Hash $additional_attributes = {},
Array $attributes_to_remove = [],
Boolean $show_diff = true,
) {
if versioncmp($::augeasversion, '1.0.0') < 0 {
fail('Server configurations require Augeas >= 1.0.0')
}

if $resources_name {
$_resources_name = $resources_name
} else {
$_resources_name = $name
}

$base_path = "Context/Resources[#attribute/name='${_resources_name}']"

if $ensure == 'absent' {
$changes = "rm ${base_path}"
} else {
# (MODULES-3353) does this need to be quoted?
$set_name = "set ${base_path}/#attribute/name ${_resources_name}"
if $resources_type {
$set_type = "set ${base_path}/#attribute/type ${resources_type}"
} else {
$set_type = undef
}

if ! empty($additional_attributes) {
$set_additional_attributes = suffix(prefix(join_keys_to_values($additional_attributes, " '"), "set ${base_path}/#attribute/"), "'")
} else {
$set_additional_attributes = undef
}
if ! empty(any2array($attributes_to_remove)) {
$rm_attributes_to_remove = prefix(any2array($attributes_to_remove), "rm ${base_path}/#attribute/")
} else {
$rm_attributes_to_remove = undef
}

$changes = delete_undef_values(flatten([
$set_name,
$set_type,
$set_additional_attributes,
$rm_attributes_to_remove,
]))
}

augeas { "context-${catalina_base}-resources-${name}":
lens => 'Xml.lns',
incl => "${catalina_base}/conf/context.xml",
changes => $changes,
show_diff => $show_diff,
}
}
8 changes: 5 additions & 3 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppetlabs-tomcat",
"version": "6.2.0",
"version": "6.3.0",
"author": "puppetlabs",
"summary": "Installs, deploys, and configures Apache Tomcat web services.",
"license": "Apache-2.0",
Expand All @@ -27,7 +27,8 @@
"operatingsystemrelease": [
"6",
"7",
"8"
"8",
"9"
]
},
{
Expand Down Expand Up @@ -63,7 +64,8 @@
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"18.04",
"20.04"
"20.04",
"22.04"
]
},
{
Expand Down
18 changes: 10 additions & 8 deletions spec/acceptance/acceptance_1b_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
end
end

let(:daemon_version) { '1.3.1' }

context 'Initial install Tomcat and verification' do
it 'applies the manifest without error' do
pp = <<-MANIFEST
Expand All @@ -41,27 +43,27 @@ class jsvc {
cleanup => false,
path => "/opt/apache-tomcat/bin/commons-daemon-native.tar.gz",
extract_path => "/opt/apache-tomcat/bin",
creates => "/opt/apache-tomcat/bin/commons-daemon-1.3.0-native-src",
creates => "/opt/apache-tomcat/bin/commons-daemon-#{daemon_version}-native-src",
}
-> exec { 'configure jsvc':
command => "JAVA_HOME=${java_home} configure --with-java=${java_home}",
creates => "/opt/apache-tomcat/bin/commons-daemon-1.3.0-native-src/unix/Makefile",
cwd => "/opt/apache-tomcat/bin/commons-daemon-1.3.0-native-src/unix",
path => "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/apache-tomcat/bin/commons-daemon-1.3.0-native-src/unix",
creates => "/opt/apache-tomcat/bin/commons-daemon-#{daemon_version}-native-src/unix/Makefile",
cwd => "/opt/apache-tomcat/bin/commons-daemon-#{daemon_version}-native-src/unix",
path => "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/apache-tomcat/bin/commons-daemon-#{daemon_version}-native-src/unix",
require => [ Class['gcc'], Class['java'] ],
provider => shell,
}
-> exec { 'make jsvc':
command => 'make',
creates => "/opt/apache-tomcat/bin/commons-daemon-1.3.0-native-src/unix/jsvc",
cwd => "/opt/apache-tomcat/bin/commons-daemon-1.3.0-native-src/unix",
path => "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/apache-tomcat/bin/commons-daemon-1.3.0-native-src/unix",
creates => "/opt/apache-tomcat/bin/commons-daemon-#{daemon_version}-native-src/unix/jsvc",
cwd => "/opt/apache-tomcat/bin/commons-daemon-#{daemon_version}-native-src/unix",
path => "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/apache-tomcat/bin/commons-daemon-#{daemon_version}-native-src/unix",
provider => shell,
}
-> file { 'jsvc':
ensure => link,
path => "/opt/apache-tomcat/bin/jsvc",
target => "/opt/apache-tomcat/bin/commons-daemon-1.3.0-native-src/unix/jsvc",
target => "/opt/apache-tomcat/bin/commons-daemon-#{daemon_version}-native-src/unix/jsvc",
}
}
Expand Down
65 changes: 65 additions & 0 deletions spec/defines/config/context/resources_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'tomcat::config::context::resources', type: :define do
let :pre_condition do
'class {"tomcat": }'
end
let :facts do
{
osfamily: 'Debian',
augeasversion: '1.0.0',
}
end
let :title do
'jdbc'
end

context 'Add Resources' do
let :params do
{
catalina_base: '/opt/apache-tomcat/test',
resources_type: 'net.sourceforge.jtds.jdbcx.JtdsDataSource',
additional_attributes: {
'cachingAllowed' => 'true',
'cacheMaxSize' => '100000',
},
attributes_to_remove: [
'foobar',
],
}
end

changes = [
'set Context/Resources[#attribute/name=\'jdbc\']/#attribute/name jdbc',
'set Context/Resources[#attribute/name=\'jdbc\']/#attribute/type net.sourceforge.jtds.jdbcx.JtdsDataSource',
'set Context/Resources[#attribute/name=\'jdbc\']/#attribute/cachingAllowed \'true\'',
'set Context/Resources[#attribute/name=\'jdbc\']/#attribute/cacheMaxSize \'100000\'',
'rm Context/Resources[#attribute/name=\'jdbc\']/#attribute/foobar',
]
it {
is_expected.to contain_augeas('context-/opt/apache-tomcat/test-resources-jdbc').with(
'lens' => 'Xml.lns',
'incl' => '/opt/apache-tomcat/test/conf/context.xml',
'changes' => changes,
)
}
end
context 'Remove Resources' do
let :params do
{
catalina_base: '/opt/apache-tomcat/test',
ensure: 'absent',
}
end

it {
is_expected.to contain_augeas('context-/opt/apache-tomcat/test-resources-jdbc').with(
'lens' => 'Xml.lns',
'incl' => '/opt/apache-tomcat/test/conf/context.xml',
'changes' => ['rm Context/Resources[#attribute/name=\'jdbc\']'],
)
}
end
end
Loading