From f220debc8b2101ade3e03d4b8f9742e0b8ffe470 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suszy=C5=84ski=20Krzysztof?= Date: Wed, 22 Jun 2016 16:22:21 +0200 Subject: [PATCH 01/21] Move examples from tests to examples directory to accomodate to puppet module directory structure change --- {tests => examples}/README.md | 0 {tests => examples}/clientry.pp | 0 {tests => examples}/datasource.pp | 0 {tests => examples}/deploy.pp | 0 {tests => examples}/domain/controller.pp | 0 {tests => examples}/domain/node.pp | 0 {tests => examples}/domain/server.pp | 0 {tests => examples}/domain/servergroup.pp | 0 {tests => examples}/init.pp | 0 {tests => examples}/interface.pp | 0 {tests => examples}/jboss/as7.pp | 0 examples/jboss/wildfly10.pp | 4 ++++ {tests => examples}/jboss/wildfly8.pp | 0 {tests => examples}/jboss/wildfly9.pp | 0 {tests => examples}/jmsqueue.pp | 0 {tests => examples}/module.pp | 0 {tests => examples}/resourceadapter.pp | 0 {tests => examples}/securitydomain.pp | 0 {tests => examples}/user.pp | 0 spec/testing/acceptance/smoke_test_reader.rb | 2 +- 20 files changed, 5 insertions(+), 1 deletion(-) rename {tests => examples}/README.md (100%) rename {tests => examples}/clientry.pp (100%) rename {tests => examples}/datasource.pp (100%) rename {tests => examples}/deploy.pp (100%) rename {tests => examples}/domain/controller.pp (100%) rename {tests => examples}/domain/node.pp (100%) rename {tests => examples}/domain/server.pp (100%) rename {tests => examples}/domain/servergroup.pp (100%) rename {tests => examples}/init.pp (100%) rename {tests => examples}/interface.pp (100%) rename {tests => examples}/jboss/as7.pp (100%) create mode 100644 examples/jboss/wildfly10.pp rename {tests => examples}/jboss/wildfly8.pp (100%) rename {tests => examples}/jboss/wildfly9.pp (100%) rename {tests => examples}/jmsqueue.pp (100%) rename {tests => examples}/module.pp (100%) rename {tests => examples}/resourceadapter.pp (100%) rename {tests => examples}/securitydomain.pp (100%) rename {tests => examples}/user.pp (100%) diff --git a/tests/README.md b/examples/README.md similarity index 100% rename from tests/README.md rename to examples/README.md diff --git a/tests/clientry.pp b/examples/clientry.pp similarity index 100% rename from tests/clientry.pp rename to examples/clientry.pp diff --git a/tests/datasource.pp b/examples/datasource.pp similarity index 100% rename from tests/datasource.pp rename to examples/datasource.pp diff --git a/tests/deploy.pp b/examples/deploy.pp similarity index 100% rename from tests/deploy.pp rename to examples/deploy.pp diff --git a/tests/domain/controller.pp b/examples/domain/controller.pp similarity index 100% rename from tests/domain/controller.pp rename to examples/domain/controller.pp diff --git a/tests/domain/node.pp b/examples/domain/node.pp similarity index 100% rename from tests/domain/node.pp rename to examples/domain/node.pp diff --git a/tests/domain/server.pp b/examples/domain/server.pp similarity index 100% rename from tests/domain/server.pp rename to examples/domain/server.pp diff --git a/tests/domain/servergroup.pp b/examples/domain/servergroup.pp similarity index 100% rename from tests/domain/servergroup.pp rename to examples/domain/servergroup.pp diff --git a/tests/init.pp b/examples/init.pp similarity index 100% rename from tests/init.pp rename to examples/init.pp diff --git a/tests/interface.pp b/examples/interface.pp similarity index 100% rename from tests/interface.pp rename to examples/interface.pp diff --git a/tests/jboss/as7.pp b/examples/jboss/as7.pp similarity index 100% rename from tests/jboss/as7.pp rename to examples/jboss/as7.pp diff --git a/examples/jboss/wildfly10.pp b/examples/jboss/wildfly10.pp new file mode 100644 index 0000000..7ea94e1 --- /dev/null +++ b/examples/jboss/wildfly10.pp @@ -0,0 +1,4 @@ +class { 'jboss': + product => 'wildfly', + version => '10.0.0.Final', +} diff --git a/tests/jboss/wildfly8.pp b/examples/jboss/wildfly8.pp similarity index 100% rename from tests/jboss/wildfly8.pp rename to examples/jboss/wildfly8.pp diff --git a/tests/jboss/wildfly9.pp b/examples/jboss/wildfly9.pp similarity index 100% rename from tests/jboss/wildfly9.pp rename to examples/jboss/wildfly9.pp diff --git a/tests/jmsqueue.pp b/examples/jmsqueue.pp similarity index 100% rename from tests/jmsqueue.pp rename to examples/jmsqueue.pp diff --git a/tests/module.pp b/examples/module.pp similarity index 100% rename from tests/module.pp rename to examples/module.pp diff --git a/tests/resourceadapter.pp b/examples/resourceadapter.pp similarity index 100% rename from tests/resourceadapter.pp rename to examples/resourceadapter.pp diff --git a/tests/securitydomain.pp b/examples/securitydomain.pp similarity index 100% rename from tests/securitydomain.pp rename to examples/securitydomain.pp diff --git a/tests/user.pp b/examples/user.pp similarity index 100% rename from tests/user.pp rename to examples/user.pp diff --git a/spec/testing/acceptance/smoke_test_reader.rb b/spec/testing/acceptance/smoke_test_reader.rb index d3e699f..79f3e7d 100644 --- a/spec/testing/acceptance/smoke_test_reader.rb +++ b/spec/testing/acceptance/smoke_test_reader.rb @@ -8,7 +8,7 @@ def smoke_pp(pp_symbol) private def smokedir - rootdir.join('tests') + rootdir.join('examples') end def rootdir From 957598852aeadef43821114031def78c923974af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suszy=C5=84ski=20Krzysztof?= Date: Wed, 22 Jun 2016 16:22:56 +0200 Subject: [PATCH 02/21] Setting version for coi/jboss module as a pre release --- metadata.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/metadata.json b/metadata.json index 88a2fde..f826817 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "coi/jboss", - "version": "1.0.4", + "version": "1.0.4-pre", "author": "Center of Information Technology COI.gov.pl", "summary": "Installs JBoss EAP and WildFly application servers and manage their resources and applications in either a domain or a stand-alone mode", "license": "Apache-2.0", @@ -25,4 +25,3 @@ { "name": "puppet", "version_requirement": ">=2.7.0 <4.0.0" } ] } - From 1c7f2e08268bf65d145bb8f2a66f26bccbb8e6bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suszy=C5=84ski=20Krzysztof?= Date: Wed, 22 Jun 2016 16:23:47 +0200 Subject: [PATCH 03/21] Pinning listen gem in order to gruard to work on Ruby 1.9 --- Gemfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 4f8af04..6a406ac 100644 --- a/Gemfile +++ b/Gemfile @@ -48,8 +48,10 @@ group :development do if RUBY_VERSION >= '1.9.0' gem 'travis', :require => false gem 'puppet-blacksmith', :require => false + gem 'guard-rake', :require => false + # PINNED: Listen is dependency of Guard, and >= 3.1.x requires Ruby 2.2 + gem 'listen', '~> 3.0.8', :require => false if RUBY_VERSION >= '2.0.0' - gem 'guard-rake', :require => false gem 'pry-byebug', :require => false else gem 'pry-debugger', :require => false From 5d14ea522db9bd9390cc5b575edff4780e1efc38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suszy=C5=84ski=20Krzysztof?= Date: Wed, 22 Jun 2016 16:24:29 +0200 Subject: [PATCH 04/21] Compatibility enhancement and modularization, tested on Ubuntu 16.04 with WildFly 10 refers to issue #73 --- manifests/internal/compatibility.pp | 55 ++++++++++--------- manifests/internal/compatibility/as.pp | 18 ++++++ manifests/internal/compatibility/common.pp | 5 ++ manifests/internal/compatibility/eap.pp | 32 +++++++++++ manifests/internal/compatibility/wildfly.pp | 61 +++++++++++++++++++++ manifests/internal/package.pp | 7 ++- spec/acceptance/jboss/wildfly10_spec.rb | 19 +++++++ 7 files changed, 167 insertions(+), 30 deletions(-) create mode 100644 manifests/internal/compatibility/as.pp create mode 100644 manifests/internal/compatibility/common.pp create mode 100644 manifests/internal/compatibility/eap.pp create mode 100644 manifests/internal/compatibility/wildfly.pp create mode 100644 spec/acceptance/jboss/wildfly10_spec.rb diff --git a/manifests/internal/compatibility.pp b/manifests/internal/compatibility.pp index 4804dff..6484d7c 100644 --- a/manifests/internal/compatibility.pp +++ b/manifests/internal/compatibility.pp @@ -2,43 +2,44 @@ class jboss::internal::compatibility { include jboss + if $::osfamily != 'RedHat' and $::osfamily != 'Debian' { + fail("Unsupported OS family: ${::osfamily}. Supporting only RHEL and Debian systems. Consult README file.") + } + case $jboss::product { 'wildfly': { - if versioncmp($jboss::version, '8.0.0') < 0 or versioncmp($jboss::version, '10.0.0') >= 0 { - fail("Unsupported version ${jboss::product} ${jboss::version}. Supporting only: Wildfly 8.x and 9.x series") - } + include jboss::internal::compatibility::wildfly + + $controller_port = $jboss::internal::compatibility::wildfly::controller_port + $product_short = $jboss::internal::compatibility::wildfly::product_short + $initd_file = $jboss::internal::compatibility::wildfly::initd_file + $systemd_file = $jboss::internal::compatibility::wildfly::systemd_file + $systemd_launcher = $jboss::internal::compatibility::wildfly::systemd_launcher + $initsystem = $jboss::internal::compatibility::wildfly::initsystem } 'jboss-eap': { - if versioncmp($jboss::version, '6.0.0') < 0 or versioncmp($jboss::version, '8.0.0') >= 0 { - fail("Unsupported version ${jboss::product} ${jboss::version}. Supporting only: JBoss EAP 6.x and 7.x series") - } + include jboss::internal::compatibility::eap + + $controller_port = $jboss::internal::compatibility::eap::controller_port + $product_short = $jboss::internal::compatibility::eap::product_short + $initd_file = $jboss::internal::compatibility::eap::initd_file + $systemd_file = $jboss::internal::compatibility::eap::systemd_file + $systemd_launcher = $jboss::internal::compatibility::eap::systemd_launcher + $initsystem = $jboss::internal::compatibility::eap::initsystem } 'jboss-as': { - if versioncmp($jboss::version, '7.0.0') < 0 or versioncmp($jboss::version, '8.0.0') >= 0 { - fail("Unsupported version ${jboss::product} ${jboss::version}. Supporting only: JBoss AS 7.x series") - } + include jboss::internal::compatibility::as + + $controller_port = $jboss::internal::compatibility::as::controller_port + $product_short = $jboss::internal::compatibility::as::product_short + $initd_file = $jboss::internal::compatibility::as::initd_file + $systemd_file = $jboss::internal::compatibility::as::systemd_file + $systemd_launcher = $jboss::internal::compatibility::as::systemd_launcher + $initsystem = $jboss::internal::compatibility::as::initsystem } default: { fail("Unsupported product ${jboss::product}. Supporting only: 'jboss-eap', 'jboss-as' and 'wildfly'") } } - case $jboss::product { - 'wildfly': { - $controller_port = '9990' - $__osfamily_down = downcase($::osfamily) - $initd_file = "${jboss::home}/bin/init.d/wildfly-init-${__osfamily_down}.sh" - $product_short = 'wildfly' - } - 'jboss-eap', 'jboss-as': { - $controller_port = '9999' - $product_short = 'jboss' - $initd_file = $jboss::runasdomain ? { - true => "${jboss::home}/bin/init.d/jboss-as-domain.sh", - default => "${jboss::home}/bin/init.d/jboss-as-standalone.sh", - } - } - default: {} - } - } diff --git a/manifests/internal/compatibility/as.pp b/manifests/internal/compatibility/as.pp new file mode 100644 index 0000000..63dc47d --- /dev/null +++ b/manifests/internal/compatibility/as.pp @@ -0,0 +1,18 @@ +# == Class: jboss::internal::compatibility::as +# This is internal class to resolve JBoss AS compatibility +class jboss::internal::compatibility::as { + include jboss + + if versioncmp($jboss::version, '7.0.0') < 0 or versioncmp($jboss::version, '8.0.0') >= 0 { + fail("Unsupported version ${jboss::product} ${jboss::version}. Supporting only: JBoss AS 7.x series") + } + $systemd_file = undef + $systemd_launcher = undef + $initsystem = 'SystemV' + $controller_port = '9999' + $product_short = 'jboss' + $initd_file = $jboss::runasdomain ? { + true => "${jboss::home}/bin/init.d/jboss-as-domain.sh", + default => "${jboss::home}/bin/init.d/jboss-as-standalone.sh", + } +} diff --git a/manifests/internal/compatibility/common.pp b/manifests/internal/compatibility/common.pp new file mode 100644 index 0000000..22db8f3 --- /dev/null +++ b/manifests/internal/compatibility/common.pp @@ -0,0 +1,5 @@ +# == Class: jboss::internal::compatibility::common +# This is internal class to resolve common compatibility variables +class jboss::internal::compatibility::common { + $osfamily_down = downcase($::osfamily) +} diff --git a/manifests/internal/compatibility/eap.pp b/manifests/internal/compatibility/eap.pp new file mode 100644 index 0000000..351cf96 --- /dev/null +++ b/manifests/internal/compatibility/eap.pp @@ -0,0 +1,32 @@ +# == Class: jboss::internal::compatibility::eap +# This is internal class to resolve JBoss EAP compatibility +class jboss::internal::compatibility::eap { + include jboss + + if versioncmp($jboss::version, '6.0.0') < 0 or versioncmp($jboss::version, '8.0.0') >= 0 { + fail("Unsupported version ${jboss::product} ${jboss::version}. Supporting only: JBoss EAP 6.x and 7.x series") + } + + $systemd_file = undef + $systemd_launcher = undef + $initsystem = 'SystemV' + + $_eap_after7x = ( versioncmp($jboss::version, '7.0.0') >= 0 ) + if $_eap_after7x and $::osfamily != 'RedHat' { + fail("Jboss EAP 7.x is supported only on RHEL systems, but tried on ${::osfamily}!") + } + $initsystem = 'SystemV' + $product_short = 'jboss' + if $_eap_after7x { + # after EAP 7.x + $controller_port = '9990' + $initd_file = "${jboss::home}/bin/init.d/jboss-eap-rhel.sh" + } else { + # before EAP 7.x + $controller_port = '9999' + $initd_file = $jboss::runasdomain ? { + true => "${jboss::home}/bin/init.d/jboss-as-domain.sh", + default => "${jboss::home}/bin/init.d/jboss-as-standalone.sh", + } + } +} diff --git a/manifests/internal/compatibility/wildfly.pp b/manifests/internal/compatibility/wildfly.pp new file mode 100644 index 0000000..ff23919 --- /dev/null +++ b/manifests/internal/compatibility/wildfly.pp @@ -0,0 +1,61 @@ +# == Class: jboss::internal::compatibility::wildfly +# This is internal class to resolve Wildfly compatibility +class jboss::internal::compatibility::wildfly { + include jboss + include jboss::internal::compatibility::common + $_osfamily_down = $jboss::internal::compatibility::common::osfamily_down + + if versioncmp($jboss::version, '8.0.0') < 0 or versioncmp($jboss::version, '11.0.0') >= 0 { + fail("Unsupported version ${jboss::product} ${jboss::version}. Supporting only: Wildfly 8.x, 9.x and 10.x series") + } + $controller_port = '9990' + $product_short = 'wildfly' + + if versioncmp($jboss::version, '10.0.0') >= 0 { + # after WFly 10.x + $initd_file = "${jboss::home}/docs/contrib/scripts/init.d/wildfly-init-${_osfamily_down}.sh" + $systemd_file = "${jboss::home}/docs/contrib/scripts/systemd/wildfly.service" + $systemd_launcher = "${jboss::home}/docs/contrib/scripts/systemd/launch.sh" + case $::osfamily { + 'RedHat': { + case $::operatingsystem { + 'RedHat', 'CentOS', 'OracleLinux', 'Scientific', 'OEL': { + if (versioncmp($::operatingsystemrelease, '7.0') > 0) { + $initsystem = 'SystemD' + } else { + $initsystem = 'SystemV' + } + } + 'Fedora': { + if (versioncmp($::operatingsystemrelease, '21') > 0) { + $initsystem = 'SystemD' + } else { + $initsystem = 'SystemV' + } + } + default: { + fail("Unsupported OS: ${::operatingsystem}") + } + } + } + 'Debian': { + case $::lsbdistcodename { + 'lenny','squeeze','lucid','natty','wheezy','precise','quantal','raring','saucy','trusty','utopic' : { + $initsystem = 'SystemV' + } + 'jessie','vivid','wily','xenial': { + $initsystem = 'SystemD' + } + default: { fail("Unsupported release ${::lsbdistcodename}") } + } + } + default: { + fail("Unsupported OS family: ${::osfamily}. Supporting only RHEL and Debian systems. Consult README file.") + } + } + } else { + # for WFly 8.x, 9.x + $initsystem = 'SystemV' + $initd_file = "${jboss::home}/bin/init.d/wildfly-init-${_osfamily_down}.sh" + } +} diff --git a/manifests/internal/package.pp b/manifests/internal/package.pp index 8a0a867..69e9d20 100644 --- a/manifests/internal/package.pp +++ b/manifests/internal/package.pp @@ -119,9 +119,10 @@ require => Exec['jboss::unzip-downloaded'], } + $extract_testfile = 'bin/jboss-cli.sh' exec { 'jboss::test-extraction': - command => "echo '${jboss::home}/bin/init.d not found!' 1>&2 && exit 1", - unless => "test -d ${jboss::home}/bin/init.d", + command => "echo '${jboss::home}/${extract_testfile} not found!' 1>&2 && exit 1", + unless => "test -f ${jboss::home}/${extract_testfile}", require => Exec['jboss::move-unzipped'], } @@ -172,7 +173,7 @@ exec { 'jboss::package::check-for-java': command => 'echo "Please provide Java executable to system!" 1>&2 && exit 1', - unless => '[ `which java` ] && java -version 2>&1 | grep -q \'java version\'', + unless => '[ `which java` ] && java -version 2>&1 | grep -qE \'(jdk|jre|java) version\'', require => Anchor['jboss::installed'], before => Anchor['jboss::package::end'], } diff --git a/spec/acceptance/jboss/wildfly10_spec.rb b/spec/acceptance/jboss/wildfly10_spec.rb new file mode 100644 index 0000000..da02820 --- /dev/null +++ b/spec/acceptance/jboss/wildfly10_spec.rb @@ -0,0 +1,19 @@ +require 'spec_helper_acceptance' + +describe 'jboss::wildfly10 smoke test', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do + let(:pp) { Testing::Acceptance::SmokeTestReader.smoke_pp :'jboss::wildfly10' } + + it 'should add install WildFly 10 with no errors' do + apply_manifest(pp, :expect_changes => true, :trace => true) + end + it 'should work idempotently' do + apply_manifest(pp, :catch_changes => true, :trace => true) + end + describe service('wildfly') do + it { is_expected.to be_running } + end + after(:all) do + extend Testing::Acceptance::Cleaner + remove_jboss_installation('wildfly') + end +end From 8e62883665f542ffaf210a577a3dcf97b4ab364c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suszy=C5=84ski=20Krzysztof?= Date: Wed, 21 Sep 2016 16:29:58 +0200 Subject: [PATCH 05/21] Bump the version to next development v1.1.1 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index e3a1f69..667ff3e 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "coi/jboss", - "version": "1.1.0", + "version": "1.1.1.pre", "author": "Center of Information Technology COI.gov.pl", "summary": "Installs JBoss EAP and WildFly application servers and manage their resources and applications in either a domain or a stand-alone mode", "license": "Apache-2.0", From 4770cfd7d7e5fd9d9cb3e63b2251496ffd848f7c Mon Sep 17 00:00:00 2001 From: Karol Kozakowski Date: Thu, 22 Dec 2016 11:03:21 +0100 Subject: [PATCH 06/21] fix indentation errors --- examples/jboss/as7.pp | 4 ++-- manifests/internal/compatibility.pp | 3 +-- manifests/internal/compatibility/wildfly.pp | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/examples/jboss/as7.pp b/examples/jboss/as7.pp index c152372..b49bdeb 100644 --- a/examples/jboss/as7.pp +++ b/examples/jboss/as7.pp @@ -1,4 +1,4 @@ class { 'jboss': - product => 'jboss-as', - version => '7.1.1.Final', + product => 'jboss-as', + version => '7.1.1.Final', } diff --git a/manifests/internal/compatibility.pp b/manifests/internal/compatibility.pp index 6484d7c..c6068ed 100644 --- a/manifests/internal/compatibility.pp +++ b/manifests/internal/compatibility.pp @@ -29,7 +29,7 @@ } 'jboss-as': { include jboss::internal::compatibility::as - + $controller_port = $jboss::internal::compatibility::as::controller_port $product_short = $jboss::internal::compatibility::as::product_short $initd_file = $jboss::internal::compatibility::as::initd_file @@ -41,5 +41,4 @@ fail("Unsupported product ${jboss::product}. Supporting only: 'jboss-eap', 'jboss-as' and 'wildfly'") } } - } diff --git a/manifests/internal/compatibility/wildfly.pp b/manifests/internal/compatibility/wildfly.pp index ff23919..641497f 100644 --- a/manifests/internal/compatibility/wildfly.pp +++ b/manifests/internal/compatibility/wildfly.pp @@ -4,7 +4,7 @@ include jboss include jboss::internal::compatibility::common $_osfamily_down = $jboss::internal::compatibility::common::osfamily_down - + if versioncmp($jboss::version, '8.0.0') < 0 or versioncmp($jboss::version, '11.0.0') >= 0 { fail("Unsupported version ${jboss::product} ${jboss::version}. Supporting only: Wildfly 8.x, 9.x and 10.x series") } From b14e82a219724ed474a7415715b0e4c4374dbb89 Mon Sep 17 00:00:00 2001 From: Karol Kozakowski Date: Thu, 22 Dec 2016 11:38:27 +0100 Subject: [PATCH 07/21] pin beaker and beaker-rspec so dependencies can be installed --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index a533d30..a26c3f9 100644 --- a/Gemfile +++ b/Gemfile @@ -8,8 +8,8 @@ group :test do gem 'puppet-lint', :require => false gem 'metadata-json-lint', :require => false gem 'os', :require => false - gem 'beaker', :require => false - gem 'beaker-rspec', :require => false + gem 'beaker', '2.0.0', :require => false + gem 'beaker-rspec', '5.6.0', :require => false gem 'docker-api', :require => false gem 'coveralls', :require => false gem 'codeclimate-test-reporter', :require => false From 5e317290c33260fc4988d5ecde4d6a900e729071 Mon Sep 17 00:00:00 2001 From: Morga Cezary Date: Fri, 20 Jan 2017 11:14:32 +0100 Subject: [PATCH 08/21] Support for Wildfly 10 on RHEL 7 --- files/launch.sh | 13 +++++++++ manifests/internal/compatibility/wildfly.pp | 4 +-- manifests/internal/package.pp | 29 +++++++++++++++++---- templates/systemd/wildfly.service | 16 ++++++++++++ 4 files changed, 55 insertions(+), 7 deletions(-) create mode 100644 files/launch.sh create mode 100644 templates/systemd/wildfly.service diff --git a/files/launch.sh b/files/launch.sh new file mode 100644 index 0000000..f819c44 --- /dev/null +++ b/files/launch.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +. /etc/wildfly/wildfly.conf + +if [ "x$JBOSS_HOME" = "x" ]; then + JBOSS_HOME="/opt/wildfly" +fi + +if [[ "$1" == "domain" ]]; then + $JBOSS_HOME/bin/domain.sh -c $2 +else + $JBOSS_HOME/bin/standalone.sh -c $2 +fi diff --git a/manifests/internal/compatibility/wildfly.pp b/manifests/internal/compatibility/wildfly.pp index 641497f..b7fef1b 100644 --- a/manifests/internal/compatibility/wildfly.pp +++ b/manifests/internal/compatibility/wildfly.pp @@ -14,8 +14,8 @@ if versioncmp($jboss::version, '10.0.0') >= 0 { # after WFly 10.x $initd_file = "${jboss::home}/docs/contrib/scripts/init.d/wildfly-init-${_osfamily_down}.sh" - $systemd_file = "${jboss::home}/docs/contrib/scripts/systemd/wildfly.service" - $systemd_launcher = "${jboss::home}/docs/contrib/scripts/systemd/launch.sh" + $systemd_file = 'puppet:///modules/jboss/wildfly.service' + $systemd_launcher = 'puppet:///modules/jboss/launch.sh' case $::osfamily { 'RedHat': { case $::operatingsystem { diff --git a/manifests/internal/package.pp b/manifests/internal/package.pp index 69e9d20..2ec554c 100644 --- a/manifests/internal/package.pp +++ b/manifests/internal/package.pp @@ -156,11 +156,30 @@ require => Jboss::Internal::Util::Groupaccess[$jboss::home], } - file { "/etc/init.d/${product}": - ensure => 'link', - alias => 'jboss::service-link', - target => $jboss::internal::compatibility::initd_file, - require => Jboss::Internal::Util::Groupaccess[$jboss::home], + if $jboss::internal::compatibility::initsystem == 'SystemD' { + file { "${jboss::home}/bin/launch.sh": + ensure => 'file', + alias => 'jboss::systemd_launcher', + mode => '0755', + source => $jboss::internal::compatibility::systemd_launcher, + require => Jboss::Internal::Util::Groupaccess[$jboss::home], + } + file { "/etc/systemd/system/${product}.service": + ensure => 'file', + alias => 'jboss::service-link', + owner => 'root', + group => 'root', + mode => '0644', + content => template('jboss/systemd/wildfly.service'), + require => Jboss::Internal::Util::Groupaccess[$jboss::home], + } + } else { + file { "/etc/init.d/${product}": + ensure => 'link', + alias => 'jboss::service-link', + target => $jboss::internal::compatibility::initd_file, + require => Jboss::Internal::Util::Groupaccess[$jboss::home], + } } file { "/usr/bin/${jboss::internal::compatibility::product_short}-cli": diff --git a/templates/systemd/wildfly.service b/templates/systemd/wildfly.service new file mode 100644 index 0000000..322705d --- /dev/null +++ b/templates/systemd/wildfly.service @@ -0,0 +1,16 @@ +[Unit] +Description=The WildFly Application Server +After=syslog.target network.target +Before=httpd.service + +[Service] +Environment=LAUNCH_JBOSS_IN_BACKGROUND=1 +EnvironmentFile=-/etc/wildfly/wildfly.conf +User=<%= @jboss_user %> +LimitNOFILE=102642 +PIDFile=/var/run/wildfly/wildfly.pid +ExecStart=<%= @home %>/bin/launch.sh $JBOSS_MODE $JBOSS_CONFIG +StandardOutput=null + +[Install] +WantedBy=multi-user.target From ae772ef77c37f83e92a4612efda6c59afb6d5706 Mon Sep 17 00:00:00 2001 From: Morga Cezary Date: Fri, 20 Jan 2017 14:56:55 +0100 Subject: [PATCH 09/21] Support for Jboss EAP 7 on RHEL systems --- Gemfile | 3 +- manifests/internal/compatibility/eap.pp | 54 +++++++++++++++++---- manifests/internal/compatibility/wildfly.pp | 6 +-- manifests/internal/package.pp | 6 +-- {files => templates/systemd}/launch.sh | 4 +- templates/systemd/wildfly.service | 6 +-- 6 files changed, 58 insertions(+), 21 deletions(-) rename {files => templates/systemd}/launch.sh (66%) diff --git a/Gemfile b/Gemfile index a26c3f9..1781f06 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,7 @@ group :test do gem 'puppet-lint', :require => false gem 'metadata-json-lint', :require => false gem 'os', :require => false - gem 'beaker', '2.0.0', :require => false + gem 'beaker', '< 3.1.0', :require => false gem 'beaker-rspec', '5.6.0', :require => false gem 'docker-api', :require => false gem 'coveralls', :require => false @@ -22,6 +22,7 @@ group :test do gem 'puppet', '~> 3.0', :require => false gem 'ruby-augeas', :require => false gem 'augeas', :require => false + gem 'nokogiri', '~> 1.6.6.0', :require => false end group :development do diff --git a/manifests/internal/compatibility/eap.pp b/manifests/internal/compatibility/eap.pp index 351cf96..2383a90 100644 --- a/manifests/internal/compatibility/eap.pp +++ b/manifests/internal/compatibility/eap.pp @@ -7,24 +7,60 @@ fail("Unsupported version ${jboss::product} ${jboss::version}. Supporting only: JBoss EAP 6.x and 7.x series") } - $systemd_file = undef - $systemd_launcher = undef - $initsystem = 'SystemV' - $_eap_after7x = ( versioncmp($jboss::version, '7.0.0') >= 0 ) if $_eap_after7x and $::osfamily != 'RedHat' { fail("Jboss EAP 7.x is supported only on RHEL systems, but tried on ${::osfamily}!") } - $initsystem = 'SystemV' $product_short = 'jboss' + if $_eap_after7x { # after EAP 7.x - $controller_port = '9990' - $initd_file = "${jboss::home}/bin/init.d/jboss-eap-rhel.sh" + $controller_port = '9990' + $initd_file = "${jboss::home}/bin/init.d/jboss-eap-rhel.sh" + $systemd_file = 'jboss/systemd/wildfly.service' + $systemd_launcher = 'jboss/systemd/launch.sh' + case $::osfamily { + 'RedHat': { + case $::operatingsystem { + 'RedHat', 'CentOS', 'OracleLinux', 'Scientific', 'OEL': { + if (versioncmp($::operatingsystemrelease, '7.0') > 0) { + $initsystem = 'SystemD' + } else { + $initsystem = 'SystemV' + } + } + 'Fedora': { + if (versioncmp($::operatingsystemrelease, '21') > 0) { + $initsystem = 'SystemD' + } else { + $initsystem = 'SystemV' + } + } + default: { + fail("Unsupported OS: ${::operatingsystem}") + } + } + } + 'Debian': { + case $::lsbdistcodename { + 'lenny','squeeze','lucid','natty','wheezy','precise','quantal','raring','saucy','trusty','utopic' : { + $initsystem = 'SystemV' + } + 'jessie','vivid','wily','xenial': { + $initsystem = 'SystemD' + } + default: { fail("Unsupported release ${::lsbdistcodename}") } + } + } + default: { + fail("Unsupported OS family: ${::osfamily}. Supporting only RHEL and Debian systems. Consult README file.") + } + } } else { # before EAP 7.x - $controller_port = '9999' - $initd_file = $jboss::runasdomain ? { + $controller_port = '9999' + $initsystem = 'SystemV' + $initd_file = $jboss::runasdomain ? { true => "${jboss::home}/bin/init.d/jboss-as-domain.sh", default => "${jboss::home}/bin/init.d/jboss-as-standalone.sh", } diff --git a/manifests/internal/compatibility/wildfly.pp b/manifests/internal/compatibility/wildfly.pp index b7fef1b..391a947 100644 --- a/manifests/internal/compatibility/wildfly.pp +++ b/manifests/internal/compatibility/wildfly.pp @@ -13,9 +13,9 @@ if versioncmp($jboss::version, '10.0.0') >= 0 { # after WFly 10.x - $initd_file = "${jboss::home}/docs/contrib/scripts/init.d/wildfly-init-${_osfamily_down}.sh" - $systemd_file = 'puppet:///modules/jboss/wildfly.service' - $systemd_launcher = 'puppet:///modules/jboss/launch.sh' + $initd_file = "${jboss::home}/docs/contrib/scripts/init.d/wildfly-init-${_osfamily_down}.sh" + $systemd_file = 'jboss/systemd/wildfly.service' + $systemd_launcher = 'jboss/systemd/launch.sh' case $::osfamily { 'RedHat': { case $::operatingsystem { diff --git a/manifests/internal/package.pp b/manifests/internal/package.pp index 2ec554c..8752f89 100644 --- a/manifests/internal/package.pp +++ b/manifests/internal/package.pp @@ -26,7 +26,7 @@ $standaloneconfigfile = $jboss::internal::runtime::standaloneconfigfile case $version { - /^[0-9]+\.[0-9]+\.[0-9]+[\._-][0-9a-zA-Z_-]+$/: { + /^[0-9]+\.[0-9]+\.[0-9]+([\._-]*[0-9a-zA-Z_-]+)?$/: { debug("Running in version: ${1} -> ${version}") } default: { @@ -161,7 +161,7 @@ ensure => 'file', alias => 'jboss::systemd_launcher', mode => '0755', - source => $jboss::internal::compatibility::systemd_launcher, + content => template($jboss::internal::compatibility::systemd_launcher), require => Jboss::Internal::Util::Groupaccess[$jboss::home], } file { "/etc/systemd/system/${product}.service": @@ -170,7 +170,7 @@ owner => 'root', group => 'root', mode => '0644', - content => template('jboss/systemd/wildfly.service'), + content => template($jboss::internal::compatibility::systemd_file), require => Jboss::Internal::Util::Groupaccess[$jboss::home], } } else { diff --git a/files/launch.sh b/templates/systemd/launch.sh similarity index 66% rename from files/launch.sh rename to templates/systemd/launch.sh index f819c44..40242be 100644 --- a/files/launch.sh +++ b/templates/systemd/launch.sh @@ -1,9 +1,9 @@ #!/bin/sh -. /etc/wildfly/wildfly.conf +. /etc/<%= @product %>/<%= @product %>.conf if [ "x$JBOSS_HOME" = "x" ]; then - JBOSS_HOME="/opt/wildfly" + JBOSS_HOME="/opt/<%= @product %>" fi if [[ "$1" == "domain" ]]; then diff --git a/templates/systemd/wildfly.service b/templates/systemd/wildfly.service index 322705d..bf13fa2 100644 --- a/templates/systemd/wildfly.service +++ b/templates/systemd/wildfly.service @@ -1,14 +1,14 @@ [Unit] -Description=The WildFly Application Server +Description=The <%= @product %> Application Server After=syslog.target network.target Before=httpd.service [Service] Environment=LAUNCH_JBOSS_IN_BACKGROUND=1 -EnvironmentFile=-/etc/wildfly/wildfly.conf +EnvironmentFile=-/etc/<%= @product %>/<%= @product %>.conf User=<%= @jboss_user %> LimitNOFILE=102642 -PIDFile=/var/run/wildfly/wildfly.pid +PIDFile=/var/run/<%= @product %>/<%= @product %>.pid ExecStart=<%= @home %>/bin/launch.sh $JBOSS_MODE $JBOSS_CONFIG StandardOutput=null From ed5ab57a324f08aeae1421df082dac37b5ab6820 Mon Sep 17 00:00:00 2001 From: Morga Cezary Date: Fri, 20 Jan 2017 15:02:35 +0100 Subject: [PATCH 10/21] Jboss EAP 7 is also supported on Debian-like systems --- manifests/internal/compatibility/eap.pp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/manifests/internal/compatibility/eap.pp b/manifests/internal/compatibility/eap.pp index 2383a90..2d7fe53 100644 --- a/manifests/internal/compatibility/eap.pp +++ b/manifests/internal/compatibility/eap.pp @@ -7,13 +7,9 @@ fail("Unsupported version ${jboss::product} ${jboss::version}. Supporting only: JBoss EAP 6.x and 7.x series") } - $_eap_after7x = ( versioncmp($jboss::version, '7.0.0') >= 0 ) - if $_eap_after7x and $::osfamily != 'RedHat' { - fail("Jboss EAP 7.x is supported only on RHEL systems, but tried on ${::osfamily}!") - } $product_short = 'jboss' - if $_eap_after7x { + if versioncmp($jboss::version, '7.0.0') >= 0 { # after EAP 7.x $controller_port = '9990' $initd_file = "${jboss::home}/bin/init.d/jboss-eap-rhel.sh" From 4f7bf66d4ad0b9a831856c710654d98409efb03a Mon Sep 17 00:00:00 2001 From: Morga Cezary Date: Fri, 20 Jan 2017 15:18:46 +0100 Subject: [PATCH 11/21] Fix ShellExecutor test due to random way the tests are performed --- spec/unit/internal/jboss_systemexec_spec.rb | 34 +++++++-------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/spec/unit/internal/jboss_systemexec_spec.rb b/spec/unit/internal/jboss_systemexec_spec.rb index 1f8b822..bd2314d 100644 --- a/spec/unit/internal/jboss_systemexec_spec.rb +++ b/spec/unit/internal/jboss_systemexec_spec.rb @@ -2,32 +2,20 @@ require 'os' describe Puppet_X::Coi::Jboss::Internal::Executor::ShellExecutor do - describe '#run_command' do + describe 'with correct command' do let(:instance) { described_class.new } - subject { instance.run_command(cmd) } + let(:execution) { instance.run_command(cmd) } + let(:status) { instance.child_status } - context 'with correct command' do - if OS.windows? - let(:cmd) { 'dir' } - it { expect { subject }.to_not raise_error } - elsif OS.osx? - let(:cmd) { 'ls' } - it { expect { subject }.to_not raise_error } - elsif OS.linux? - let(:cmd) { 'ls' } - it { expect { subject }.to_not raise_error } - end + if OS.windows? + let(:cmd) { 'dir' } + elsif OS.osx? + let(:cmd) { 'ls' } + elsif OS.linux? + let(:cmd) { 'ls' } end - end - - describe '#child_status' do - before :each do - instance.instance_variable_set(:@result, 'mocked result') - end - - let(:instance) { described_class.new } - subject { instance.child_status } - it { expect(subject).to be_truthy } + it { expect { execution }.to_not raise_error } + it { expect(status).to be_truthy } end end From ca7d1db961fdcb2396b0f2264ccb6142f0282c69 Mon Sep 17 00:00:00 2001 From: Morga Cezary Date: Mon, 23 Jan 2017 12:19:14 +0100 Subject: [PATCH 12/21] Acceptance tests for Wildfly 10 --- spec/acceptance/jboss/wildfly10_spec.rb | 34 ++++++++++++++++--------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/spec/acceptance/jboss/wildfly10_spec.rb b/spec/acceptance/jboss/wildfly10_spec.rb index da02820..f996139 100644 --- a/spec/acceptance/jboss/wildfly10_spec.rb +++ b/spec/acceptance/jboss/wildfly10_spec.rb @@ -1,19 +1,29 @@ require 'spec_helper_acceptance' describe 'jboss::wildfly10 smoke test', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do - let(:pp) { Testing::Acceptance::SmokeTestReader.smoke_pp :'jboss::wildfly10' } + shared_examples 'a properly working class on a platform with supported Java version' do + let(:pp) { Testing::Acceptance::SmokeTestReader.smoke_pp :'jboss::wildfly10' } - it 'should add install WildFly 10 with no errors' do - apply_manifest(pp, :expect_changes => true, :trace => true) + it 'should install WildFly 10 with no errors' do + apply_manifest(pp, :expect_changes => true, :trace => true) + end + it 'should work idempotently' do + apply_manifest(pp, :catch_changes => true, :trace => true) + end + describe service('wildfly') do + it { is_expected.to be_running } + end + after(:all) do + extend Testing::Acceptance::Cleaner + remove_jboss_installation('wildfly') + end end - it 'should work idempotently' do - apply_manifest(pp, :catch_changes => true, :trace => true) - end - describe service('wildfly') do - it { is_expected.to be_running } - end - after(:all) do - extend Testing::Acceptance::Cleaner - remove_jboss_installation('wildfly') + + if (fact('osfamily') == 'RedHat' && fact('operatingsystemmajrelease') >= '7') + it_behaves_like 'a properly working class on a platform with supported Java version' + elsif (fact('operatingsystem') == 'Debian' && fact('operatingsystemmajrelease') >= '8' ) + it_behaves_like 'a properly working class on a platform with supported Java version' + elsif (fact('operatingsystem') == 'Ubuntu' && fact('operatingsystemmajrelease') >= '15.10' ) + it_behaves_like 'a properly working class on a platform with supported Java version' end end From 123a4eaeaedc391190cd0e35a30dfc0861b0ed1c Mon Sep 17 00:00:00 2001 From: Morga Cezary Date: Mon, 23 Jan 2017 12:35:31 +0100 Subject: [PATCH 13/21] Warn about probable wrong Java version on some OSes --- manifests/internal/compatibility/wildfly.pp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/manifests/internal/compatibility/wildfly.pp b/manifests/internal/compatibility/wildfly.pp index 391a947..cf09683 100644 --- a/manifests/internal/compatibility/wildfly.pp +++ b/manifests/internal/compatibility/wildfly.pp @@ -24,6 +24,10 @@ $initsystem = 'SystemD' } else { $initsystem = 'SystemV' + $versioned_name = "${::operatingsystem} ${::operatingsystemrelease}" + if jboss_to_bool($jboss::java_autoinstall) { + warning("Wildfly 10 requires Java 8 or greater, which is not suppoted by default on ${versioned_name}.") + } } } 'Fedora': { @@ -31,6 +35,10 @@ $initsystem = 'SystemD' } else { $initsystem = 'SystemV' + $versioned_name = "${::operatingsystem} ${::operatingsystemrelease}" + if jboss_to_bool($jboss::java_autoinstall) { + warning("Wildfly 10 requires Java 8 or greater, which is not suppoted by default on ${versioned_name}.") + } } } default: { @@ -45,6 +53,10 @@ } 'jessie','vivid','wily','xenial': { $initsystem = 'SystemD' + $versioned_name = "${::operatingsystem} ${::operatingsystemrelease}" + if jboss_to_bool($jboss::java_autoinstall) { + warning("Wildfly 10 requires Java 8 or greater, which is not suppoted by default on ${versioned_name}.") + } } default: { fail("Unsupported release ${::lsbdistcodename}") } } From 4cf43b59fc27d06aebff06d7e46e6491d7ef3fe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suszy=C5=84ski=20Krzysztof?= Date: Wed, 25 Jan 2017 13:34:41 +0100 Subject: [PATCH 14/21] Fixing issues with test execution order --- .../coi/jboss/internal/executor/shell_executor.rb | 4 +++- spec/unit/internal/jboss_systemexec_spec.rb | 14 +++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/puppet_x/coi/jboss/internal/executor/shell_executor.rb b/lib/puppet_x/coi/jboss/internal/executor/shell_executor.rb index aad3bc9..e67622e 100644 --- a/lib/puppet_x/coi/jboss/internal/executor/shell_executor.rb +++ b/lib/puppet_x/coi/jboss/internal/executor/shell_executor.rb @@ -1,3 +1,5 @@ +require 'English' + # Class that handles shell command execution class Puppet_X::Coi::Jboss::Internal::Executor::ShellExecutor # Method that executes method by real system command execution @@ -9,6 +11,6 @@ def run_command(cmd) # Method to check return code from last command that was executed # @return {Process::Status} result of last command def child_status - $? + $CHILD_STATUS end end diff --git a/spec/unit/internal/jboss_systemexec_spec.rb b/spec/unit/internal/jboss_systemexec_spec.rb index bd2314d..21dc183 100644 --- a/spec/unit/internal/jboss_systemexec_spec.rb +++ b/spec/unit/internal/jboss_systemexec_spec.rb @@ -5,7 +5,10 @@ describe 'with correct command' do let(:instance) { described_class.new } let(:execution) { instance.run_command(cmd) } - let(:status) { instance.child_status } + let(:status) do + execution + instance.child_status + end if OS.windows? let(:cmd) { 'dir' } @@ -15,7 +18,12 @@ let(:cmd) { 'ls' } end - it { expect { execution }.to_not raise_error } - it { expect(status).to be_truthy } + describe 'execution' do + it { expect { execution }.to_not raise_error } + end + describe 'child process status' do + it { expect(status).not_to be_nil } + it { expect(status.success?).to be_truthy } + end end end From 15893b69bc5731b62be1877a0a1ebd10bd4a2cb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suszy=C5=84ski=20Krzysztof?= Date: Wed, 25 Jan 2017 13:34:56 +0100 Subject: [PATCH 15/21] Fix issues with pinned versions Due to Ruby libs dropping support for Ruby <= 2.1 --- Gemfile | 5 +++-- gemfiles/Gemfile18.facter16 | 1 + gemfiles/Gemfile18.facter16.lock | 5 ++--- gemfiles/Gemfile18.facter17 | 2 +- gemfiles/Gemfile18.facter17.lock | 5 ++--- gemfiles/Gemfile19 | 1 + gemfiles/Gemfile19.lock | 4 +--- 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Gemfile b/Gemfile index 1781f06..ee7d2ba 100644 --- a/Gemfile +++ b/Gemfile @@ -8,8 +8,10 @@ group :test do gem 'puppet-lint', :require => false gem 'metadata-json-lint', :require => false gem 'os', :require => false + # TODO: Pinned because beaker is supported only MRI >=2.2, remove this + # explicitly pinned version by the time ticket gh-org/puppet-jboss#96 is closed. gem 'beaker', '< 3.1.0', :require => false - gem 'beaker-rspec', '5.6.0', :require => false + gem 'beaker-rspec', '< 6.0.0', :require => false gem 'docker-api', :require => false gem 'coveralls', :require => false gem 'codeclimate-test-reporter', :require => false @@ -22,7 +24,6 @@ group :test do gem 'puppet', '~> 3.0', :require => false gem 'ruby-augeas', :require => false gem 'augeas', :require => false - gem 'nokogiri', '~> 1.6.6.0', :require => false end group :development do diff --git a/gemfiles/Gemfile18.facter16 b/gemfiles/Gemfile18.facter16 index 450e002..fa1c622 100644 --- a/gemfiles/Gemfile18.facter16 +++ b/gemfiles/Gemfile18.facter16 @@ -25,6 +25,7 @@ group :test do gem 'ruby-augeas', :require => false gem 'augeas', :require => false + gem 'nokogiri', '~> 1.5.11', :require => false end group :development do diff --git a/gemfiles/Gemfile18.facter16.lock b/gemfiles/Gemfile18.facter16.lock index 8ab2206..f461452 100644 --- a/gemfiles/Gemfile18.facter16.lock +++ b/gemfiles/Gemfile18.facter16.lock @@ -27,6 +27,7 @@ GEM net-ssh (>= 2.6.5) net-ssh (2.9.4) net-telnet (0.1.1) + nokogiri (1.5.11) os (0.9.6) pry (0.9.12.6) coderay (~> 1.0) @@ -89,6 +90,7 @@ DEPENDENCIES json_pure (= 1.8.3) metadata-json-lint net-ssh (= 2.9.4) + nokogiri (~> 1.5.11) os pry (~> 0.9.12.0) puppet (~> 2.7.0) @@ -102,6 +104,3 @@ DEPENDENCIES specinfra (= 2.59.0) tins (~> 1.6.0) vagrant-wrapper - -BUNDLED WITH - 1.12.5 diff --git a/gemfiles/Gemfile18.facter17 b/gemfiles/Gemfile18.facter17 index 2c915b0..49b8f6e 100644 --- a/gemfiles/Gemfile18.facter17 +++ b/gemfiles/Gemfile18.facter17 @@ -20,12 +20,12 @@ group :test do gem 'tins', '~> 1.6.0', :require => false gem 'facter', '1.7.0', :require => false - gem 'puppet', '~> 2.7.0', :require => false gem 'hiera-puppet', :require => false gem 'ruby-augeas', :require => false gem 'augeas', :require => false + gem 'nokogiri', '~> 1.5.11', :require => false end group :development do diff --git a/gemfiles/Gemfile18.facter17.lock b/gemfiles/Gemfile18.facter17.lock index 10ae30f..01d9b63 100644 --- a/gemfiles/Gemfile18.facter17.lock +++ b/gemfiles/Gemfile18.facter17.lock @@ -27,6 +27,7 @@ GEM net-ssh (>= 2.6.5) net-ssh (2.9.4) net-telnet (0.1.1) + nokogiri (1.5.11) os (0.9.6) pry (0.9.12.6) coderay (~> 1.0) @@ -89,6 +90,7 @@ DEPENDENCIES json_pure (= 1.8.3) metadata-json-lint net-ssh (= 2.9.4) + nokogiri (~> 1.5.11) os pry (~> 0.9.12.0) puppet (~> 2.7.0) @@ -102,6 +104,3 @@ DEPENDENCIES specinfra (= 2.59.0) tins (~> 1.6.0) vagrant-wrapper - -BUNDLED WITH - 1.12.5 diff --git a/gemfiles/Gemfile19 b/gemfiles/Gemfile19 index ecbf425..75e9b01 100644 --- a/gemfiles/Gemfile19 +++ b/gemfiles/Gemfile19 @@ -32,6 +32,7 @@ group :test do gem 'ruby-augeas', :require => false gem 'augeas', :require => false + gem 'nokogiri', '~> 1.6.8', :require => false end group :development do diff --git a/gemfiles/Gemfile19.lock b/gemfiles/Gemfile19.lock index ebf4f3d..83da4e3 100644 --- a/gemfiles/Gemfile19.lock +++ b/gemfiles/Gemfile19.lock @@ -378,6 +378,7 @@ DEPENDENCIES metadata-json-lint mime-types (= 2.99.2) net-ssh (= 2.9.4) + nokogiri (~> 1.6.8) os pry-debugger puppet (~> 3.0) @@ -393,6 +394,3 @@ DEPENDENCIES tins (~> 1.6.0) travis vagrant-wrapper - -BUNDLED WITH - 1.12.5 From db3df9cd6a1af8d7f2e3d32b3c6f49df61e8749e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suszy=C5=84ski=20Krzysztof?= Date: Wed, 25 Jan 2017 13:36:05 +0100 Subject: [PATCH 16/21] Deprecated MultiFormatter creation removal --- spec/spec_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 5b1ca18..2cf1111 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -23,7 +23,7 @@ rescue Gem::LoadError # do nothing end - SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[*formatters] + SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(formatters) SimpleCov.start do add_filter "/spec/" add_filter "/.vendor/" From ee884045037cc3103abbcc7c0e0edb4ee70a392c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suszy=C5=84ski=20Krzysztof?= Date: Wed, 25 Jan 2017 13:55:15 +0100 Subject: [PATCH 17/21] Fixes to Gemfiles for MRI 2.0 and beaker --- .travis.yml | 1 + Gemfile | 2 +- gemfiles/Gemfile20 | 38 ++++ gemfiles/Gemfile20.lock | 402 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 442 insertions(+), 1 deletion(-) create mode 100644 gemfiles/Gemfile20 create mode 100644 gemfiles/Gemfile20.lock diff --git a/.travis.yml b/.travis.yml index 5742408..e810ad8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,7 @@ matrix: bundler_args: "--without development --jobs=3 --retry=3 --path=${BUNDLE_PATH:-../vendor/bundle}" - rvm: '2.0' env: PUPPET_VERSION="~> 3.0" + gemfile: gemfiles/Gemfile20 - rvm: '2.1' env: PUPPET_VERSION="~> 3.0" - rvm: '2.1' diff --git a/Gemfile b/Gemfile index ee7d2ba..c030d48 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,7 @@ group :test do # TODO: Pinned because beaker is supported only MRI >=2.2, remove this # explicitly pinned version by the time ticket gh-org/puppet-jboss#96 is closed. gem 'beaker', '< 3.1.0', :require => false - gem 'beaker-rspec', '< 6.0.0', :require => false + gem 'beaker-rspec', '~> 5.6.0', :require => false gem 'docker-api', :require => false gem 'coveralls', :require => false gem 'codeclimate-test-reporter', :require => false diff --git a/gemfiles/Gemfile20 b/gemfiles/Gemfile20 new file mode 100644 index 0000000..1e36678 --- /dev/null +++ b/gemfiles/Gemfile20 @@ -0,0 +1,38 @@ +source ENV['GEM_SOURCE'] || 'https://rubygems.org' + +group :test do + gem 'rake', :require => false unless dependencies.map {|dep| dep.name}.include?('rake') + # TODO: Remove this explicitly pinned version by the time ticket gh-org/puppet-jboss#84 is closed. + gem 'rspec-puppet', '2.3.2', :require => false + gem 'puppetlabs_spec_helper', :require => false + gem 'puppet-lint', :require => false + gem 'metadata-json-lint', :require => false + gem 'os', :require => false + # TODO: Pinned because beaker is supported only MRI >=2.2, remove this + # explicitly pinned version by the time ticket gh-org/puppet-jboss#96 is closed. + gem 'beaker', '< 3.1.0', :require => false + gem 'beaker-rspec', '< 6.0.0', :require => false + gem 'docker-api', :require => false + gem 'coveralls', :require => false + gem 'codeclimate-test-reporter', :require => false + gem 'simplecov', :require => false + if facterver = ENV['FACTER_VERSION'] + gem 'facter', facterver, :require => false + else + gem 'facter', :require => false + end + gem 'puppet', '~> 3.0', :require => false + gem 'ruby-augeas', :require => false + gem 'augeas', :require => false + gem 'nokogiri', '~> 1.6.8', :require => false +end + +group :development do + gem 'inch', :require => false + gem 'vagrant-wrapper', :require => false + gem 'travis', :require => false + gem 'puppet-blacksmith', :require => false + gem 'pry-byebug', :require => false +end + +# vim:ft=ruby diff --git a/gemfiles/Gemfile20.lock b/gemfiles/Gemfile20.lock new file mode 100644 index 0000000..0d9a03b --- /dev/null +++ b/gemfiles/Gemfile20.lock @@ -0,0 +1,402 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (2.3.4) + addressable (2.4.0) + augeas (0.6.4) + aws-sdk-v1 (1.66.0) + json (~> 1.4) + nokogiri (>= 1.4.4) + backports (3.6.8) + beaker (2.52.0) + aws-sdk-v1 (~> 1.57) + beaker-answers (~> 0.0) + beaker-hiera (~> 0.0) + beaker-hostgenerator + beaker-pe (~> 0.0) + docker-api + fission (~> 0.4) + fog (~> 1.25, < 1.35.0) + fog-google (~> 0.0.9) + google-api-client (~> 0.8, < 0.9.5) + hocon (~> 1.0) + in-parallel (~> 0.1) + inifile (~> 2.0) + json (~> 1.8) + mime-types (~> 2.99) + minitest (~> 5.4) + net-scp (~> 1.2) + net-ssh (~> 2.9) + open_uri_redirections (~> 0.2.1) + public_suffix (< 1.5.0) + rbvmomi (~> 1.8, < 1.9.0) + rsync (~> 1.0.9) + stringify-hash (~> 0.0) + unf (~> 0.1) + beaker-answers (0.14.0) + hocon (~> 1.0) + require_all (~> 1.3.2) + stringify-hash (~> 0.0.0) + beaker-hiera (0.1.1) + stringify-hash (~> 0.0.0) + beaker-hostgenerator (0.8.2) + deep_merge (~> 1.0) + stringify-hash (~> 0.0.0) + beaker-pe (0.12.1) + stringify-hash (~> 0.0.0) + beaker-rspec (5.6.0) + beaker (~> 2.0) + rspec + serverspec (~> 2) + specinfra (~> 2) + builder (3.2.3) + byebug (9.0.6) + codeclimate-test-reporter (1.0.5) + simplecov + coderay (1.1.1) + coveralls (0.8.19) + json (>= 1.8, < 3) + simplecov (~> 0.12.0) + term-ansicolor (~> 1.3) + thor (~> 0.19.1) + tins (~> 1.6) + deep_merge (1.1.1) + diff-lcs (1.3) + docile (1.1.5) + docker-api (1.33.1) + excon (>= 0.38.0) + json + domain_name (0.5.20161129) + unf (>= 0.0.5, < 1.0.0) + ethon (0.10.1) + ffi (>= 1.3.0) + excon (0.54.0) + facter (2.4.6) + faraday (0.11.0) + multipart-post (>= 1.2, < 3) + faraday_middleware (0.11.0.1) + faraday (>= 0.7.4, < 1.0) + fast_gettext (1.1.0) + ffi (1.9.17) + fission (0.5.0) + CFPropertyList (~> 2.2) + fog (1.34.0) + fog-atmos + fog-aws (>= 0.6.0) + fog-brightbox (~> 0.4) + fog-core (~> 1.32) + fog-dynect (~> 0.0.2) + fog-ecloud (~> 0.1) + fog-google (>= 0.0.2) + fog-json + fog-local + fog-powerdns (>= 0.1.1) + fog-profitbricks + fog-radosgw (>= 0.0.2) + fog-riakcs + fog-sakuracloud (>= 0.0.4) + fog-serverlove + fog-softlayer + fog-storm_on_demand + fog-terremark + fog-vmfusion + fog-voxel + fog-xml (~> 0.1.1) + ipaddress (~> 0.5) + nokogiri (~> 1.5, >= 1.5.11) + fog-atmos (0.1.0) + fog-core + fog-xml + fog-aws (1.2.0) + fog-core (~> 1.38) + fog-json (~> 1.0) + fog-xml (~> 0.1) + ipaddress (~> 0.8) + fog-brightbox (0.11.0) + fog-core (~> 1.22) + fog-json + inflecto (~> 0.0.2) + fog-core (1.43.0) + builder + excon (~> 0.49) + formatador (~> 0.2) + fog-dynect (0.0.3) + fog-core + fog-json + fog-xml + fog-ecloud (0.3.0) + fog-core + fog-xml + fog-google (0.0.9) + fog-core + fog-json + fog-xml + fog-json (1.0.2) + fog-core (~> 1.0) + multi_json (~> 1.10) + fog-local (0.3.1) + fog-core (~> 1.27) + fog-powerdns (0.1.1) + fog-core (~> 1.27) + fog-json (~> 1.0) + fog-xml (~> 0.1) + fog-profitbricks (3.0.0) + fog-core (~> 1.42) + fog-json (~> 1.0) + fog-radosgw (0.0.5) + fog-core (>= 1.21.0) + fog-json + fog-xml (>= 0.0.1) + fog-riakcs (0.1.0) + fog-core + fog-json + fog-xml + fog-sakuracloud (1.7.5) + fog-core + fog-json + fog-serverlove (0.1.2) + fog-core + fog-json + fog-softlayer (1.1.4) + fog-core + fog-json + fog-storm_on_demand (0.1.1) + fog-core + fog-json + fog-terremark (0.1.0) + fog-core + fog-xml + fog-vmfusion (0.1.0) + fission + fog-core + fog-voxel (0.1.0) + fog-core + fog-xml + fog-xml (0.1.2) + fog-core + nokogiri (~> 1.5, >= 1.5.11) + formatador (0.2.5) + gettext (3.2.2) + locale (>= 2.0.5) + text (>= 1.3.0) + gettext-setup (0.13) + fast_gettext (~> 1.1.0) + gettext (>= 3.0.2) + locale + gh (0.15.0) + addressable (~> 2.4.0) + backports + faraday (~> 0.8) + multi_json (~> 1.0) + net-http-persistent (~> 2.9) + net-http-pipeline + google-api-client (0.9.4) + addressable (~> 2.3) + googleauth (~> 0.5) + httpclient (~> 2.7) + hurley (~> 0.1) + memoist (~> 0.11) + mime-types (>= 1.6) + representable (~> 2.3.0) + retriable (~> 2.0) + thor (~> 0.19) + googleauth (0.5.1) + faraday (~> 0.9) + jwt (~> 1.4) + logging (~> 2.0) + memoist (~> 0.12) + multi_json (~> 1.11) + os (~> 0.9) + signet (~> 0.7) + hiera (1.3.4) + json_pure + highline (1.7.8) + hocon (1.2.4) + http-cookie (1.0.3) + domain_name (~> 0.5) + httpclient (2.8.3) + hurley (0.2) + in-parallel (0.1.15) + inch (0.7.1) + pry + sparkr (>= 0.2.0) + term-ansicolor + yard (~> 0.8.7.5) + inflecto (0.0.2) + inifile (2.0.2) + ipaddress (0.8.3) + json (1.8.6) + json_pure (2.0.3) + jwt (1.5.6) + launchy (2.4.3) + addressable (~> 2.3) + little-plugger (1.1.4) + locale (2.1.2) + logging (2.1.0) + little-plugger (~> 1.1) + multi_json (~> 1.10) + memoist (0.15.0) + metaclass (0.0.4) + metadata-json-lint (1.0.0) + json + semantic_puppet (>= 0.1.2, < 2.0.0) + spdx-licenses (~> 1.0) + method_source (0.8.2) + mime-types (2.99.3) + mini_portile2 (2.1.0) + minitest (5.10.1) + mocha (1.2.1) + metaclass (~> 0.0.1) + multi_json (1.12.1) + multipart-post (2.0.0) + net-http-persistent (2.9.4) + net-http-pipeline (1.0.1) + net-scp (1.2.1) + net-ssh (>= 2.6.5) + net-ssh (2.9.4) + net-telnet (0.1.1) + netrc (0.11.0) + nokogiri (1.6.8.1) + mini_portile2 (~> 2.1.0) + open_uri_redirections (0.2.1) + os (0.9.6) + pry (0.10.4) + coderay (~> 1.1.0) + method_source (~> 0.8.1) + slop (~> 3.4) + pry-byebug (3.4.2) + byebug (~> 9.0) + pry (~> 0.10) + public_suffix (1.4.6) + puppet (3.8.7) + facter (> 1.6, < 3) + hiera (~> 1.0) + json_pure + puppet-blacksmith (3.4.0) + puppet (>= 2.7.16) + rest-client (~> 1.8.0) + puppet-lint (2.1.0) + puppet-syntax (2.2.0) + rake + puppetlabs_spec_helper (1.2.2) + mocha (~> 1.0) + puppet-lint (~> 2.0) + puppet-syntax (~> 2.0) + rspec-puppet (~> 2.0) + pusher-client (0.6.2) + json + websocket (~> 1.0) + rake (12.0.0) + rbvmomi (1.8.2) + builder + nokogiri (>= 1.4.1) + trollop + representable (2.3.0) + uber (~> 0.0.7) + require_all (1.3.3) + rest-client (1.8.0) + http-cookie (>= 1.0.2, < 2.0) + mime-types (>= 1.16, < 3.0) + netrc (~> 0.7) + retriable (2.1.0) + rspec (3.5.0) + rspec-core (~> 3.5.0) + rspec-expectations (~> 3.5.0) + rspec-mocks (~> 3.5.0) + rspec-core (3.5.4) + rspec-support (~> 3.5.0) + rspec-expectations (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-its (1.2.0) + rspec-core (>= 3.0.0) + rspec-expectations (>= 3.0.0) + rspec-mocks (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-puppet (2.3.2) + rspec + rspec-support (3.5.0) + rsync (1.0.9) + ruby-augeas (0.5.0) + semantic_puppet (0.1.4) + gettext-setup (>= 0.3) + serverspec (2.38.0) + multi_json + rspec (~> 3.0) + rspec-its + specinfra (~> 2.53) + sfl (2.3) + signet (0.7.3) + addressable (~> 2.3) + faraday (~> 0.9) + jwt (~> 1.5) + multi_json (~> 1.10) + simplecov (0.12.0) + docile (~> 1.1.0) + json (>= 1.8, < 3) + simplecov-html (~> 0.10.0) + simplecov-html (0.10.0) + slop (3.6.0) + sparkr (0.4.1) + spdx-licenses (1.1.0) + specinfra (2.66.5) + net-scp + net-ssh (>= 2.7, < 5.0) + net-telnet + sfl + stringify-hash (0.0.2) + term-ansicolor (1.4.0) + tins (~> 1.0) + text (1.3.1) + thor (0.19.4) + tins (1.13.0) + travis (1.8.5) + backports + faraday (~> 0.9) + faraday_middleware (~> 0.9, >= 0.9.1) + gh (~> 0.13) + highline (~> 1.6) + launchy (~> 2.1) + pusher-client (~> 0.4) + typhoeus (~> 0.6, >= 0.6.8) + trollop (2.1.2) + typhoeus (0.8.0) + ethon (>= 0.8.0) + uber (0.0.15) + unf (0.1.4) + unf_ext + unf_ext (0.0.7.2) + vagrant-wrapper (2.0.3) + websocket (1.2.3) + yard (0.8.7.6) + +PLATFORMS + ruby + +DEPENDENCIES + augeas + beaker (< 3.1.0) + beaker-rspec (< 6.0.0) + codeclimate-test-reporter + coveralls + docker-api + facter + inch + metadata-json-lint + nokogiri (~> 1.6.8) + os + pry-byebug + puppet (~> 3.0) + puppet-blacksmith + puppet-lint + puppetlabs_spec_helper + rake + rspec-puppet (= 2.3.2) + ruby-augeas + simplecov + travis + vagrant-wrapper + +BUNDLED WITH + 1.14.3 From ab2ff567fd8fda8bf38ff99d91ef7537401feedd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suszy=C5=84ski=20Krzysztof?= Date: Wed, 25 Jan 2017 14:38:12 +0100 Subject: [PATCH 18/21] Bundler Args for MRI 2.0, Puppet version 3.8.7 for beaker --- .travis.yml | 7 ++++--- spec/spec_helper_acceptance.rb | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index e810ad8..7161065 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,6 +33,7 @@ matrix: - rvm: '2.0' env: PUPPET_VERSION="~> 3.0" gemfile: gemfiles/Gemfile20 + bundler_args: "--without development --jobs=3 --retry=3 --path=${BUNDLE_PATH:-../vendor/bundle}" - rvm: '2.1' env: PUPPET_VERSION="~> 3.0" - rvm: '2.1' @@ -40,17 +41,17 @@ matrix: - rvm: '2.1' sudo: required services: docker - env: PUPPET_VERSION="3.8.5" RS_SET="centos-6-x86_64-docker" + env: PUPPET_VERSION="3.8.7" RS_SET="centos-6-x86_64-docker" script: bundle exec rake acceptance - rvm: '2.1' sudo: required services: docker - env: PUPPET_VERSION="3.8.5" RS_SET="debian-7-x86_64-docker" + env: PUPPET_VERSION="3.8.7" RS_SET="debian-7-x86_64-docker" script: bundle exec rake acceptance - rvm: '2.1' sudo: required services: docker - env: PUPPET_VERSION="3.8.5" RS_SET="ubuntu-14.04-x86_64-docker" + env: PUPPET_VERSION="3.8.7" RS_SET="ubuntu-14.04-x86_64-docker" script: bundle exec rake acceptance # FIXME: GH Issue #3 - Activate acceptance tests on Travis CI for Puppet Enterprise, at least 2.8.8 and 3.8.2 notifications: diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 011750e..0dce8b7 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -14,7 +14,7 @@ if default.is_pe? install_pe else - install_puppet foss_opts + install_puppet_on(hosts, foss_opts) end hosts.each do |host| From 6af4d98192c8b829f433c8573dc64e693ff87649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suszy=C5=84ski=20Krzysztof?= Date: Thu, 26 Jan 2017 17:57:43 +0100 Subject: [PATCH 19/21] Adding $expect_to_start handling to running test --- examples/jboss/wildfly10.pp | 2 +- manifests/init.pp | 2 +- manifests/internal/compatibility.pp | 3 +++ manifests/internal/compatibility/as.pp | 7 ++--- manifests/internal/compatibility/eap.pp | 3 ++- manifests/internal/compatibility/wildfly.pp | 27 ++++++++++++------- manifests/internal/configuration.pp | 2 -- manifests/internal/service.pp | 21 +++++++++++---- spec/acceptance/jboss/wildfly10_spec.rb | 20 ++++++++++---- .../nodesets/centos-6-x86_64-docker.yml | 8 ++++++ .../nodesets/centos-7-x86_64-docker.yml | 10 ++++++- .../nodesets/debian-6-x86_64-docker.yml | 7 +++++ .../nodesets/debian-7-x86_64-docker.yml | 7 +++++ .../nodesets/debian-8-x86_64-docker.yml | 14 +++++++--- spec/acceptance/nodesets/default.yml | 8 ++++++ .../nodesets/ubuntu-12.04-x86_64-docker.yml | 7 +++++ .../nodesets/ubuntu-14.04-x86_64-docker.yml | 7 +++++ .../nodesets/ubuntu-14.10-x86_64-docker.yml | 14 ---------- .../ubuntu-14.10-x86_64-openstack.yml | 11 -------- .../nodesets/ubuntu-15.04-x86_64-docker.yml | 13 --------- .../ubuntu-15.04-x86_64-openstack.yml | 11 -------- .../nodesets/ubuntu-16.04-x86_64-docker.yml | 23 ++++++++++++++++ spec/classes/internal/service_spec.rb | 6 ++--- 23 files changed, 150 insertions(+), 83 deletions(-) delete mode 100644 spec/acceptance/nodesets/ubuntu-14.10-x86_64-docker.yml delete mode 100644 spec/acceptance/nodesets/ubuntu-14.10-x86_64-openstack.yml delete mode 100644 spec/acceptance/nodesets/ubuntu-15.04-x86_64-docker.yml delete mode 100644 spec/acceptance/nodesets/ubuntu-15.04-x86_64-openstack.yml create mode 100644 spec/acceptance/nodesets/ubuntu-16.04-x86_64-docker.yml diff --git a/examples/jboss/wildfly10.pp b/examples/jboss/wildfly10.pp index 7ea94e1..014d7b2 100644 --- a/examples/jboss/wildfly10.pp +++ b/examples/jboss/wildfly10.pp @@ -1,4 +1,4 @@ class { 'jboss': product => 'wildfly', - version => '10.0.0.Final', + version => '10.1.0.Final', } diff --git a/manifests/init.pp b/manifests/init.pp index bc1506b..d5067fb 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -100,7 +100,7 @@ $full_download_url = $jboss::internal::runtime::download_url if $full_download_url == undef { - fail Puppet::Errorr, 'Full download url cannot be undef' + fail Puppet::Error, 'Full download url cannot be undef' } class { 'jboss::internal::package': diff --git a/manifests/internal/compatibility.pp b/manifests/internal/compatibility.pp index c6068ed..9e64407 100644 --- a/manifests/internal/compatibility.pp +++ b/manifests/internal/compatibility.pp @@ -16,6 +16,7 @@ $systemd_file = $jboss::internal::compatibility::wildfly::systemd_file $systemd_launcher = $jboss::internal::compatibility::wildfly::systemd_launcher $initsystem = $jboss::internal::compatibility::wildfly::initsystem + $expect_to_start = $jboss::internal::compatibility::wildfly::expect_to_start } 'jboss-eap': { include jboss::internal::compatibility::eap @@ -26,6 +27,7 @@ $systemd_file = $jboss::internal::compatibility::eap::systemd_file $systemd_launcher = $jboss::internal::compatibility::eap::systemd_launcher $initsystem = $jboss::internal::compatibility::eap::initsystem + $expect_to_start = $jboss::internal::compatibility::eap::expect_to_start } 'jboss-as': { include jboss::internal::compatibility::as @@ -36,6 +38,7 @@ $systemd_file = $jboss::internal::compatibility::as::systemd_file $systemd_launcher = $jboss::internal::compatibility::as::systemd_launcher $initsystem = $jboss::internal::compatibility::as::initsystem + $expect_to_start = $jboss::internal::compatibility::as::expect_to_start } default: { fail("Unsupported product ${jboss::product}. Supporting only: 'jboss-eap', 'jboss-as' and 'wildfly'") diff --git a/manifests/internal/compatibility/as.pp b/manifests/internal/compatibility/as.pp index 63dc47d..dbd337e 100644 --- a/manifests/internal/compatibility/as.pp +++ b/manifests/internal/compatibility/as.pp @@ -9,9 +9,10 @@ $systemd_file = undef $systemd_launcher = undef $initsystem = 'SystemV' - $controller_port = '9999' - $product_short = 'jboss' - $initd_file = $jboss::runasdomain ? { + $controller_port = '9999' + $product_short = 'jboss' + $expect_to_start = true + $initd_file = $jboss::runasdomain ? { true => "${jboss::home}/bin/init.d/jboss-as-domain.sh", default => "${jboss::home}/bin/init.d/jboss-as-standalone.sh", } diff --git a/manifests/internal/compatibility/eap.pp b/manifests/internal/compatibility/eap.pp index 2d7fe53..b6b6c2a 100644 --- a/manifests/internal/compatibility/eap.pp +++ b/manifests/internal/compatibility/eap.pp @@ -8,6 +8,7 @@ } $product_short = 'jboss' + $expect_to_start = true if versioncmp($jboss::version, '7.0.0') >= 0 { # after EAP 7.x @@ -42,7 +43,7 @@ 'lenny','squeeze','lucid','natty','wheezy','precise','quantal','raring','saucy','trusty','utopic' : { $initsystem = 'SystemV' } - 'jessie','vivid','wily','xenial': { + 'jessie','vivid','wily','xenial','yakkety','zesty': { $initsystem = 'SystemD' } default: { fail("Unsupported release ${::lsbdistcodename}") } diff --git a/manifests/internal/compatibility/wildfly.pp b/manifests/internal/compatibility/wildfly.pp index cf09683..3d865fc 100644 --- a/manifests/internal/compatibility/wildfly.pp +++ b/manifests/internal/compatibility/wildfly.pp @@ -10,6 +10,10 @@ } $controller_port = '9990' $product_short = 'wildfly' + $versioned_name = "${::operatingsystem} ${::operatingsystemrelease}" + $not_start_warn1 = 'Wildfly >= 10 requires Java 8 or greater to operate. Module puppetlabs/java will install older version of Java on' + $not_start_warn2 = " ${versioned_name}. Install Java 8 and set flag \$jboss::java_autoinstall to false to suppress this warning." + $not_start_warn = "${not_start_warn1}${not_start_warn2}" if versioncmp($jboss::version, '10.0.0') >= 0 { # after WFly 10.x @@ -24,9 +28,9 @@ $initsystem = 'SystemD' } else { $initsystem = 'SystemV' - $versioned_name = "${::operatingsystem} ${::operatingsystemrelease}" if jboss_to_bool($jboss::java_autoinstall) { - warning("Wildfly 10 requires Java 8 or greater, which is not suppoted by default on ${versioned_name}.") + warning($not_start_warn) + $expect_to_start = false } } } @@ -35,9 +39,10 @@ $initsystem = 'SystemD' } else { $initsystem = 'SystemV' - $versioned_name = "${::operatingsystem} ${::operatingsystemrelease}" + if jboss_to_bool($jboss::java_autoinstall) { - warning("Wildfly 10 requires Java 8 or greater, which is not suppoted by default on ${versioned_name}.") + warning($not_start_warn) + $expect_to_start = false } } } @@ -50,14 +55,14 @@ case $::lsbdistcodename { 'lenny','squeeze','lucid','natty','wheezy','precise','quantal','raring','saucy','trusty','utopic' : { $initsystem = 'SystemV' - } - 'jessie','vivid','wily','xenial': { - $initsystem = 'SystemD' - $versioned_name = "${::operatingsystem} ${::operatingsystemrelease}" if jboss_to_bool($jboss::java_autoinstall) { - warning("Wildfly 10 requires Java 8 or greater, which is not suppoted by default on ${versioned_name}.") + warning($not_start_warn) + $expect_to_start = false } } + 'jessie','vivid','wily','xenial','yakkety','zesty': { + $initsystem = 'SystemD' + } default: { fail("Unsupported release ${::lsbdistcodename}") } } } @@ -70,4 +75,8 @@ $initsystem = 'SystemV' $initd_file = "${jboss::home}/bin/init.d/wildfly-init-${_osfamily_down}.sh" } + + if $expect_to_start == undef { + $expect_to_start = true + } } diff --git a/manifests/internal/configuration.pp b/manifests/internal/configuration.pp index dbf2599..0283b36 100644 --- a/manifests/internal/configuration.pp +++ b/manifests/internal/configuration.pp @@ -6,8 +6,6 @@ include jboss::internal::augeas include jboss::internal::configure::interfaces - include jboss::internal::quirks::etc_initd_functions - $home = $jboss::home $user = $jboss::jboss_user $enableconsole = $jboss::enableconsole diff --git a/manifests/internal/service.pp b/manifests/internal/service.pp index 1aac090..5ed0fbf 100644 --- a/manifests/internal/service.pp +++ b/manifests/internal/service.pp @@ -3,8 +3,10 @@ include jboss include jboss::params - include jboss::internal::configuration include jboss::internal::params + include jboss::internal::compatibility + include jboss::internal::configuration + include jboss::internal::quirks::etc_initd_functions Exec { path => $jboss::internal::params::syspath, @@ -13,6 +15,7 @@ anchor { 'jboss::service::begin': } + $service_start_cooldown = 5 # sec. $servicename = $jboss::product # TODO: change to $::virtual after dropping support for Puppet 2.x $enable = $::jboss_virtual ? { @@ -31,16 +34,24 @@ ], } + if $jboss::internal::compatibility::expect_to_start { + $test_running_loglevel = 'emerg' + $test_running_failstatus = 1 + } else { + $test_running_loglevel = 'warning' + $test_running_failstatus = 0 + } + exec { 'jboss::service::test-running': - loglevel => 'emerg', - command => "tail -n 50 ${jboss::internal::configuration::logfile} && exit 1", - unless => "ps aux | grep ${servicename} | grep -vq grep", + loglevel => $test_running_loglevel, + command => "tail -n 80 ${jboss::internal::configuration::logfile} && exit ${test_running_failstatus}", + unless => "pgrep -f '^java.*${servicename}' > /dev/null", logoutput => true, subscribe => Service[$servicename], } exec { 'jboss::service::restart': - command => "service ${servicename} stop ; pkill -9 -f \"^java.*jboss\" ; service ${servicename} start", + command => "service ${servicename} stop ; sleep 5 ; pkill -9 -f '^java.*${servicename}' ; service ${servicename} start", refreshonly => true, require => Exec['jboss::service::test-running'], } diff --git a/spec/acceptance/jboss/wildfly10_spec.rb b/spec/acceptance/jboss/wildfly10_spec.rb index f996139..6c7f6c9 100644 --- a/spec/acceptance/jboss/wildfly10_spec.rb +++ b/spec/acceptance/jboss/wildfly10_spec.rb @@ -1,8 +1,9 @@ require 'spec_helper_acceptance' describe 'jboss::wildfly10 smoke test', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do + let(:pp) { Testing::Acceptance::SmokeTestReader.smoke_pp :'jboss::wildfly10' } + shared_examples 'a properly working class on a platform with supported Java version' do - let(:pp) { Testing::Acceptance::SmokeTestReader.smoke_pp :'jboss::wildfly10' } it 'should install WildFly 10 with no errors' do apply_manifest(pp, :expect_changes => true, :trace => true) @@ -13,10 +14,7 @@ describe service('wildfly') do it { is_expected.to be_running } end - after(:all) do - extend Testing::Acceptance::Cleaner - remove_jboss_installation('wildfly') - end + end if (fact('osfamily') == 'RedHat' && fact('operatingsystemmajrelease') >= '7') @@ -25,5 +23,17 @@ it_behaves_like 'a properly working class on a platform with supported Java version' elsif (fact('operatingsystem') == 'Ubuntu' && fact('operatingsystemmajrelease') >= '15.10' ) it_behaves_like 'a properly working class on a platform with supported Java version' + else + it 'should install WildFly, but it should not start due to lack of Java 8' do + apply_manifest(pp, :expect_changes => true, :trace => true) + end + describe service('wildfly') do + it { is_expected.not_to be_running } + end + end + + after(:all) do + extend Testing::Acceptance::Cleaner + remove_jboss_installation('wildfly') end end diff --git a/spec/acceptance/nodesets/centos-6-x86_64-docker.yml b/spec/acceptance/nodesets/centos-6-x86_64-docker.yml index d4d9922..453ce2a 100644 --- a/spec/acceptance/nodesets/centos-6-x86_64-docker.yml +++ b/spec/acceptance/nodesets/centos-6-x86_64-docker.yml @@ -5,7 +5,15 @@ HOSTS: image: centos:6 docker_preserve_image: true docker_image_commands: + - "sed -i 's/keepcache=0/keepcache=1/g' /etc/yum.conf" - 'yum install -y crontabs wget' + mount_folders: + wget_cache: + host_path: /tmp/wget_cache + container_path: /var/cache/wget + yum_cache: + host_path: /tmp/yum_cache/centos-6-x64 + container_path: /var/cache/yum CONFIG: type: foss log_level: debug diff --git a/spec/acceptance/nodesets/centos-7-x86_64-docker.yml b/spec/acceptance/nodesets/centos-7-x86_64-docker.yml index 5988d13..4551cf5 100644 --- a/spec/acceptance/nodesets/centos-7-x86_64-docker.yml +++ b/spec/acceptance/nodesets/centos-7-x86_64-docker.yml @@ -6,7 +6,15 @@ HOSTS: docker_preserve_image: true docker_cmd: '["/usr/sbin/init"]' docker_image_commands: - - 'yum install -y crontabs wget' + - "sed -i 's/keepcache=0/keepcache=1/g' /etc/yum.conf" + - 'yum install -y crontabs tar wget openssl sysvinit-tools iproute which initscripts' + mount_folders: + wget_cache: + host_path: /tmp/wget_cache + container_path: /var/cache/wget + yum_cache: + host_path: /tmp/yum_cache/centos-7-x64 + container_path: /var/cache/yum CONFIG: type: foss log_level: debug diff --git a/spec/acceptance/nodesets/debian-6-x86_64-docker.yml b/spec/acceptance/nodesets/debian-6-x86_64-docker.yml index bffefad..6aa1808 100644 --- a/spec/acceptance/nodesets/debian-6-x86_64-docker.yml +++ b/spec/acceptance/nodesets/debian-6-x86_64-docker.yml @@ -7,6 +7,13 @@ HOSTS: docker_cmd: '["/sbin/init"]' docker_image_commands: - 'apt-get update && apt-get install -y cron locales-all net-tools wget' + mount_folders: + wget_cache: + host_path: /tmp/wget_cache + container_path: /var/cache/wget + apt_cache: + host_path: /tmp/apt_cache/debian-6-amd64 + container_path: /var/cache/apt CONFIG: type: foss log_level: debug diff --git a/spec/acceptance/nodesets/debian-7-x86_64-docker.yml b/spec/acceptance/nodesets/debian-7-x86_64-docker.yml index 0ffd7b4..63d3d1a 100644 --- a/spec/acceptance/nodesets/debian-7-x86_64-docker.yml +++ b/spec/acceptance/nodesets/debian-7-x86_64-docker.yml @@ -7,6 +7,13 @@ HOSTS: docker_cmd: '["/sbin/init"]' docker_image_commands: - 'apt-get update && apt-get install -y cron locales-all net-tools wget' + mount_folders: + wget_cache: + host_path: /tmp/wget_cache + container_path: /var/cache/wget + apt_cache: + host_path: /tmp/apt_cache/debian-7-amd64 + container_path: /var/cache/apt CONFIG: type: foss log_level: debug diff --git a/spec/acceptance/nodesets/debian-8-x86_64-docker.yml b/spec/acceptance/nodesets/debian-8-x86_64-docker.yml index c29830e..934fce3 100644 --- a/spec/acceptance/nodesets/debian-8-x86_64-docker.yml +++ b/spec/acceptance/nodesets/debian-8-x86_64-docker.yml @@ -4,10 +4,18 @@ HOSTS: hypervisor : docker image: debian:8 docker_preserve_image: true - docker_cmd: '["/sbin/init"]' + docker_cmd: ["/bin/systemd"] + docker_preserve_image: true docker_image_commands: - - 'apt-get update && apt-get install -y cron locales-all net-tools wget' - - 'rm -f /usr/sbin/policy-rc.d' + - apt-get install -y wget net-tools + - rm /lib/systemd/system/getty.target + mount_folders: + wget_cache: + host_path: /tmp/wget_cache + container_path: /var/cache/wget + apt_cache: + host_path: /tmp/apt_cache/debian-8-amd64 + container_path: /var/cache/apt CONFIG: type: foss log_level: debug diff --git a/spec/acceptance/nodesets/default.yml b/spec/acceptance/nodesets/default.yml index d4d9922..453ce2a 100644 --- a/spec/acceptance/nodesets/default.yml +++ b/spec/acceptance/nodesets/default.yml @@ -5,7 +5,15 @@ HOSTS: image: centos:6 docker_preserve_image: true docker_image_commands: + - "sed -i 's/keepcache=0/keepcache=1/g' /etc/yum.conf" - 'yum install -y crontabs wget' + mount_folders: + wget_cache: + host_path: /tmp/wget_cache + container_path: /var/cache/wget + yum_cache: + host_path: /tmp/yum_cache/centos-6-x64 + container_path: /var/cache/yum CONFIG: type: foss log_level: debug diff --git a/spec/acceptance/nodesets/ubuntu-12.04-x86_64-docker.yml b/spec/acceptance/nodesets/ubuntu-12.04-x86_64-docker.yml index c73068a..aeddc9d 100644 --- a/spec/acceptance/nodesets/ubuntu-12.04-x86_64-docker.yml +++ b/spec/acceptance/nodesets/ubuntu-12.04-x86_64-docker.yml @@ -7,6 +7,13 @@ HOSTS: docker_image_commands: - 'apt-get update && apt-get install -y net-tools ca-certificates wget' - 'locale-gen en_US.UTF-8' + mount_folders: + wget_cache: + host_path: /tmp/wget_cache + container_path: /var/cache/wget + apt_cache: + host_path: /tmp/apt_cache/ubuntu-12.04-amd64 + container_path: /var/cache/apt CONFIG: type: foss log_level: debug diff --git a/spec/acceptance/nodesets/ubuntu-14.04-x86_64-docker.yml b/spec/acceptance/nodesets/ubuntu-14.04-x86_64-docker.yml index 346bf34..8a0f274 100644 --- a/spec/acceptance/nodesets/ubuntu-14.04-x86_64-docker.yml +++ b/spec/acceptance/nodesets/ubuntu-14.04-x86_64-docker.yml @@ -9,6 +9,13 @@ HOSTS: - 'rm /sbin/initctl; dpkg-divert --rename --remove /sbin/initctl' - 'apt-get update && apt-get install -y net-tools ca-certificates wget' - 'locale-gen en_US.UTF-8' + mount_folders: + wget_cache: + host_path: /tmp/wget_cache + container_path: /var/cache/wget + apt_cache: + host_path: /tmp/apt_cache/ubuntu-14.04-amd64 + container_path: /var/cache/apt CONFIG: type: foss log_level: debug diff --git a/spec/acceptance/nodesets/ubuntu-14.10-x86_64-docker.yml b/spec/acceptance/nodesets/ubuntu-14.10-x86_64-docker.yml deleted file mode 100644 index fdd22cc..0000000 --- a/spec/acceptance/nodesets/ubuntu-14.10-x86_64-docker.yml +++ /dev/null @@ -1,14 +0,0 @@ -HOSTS: - ubuntu-1410-x64: - platform: ubuntu-14.10-amd64 - hypervisor : docker - image: ubuntu:14.10 - docker_preserve_image: true - docker_image_commands: - - 'rm /usr/sbin/policy-rc.d' - - 'rm /sbin/initctl; dpkg-divert --rename --remove /sbin/initctl' - - 'apt-get update && apt-get install -y net-tools ca-certificates wget' - - 'locale-gen en_US.UTF-8' -CONFIG: - type: foss - log_level: debug diff --git a/spec/acceptance/nodesets/ubuntu-14.10-x86_64-openstack.yml b/spec/acceptance/nodesets/ubuntu-14.10-x86_64-openstack.yml deleted file mode 100644 index 6ae4e05..0000000 --- a/spec/acceptance/nodesets/ubuntu-14.10-x86_64-openstack.yml +++ /dev/null @@ -1,11 +0,0 @@ -HOSTS: - ubuntu-1410-x64: - platform: ubuntu-14.10-amd64 - hypervisor : openstack - flavor: m1.small - image: ubuntu-1410-latest - user: ubuntu -CONFIG: - type: foss - log_level: debug - openstack_network: default diff --git a/spec/acceptance/nodesets/ubuntu-15.04-x86_64-docker.yml b/spec/acceptance/nodesets/ubuntu-15.04-x86_64-docker.yml deleted file mode 100644 index b872fdc..0000000 --- a/spec/acceptance/nodesets/ubuntu-15.04-x86_64-docker.yml +++ /dev/null @@ -1,13 +0,0 @@ -HOSTS: - ubuntu-1504-x64: - platform: ubuntu-15.04-amd64 - hypervisor : docker - image: ubuntu:15.04 - docker_preserve_image: true - docker_cmd: '["/sbin/init"]' - docker_image_commands: - - 'apt-get update && apt-get install -y net-tools ca-certificates wget' - - 'locale-gen en_US.UTF-8' -CONFIG: - type: foss - log_level: debug diff --git a/spec/acceptance/nodesets/ubuntu-15.04-x86_64-openstack.yml b/spec/acceptance/nodesets/ubuntu-15.04-x86_64-openstack.yml deleted file mode 100644 index 894fedd..0000000 --- a/spec/acceptance/nodesets/ubuntu-15.04-x86_64-openstack.yml +++ /dev/null @@ -1,11 +0,0 @@ -HOSTS: - ubuntu-1504-x64: - platform: ubuntu-15.04-amd64 - hypervisor : openstack - flavor: m1.small - image: ubuntu-1504-latest - user: ubuntu -CONFIG: - type: foss - log_level: debug - openstack_network: default diff --git a/spec/acceptance/nodesets/ubuntu-16.04-x86_64-docker.yml b/spec/acceptance/nodesets/ubuntu-16.04-x86_64-docker.yml new file mode 100644 index 0000000..6cc3545 --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-16.04-x86_64-docker.yml @@ -0,0 +1,23 @@ +HOSTS: + ubuntu-1604-x64: + roles: + - agent + - default + platform: ubuntu-16.04-amd64 + image: ubuntu:16.04 + hypervisor: docker + docker_cmd: ["/bin/systemd"] + docker_preserve_image: true + docker_image_commands: + - apt-get install -y wget net-tools + - rm /lib/systemd/system/getty.target + mount_folders: + wget_cache: + host_path: /tmp/wget_cache + container_path: /var/cache/wget + apt_cache: + host_path: /tmp/apt_cache/ubuntu-16.04-amd64 + container_path: /var/cache/apt +CONFIG: + type: foss + log_level: debug diff --git a/spec/classes/internal/service_spec.rb b/spec/classes/internal/service_spec.rb index 9b940a7..e33f06e 100644 --- a/spec/classes/internal/service_spec.rb +++ b/spec/classes/internal/service_spec.rb @@ -17,15 +17,15 @@ is_expected.to contain_exec('jboss::service::test-running'). with( :loglevel => 'emerg', - :command => 'tail -n 50 /var/log/wildfly/console.log && exit 1', - :unless => 'ps aux | grep wildfly | grep -vq grep', + :command => 'tail -n 80 /var/log/wildfly/console.log && exit 1', + :unless => "pgrep -f '^java.*wildfly' > /dev/null", :logoutput => true ) end it do is_expected.to contain_exec('jboss::service::restart'). with( - :command => 'service wildfly stop ; pkill -9 -f "^java.*jboss" ; service wildfly start', + :command => "service wildfly stop ; sleep 5 ; pkill -9 -f '^java.*wildfly' ; service wildfly start", :refreshonly => true ) end From 612d7e0e449005b9decb0f69f9611965aa79fc22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suszy=C5=84ski=20Krzysztof?= Date: Fri, 27 Jan 2017 15:54:55 +0100 Subject: [PATCH 20/21] Init scripts for systemd and systemv --- manifests/internal/compatibility/as.pp | 8 +- manifests/internal/compatibility/eap.pp | 48 ++------- .../internal/compatibility/initsystem.pp | 52 ++++++++++ manifests/internal/compatibility/wildfly.pp | 82 ++++------------ manifests/internal/package.pp | 15 ++- manifests/internal/prerequisites.pp | 2 +- manifests/internal/service.pp | 39 +++++++- manifests/params.pp | 3 + spec/classes/internal/prerequisites_spec.rb | 2 + spec/classes/internal/service_spec.rb | 98 ++++++++++++++++--- templates/jboss-as.conf.erb | 6 +- templates/systemd/launch.sh | 12 +-- templates/systemd/wait-for-start.sh | 21 ++++ templates/systemd/wildfly.service | 6 +- 14 files changed, 245 insertions(+), 149 deletions(-) create mode 100644 manifests/internal/compatibility/initsystem.pp create mode 100644 templates/systemd/wait-for-start.sh diff --git a/manifests/internal/compatibility/as.pp b/manifests/internal/compatibility/as.pp index dbd337e..dad44be 100644 --- a/manifests/internal/compatibility/as.pp +++ b/manifests/internal/compatibility/as.pp @@ -2,16 +2,18 @@ # This is internal class to resolve JBoss AS compatibility class jboss::internal::compatibility::as { include jboss + include jboss::internal::compatibility::initsystem if versioncmp($jboss::version, '7.0.0') < 0 or versioncmp($jboss::version, '8.0.0') >= 0 { fail("Unsupported version ${jboss::product} ${jboss::version}. Supporting only: JBoss AS 7.x series") } - $systemd_file = undef - $systemd_launcher = undef - $initsystem = 'SystemV' + + $initsystem = $jboss::internal::compatibility::initsystem::initsystem $controller_port = '9999' $product_short = 'jboss' $expect_to_start = true + $systemd_file = 'jboss/systemd/wildfly.service' + $systemd_launcher = 'jboss/systemd/launch.sh' $initd_file = $jboss::runasdomain ? { true => "${jboss::home}/bin/init.d/jboss-as-domain.sh", default => "${jboss::home}/bin/init.d/jboss-as-standalone.sh", diff --git a/manifests/internal/compatibility/eap.pp b/manifests/internal/compatibility/eap.pp index b6b6c2a..93b3295 100644 --- a/manifests/internal/compatibility/eap.pp +++ b/manifests/internal/compatibility/eap.pp @@ -2,61 +2,25 @@ # This is internal class to resolve JBoss EAP compatibility class jboss::internal::compatibility::eap { include jboss + include jboss::internal::compatibility::initsystem if versioncmp($jboss::version, '6.0.0') < 0 or versioncmp($jboss::version, '8.0.0') >= 0 { fail("Unsupported version ${jboss::product} ${jboss::version}. Supporting only: JBoss EAP 6.x and 7.x series") } - $product_short = 'jboss' - $expect_to_start = true + $product_short = 'jboss' + $expect_to_start = true + $initsystem = $jboss::internal::compatibility::initsystem::initsystem + $systemd_file = 'jboss/systemd/wildfly.service' + $systemd_launcher = 'jboss/systemd/launch.sh' if versioncmp($jboss::version, '7.0.0') >= 0 { # after EAP 7.x $controller_port = '9990' $initd_file = "${jboss::home}/bin/init.d/jboss-eap-rhel.sh" - $systemd_file = 'jboss/systemd/wildfly.service' - $systemd_launcher = 'jboss/systemd/launch.sh' - case $::osfamily { - 'RedHat': { - case $::operatingsystem { - 'RedHat', 'CentOS', 'OracleLinux', 'Scientific', 'OEL': { - if (versioncmp($::operatingsystemrelease, '7.0') > 0) { - $initsystem = 'SystemD' - } else { - $initsystem = 'SystemV' - } - } - 'Fedora': { - if (versioncmp($::operatingsystemrelease, '21') > 0) { - $initsystem = 'SystemD' - } else { - $initsystem = 'SystemV' - } - } - default: { - fail("Unsupported OS: ${::operatingsystem}") - } - } - } - 'Debian': { - case $::lsbdistcodename { - 'lenny','squeeze','lucid','natty','wheezy','precise','quantal','raring','saucy','trusty','utopic' : { - $initsystem = 'SystemV' - } - 'jessie','vivid','wily','xenial','yakkety','zesty': { - $initsystem = 'SystemD' - } - default: { fail("Unsupported release ${::lsbdistcodename}") } - } - } - default: { - fail("Unsupported OS family: ${::osfamily}. Supporting only RHEL and Debian systems. Consult README file.") - } - } } else { # before EAP 7.x $controller_port = '9999' - $initsystem = 'SystemV' $initd_file = $jboss::runasdomain ? { true => "${jboss::home}/bin/init.d/jboss-as-domain.sh", default => "${jboss::home}/bin/init.d/jboss-as-standalone.sh", diff --git a/manifests/internal/compatibility/initsystem.pp b/manifests/internal/compatibility/initsystem.pp new file mode 100644 index 0000000..6a30b1f --- /dev/null +++ b/manifests/internal/compatibility/initsystem.pp @@ -0,0 +1,52 @@ +# == Class: jboss::internal::compatibility::initsystem +# INTERNAL CLASS! +# +class jboss::internal::compatibility::initsystem { + case $::osfamily { + 'RedHat': { + case $::operatingsystem { + 'RedHat', 'CentOS', 'OracleLinux', 'Scientific', 'OEL': { + if (versioncmp($::operatingsystemrelease, '7.0') >= 0) { + $initsystem = 'SystemD' + } else { + $initsystem = 'SystemV' + } + } + 'Fedora': { + if (versioncmp($::operatingsystemrelease, '21') >= 0) { + $initsystem = 'SystemD' + } else { + $initsystem = 'SystemV' + } + } + default: { + fail("Unsupported OS: ${::operatingsystem}") + } + } + } + 'Debian': { + case $::operatingsystem { + 'Ubuntu': { + if (versioncmp($::operatingsystemrelease, '15.04') >= 0) { + $initsystem = 'SystemD' + } else { + $initsystem = 'SystemV' + } + } + 'Debian': { + if (versioncmp($::operatingsystemrelease, '8') >= 0) { + $initsystem = 'SystemD' + } else { + $initsystem = 'SystemV' + } + } + default: { + fail("Unsupported OS: ${::operatingsystem}") + } + } + } + default: { + fail("Unsupported OS family: ${::osfamily}. Supporting only RHEL and Debian systems. Consult README file.") + } + } +} diff --git a/manifests/internal/compatibility/wildfly.pp b/manifests/internal/compatibility/wildfly.pp index 3d865fc..7c5cf78 100644 --- a/manifests/internal/compatibility/wildfly.pp +++ b/manifests/internal/compatibility/wildfly.pp @@ -3,80 +3,34 @@ class jboss::internal::compatibility::wildfly { include jboss include jboss::internal::compatibility::common + include jboss::internal::compatibility::initsystem $_osfamily_down = $jboss::internal::compatibility::common::osfamily_down if versioncmp($jboss::version, '8.0.0') < 0 or versioncmp($jboss::version, '11.0.0') >= 0 { fail("Unsupported version ${jboss::product} ${jboss::version}. Supporting only: Wildfly 8.x, 9.x and 10.x series") } - $controller_port = '9990' - $product_short = 'wildfly' - $versioned_name = "${::operatingsystem} ${::operatingsystemrelease}" - $not_start_warn1 = 'Wildfly >= 10 requires Java 8 or greater to operate. Module puppetlabs/java will install older version of Java on' - $not_start_warn2 = " ${versioned_name}. Install Java 8 and set flag \$jboss::java_autoinstall to false to suppress this warning." - $not_start_warn = "${not_start_warn1}${not_start_warn2}" + $systemd_file = 'jboss/systemd/wildfly.service' + $systemd_launcher = 'jboss/systemd/launch.sh' + $initsystem = $jboss::internal::compatibility::initsystem::initsystem + $controller_port = '9990' + $product_short = 'wildfly' + $versioned_name = "${::operatingsystem} ${::operatingsystemrelease}" + $not_start_warn1 = 'Wildfly >= 10 requires Java 8 or greater to operate. Module puppetlabs/java will install older version of Java on' + $not_start_warn2 = " ${versioned_name}. Install Java 8 and set flag \$jboss::java_autoinstall to false to suppress this warning." + $not_start_warn = "${not_start_warn1}${not_start_warn2}" + + if jboss_to_bool($jboss::java_autoinstall) and $initsystem == 'SystemV' { + warning($not_start_warn) + $expect_to_start = false + } else { + $expect_to_start = true + } if versioncmp($jboss::version, '10.0.0') >= 0 { # after WFly 10.x - $initd_file = "${jboss::home}/docs/contrib/scripts/init.d/wildfly-init-${_osfamily_down}.sh" - $systemd_file = 'jboss/systemd/wildfly.service' - $systemd_launcher = 'jboss/systemd/launch.sh' - case $::osfamily { - 'RedHat': { - case $::operatingsystem { - 'RedHat', 'CentOS', 'OracleLinux', 'Scientific', 'OEL': { - if (versioncmp($::operatingsystemrelease, '7.0') > 0) { - $initsystem = 'SystemD' - } else { - $initsystem = 'SystemV' - if jboss_to_bool($jboss::java_autoinstall) { - warning($not_start_warn) - $expect_to_start = false - } - } - } - 'Fedora': { - if (versioncmp($::operatingsystemrelease, '21') > 0) { - $initsystem = 'SystemD' - } else { - $initsystem = 'SystemV' - - if jboss_to_bool($jboss::java_autoinstall) { - warning($not_start_warn) - $expect_to_start = false - } - } - } - default: { - fail("Unsupported OS: ${::operatingsystem}") - } - } - } - 'Debian': { - case $::lsbdistcodename { - 'lenny','squeeze','lucid','natty','wheezy','precise','quantal','raring','saucy','trusty','utopic' : { - $initsystem = 'SystemV' - if jboss_to_bool($jboss::java_autoinstall) { - warning($not_start_warn) - $expect_to_start = false - } - } - 'jessie','vivid','wily','xenial','yakkety','zesty': { - $initsystem = 'SystemD' - } - default: { fail("Unsupported release ${::lsbdistcodename}") } - } - } - default: { - fail("Unsupported OS family: ${::osfamily}. Supporting only RHEL and Debian systems. Consult README file.") - } - } + $initd_file = "${jboss::home}/docs/contrib/scripts/init.d/wildfly-init-${_osfamily_down}.sh" } else { # for WFly 8.x, 9.x - $initsystem = 'SystemV' $initd_file = "${jboss::home}/bin/init.d/wildfly-init-${_osfamily_down}.sh" } - - if $expect_to_start == undef { - $expect_to_start = true - } } diff --git a/manifests/internal/package.pp b/manifests/internal/package.pp index 8752f89..58bb319 100644 --- a/manifests/internal/package.pp +++ b/manifests/internal/package.pp @@ -162,6 +162,15 @@ alias => 'jboss::systemd_launcher', mode => '0755', content => template($jboss::internal::compatibility::systemd_launcher), + notify => Anchor['jboss::installed'], + require => Jboss::Internal::Util::Groupaccess[$jboss::home], + } + file { "${jboss::home}/bin/wait-for-start.sh": + ensure => 'file', + alias => 'jboss::systemd_waiter', + mode => '0755', + content => template('jboss/systemd/wait-for-start.sh'), + notify => Anchor['jboss::installed'], require => Jboss::Internal::Util::Groupaccess[$jboss::home], } file { "/etc/systemd/system/${product}.service": @@ -198,15 +207,15 @@ } anchor { 'jboss::installed': - require => [ + notify => Anchor['jboss::package::end'], + subscribe => [ Jboss::Internal::Util::Groupaccess[$jboss::home], Exec['jboss::test-extraction'], File['jboss::confdir'], File['jboss::logfile'], File['jboss::jbosscli'], - File['jboss::service-link'], + File['jboss::service-link'] ], - before => Anchor['jboss::package::end'], } anchor { 'jboss::package::end': } } diff --git a/manifests/internal/prerequisites.pp b/manifests/internal/prerequisites.pp index c157944..7ce9703 100644 --- a/manifests/internal/prerequisites.pp +++ b/manifests/internal/prerequisites.pp @@ -7,5 +7,5 @@ # None # class jboss::internal::prerequisites { - ensure_packages(['unzip']) + ensure_packages(['unzip', 'procps', 'coreutils']) } diff --git a/manifests/internal/service.pp b/manifests/internal/service.pp index 5ed0fbf..14ed366 100644 --- a/manifests/internal/service.pp +++ b/manifests/internal/service.pp @@ -1,7 +1,8 @@ # Internal class - manage JBoss service class jboss::internal::service { - include jboss + $servicename = $jboss::product + include jboss::params include jboss::internal::params include jboss::internal::compatibility @@ -15,20 +16,33 @@ anchor { 'jboss::service::begin': } - $service_start_cooldown = 5 # sec. - $servicename = $jboss::product + $service_stop_cooldown = 5 # sec. # TODO: change to $::virtual after dropping support for Puppet 2.x $enable = $::jboss_virtual ? { 'docker' => undef, default => true, } + if $jboss::internal::compatibility::initsystem == 'SystemD' { + exec { "systemctl-daemon-reload-for-${servicename}": + command => '/bin/systemctl daemon-reload', + refreshonly => true, + notify => Service[$servicename], + subscribe => [ + Anchor['jboss::package::end'], + Anchor['jboss::configuration::end'], + Anchor['jboss::service::begin'], + ], + } + } + service { $servicename: ensure => running, enable => $enable, hasstatus => true, hasrestart => true, subscribe => [ + Package['coreutils'], Anchor['jboss::package::end'], Anchor['jboss::service::begin'], ], @@ -48,12 +62,27 @@ unless => "pgrep -f '^java.*${servicename}' > /dev/null", logoutput => true, subscribe => Service[$servicename], + require => Package['procps'], + } + + $restart_cmd1 = $jboss::internal::compatibility::initsystem ? { + 'SystemD' => "systemctl stop ${servicename}", + default => "service ${servicename} stop" + } + $restart_cmd2 = "sleep ${service_stop_cooldown}" + $restart_cmd3 = "pkill -9 -f '^java.*${servicename}'" + $restart_cmd4 = $jboss::internal::compatibility::initsystem ? { + 'SystemD' => "systemctl start ${servicename}", + default => "service ${servicename} start" } exec { 'jboss::service::restart': - command => "service ${servicename} stop ; sleep 5 ; pkill -9 -f '^java.*${servicename}' ; service ${servicename} start", + command => "${restart_cmd1} ; ${restart_cmd2} ; ${restart_cmd3} ; ${restart_cmd4}", refreshonly => true, - require => Exec['jboss::service::test-running'], + require => [ + Package['procps'], + Exec['jboss::service::test-running'], + ], } anchor { 'jboss::service::end': diff --git a/manifests/params.pp b/manifests/params.pp index 425a141..3426edc 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -57,4 +57,7 @@ # Tool used by this module to fetch JBoss installation files from network $fetch_tool = hiera('jboss::params::fetch_tool', 'jboss::internal::util::download') + # Time to wait (in seconds) for server to become available + $startup_wait = hiera('jboss::params::startup_wait', '60') + } diff --git a/spec/classes/internal/prerequisites_spec.rb b/spec/classes/internal/prerequisites_spec.rb index e1c27d8..c4e432c 100644 --- a/spec/classes/internal/prerequisites_spec.rb +++ b/spec/classes/internal/prerequisites_spec.rb @@ -5,6 +5,8 @@ it { is_expected.to compile } it { is_expected.to contain_class 'jboss::internal::prerequisites' } it { is_expected.to contain_package('unzip') } + it { is_expected.to contain_package('procps') } + it { is_expected.to contain_package('coreutils') } end context 'On RedHat os family' do diff --git a/spec/classes/internal/service_spec.rb b/spec/classes/internal/service_spec.rb index e33f06e..cdb24cd 100644 --- a/spec/classes/internal/service_spec.rb +++ b/spec/classes/internal/service_spec.rb @@ -12,7 +12,16 @@ it { is_expected.to contain_class('jboss::params') } it { is_expected.to contain_class('jboss::internal::configuration') } end - shared_examples 'containg service execs' do + shared_examples 'containg service restart exec' do + it do + is_expected.to contain_exec('jboss::service::restart'). + with( + :command => "service wildfly stop ; sleep 5 ; pkill -9 -f '^java.*wildfly' ; service wildfly start", + :refreshonly => true + ) + end + end + shared_examples 'containg SystemD execs' do it do is_expected.to contain_exec('jboss::service::test-running'). with( @@ -23,10 +32,18 @@ ) end it do - is_expected.to contain_exec('jboss::service::restart'). + is_expected.to contain_exec('systemctl-daemon-reload-for-wildfly'). + with_command("/bin/systemctl daemon-reload") + end + end + shared_examples 'containg SystemV execs' do + it do + is_expected.to contain_exec('jboss::service::test-running'). with( - :command => "service wildfly stop ; sleep 5 ; pkill -9 -f '^java.*wildfly' ; service wildfly start", - :refreshonly => true + :loglevel => 'warning', + :command => 'tail -n 80 /var/log/wildfly/console.log && exit 0', + :unless => "pgrep -f '^java.*wildfly' > /dev/null", + :logoutput => true ) end end @@ -39,15 +56,27 @@ ) end it_behaves_like 'containg service anchors' - it_behaves_like 'containg service execs' + it_behaves_like 'containg service restart exec' + it_behaves_like 'containg SystemV execs' it_behaves_like 'containg class structure' - it { is_expected.to contain_service('wildfly'). + it do + is_expected.to contain_service('wildfly'). with( :ensure => 'running', :enable => nil, :hasstatus => true, :hasrestart => true - ) } + ) + end + context 'on SystemD system' do + let(:facts) do + Testing::RspecPuppet::SharedFacts.oraclelinux_facts( + :jboss_virtual => 'docker', + :operatingsystemrelease => '7.1' + ) + end + it_behaves_like 'containg SystemD execs' + end end context 'on non-Docker machine' do let(:facts) do @@ -56,15 +85,27 @@ ) end it_behaves_like 'containg service anchors' - it_behaves_like 'containg service execs' + it_behaves_like 'containg service restart exec' + it_behaves_like 'containg SystemV execs' it_behaves_like 'containg class structure' - it { is_expected.to contain_service('wildfly'). + it do + is_expected.to contain_service('wildfly'). with( :ensure => 'running', :enable => true, :hasstatus => true, :hasrestart => true - ) } + ) + end + context 'on SystemD system' do + let(:facts) do + Testing::RspecPuppet::SharedFacts.oraclelinux_facts( + :jboss_virtual => 'phisycal', + :operatingsystemrelease => '7.1' + ) + end + it_behaves_like 'containg SystemD execs' + end end end @@ -76,15 +117,28 @@ ) end it_behaves_like 'containg service anchors' - it_behaves_like 'containg service execs' + it_behaves_like 'containg service restart exec' + it_behaves_like 'containg SystemV execs' it_behaves_like 'containg class structure' - it { is_expected.to contain_service('wildfly'). + it do + is_expected.to contain_service('wildfly'). with( :ensure => 'running', :enable => nil, :hasstatus => true, :hasrestart => true - ) } + ) + end + context 'on SystemD system' do + let(:facts) do + Testing::RspecPuppet::SharedFacts.ubuntu_facts( + :jboss_virtual => 'docker', + :operatingsystem => 'Debian', + :operatingsystemrelease => '8' + ) + end + it_behaves_like 'containg SystemD execs' + end end context 'on non-Docker machine' do let(:facts) do @@ -93,15 +147,27 @@ ) end it_behaves_like 'containg service anchors' - it_behaves_like 'containg service execs' + it_behaves_like 'containg service restart exec' + it_behaves_like 'containg SystemV execs' it_behaves_like 'containg class structure' - it { is_expected.to contain_service('wildfly'). + it do + is_expected.to contain_service('wildfly'). with( :ensure => 'running', :enable => true, :hasstatus => true, :hasrestart => true - ) } + ) + end + context 'on SystemD system' do + let(:facts) do + Testing::RspecPuppet::SharedFacts.ubuntu_facts( + :jboss_virtual => 'vmware', + :operatingsystemrelease => '16.04' + ) + end + it_behaves_like 'containg SystemD execs' + end end end end diff --git a/templates/jboss-as.conf.erb b/templates/jboss-as.conf.erb index 73970ee..0fe15f8 100644 --- a/templates/jboss-as.conf.erb +++ b/templates/jboss-as.conf.erb @@ -23,11 +23,7 @@ JBOSS_USER=<%= @user %> # The amount of time to wait for startup # -# STARTUP_WAIT=30 - -# The amount of time to wait for shutdown -# -# SHUTDOWN_WAIT=30 +STARTUP_WAIT=<%= @startup_wait %> # Location to keep the console log # diff --git a/templates/systemd/launch.sh b/templates/systemd/launch.sh index 40242be..f5b8c7c 100644 --- a/templates/systemd/launch.sh +++ b/templates/systemd/launch.sh @@ -1,13 +1,11 @@ -#!/bin/sh +#!/bin/bash . /etc/<%= @product %>/<%= @product %>.conf +set -x + if [ "x$JBOSS_HOME" = "x" ]; then - JBOSS_HOME="/opt/<%= @product %>" + JBOSS_HOME="/usr/lib/<%= @product %>-<%= @version %>" fi -if [[ "$1" == "domain" ]]; then - $JBOSS_HOME/bin/domain.sh -c $2 -else - $JBOSS_HOME/bin/standalone.sh -c $2 -fi +$JBOSS_HOME/bin/$JBOSS_MODE.sh -c "${1}" | tee $JBOSS_CONSOLE_LOG diff --git a/templates/systemd/wait-for-start.sh b/templates/systemd/wait-for-start.sh new file mode 100644 index 0000000..f1e20f0 --- /dev/null +++ b/templates/systemd/wait-for-start.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +. /etc/<%= @product %>/<%= @product %>.conf + +if [ "x$JBOSS_HOME" = "x" ]; then + JBOSS_HOME="/usr/lib/<%= @product %>-<%= @version %>" +fi + +let count=0 +let max_count=$(($STARTUP_WAIT * 5)) + +until [ $count -gt $max_count ]; do + grep -q '.*started in' $JBOSS_CONSOLE_LOG + if [ $? -eq 0 ] ; then + exit 0 + fi + sleep 0.2 + let count=$count+1; +done + +exit 1 diff --git a/templates/systemd/wildfly.service b/templates/systemd/wildfly.service index bf13fa2..30535e5 100644 --- a/templates/systemd/wildfly.service +++ b/templates/systemd/wildfly.service @@ -4,13 +4,13 @@ After=syslog.target network.target Before=httpd.service [Service] +Type=simple Environment=LAUNCH_JBOSS_IN_BACKGROUND=1 EnvironmentFile=-/etc/<%= @product %>/<%= @product %>.conf User=<%= @jboss_user %> LimitNOFILE=102642 -PIDFile=/var/run/<%= @product %>/<%= @product %>.pid -ExecStart=<%= @home %>/bin/launch.sh $JBOSS_MODE $JBOSS_CONFIG -StandardOutput=null +ExecStart=<%= @home %>/bin/launch.sh $JBOSS_CONFIG +ExecStartPost=<%= @home %>/bin/wait-for-start.sh [Install] WantedBy=multi-user.target From 0db3e3b5635a348206def9e1c0bb7d44fce3bd83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suszy=C5=84ski=20Krzysztof?= Date: Mon, 6 Feb 2017 13:04:57 +0100 Subject: [PATCH 21/21] Bump version to v1.2.0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 667ff3e..248bedd 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "coi/jboss", - "version": "1.1.1.pre", + "version": "1.2.0", "author": "Center of Information Technology COI.gov.pl", "summary": "Installs JBoss EAP and WildFly application servers and manage their resources and applications in either a domain or a stand-alone mode", "license": "Apache-2.0",