Showing with 118 additions and 52 deletions.
  1. +18 −0 .sync.yml
  2. +5 −2 .travis.yml
  3. +10 −0 CHANGELOG.md
  4. +69 −32 Gemfile
  5. +7 −3 README.md
  6. +1 −1 manifests/install.pp
  7. +0 −10 manifests/install/source.pp
  8. +1 −1 metadata.json
  9. +3 −3 spec/acceptance/readme_spec.rb
  10. +4 −0 spec/spec_helper.rb
18 changes: 18 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,21 @@
- set: docker/centos-7
options:
env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=@@SET@@ SPEC_OPTS="--tag docker"
includes:
- rvm: 2.3.1
env: PUPPET_GEM_VERSION="~> 4.0" STDLIB_LOG_DEPRECATIONS="false"
bundler_args: --without system_tests
- rvm: 2.1.9
env: PUPPET_GEM_VERSION="~> 4.0" STDLIB_LOG_DEPRECATIONS="false"
bundler_args: --without system_tests
- rvm: 2.1.5
env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes"
bundler_args: --without system_tests
- rvm: 2.1.5
env: PUPPET_GEM_VERSION="~> 3.0"
bundler_args: --without system_tests
- rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 3.0"
bundler_args: --without system_tests
spec/spec_helper.rb:
allow_deprecations: true
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ sudo: false
language: ruby
cache: bundler
script: "bundle exec rake validate lint spec"
#Inserting below due to the following issue: https://github.com/travis-ci/travis-ci/issues/3531#issuecomment-88311203
before_install:
- gem update bundler
matrix:
fast_finish: true
include:
Expand All @@ -21,10 +24,10 @@ matrix:
sudo: required
- rvm: 2.3.1
bundler_args: --without system_tests
env: PUPPET_GEM_VERSION="~> 4.0"
env: PUPPET_GEM_VERSION="~> 4.0" STDLIB_LOG_DEPRECATIONS="false"
- rvm: 2.1.9
bundler_args: --without system_tests
env: PUPPET_GEM_VERSION="~> 4.0"
env: PUPPET_GEM_VERSION="~> 4.0" STDLIB_LOG_DEPRECATIONS="false"
- rvm: 2.1.5
bundler_args: --without system_tests
env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes"
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## Supported Release 1.6.1
### Summary
This release removes an attempted bugfix made in 1.6.0 for working around strict
umasks. The previous change caused duplicate resource declarations when
downloading a tomcat tarball from `puppet://` or local paths. The umask bug
remains (it is actually present in staging, not tomcat).

#### Bugfixes
- Fix duplicate resource declarations when using local source paths

## Supported Release 1.6.0
### Summary
This release adds two new defines for managing environment variables and manager elements, enhances multi-instance multi-user support, allows valves to be nested in contexts, fixes an issue with installing directly to NFS mounted directories, fixes installation on systems with a strict root umask,
Expand Down
101 changes: 69 additions & 32 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,84 @@

source ENV['GEM_SOURCE'] || "https://rubygems.org"

