Skip to content

Commit

Permalink
Merge pull request #88 from puppet-community/jre_removal
Browse files Browse the repository at this point in the history
Option 2 - removing the management of the java jre
  • Loading branch information
Liam Bennett committed Jun 5, 2015
2 parents a783de1 + f14cde1 commit 9b66900
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 151 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ end
group :system_tests do
gem "beaker"
gem "beaker-rspec"
gem "vagrant-wrapper"
end
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ The rundeck module primary class, guides the basic installation and management o
#####`package_ensure`
Ensure the state of the rundeck package, either present, absent or a specific version

#####`jre_name`
The name of the jre to be installed if using a custom jre.

#####`jre_ensure`
Ensure the version of jre to be installed, either present, absent or a specific version

#####`auth_type`
The method used to authenticate to Rundeck. Default is file.

Expand Down
16 changes: 0 additions & 16 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,6 @@
# [*package_ensure*]
# Ensure the state of the rundeck package, either present, absent or a specific version
#
# [*jre_name*]
# The name of the jre to be installed if using a custom jre.
#
# [*jre_ensure*]
# Ensure the version of jre to be installed, either present, absent or a specific version
#
# [*jre_manage*]
# Boolean value to set whether an installation of a JRE should be attempted.
# If you set this to true, you are responsible for ensuring the package defined by
# jre_name is available.
#
# [*auth_types*]
# The method used to authenticate to rundeck. Default is file.
#
Expand Down Expand Up @@ -113,9 +102,6 @@
class rundeck (
$package_ensure = $rundeck::params::package_ensure,
$package_source = $rundeck::params::package_source,
$jre_name = $rundeck::params::jre_name,
$jre_ensure = $rundeck::params::jre_ensure,
$jre_manage = $rundeck::params::jre_manage,
$auth_types = $rundeck::params::auth_types,
$auth_template = $rundeck::params::auth_template,
$auth_config = $rundeck::params::auth_config,
Expand Down Expand Up @@ -153,8 +139,6 @@

#validate_re($package_ensure, '\d+\.\d+\.\d+')

validate_string($jre_name)
validate_string($jre_ensure)
validate_array($auth_types)
validate_hash($auth_config)
validate_bool($ssl_enabled)
Expand Down
9 changes: 1 addition & 8 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
# This private class installs the rundeck package and it's dependencies
#
class rundeck::install(
$jre_name = $rundeck::jre_name,
$jre_ensure = $rundeck::jre_ensure,
$jre_manage = $rundeck::jre_manage,
$package_source = $rundeck::package_source,
$package_ensure = $rundeck::package_ensure,
$manage_yum_repo = $rundeck::manage_yum_repo,
Expand All @@ -24,10 +21,6 @@
$projects_dir = $framework_config['framework.projects.dir']
$plugin_dir = $framework_config['framework.libext.dir']

if $jre_manage {
ensure_resource('package', $jre_name, {'ensure' => $jre_ensure} )
}

$user = $rundeck::user
$group = $rundeck::group

Expand Down Expand Up @@ -65,7 +58,7 @@
exec { 'install rundeck package':
command => "/usr/bin/dpkg --force-confold -i /tmp/rundeck-${package_ensure}.deb",
unless => "/usr/bin/dpkg -l | grep rundeck | grep ${version}",
require => [ Exec['download rundeck package'], Exec['stop rundeck service'], Package[$jre_name] ]
require => [ Exec['download rundeck package'], Exec['stop rundeck service'] ]
}
}

Expand Down
8 changes: 1 addition & 7 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,21 @@
case $::osfamily {
'Debian': {
$package_name = 'rundeck'
$package_ensure = '2.2.3-1-GA'
$package_ensure = '2.5.1-1-GA'
$service_name = 'rundeckd'
$jre_name = 'openjdk-6-jre'
$jre_ensure = 'installed'
$manage_yum_repo = false
}
'RedHat', 'Amazon': {
$package_name = 'rundeck'
$package_ensure = 'installed'
$service_name = 'rundeckd'
$jre_name = 'java-1.7.0-openjdk'
$jre_ensure = 'installed'
$manage_yum_repo = true
}
default: {
fail("${::operatingsystem} not supported")
}
}

$jre_manage = true

$service_manage = false
$service_config = ''
$service_script = ''
Expand Down
10 changes: 0 additions & 10 deletions spec/acceptance/nodesets/centos-59-x64.yml

This file was deleted.

10 changes: 0 additions & 10 deletions spec/acceptance/nodesets/ubuntu-server-10044-x64.yml

This file was deleted.

92 changes: 11 additions & 81 deletions spec/acceptance/rundeck_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@
context 'default parameters on ubuntu', :if => fact('osfamily').eql?('Debian') do
it 'should work with no errors' do
pp = <<-EOS
class { 'java':
distribution => 'jre'
}
class { 'rundeck': }
Package['openjdk-7-jre-headless'] -> Exec['install rundeck package']
EOS

# Run it twice and test for idempotency
expect(apply_manifest(pp).exit_code).to_not eq(1)
expect(apply_manifest(pp).exit_code).to eq(0)
end

describe package('openjdk-6-jre') do
it { should be_installed }
end

describe package('rundeck') do
it { should be_installed }
end
Expand All @@ -25,22 +26,23 @@ class { 'rundeck': }
it { should be_running }
end
end

context 'default parameters on centos', :if => fact('osfamily').eql?('RedHat') do
it 'should work with no errors' do
pp = <<-EOS
class { 'java':
distribution => 'jre'
}
class { 'rundeck': }
Package['java-1.7.0-openjdk'] -> Package['rundeck']
EOS

# Run it twice and test for idempotency
expect(apply_manifest(pp).exit_code).to_not eq(1)
expect(apply_manifest(pp).exit_code).to eq(0)
end

describe package('java-1.7.0-openjdk') do
it { should be_installed }
end

describe package('rundeck') do
it { should be_installed }
end
Expand All @@ -49,76 +51,4 @@ class { 'rundeck': }
it { should be_running }
end
end

context 'older package version', :if => fact('osfamily').eql?('Debian') do
it 'should work with no errors' do

puppet('resource', 'package', 'rundeck', 'ensure=absent')

pp = <<-EOS
class { 'rundeck':
package_ensure => '2.0.0-1-GA'
}
EOS

# Run it twice and test for idempotency
expect(apply_manifest(pp).exit_code).to_not eq(1)
expect(apply_manifest(pp).exit_code).to eq(0)
end

describe package('rundeck') do
it { should be_installed.with_version('2.0.0') }
end
end

context 'older package version', :if => fact('osfamily').eql?('RedHat') do
it 'should work with no errors' do

puppet('resource', 'package', 'rundeck', 'ensure=absent')

pp = <<-EOS
class { 'rundeck':
package_ensure => '2.0.0-1.8.GA'
}
EOS

# Run it twice and test for idempotency
expect(apply_manifest(pp).exit_code).to_not eq(1)
expect(apply_manifest(pp).exit_code).to eq(0)
end

describe package('rundeck') do
it { should be_installed.with_version('2.0.0') }
end
end

context 'different jre version on ubuntu', :if => fact('osfamily').eql?('Debain') do
it 'should work with no errors' do
pp = <<-EOS
class { 'rundeck':
jre_name => 'openjdk-7-jre',
jre_ensure => '7u51-2.4.4-0ubuntu0.12.04.2'
}
EOS

# Run it twice and test for idempotency
expect(apply_manifest(pp).exit_code).to_not eq(1)
expect(apply_manifest(pp).exit_code).to eq(0)
end
end

context 'different jre version on centos', :if => fact('osfamily').eql?('RedHat') do
it 'should work with no errors' do
pp = <<-EOS
class { 'rundeck':
jre_name => 'java-1.7.0-openjdk',
jre_ensure => '1.7.0.51-2.4.4.1.el6_5'
}
EOS

# Run it twice and test for idempotency
expect(apply_manifest(pp).exit_code).to_not eq(1)
expect(apply_manifest(pp).exit_code).to eq(0)
end
end
end
6 changes: 0 additions & 6 deletions spec/classes/rundeck_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@
it { should contain_class('rundeck::service').that_comes_before('rundeck') }
it { should contain_class('rundeck').that_requires('rundeck::service') }

if osfamily.eql?('RedHat')
it { should contain_package('java-1.7.0-openjdk') }
else
it { should contain_package('openjdk-6-jre') }
end

end
end
end
Expand Down
11 changes: 4 additions & 7 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@
install_puppet(:version => version)
end

Spec.configure do |c|
RSpec.configure do |c|
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))

c.formatter = :documentation

c.before :suite do
#The gets around a bug where windows can't validate the cert when using https
#forge_repo = '--module_repository=http://forge.puppetlabs.com'
forge_repo = ''

hosts.each do |host|
c.host = host
Expand All @@ -27,9 +24,9 @@

copy_module_to(host, :source => proj_root, :module_name => name)

on host, puppet('module','install', forge_repo, "puppetlabs-stdlib"), { :acceptable_exit_codes => [0,1] }

on host, puppet('module','install', forge_repo, "puppetlabs-inifile"), { :acceptable_exit_codes => [0,1] }
on host, puppet('module','install', 'puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module','install', 'puppetlabs-java'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module','install', 'puppetlabs-inifile'), { :acceptable_exit_codes => [0,1] }
end
end
end

0 comments on commit 9b66900

Please sign in to comment.