2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@
/convert_report.txt
/update_report.txt
.DS_Store
.envrc
/inventory.yaml
4 changes: 4 additions & 0 deletions .pdkignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
/convert_report.txt
/update_report.txt
.DS_Store
.envrc
/inventory.yaml
/appveyor.yml
/.fixtures.yml
/Gemfile
Expand All @@ -30,8 +32,10 @@
/.gitlab-ci.yml
/.pdkignore
/Rakefile
/rakelib/
/.rspec
/.rubocop.yml
/.travis.yml
/.yardopts
/spec/
/.vscode/
1 change: 1 addition & 0 deletions .puppet-lint.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--relative
18 changes: 13 additions & 5 deletions .sync.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
---
.gitignore:
required:
- ---.project

.gitlab-ci.yml:
unmanaged: true

.travis.yml:
docker_sets:
- set: docker/centos-7
Expand All @@ -9,6 +16,9 @@
branches:
- release

appveyor.yml:
delete: true

Gemfile:
required:
':system_tests':
Expand All @@ -28,8 +38,6 @@ Gemfile:
ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018'
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')"

appveyor.yml:
delete: true

.gitlab-ci.yml:
unmanaged: true
spec/spec_helper.rb:
mock_with: ':rspec'
coverage_report: true
34 changes: 23 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
dist: trusty
language: ruby
cache: bundler
before_install:
Expand All @@ -12,36 +11,49 @@ script:
- 'bundle exec rake $CHECK'
bundler_args: --without system_tests
rvm:
- 2.5.1
env:
global:
- BEAKER_PUPPET_COLLECTION=puppet6 PUPPET_GEM_VERSION="~> 6.0"
- 2.5.3
stages:
- static
- spec
- acceptance
-
if: tag =~ ^v\d
name: deploy
matrix:
fast_finish: true
include:
-
bundler_args:
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=docker/centos-7 BEAKER_TESTMODE=apply
rvm: 2.5.1
rvm: 2.5.3
script: bundle exec rake beaker
services: docker
stage: acceptance
sudo: required
-
bundler_args:
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=docker/ubuntu-14.04 BEAKER_TESTMODE=apply
rvm: 2.5.1
rvm: 2.5.3
script: bundle exec rake beaker
services: docker
stage: acceptance
sudo: required
-
env: CHECK="syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop"
-
env: CHECK=parallel_spec
env: CHECK="check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint"
stage: static
-
env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec
rvm: 2.4.4
rvm: 2.4.5
stage: spec
-
env: PUPPET_GEM_VERSION="~> 6.0" CHECK=parallel_spec
rvm: 2.5.3
stage: spec
-
env: DEPLOY_TO_FORGE=yes
stage: deploy
branches:
only:
- master
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

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).

## [v3.0.0](https://github.com/puppetlabs/puppetlabs-tomcat/tree/v3.0.0) (2019-05-17)

