Skip to content

Commit

Permalink
Merge pull request #316 from EmersonPrado/issue_315
Browse files Browse the repository at this point in the history
Use proper download URLs if Wildfly version >= 25
  • Loading branch information
bastelfreak authored Jan 8, 2024
2 parents 0dabf75 + 4ceaa6a commit 4cc3464
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 11 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* [to 2.0.0](#to-200)
* [to 2.1.0](#to-210)
5. [Usage - Configuration options and additional functionality](#usage)
* [Wildfly 25.0.0](#wildfly-2500)
* [Wildfly 23.0.2](#wildfly-2302)
* [Wildfly 10.1.0](#wildfly-1010)
* [Wildfly 9.0.2](#wildfly-902)
Expand Down Expand Up @@ -149,6 +150,18 @@ This version will no longer stringify values for `wildfly_resource`'s state or s
class { 'wildfly': }
```

### Wildfly 25.0.0

```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',
}
```

### Wildfly 23.0.2

```puppet
Expand Down
7 changes: 4 additions & 3 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,14 @@ Data type:
```puppet
Variant[Pattern[/^file:\/\//],
Pattern[/^puppet:\/\//],
Stdlib::Httpsurl, Stdlib::Httpurl
Stdlib::Httpsurl, Stdlib::Httpurl,
Undef
]
```

Source of Wildfly tarball installer.
Custom source of Wildfly tarball installer. Defaults to standard Wildfly repositories.

Default value: `"http://download.jboss.org/wildfly/${version}.Final/wildfly-${version}.Final.tar.gz"`
Default value: `undef`

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

Expand Down
7 changes: 4 additions & 3 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# @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.
# @param install_source Source of Wildfly tarball installer.
# @param install_source Custom source of Wildfly tarball installer. Defaults to standard Wildfly repositories.
# @param java_home Sets the `JAVA_HOME` for Wildfly.
# @param java_opts Sets `JAVA_OPTS`, allowing to override several Java params, like `Xmx`, `Xms` and `MaxMetaspaceSize`,
# @param java_xmx Sets Java's `-Xmx` parameter.
Expand Down Expand Up @@ -61,8 +61,9 @@
Pattern[/^(\d{1,}\.\d{1,}(\.\d{1,})?$)/] $version = '9.0.2',
Variant[Pattern[/^file:\/\//],
Pattern[/^puppet:\/\//],
Stdlib::Httpsurl, Stdlib::Httpurl
] $install_source = "http://download.jboss.org/wildfly/${version}.Final/wildfly-${version}.Final.tar.gz",
Stdlib::Httpsurl, Stdlib::Httpurl,
Undef
] $install_source = undef,
Wildfly::Distribution $distribution = 'wildfly',
Enum['sysvinit', 'systemd', 'upstart'] $init_system = $facts['initsystem'],
Wildfly::Mode $mode = 'standalone',
Expand Down
10 changes: 8 additions & 2 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@
ensure => $wildfly::package_version,
}
} else {
$install_source = $wildfly::install_source
$install_file = basename($install_source)
$install_file = "wildfly-${wildfly::version}.Final.tar.gz"
$install_source = $wildfly::install_source ? {
undef => versioncmp($wildfly::version, '25.0.0') ? {
-1 => "http://download.jboss.org/wildfly/${wildfly::version}.Final/${install_file}",
default => "https://github.com/wildfly/wildfly/releases/download/${wildfly::version}.Final/${install_file}",
},
default => $wildfly::install_source,
}

file { $wildfly::install_cache_dir:
ensure => 'directory',
Expand Down
24 changes: 23 additions & 1 deletion spec/classes/install_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
context "on #{os}" do
let(:facts) { os_facts }

context 'install wildfly' do
context 'install wildfly default version' do
let :pre_condition do
'class { "wildfly": }'
end
Expand All @@ -27,6 +27,28 @@
end
end

context 'install wildfly 25' do
let :pre_condition do
"class { 'wildfly':
version => '25.0.0',
}"
end

it { is_expected.to contain_class('wildfly::install') }
it { is_expected.to contain_file('/var/cache/wget').with('ensure' => 'directory') }
it do
is_expected.to contain_file('/var/cache/wget/wildfly-25.0.0.Final.tar.gz').with(
'source' => 'https://github.com/wildfly/wildfly/releases/download/25.0.0.Final/wildfly-25.0.0.Final.tar.gz'
)
end
it do
is_expected.to contain_exec('untar wildfly-25.0.0.Final.tar.gz').with(
'command' => 'tar --no-same-owner --no-same-permissions --strip-components=1 -C /opt/wildfly -zxvf /var/cache/wget/wildfly-25.0.0.Final.tar.gz',
'creates' => '/opt/wildfly/jboss-modules.jar'
)
end
end

context 'install wildfly from package' do
let :pre_condition do
"class { 'wildfly':
Expand Down
3 changes: 2 additions & 1 deletion spec/old_spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ def test_data
when /(wildfly):(\d{1,}\.\d{1,}\.\d{1,})/
data['distribution'] = Regexp.last_match(1)
data['version'] = Regexp.last_match(2)
data['install_source'] = "http://download.jboss.org/wildfly/#{data['version']}.Final/wildfly-#{data['version']}.Final.tar.gz"
pkg_path = "wildfly/#{data['version']}.Final/wildfly-#{data['version']}.Final.tar.gz"
data['install_source'] = (data['version'].to_f < 25.0 ? "http://download.jboss.org/#{pkg_path}" : "https://github.com/wildfly/#{pkg_path}")
data['service_name'] = 'wildfly'
when /(jboss-eap):(\d{1,}\.\d{1,})/
data['distribution'] = Regexp.last_match(1)
Expand Down
3 changes: 2 additions & 1 deletion spec/support/acceptance/test_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ def test_data
when /(wildfly):(\d{1,}\.\d{1,}\.\d{1,})/
data['distribution'] = Regexp.last_match(1)
data['version'] = Regexp.last_match(2)
data['install_source'] = "http://download.jboss.org/wildfly/#{data['version']}.Final/wildfly-#{data['version']}.Final.tar.gz"
pkg_path = "wildfly/#{data['version']}.Final/wildfly-#{data['version']}.Final.tar.gz"
data['install_source'] = (data['version'].to_f < 25.0 ? "http://download.jboss.org/#{pkg_path}" : "https://github.com/wildfly/#{pkg_path}")
data['service_name'] = 'wildfly'

when /(jboss-eap):(\d{1,}\.\d{1,})/
Expand Down

0 comments on commit 4cc3464

Please sign in to comment.