def location_from_env(env, default_location = [])
if location = ENV[env]
if location =~ /^((?:git|https?)[:@][^#]*)#(.*)/
[{ :git => $1, :branch => $2, :require => false }]
elsif location =~ /^file:\/\/(.*)/
['>= 0', { :path => File.expand_path($1), :require => false }]
else
[location, { :require => false }]
end
# Determines what type of gem is requested based on place_or_version.
def gem_type(place_or_version)
if place_or_version =~ /^git:/
:git
elsif place_or_version =~ /^file:/
:file
else
default_location
:gem
end
end

group :development, :unit_tests do
gem 'metadata-json-lint'
gem 'puppet_facts'
gem 'puppet-blacksmith', '>= 3.4.0'
gem 'puppetlabs_spec_helper', '>= 1.2.1'
gem 'rspec-puppet', '>= 2.3.2'
gem 'rspec-puppet-facts'
gem 'simplecov'
gem 'parallel_tests'
gem 'rubocop', '0.41.2' if RUBY_VERSION < '2.0.0'
gem 'rubocop' if RUBY_VERSION >= '2.0.0'
gem 'rubocop-rspec', '~> 1.6' if RUBY_VERSION >= '2.3.0'
gem 'json_pure', '<= 2.0.1' if RUBY_VERSION < '2.0.0'
# Find a location or specific version for a gem. place_or_version can be a
# version, which is most often used. It can also be git, which is specified as
# `git://somewhere.git#branch`. You can also use a file source location, which
# is specified as `file://some/location/on/disk`.
def location_for(place_or_version, fake_version = nil)
if place_or_version =~ /^(git[:@][^#]*)#(.*)/
[fake_version, { :git => $1, :branch => $2, :require => false }].compact
elsif place_or_version =~ /^file:\/\/(.*)/
['>= 0', { :path => File.expand_path($1), :require => false }]
else
[place_or_version, { :require => false }]
end
end

# Used for gem conditionals
supports_windows = false

group :development do
gem 'puppet-lint', :require => false
gem 'metadata-json-lint', :require => false, :platforms => 'ruby'
gem 'puppet_facts', :require => false
gem 'puppet-blacksmith', '>= 3.4.0', :require => false, :platforms => 'ruby'
gem 'puppetlabs_spec_helper', '>= 1.2.1', :require => false
gem 'rspec-puppet', '>= 2.3.2', :require => false
gem 'rspec-puppet-facts', :require => false, :platforms => 'ruby'
gem 'mocha', '< 1.2.0', :require => false
gem 'simplecov', :require => false, :platforms => 'ruby'
gem 'parallel_tests', '< 2.10.0', :require => false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
gem 'parallel_tests', :require => false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.0.0')
gem 'rubocop', '0.41.2', :require => false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
gem 'rubocop', :require => false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.0.0')
gem 'rubocop-rspec', '~> 1.6', :require => false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0')
gem 'pry', :require => false
gem 'json_pure', '<= 2.0.1', :require => false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
end

group :system_tests do
gem 'beaker', *location_from_env('BEAKER_VERSION', []) if RUBY_VERSION >= '2.3.0'
gem 'beaker', *location_from_env('BEAKER_VERSION', ['< 3']) if RUBY_VERSION < '2.3.0'
gem 'beaker-rspec', *location_from_env('BEAKER_RSPEC_VERSION', ['>= 3.4'])
gem 'serverspec'
gem 'beaker-puppet_install_helper'
gem 'master_manipulator'
gem 'beaker-hostgenerator', *location_from_env('BEAKER_HOSTGENERATOR_VERSION', [])
gem 'beaker', *location_for(ENV['BEAKER_VERSION'] || '~> 2.20') if supports_windows
gem 'beaker', *location_for(ENV['BEAKER_VERSION']) if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0') and ! supports_windows
gem 'beaker', *location_for(ENV['BEAKER_VERSION'] || '< 3') if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.3.0') and ! supports_windows
gem 'beaker-pe', :require => false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0')
gem 'beaker-rspec', *location_for(ENV['BEAKER_RSPEC_VERSION'] || '>= 3.4') if ! supports_windows
gem 'beaker-rspec', *location_for(ENV['BEAKER_RSPEC_VERSION'] || '~> 5.1') if supports_windows
gem 'beaker-puppet_install_helper', :require => false
gem 'master_manipulator', :require => false
gem 'beaker-hostgenerator', *location_for(ENV['BEAKER_HOSTGENERATOR_VERSION'])
gem 'beaker-abs', *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.1')
end

gem 'facter', *location_from_env('FACTER_GEM_VERSION')
gem 'puppet', *location_from_env('PUPPET_GEM_VERSION')
gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION'])

# Only explicitly specify Facter/Hiera if a version has been specified.
# Otherwise it can lead to strange bundler behavior. If you are seeing weird
# gem resolution behavior, try setting `DEBUG_RESOLVER` environment variable
# to `1` and then run bundle install.
gem 'facter', *location_for(ENV['FACTER_GEM_VERSION']) if ENV['FACTER_GEM_VERSION']
gem 'hiera', *location_for(ENV['HIERA_GEM_VERSION']) if ENV['HIERA_GEM_VERSION']


# Evaluate Gemfile.local if it exists
if File.exists? "#{__FILE__}.local"
eval(File.read("#{__FILE__}.local"), binding)
end

# Evaluate ~/.gemfile if it exists
if File.exists?(File.join(Dir.home, '.gemfile'))
eval(File.read(File.join(Dir.home, '.gemfile')), binding)
end

# vim:ft=ruby
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,23 @@ The simplest way to get Tomcat up and running with the tomcat module is to insta

```puppet
tomcat::install { '/opt/tomcat':
source_url => 'https://www-us.apache.org/dist/tomcat/tomcat-7/v7.0.72/bin/apache-tomcat-7.0.72.tar.gz',
source_url => 'https://www-us.apache.org/dist/tomcat/tomcat-7/v7.0.x/bin/apache-tomcat-7.0.x.tar.gz',
}
tomcat::instance { 'default':
catalina_home => '/opt/tomcat',
}
```

> Note: look up the correct version you want to install on the [version list](http://tomcat.apache.org/whichversion.html).
## Usage
### I want to run multiple instances of multiple versions tomcat

```puppet
class { 'java': }
tomcat::install { '/opt/tomcat8':
source_url => 'https://www.apache.org/dist/tomcat/tomcat-8/v8.0.36/bin/apache-tomcat-8.0.36.tar.gz'
source_url => 'https://www.apache.org/dist/tomcat/tomcat-8/v8.0.x/bin/apache-tomcat-8.0.x.tar.gz'
}
tomcat::instance { 'tomcat8-first':
catalina_home => '/opt/tomcat8',
Expand All @@ -106,7 +108,7 @@ tomcat::config::server::connector { 'tomcat8-second-http':
}
tomcat::install { '/opt/tomcat6':
source_url => 'http://www-eu.apache.org/dist/tomcat/tomcat-6/v6.0.45/bin/apache-tomcat-6.0.45.tar.gz',
source_url => 'http://www-eu.apache.org/dist/tomcat/tomcat-6/v6.0.x/bin/apache-tomcat-6.0.x.tar.gz',
}
tomcat::instance { 'tomcat6':
catalina_home => '/opt/tomcat6',
Expand Down Expand Up @@ -134,6 +136,8 @@ tomcat::config::server::connector { 'tomcat6-ajp':
}
```

> Note: look up the correct version you want to install on the [version list](http://tomcat.apache.org/whichversion.html).
### I want to deploy WAR files

Add the following to any existing installation with your own war source:
Expand Down
2 changes: 1 addition & 1 deletion manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
$package_name = undef,
$package_options = undef,
) {
include tomcat
include ::tomcat
$_install_from_source = pick($install_from_source, $::tomcat::install_from_source)
$_user = pick($user, $::tomcat::user)
$_group = pick($group, $::tomcat::group)
Expand Down
10 changes: 0 additions & 10 deletions manifests/install/source.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,6 @@
'source' => $source_url,
})

# FM-5578 workaround for strict umodes
ensure_resource('file', "${::staging::path}/tomcat", {
'ensure' => 'directory',
'mode' => '0755'
})
ensure_resource('file', "${::staging::path}/tomcat/${filename}", {
'mode' => '0644',
'require' => "Exec[${::staging::path}/tomcat/${filename}]",
})

staging::extract { "${name}-${filename}":
source => "${::staging::path}/tomcat/${filename}",
target => $catalina_home,
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppetlabs-tomcat",
"version": "1.6.0",
"version": "1.6.1",
"author": "puppetlabs",
"summary": "Installs, deploys, and configures Apache Tomcat web services.",
"license": "Apache-2.0",
Expand Down
6 changes: 3 additions & 3 deletions spec/acceptance/readme_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
pp = <<-EOS
class{'java':}
tomcat::install { '/opt/tomcat':
source_url => 'https://www-us.apache.org/dist/tomcat/tomcat-7/v7.0.72/bin/apache-tomcat-7.0.72.tar.gz',
source_url => '#{TOMCAT7_RECENT_SOURCE}',
}
tomcat::instance { 'default':
catalina_home => '/opt/tomcat',
Expand All @@ -48,7 +48,7 @@
class { 'java': }
tomcat::install { '/opt/tomcat8':
source_url => 'https://www.apache.org/dist/tomcat/tomcat-8/v8.0.37/bin/apache-tomcat-8.0.37.tar.gz'
source_url => '#{TOMCAT8_RECENT_SOURCE}'
}
tomcat::instance { 'tomcat8-first':
catalina_home => '/opt/tomcat8',
Expand All @@ -73,7 +73,7 @@ class { 'java': }
}
tomcat::install { '/opt/tomcat6':
source_url => 'http://www-eu.apache.org/dist/tomcat/tomcat-6/v6.0.45/bin/apache-tomcat-6.0.45.tar.gz',
source_url => '#{TOMCAT6_RECENT_SOURCE}',
}
tomcat::instance { 'tomcat6':
catalina_home => '/opt/tomcat6',
Expand Down
4 changes: 4 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@
require 'spec_helper_local'
rescue LoadError
end
RSpec.configure do |c|
c.filter_run :focus => true
c.run_all_when_everything_filtered = true
end