[Full Changelog](https://github.com/puppetlabs/puppetlabs-tomcat/compare/2.5.0...v3.0.0)

### Changed

- pdksync - \(MODULES-8444\) - Raise lower Puppet bound [\#347](https://github.com/puppetlabs/puppetlabs-tomcat/pull/347) ([david22swan](https://github.com/david22swan))

### Fixed

- \(MODULES-8817\) - Update to account for loss of SVN Tomcat archive [\#344](https://github.com/puppetlabs/puppetlabs-tomcat/pull/344) ([david22swan](https://github.com/david22swan))

## [2.5.0](https://github.com/puppetlabs/puppetlabs-tomcat/tree/2.5.0) (2019-01-29)

[Full Changelog](https://github.com/puppetlabs/puppetlabs-tomcat/compare/2.4.0...2.5.0)
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ end

def changelog_future_release
return unless Rake.application.top_level_tasks.include? "changelog"
returnVal = JSON.load(File.read('metadata.json'))['version']
returnVal = "v%s" % JSON.load(File.read('metadata.json'))['version']
raise "unable to find the future_release (version) in metadata.json" if returnVal.nil?
puts "GitHubChangelogGenerator future_release:#{returnVal}"
returnVal
Expand Down
14 changes: 7 additions & 7 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppetlabs-tomcat",
"version": "2.5.0",
"version": "3.0.0",
"author": "puppetlabs",
"summary": "Installs, deploys, and configures Apache Tomcat web services.",
"license": "Apache-2.0",
Expand All @@ -10,11 +10,11 @@
"dependencies": [
{
"name": "puppetlabs/stdlib",
"version_requirement": ">= 4.6.0 < 6.0.0"
"version_requirement": ">= 4.6.0 < 7.0.0"
},
{
"name": "puppetlabs/concat",
"version_requirement": ">= 1.1.0 < 6.0.0"
"version_requirement": ">= 1.1.0 < 7.0.0"
},
{
"name": "puppet/archive",
Expand Down Expand Up @@ -80,10 +80,10 @@
"requirements": [
{
"name": "puppet",
"version_requirement": ">= 4.7.0 < 7.0.0"
"version_requirement": ">= 5.5.10 < 7.0.0"
}
],
"template-url": "https://github.com/puppetlabs/pdk-templates/",
"template-ref": "heads/master-0-g6814a87",
"pdk-version": "1.7.1"
"template-url": "https://github.com/puppetlabs/pdk-templates#master",
"template-ref": "heads/master-0-gf778803",
"pdk-version": "1.10.0"
}
21 changes: 10 additions & 11 deletions spec/acceptance/acceptance_1b_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,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-#{LATEST_DAEMON_8}-native-src",
creates => "/opt/apache-tomcat/bin/commons-daemon-1.1.0-native-src",
}
-> exec { 'configure jsvc':
command => "JAVA_HOME=${java_home} configure --with-java=${java_home}",
creates => "/opt/apache-tomcat/bin/commons-daemon-#{LATEST_DAEMON_8}-native-src/unix/Makefile",
cwd => "/opt/apache-tomcat/bin/commons-daemon-#{LATEST_DAEMON_8}-native-src/unix",
path => "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/apache-tomcat/bin/commons-daemon-#{LATEST_DAEMON_8}-native-src/unix",
creates => "/opt/apache-tomcat/bin/commons-daemon-1.1.0-native-src/unix/Makefile",
cwd => "/opt/apache-tomcat/bin/commons-daemon-1.1.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.1.0-native-src/unix",
require => [ Class['gcc'], Class['java'] ],
provider => shell,
}
-> exec { 'make jsvc':
command => 'make',
creates => "/opt/apache-tomcat/bin/commons-daemon-#{LATEST_DAEMON_8}-native-src/unix/jsvc",
cwd => "/opt/apache-tomcat/bin/commons-daemon-#{LATEST_DAEMON_8}-native-src/unix",
path => "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/apache-tomcat/bin/commons-daemon-#{LATEST_DAEMON_8}-native-src/unix",
creates => "/opt/apache-tomcat/bin/commons-daemon-1.1.0-native-src/unix/jsvc",
cwd => "/opt/apache-tomcat/bin/commons-daemon-1.1.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.1.0-native-src/unix",
provider => shell,
}
-> file { 'jsvc':
ensure => link,
path => "/opt/apache-tomcat/bin/jsvc",
target => "/opt/apache-tomcat/bin/commons-daemon-#{LATEST_DAEMON_8}-native-src/unix/jsvc",
target => "/opt/apache-tomcat/bin/commons-daemon-1.1.0-native-src/unix/jsvc",
}
}
Expand Down Expand Up @@ -116,8 +116,7 @@ class jsvc {
value => $java_home,
}
MANIFEST
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
idempotent_apply(default, pp, {})
end
it 'is serving a page on port 80', retry: 5, retry_wait: 10 do
shell('curl --retry 10 --retry-delay 15 localhost:80/war_one/hello.jsp', acceptable_exit_codes: 0) do |r|
Expand Down Expand Up @@ -188,7 +187,7 @@ class jsvc {
end
it 'does not have deployed the war', retry: 5, retry_wait: 10 do
shell('curl localhost:80/war_one/hello.jsp', acceptable_exit_codes: 0) do |r|
r.stdout.should eq('')
r.stdout.should match(%r{The origin server did not find a current representation for the target resource})
end
end
end
Expand Down
3 changes: 1 addition & 2 deletions spec/acceptance/acceptance_2b_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ class { 'java':}
}
MANIFEST
it 'applies the manifest without error' do
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
idempotent_apply(default, pp, {})
end
# test the war
it 'tomcat7-first should have war deployed by default', retry: 5, retry_wait: 10 do
Expand Down
9 changes: 4 additions & 5 deletions spec/acceptance/acceptance_3b_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,11 @@ class { 'tomcat':
}
MANIFEST
it 'applies the manifest without error' do
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
idempotent_apply(default, pp, {})
end
it 'is serving a page on port 8180', retry: 5, retry_wait: 10 do
shell('curl --retry 10 --retry-delay 15 localhost:8180') do |r|
r.stdout.should eq('')
r.stdout.should match(%r{The origin server did not find a current representation for the target resource})
end
end
it 'is serving a JSP page from the war', retry: 5, retry_wait: 10 do
Expand Down Expand Up @@ -98,7 +97,7 @@ class { 'tomcat':
end
it 'is serving a page on port 8180', retry: 5, retry_wait: 10 do
shell('curl --retry 10 --retry-delay 15 localhost:8180') do |r|
r.stdout.should eq('')
r.stdout.should match(%r{The origin server did not find a current representation for the target resource})
end
end
end
Expand All @@ -116,7 +115,7 @@ class { 'tomcat':
end
it 'does not have deployed the war', retry: 5, retry_wait: 10 do
shell('curl --retry 10 --retry-delay 15 localhost:8180/tomcat8-sample/hello.jsp', acceptable_exit_codes: 0) do |r|
r.stdout.should eq('')
r.stdout.should match(%r{The origin server did not find a current representation for the target resource})
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/acceptance_4b_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class { 'tomcat': catalina_home => '/opt/apache-tomcat40', }
}
MANIFEST
it 'is idempotent' do
apply_manifest(pp_two, catch_changes: true)
idempotent_apply(default, pp_two, {})
end
end
end
4 changes: 1 addition & 3 deletions spec/acceptance/readme_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
(fact('operatingsystem') == 'Ubuntu' && fact('operatingsystemrelease') == '18.04'),
(fact('osfamily') == 'RedHat' && fact('operatingsystemmajrelease') == '5'),
(fact('operatingsystem') == 'Debian' && fact('operatingsystemmajrelease') == '8'),
fact('osfamily') == 'Suse',
]

stop_test = false
Expand All @@ -32,8 +31,7 @@
}
MANIFEST
it 'applies the manifest without error' do
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
idempotent_apply(default, pp, {})
shell('sleep 15')
end
it 'has the server running on port 8080' do
Expand Down
10 changes: 9 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
RSpec.configure do |c|
c.mock_with :rspec
end

require 'puppetlabs_spec_helper/module_spec_helper'
require 'rspec-puppet-facts'

Expand All @@ -19,7 +23,7 @@
next unless File.exist?(f) && File.readable?(f) && File.size?(f)

begin
default_facts.merge!(YAML.safe_load(File.read(f)))
default_facts.merge!(YAML.safe_load(File.read(f), [], [], true))
rescue => e
RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}"
end
Expand All @@ -32,6 +36,10 @@
# by default Puppet runs at warning level
Puppet.settings[:strict] = :warning
end
c.filter_run_excluding(bolt: true) unless ENV['GEM_BOLT']
c.after(:suite) do
RSpec::Puppet::Coverage.report!(0)
end
end

def ensure_module_defined(module_name)
Expand Down
25 changes: 14 additions & 11 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,6 @@ def latest_tomcat_tarball_url(version)
"#{mirror_url}/tomcat/tomcat-#{version}/v#{latest_version}/bin/apache-tomcat-#{latest_version}.tar.gz"
end

def latest_daemon_version(tomcat_version)
require 'net/http'
build_value = tomcat_version.match(%r{(\d+)\.(\d+)\.(\d+)})
uri = "http://svn.apache.org/repos/asf/tomcat/tc#{build_value[1]}.#{build_value[2]}.x/tags/TOMCAT_#{build_value[1]}_#{build_value[2]}_#{build_value[3]}/build.properties.default"
page = Net::HTTP.get(URI(uri))
latest_version = page.match(%r{(?:commons-daemon.version=)(\d.\d.\d)})[1]
latest_version
end

latest7 = latest_tomcat_tarball_url('7')
latest8 = latest_tomcat_tarball_url('8')
latest9 = latest_tomcat_tarball_url('9')
Expand All @@ -53,8 +44,6 @@ def latest_daemon_version(tomcat_version)
TOMCAT_LEGACY_SOURCE = "http://archive.apache.org/dist/tomcat/tomcat-7/v#{TOMCAT_LEGACY_VERSION}/bin/apache-tomcat-#{TOMCAT_LEGACY_VERSION}.tar.gz".freeze
SAMPLE_WAR = 'http://tomcat.apache.org/tomcat-9.0-doc/appdev/sample/sample.war'.freeze

LATEST_DAEMON_8 = latest_daemon_version(TOMCAT8_RECENT_VERSION)

UNSUPPORTED_PLATFORMS = ['windows', 'Solaris', 'Darwin'].freeze

# Tomcat 7 needs java 1.6 or newer
Expand All @@ -71,6 +60,20 @@ def latest_daemon_version(tomcat_version)
SKIP_TOMCAT_8 = confine_8_array.any?
SKIP_GCC = (fact('osfamily') == 'Suse')

def idempotent_apply(hosts, manifest, opts = {}, &block)
block_on hosts, opts do |host|
file_path = host.tmpfile('apply_manifest.pp')
create_remote_file(host, file_path, manifest + "\n")

puppet_apply_opts = { :verbose => nil, 'detailed-exitcodes' => nil }
on_options = { acceptable_exit_codes: [0, 2] }
on host, puppet('apply', file_path, puppet_apply_opts), on_options, &block
puppet_apply_opts2 = { :verbose => nil, 'detailed-exitcodes' => nil }
on_options2 = { acceptable_exit_codes: [0] }
on host, puppet('apply', file_path, puppet_apply_opts2), on_options2, &block
end
end

RSpec.configure do |c|
c.filter_run focus: true
c.run_all_when_everything_filtered = true
Expand Down
Loading