Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for non-systemd #330

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
---
fixtures:
repositories:
stdlib:
repo: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
branch: "main"
augeas_core:
repo: "https://github.com/puppetlabs/puppetlabs-augeas_core.git"
branch: "main"
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
augeas_core: "https://github.com/puppetlabs/puppetlabs-augeas_core.git"
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ Three gems are bundled with this module: `treetop` (parsing JBoss-CLI commands),

Acceptance tests works with **puppetlabs/java** in both CentOS and Debian.

This module requires `puppetlabs-stdlib` and `jethrocarr/initfact` (it uses `init_system` fact provided by this module by default, but it's overridable in `wildfly::initsystem` parameter)
This module requires `puppetlabs-stdlib`.

It should work on every operating system with the following init systems: sysvinit, systemd and upstart
It should work on every modern Linux. TO see a list of all tested OSes, please check the metadata.json.

## Upgrade

Expand Down Expand Up @@ -155,7 +155,6 @@ class { 'wildfly': }
```puppet
class { 'wildfly':
version => '25.0.0',
init_system => 'systemd',
install_source => 'https://github.com/wildfly/wildfly/releases/download/25.0.0.Final/wildfly-25.0.0.Final.tar.gz',
install_cache_dir => '/tmp',
java_home => '/usr/lib/jvm/java-17-openjdk-amd64',
Expand All @@ -167,7 +166,6 @@ class { 'wildfly':
```puppet
class { 'wildfly':
version => '23.0.2',
init_system => 'systemd',
install_source => 'https://download.jboss.org/wildfly/23.0.2.Final/wildfly-23.0.2.Final.tar.gz',
install_cache_dir => '/tmp',
java_home => '/usr/lib/jvm/java-17-openjdk-amd64',
Expand Down
27 changes: 1 addition & 26 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
* [`wildfly::secure_mgmt_api`](#wildfly--secure_mgmt_api): Manages secure management api
* [`wildfly::service`](#wildfly--service): Manages Wildfly service.
* [`wildfly::service::systemd`](#wildfly--service--systemd): Wildfly systemd configuration
* [`wildfly::service::sysvinit`](#wildfly--service--sysvinit): Wildfly sysvinit configuration
* [`wildfly::service::upstart`](#wildfly--service--upstart): Wildfly upstart configuration
* [`wildfly::setup`](#wildfly--setup): Manages Wildfly configuration required to run in service mode.

### Defined types
Expand Down Expand Up @@ -102,7 +100,6 @@ The following parameters are available in the `wildfly` class:
* [`gid`](#-wildfly--gid)
* [`group`](#-wildfly--group)
* [`host_config`](#-wildfly--host_config)
* [`init_system`](#-wildfly--init_system)
* [`install_cache_dir`](#-wildfly--install_cache_dir)
* [`deploy_cache_dir`](#-wildfly--deploy_cache_dir)
* [`install_download_timeout`](#-wildfly--install_download_timeout)
Expand Down Expand Up @@ -244,14 +241,6 @@ Sets Wildfly Host configuration file for initialization when you're using 'domai

Default value: `'host.xml'`

##### <a name="-wildfly--init_system"></a>`init_system`

Data type: `Enum['sysvinit', 'systemd', 'upstart']`

Sets initsystem for service configuration.

Default value: `$facts['initsystem']`

##### <a name="-wildfly--install_cache_dir"></a>`install_cache_dir`

Data type: `Stdlib::Unixpath`
Expand Down Expand Up @@ -655,14 +644,6 @@ Manages Wildfly service.

Wildfly systemd configuration

### <a name="wildfly--service--sysvinit"></a>`wildfly::service::sysvinit`

Wildfly sysvinit configuration

### <a name="wildfly--service--upstart"></a>`wildfly::service::upstart`

Wildfly upstart configuration

### <a name="wildfly--setup"></a>`wildfly::setup`

Manages Wildfly configuration required to run in service mode.
Expand Down Expand Up @@ -3371,7 +3352,7 @@ Type: Puppet Language
Default service configuration for a specific distribution, version
execution mode and initsystem.

#### `wildfly::service_config(String $distribution, String $version, String $mode, Enum['sysvinit', 'systemd', 'upstart'] $init_system)`
#### `wildfly::service_config(String $distribution, String $version, String $mode)`

Default service configuration for a specific distribution, version
execution mode and initsystem.
Expand All @@ -3396,12 +3377,6 @@ Data type: `String`

Wildfly execution mode will run, 'standalone' or 'domain'.

##### `init_system`

Data type: `Enum['sysvinit', 'systemd', 'upstart']`

System's initsystem.

## Data types

### <a name="Wildfly--Config_file"></a>`Wildfly::Config_file`
Expand Down
75 changes: 12 additions & 63 deletions functions/service_config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,80 +4,29 @@
# @param distribution Wildfly distribution: 'wildfly' or 'jboss-eap'.
# @param version Wildfly version.
# @param mode Wildfly execution mode will run, 'standalone' or 'domain'.
# @param init_system System's initsystem.
# @return [Hash[String, String]] service configuration: name, configuration file and template and bundled init scripts.
function wildfly::service_config(
String $distribution,
String $version,
String $mode,
Enum['sysvinit', 'systemd', 'upstart'] $init_system,
) {
case $distribution {
# intentionally not using $facts (see rspec-puppet #503)

'wildfly': {
$conf_file = $facts['os']['family'] ? {
'Debian' => '/etc/default/wildfly',
default => '/etc/default/wildfly.conf',
}

$service_file = "wildfly-init-${downcase($facts['os']['family'])}.sh"

case [versioncmp($version, '10'), $init_system] {
[-1, default]: {
{
'service_name' => 'wildfly',
'conf_file' => $conf_file,
'conf_template' => 'wildfly/wildfly.sysvinit.conf',
'service_file' => "bin/init.d/${service_file}",
}
}
[default, 'systemd']: {
{
'service_name' => 'wildfly',
'conf_file' => '/etc/wildfly/wildfly.conf',
'conf_template' => 'wildfly/wildfly.systemd.conf',
'service_file' => "docs/contrib/scripts/init.d/${service_file}",
'systemd_template' => 'wildfly/wildfly.systemd.service',
}
}
[default, default]: {
{
'service_name' => 'wildfly',
'conf_file' => $conf_file,
'conf_template' => 'wildfly/wildfly.sysvinit.conf',
'service_file' => "docs/contrib/scripts/init.d/${service_file}",
}
}
{
'service_name' => 'wildfly',
'conf_file' => '/etc/wildfly/wildfly.conf',
'conf_template' => 'wildfly/wildfly.systemd.conf',
'service_file' => "docs/contrib/scripts/init.d/wildfly-init-${downcase($facts['os']['family'])}.sh",
'systemd_template' => 'wildfly/wildfly.systemd.service',
}
}
'jboss-eap': {
case [versioncmp($version, '7'), $init_system] {
[-1, default]: {
{
'service_name' => 'jboss-as',
'conf_file' => '/etc/jboss-as/jboss-as.conf',
'conf_template' => 'wildfly/wildfly.sysvinit.conf',
'service_file' => "bin/init.d/jboss-as-${mode}.sh",
}
}
[default, 'systemd']: {
{
'service_name' => 'jboss-eap',
'conf_file' => '/etc/default/jboss-eap.conf',
'conf_template' => 'wildfly/wildfly.sysvinit.conf',
'service_file' => 'bin/init.d/jboss-eap-rhel.sh',
'systemd_template' => 'jboss-eap/jboss-eap.systemd.service',
}
}
[default, default]: {
{
'service_name' => 'jboss-eap',
'conf_file' => '/etc/default/jboss-eap.conf',
'conf_template' => 'wildfly/wildfly.sysvinit.conf',
'service_file' => 'bin/init.d/jboss-eap-rhel.sh',
}
}
{
'service_name' => 'jboss-eap',
'conf_file' => '/etc/default/jboss-eap.conf',
'conf_template' => 'wildfly/wildfly.sysvinit.conf',
'service_file' => 'bin/init.d/jboss-eap-rhel.sh',
'systemd_template' => 'jboss-eap/jboss-eap.systemd.service',
}
}
default: {
Expand Down
2 changes: 0 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# @param gid Sets managed group ID.
# @param group Group to own `JBOSS_HOME`. If `manage_user` is `true`, this group will be managed.
# @param host_config Sets Wildfly Host configuration file for initialization when you're using 'domain' mode.
# @param init_system Sets initsystem for service configuration.
# @param install_cache_dir The directory to be used for wget cache.
# @param deploy_cache_dir The directory to be used for deployment cache.
# @param install_download_timeout Sets the timeout for installer download.
Expand Down Expand Up @@ -65,7 +64,6 @@
Undef
] $install_source = undef,
Wildfly::Distribution $distribution = 'wildfly',
Enum['sysvinit', 'systemd', 'upstart'] $init_system = $facts['initsystem'],
Wildfly::Mode $mode = 'standalone',
Stdlib::Unixpath $dirname = '/opt/wildfly',
Stdlib::Unixpath $java_home = '/usr/java/default',
Expand Down
6 changes: 3 additions & 3 deletions manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# Manages Wildfly service.
#
class wildfly::service {
$config = wildfly::service_config($wildfly::distribution, $wildfly::version, $wildfly::mode, $wildfly::init_system)
$config = wildfly::service_config($wildfly::distribution, $wildfly::version, $wildfly::mode)

debug("${wildfly::distribution}.${wildfly::version}.${wildfly::mode}.${wildfly::init_system}: ${config}")
debug("${wildfly::distribution}.${wildfly::version}.${wildfly::mode}: ${config}")

$conf_file = pick($wildfly::conf_file, $config['conf_file'])
$conf_template = pick($wildfly::conf_template, $config['conf_template'])
Expand All @@ -14,7 +14,7 @@
$systemd_template = pick($wildfly::systemd_template, $config['systemd_template'], 'wildfly/wildfly.sysvinit.service')

if !$wildfly::package_name {
contain "wildfly::service::${wildfly::init_system}"
contain wildfly::service::systemd
}

$conf_dir = dirname($conf_file)
Expand Down
23 changes: 9 additions & 14 deletions manifests/service/systemd.pp
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
# Wildfly systemd configuration
#
class wildfly::service::systemd {
if $wildfly::service::systemd_template == 'wildfly/wildfly.systemd.service' {
# Use native script
file { "${wildfly::dirname}/bin/launch.sh" :
ensure => file,
mode => '0755',
owner => $wildfly::user,
group => $wildfly::group,
# need to manage this until it's fixed in the upstream
content => file('wildfly/launch.sh'),
before => File["/etc/systemd/system/${wildfly::service::service_name}.service"],
}
} else {
# Use init.d scripts for systemd
contain wildfly::service::sysvinit
# Use native script
file { "${wildfly::dirname}/bin/launch.sh" :
ensure => file,
mode => '0755',
owner => $wildfly::user,
group => $wildfly::group,
# need to manage this until it's fixed in the upstream
content => file('wildfly/launch.sh'),
before => File["/etc/systemd/system/${wildfly::service::service_name}.service"],
}

file { "/etc/systemd/system/${wildfly::service::service_name}.service":
Expand Down
23 changes: 0 additions & 23 deletions manifests/service/sysvinit.pp

This file was deleted.

6 changes: 0 additions & 6 deletions manifests/service/upstart.pp

This file was deleted.

4 changes: 0 additions & 4 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
{

Check warning on line 1 in metadata.json

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Skipping EOL operating system CentOS 8
"author": "Vox Pupuli",
"dependencies": [
{
"name": "puppetlabs/stdlib",
"version_requirement": ">=4.13.1 < 10.0.0"
},
{
"name": "jethrocarr/initfact",
"version_requirement": ">=1.0.1 < 2.0.0"
}
],
"license": "Apache-2.0",
Expand Down
2 changes: 0 additions & 2 deletions spec/default_module_facts.yml

This file was deleted.

46 changes: 4 additions & 42 deletions spec/functions/service_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,25 @@
require 'spec_helper'

describe 'wildfly::service_config' do
context 'Wildfly 10' do
context 'Wildfly 10 and newer' do
let(:distribution) { 'wildfly' }
let(:version) { '10.0' }

let(:facts) do
{ :os => { :family => 'RedHat' } }
end

it 'using sysvinit' do
is_expected.to run.with_params(distribution, version, 'standalone', 'sysvinit').and_return('service_name' => 'wildfly', 'conf_file' => '/etc/default/wildfly.conf', 'conf_template' => 'wildfly/wildfly.sysvinit.conf', 'service_file' => 'docs/contrib/scripts/init.d/wildfly-init-redhat.sh')
end

it 'using systemd' do
is_expected.to run.with_params(distribution, version, 'standalone', 'systemd').and_return('service_name' => 'wildfly', 'conf_file' => '/etc/wildfly/wildfly.conf', 'conf_template' => 'wildfly/wildfly.systemd.conf', 'service_file' => 'docs/contrib/scripts/init.d/wildfly-init-redhat.sh', 'systemd_template' => 'wildfly/wildfly.systemd.service')
end
end

context 'Wildfly < 10' do
let(:distribution) { 'wildfly' }
let(:version) { '9.0.2' }

let(:facts) do
{ :os => { :family => 'RedHat' } }
end

it 'using sysvinit' do
is_expected.to run.with_params(distribution, version, 'standalone', 'sysvinit').and_return('service_name' => 'wildfly', 'conf_file' => '/etc/default/wildfly.conf', 'service_file' => 'bin/init.d/wildfly-init-redhat.sh', 'conf_template' => 'wildfly/wildfly.sysvinit.conf')
end

it 'using systemd' do
is_expected.to run.with_params(distribution, version, 'standalone', 'systemd').and_return('service_name' => 'wildfly', 'conf_file' => '/etc/default/wildfly.conf', 'service_file' => 'bin/init.d/wildfly-init-redhat.sh', 'conf_template' => 'wildfly/wildfly.sysvinit.conf')
is_expected.to run.with_params(distribution, version, 'standalone').and_return('service_name' => 'wildfly', 'conf_file' => '/etc/wildfly/wildfly.conf', 'conf_template' => 'wildfly/wildfly.systemd.conf', 'service_file' => 'docs/contrib/scripts/init.d/wildfly-init-redhat.sh', 'systemd_template' => 'wildfly/wildfly.systemd.service')
end
end

context 'JBoss EAP 7' do
context 'JBoss EAP 7 and newer' do
let(:distribution) { 'jboss-eap' }
let(:version) { '7.0' }

it 'using sysvinit' do
is_expected.to run.with_params(distribution, version, 'standalone', 'sysvinit').and_return('service_file' => 'bin/init.d/jboss-eap-rhel.sh', 'conf_file' => '/etc/default/jboss-eap.conf', 'service_name' => 'jboss-eap', 'conf_template' => 'wildfly/wildfly.sysvinit.conf')
end

it 'using systemd' do
is_expected.to run.with_params(distribution, version, 'standalone', 'systemd').and_return('service_file' => 'bin/init.d/jboss-eap-rhel.sh', 'conf_file' => '/etc/default/jboss-eap.conf', 'service_name' => 'jboss-eap', 'conf_template' => 'wildfly/wildfly.sysvinit.conf', 'systemd_template' => 'jboss-eap/jboss-eap.systemd.service')
end
end

context 'JBoss EAP 6' do
let(:distribution) { 'jboss-eap' }
let(:version) { '6.4' }

it 'using sysvinit' do
is_expected.to run.with_params(distribution, version, 'standalone', 'sysvinit').and_return('service_file' => 'bin/init.d/jboss-as-standalone.sh', 'conf_file' => '/etc/jboss-as/jboss-as.conf', 'service_name' => 'jboss-as', 'conf_template' => 'wildfly/wildfly.sysvinit.conf')
end

it 'using systemd' do
is_expected.to run.with_params(distribution, version, 'standalone', 'systemd').and_return('service_file' => 'bin/init.d/jboss-as-standalone.sh', 'conf_file' => '/etc/jboss-as/jboss-as.conf', 'service_name' => 'jboss-as', 'conf_template' => 'wildfly/wildfly.sysvinit.conf')
is_expected.to run.with_params(distribution, version, 'standalone').and_return('service_file' => 'bin/init.d/jboss-eap-rhel.sh', 'conf_file' => '/etc/default/jboss-eap.conf', 'service_name' => 'jboss-eap', 'conf_template' => 'wildfly/wildfly.sysvinit.conf', 'systemd_template' => 'jboss-eap/jboss-eap.systemd.service')
end
end
end
Loading