Skip to content

Commit 714587b

Browse files
authored
Support OnDemand 4.0 (#169)
* Support OnDemand 4.0 * Support OnDemand 4.0 dependencies Fixes #166 * Change repo_release to default to '4.0' * Remove apache_scls parameter * Remove nginx_stage_scl_env parameter * Add http_redirect_host parameter * No longer support OnDemand 3.0 * Remove all references to SCL , Fixes #167 * Test against 4.0 repo
1 parent 25fee5f commit 714587b

File tree

10 files changed

+86
-188
lines changed

10 files changed

+86
-188
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Manage [Open OnDemand](http://openondemand.org/) installation and configuration.
1919

2020
The following are the versions of this module and the supported versions of Open OnDemand:
2121

22+
* Module 7.x supports OnDemand 4.0 and 3.1
2223
* Module 5.x and 6.x supports Open OnDemand 3.1 and 3.0
2324
* Module 3.x and 4.x supports Open OnDemand 3.0
2425
* Module 2.x supports Open OnDemand 2.x
@@ -34,12 +35,12 @@ All configuration can be done through the `openondemand` class. Example configur
3435
include openondemand
3536
```
3637

37-
Install specific versions of OnDemand from 3.0 repo with OpenID Connect support.
38+
Install specific versions of OnDemand from 3.1 repo with OpenID Connect support.
3839

3940
```yaml
40-
openondemand::repo_release: '3.0'
41-
openondemand::ondemand_package_ensure: "3.0.0-1.el7"
42-
openondemand::mod_auth_openidc_ensure: "3.4.5-1.el7"
41+
openondemand::repo_release: '3.1'
42+
openondemand::ondemand_package_ensure: "3.1.0-1.el9"
43+
openondemand::mod_auth_openidc_ensure: "3.4.5-1.el9"
4344
```
4445
4546
Configure OnDemand SSL certs

manifests/apache.pp

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,17 @@
44
assert_private()
55

66
if $openondemand::declare_apache {
7-
if $openondemand::scl_apache {
8-
class { 'apache::version':
9-
scl_httpd_version => '2.4',
10-
scl_php_version => '7.0',
11-
}
12-
}
137
class { 'apache':
148
default_vhost => false,
159
}
1610
} else {
1711
contain apache
1812
}
1913

20-
if $openondemand::scl_apache {
21-
$package_prefix = 'httpd24-'
22-
} else {
23-
$package_prefix = ''
24-
}
25-
2614
if $facts['os']['family'] == 'RedHat' {
27-
$session_package = "${package_prefix}mod_session"
28-
$proxy_html_package = "${package_prefix}mod_proxy_html"
29-
$openidc_package = "${package_prefix}mod_auth_openidc"
15+
$session_package = 'mod_session'
16+
$proxy_html_package = 'mod_proxy_html'
17+
$openidc_package = 'mod_auth_openidc'
3018
} else {
3119
$session_package = undef
3220
$proxy_html_package = undef
@@ -71,16 +59,6 @@
7159
}
7260
}
7361

74-
if $openondemand::scl_apache {
75-
shellvar { 'HTTPD24_HTTPD_SCLS_ENABLED':
76-
ensure => 'present',
77-
target => '/opt/rh/httpd24/service-environment',
78-
value => $openondemand::apache_scls,
79-
require => Package['httpd'],
80-
notify => Class['Apache::Service'],
81-
}
82-
}
83-
8462
systemd::dropin_file { 'ood.conf':
8563
unit => "${apache::service_name}.service",
8664
content => join([

manifests/config.pp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -315,12 +315,12 @@
315315
}
316316
}
317317

318+
# TODO: Add back once better way to customize this file
318319
file { '/etc/ood/profile':
319-
ensure => 'file',
320-
owner => 'root',
321-
group => 'root',
322-
mode => '0644',
323-
content => template('openondemand/profile.erb'),
320+
ensure => 'absent',
321+
owner => 'root',
322+
group => 'root',
323+
mode => '0644',
324324
}
325325

326326
sudo::conf { 'ood':

manifests/init.pp

Lines changed: 14 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@
3838
# Boolean that determines if apache is declared or included
3939
# @param apache_user
4040
# Name of the Apache user
41-
# @param apache_scls
42-
# SCLs to load when starting Apache service
4341
# @param generator_insecure
4442
# Run ood-portal-generator with --insecure flag
4543
# This is needed if you wish to use default ood@localhost user or
@@ -58,6 +56,8 @@
5856
# ood_portal.yml logroot
5957
# @param use_rewrites
6058
# ood_portal.yml use_rewrites
59+
# @param http_redirect_host
60+
# ood_portal.yml http_redirect_host
6161
# @param use_maintenance
6262
# ood_portal.yml use_maintenance
6363
# @param maintenance_ip_allowlist
@@ -169,8 +169,6 @@
169169
# nginx_stage.yml pun_custom_env
170170
# @param nginx_stage_app_root
171171
# nginx_stage.yml app_root
172-
# @param nginx_stage_scl_env
173-
# nginx_stage.yml scl_env
174172
# @param nginx_stage_app_request_regex
175173
# nginx_stage.yml app_request_regex
176174
# @param nginx_stage_min_uid
@@ -248,7 +246,7 @@
248246
#
249247
class openondemand (
250248
# repos
251-
String $repo_release = '3.1',
249+
String $repo_release = '4.0',
252250
Variant[Stdlib::HTTPSUrl, Stdlib::HTTPUrl]
253251
$repo_baseurl_prefix = 'https://yum.osc.edu/ondemand',
254252
Variant[Stdlib::HTTPSUrl, Stdlib::HTTPUrl, Stdlib::Absolutepath]
@@ -273,7 +271,6 @@
273271
# Apache
274272
Boolean $declare_apache = true,
275273
String[1] $apache_user = 'apache',
276-
String $apache_scls = 'httpd24',
277274

278275
# ood_portal.yml
279276
Boolean $generator_insecure = false,
@@ -284,6 +281,7 @@
284281
Boolean $disable_logs = false,
285282
String $logroot = 'logs',
286283
Boolean $use_rewrites = true,
284+
String $http_redirect_host = '%{HTTP_HOST}',
287285
Boolean $use_maintenance = true,
288286
Array $maintenance_ip_allowlist = [],
289287
Optional[String] $maintenance_source = undef,
@@ -347,7 +345,6 @@
347345
Optional[String] $nginx_stage_ondemand_title = undef,
348346
Hash $nginx_stage_pun_custom_env = {},
349347
Openondemand::Nginx_stage_namespace_config $nginx_stage_app_root = {},
350-
String $nginx_stage_scl_env = 'ondemand',
351348
Optional[Openondemand::Nginx_stage_namespace_config] $nginx_stage_app_request_regex = undef,
352349
Integer $nginx_stage_min_uid = 1000,
353350
Integer $nginx_stage_passenger_pool_idle_time = 300,
@@ -402,46 +399,23 @@
402399
$osname = $facts.dig('os', 'name')
403400
$osmajor = $facts.dig('os', 'release', 'major')
404401

405-
$supported = ['RedHat-7','RedHat-8','RedHat-9','RedHat-2023','Debian-20.04','Debian-22.04','Debian-24.04','Debian-12']
402+
$supported = ['RedHat-8','RedHat-9','RedHat-2023','Debian-20.04','Debian-22.04','Debian-24.04','Debian-12']
406403
$os = "${osfamily}-${osmajor}"
407404
if ! ($os in $supported) {
408405
fail("Unsupported OS: module ${module_name}. osfamily=${osfamily} osmajor=${osmajor} detected")
409406
}
410407

411-
# Handle unsupported distro and OnDemand combos
412408
if $repo_release == '3.1' {
413-
if "${osfamily}-${osmajor}" == 'RedHat-7' {
414-
fail('EL7 is not supported with OnDemand 3.1')
409+
# Debian 12 and Ubuntu 24.04 in OnDemand 3.1 use OS NodeJS
410+
if (String($openondemand::osmajor) in ['12', '24.04']) {
411+
$nodejs = undef
412+
} else {
413+
$nodejs = '18'
415414
}
416-
}
417-
if $repo_release == '3.0' {
418-
if "${osname}-${osmajor}" == 'Amazon-2023' {
419-
fail('Amazon 2023 is not supported with OnDemand 3.0')
420-
}
421-
if "${osname}-${osmajor}" == 'Debian-12' {
422-
fail('Debian 12 is not supported with OnDemand 3.0')
423-
}
424-
if "${osname}-${osmajor}" == 'Ubuntu-24.04' {
425-
fail('Ubuntu 24.04 is not supported with OnDemand 3.0')
426-
}
427-
}
428-
429-
if versioncmp($osmajor, '7') <= 0 {
430-
$scl_apache = true
431-
} else {
432-
$scl_apache = false
433-
}
434-
435-
# EL9 only has these two versions at this time
436-
if $repo_release == '3.0' and "${osfamily}-${osmajor}" == 'RedHat-9' {
437-
$nodejs = 'absent'
438-
$ruby = 'absent'
439-
} elsif $repo_release == '3.0' {
440-
$nodejs = '14'
441-
$ruby = '3.0'
442-
} else {
443-
$nodejs = '18'
444415
$ruby = '3.1'
416+
} else {
417+
$nodejs = '20'
418+
$ruby = '3.3'
445419
}
446420

447421
if $selinux {
@@ -539,6 +513,7 @@
539513
'disable_logs' => $disable_logs,
540514
'logroot' => $logroot,
541515
'use_rewrites' => $use_rewrites,
516+
'http_redirect_host' => $http_redirect_host,
542517
'use_maintenance' => $use_maintenance,
543518
'maintenance_ip_allowlist' => $maintenance_ip_allowlist,
544519
'security_csp_frame_ancestors' => $security_csp_frame_ancestors,

manifests/repo/apt.pp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
},
2626
}
2727

28-
# Debian 12 has NodeJS 18 in OS repos
29-
if ! (String($openondemand::osmajor) in ['12', '24.04']) and $openondemand::nodejs == '18' {
28+
if $openondemand::nodejs == '18' {
3029
apt::source { 'nodesource':
3130
ensure => 'present',
3231
location => 'https://deb.nodesource.com/node_18.x',
@@ -39,15 +38,15 @@
3938
}
4039
}
4140

42-
if $openondemand::nodejs == '14' {
41+
if $openondemand::nodejs == '20' {
4342
apt::source { 'nodesource':
4443
ensure => 'present',
45-
location => 'https://deb.nodesource.com/node_14.x',
44+
location => 'https://deb.nodesource.com/node_20.x',
4645
repos => 'main',
47-
release => $facts['os']['distro']['codename'],
46+
release => 'nodistro',
4847
key => {
49-
'id' => '9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280',
50-
'source' => 'https://deb.nodesource.com/gpgkey/nodesource.gpg.key',
48+
'id' => '6F71F525282841EEDAF851B42F59B5F99B1BE0B4',
49+
'source' => 'https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key',
5150
},
5251
}
5352
}

manifests/repo/rpm.pp

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -40,38 +40,18 @@
4040
module_hotfixes => $openondemand::repo_module_hotfixes,
4141
}
4242

43-
if versioncmp($openondemand::osmajor, '8') >= 0 {
44-
# Work around a bug where 'dnf module list' is not executed with -y
45-
exec { 'dnf makecache ondemand-web':
46-
path => '/usr/bin:/bin:/usr/sbin:/sbin',
47-
command => "dnf -q makecache -y --disablerepo='*' --enablerepo='ondemand-web'",
48-
refreshonly => true,
49-
subscribe => Yumrepo['ondemand-web'],
50-
}
43+
# Work around a bug where 'dnf module list' is not executed with -y
44+
exec { 'dnf makecache ondemand-web':
45+
path => '/usr/bin:/bin:/usr/sbin:/sbin',
46+
command => "dnf -q makecache -y --disablerepo='*' --enablerepo='ondemand-web'",
47+
refreshonly => true,
48+
subscribe => Yumrepo['ondemand-web'],
5149
}
5250

5351
if $openondemand::manage_epel {
5452
contain epel
5553
}
5654

57-
if versioncmp($openondemand::osmajor, '7') == 0 and $openondemand::manage_dependency_repos {
58-
case $facts['os']['name'] {
59-
'RedHat': {
60-
rh_repo { "rhel-server-rhscl-${openondemand::osmajor}-rpms":
61-
ensure => 'present',
62-
}
63-
}
64-
'CentOS': {
65-
package { 'centos-release-scl':
66-
ensure => 'installed',
67-
}
68-
}
69-
default: {
70-
# Do nothing
71-
}
72-
}
73-
}
74-
7555
if String($openondemand::osmajor) in ['8', '9'] and $openondemand::manage_dependency_repos {
7656
package { 'nodejs':
7757
ensure => $openondemand::nodejs,

spec/shared_examples/repo_apt.rb

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
it do
55
is_expected.to contain_apt__source('ondemand-web').with(
66
ensure: 'present',
7-
location: 'https://apt.osc.edu/ondemand/3.1/web/apt',
7+
location: 'https://apt.osc.edu/ondemand/4.0/web/apt',
88
repos: 'main',
99
release: facts[:os]['distro']['codename'],
1010
key: {
@@ -27,37 +27,37 @@
2727
)
2828
end
2929

30-
if facts[:os]['release']['major'].to_i != 12 && facts[:os]['release']['major'].to_s != '24.04'
31-
it do
32-
is_expected.to contain_apt__source('nodesource').with(
33-
ensure: 'present',
34-
location: 'https://deb.nodesource.com/node_18.x',
35-
repos: 'main',
36-
release: 'nodistro',
37-
key: {
38-
'id' => '6F71F525282841EEDAF851B42F59B5F99B1BE0B4',
39-
'source' => 'https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key',
40-
},
41-
)
42-
end
43-
else
44-
it { is_expected.not_to contain_apt__source('nodesource') }
30+
it do
31+
is_expected.to contain_apt__source('nodesource').with(
32+
ensure: 'present',
33+
location: 'https://deb.nodesource.com/node_20.x',
34+
repos: 'main',
35+
release: 'nodistro',
36+
key: {
37+
'id' => '6F71F525282841EEDAF851B42F59B5F99B1BE0B4',
38+
'source' => 'https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key',
39+
},
40+
)
4541
end
4642

47-
context 'when repo_release => 3.0', if: facts[:os]['release']['major'].to_i != 12 && facts[:os]['release']['major'].to_s != '24.04' do
48-
let(:params) { { repo_release: '3.0' } }
43+
context 'when repo_release => 3.1' do
44+
let(:params) { { repo_release: '3.1' } }
4945

50-
it do
51-
is_expected.to contain_apt__source('nodesource').with(
52-
ensure: 'present',
53-
location: 'https://deb.nodesource.com/node_14.x',
54-
repos: 'main',
55-
release: facts[:os]['distro']['codename'],
56-
key: {
57-
'id' => '9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280',
58-
'source' => 'https://deb.nodesource.com/gpgkey/nodesource.gpg.key',
59-
},
60-
)
46+
if facts[:os]['release']['major'].to_i != 12 && facts[:os]['release']['major'].to_s != '24.04'
47+
it do
48+
is_expected.to contain_apt__source('nodesource').with(
49+
ensure: 'present',
50+
location: 'https://deb.nodesource.com/node_18.x',
51+
repos: 'main',
52+
release: 'nodistro',
53+
key: {
54+
'id' => '6F71F525282841EEDAF851B42F59B5F99B1BE0B4',
55+
'source' => 'https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key',
56+
},
57+
)
58+
end
59+
else
60+
it { is_expected.not_to contain_apt__source('nodesource') }
6161
end
6262
end
6363

0 commit comments

Comments
 (0)