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

Added configuration to enable/disable maintenance with Puppet #170

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
15 changes: 15 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,21 @@
mode => '0755',
}

if $openondemand::maintenance_enabled != undef {
if $openondemand::maintenance_enabled {
$maintenance_enable_ensure = 'file'
} else {
$maintenance_enable_ensure = 'absent'
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if $openondemand::maintenance_enabled != undef {
if $openondemand::maintenance_enabled {
$maintenance_enable_ensure = 'file'
} else {
$maintenance_enable_ensure = 'absent'
}
if $openondemand::maintenance_enabled {
$maintenance_enable_ensure = 'file'
} else {
$maintenance_enable_ensure = 'absent'
}

If it goes from enabled=true to undef the file won't get removed, so probably better to that undef or false will remove the file and true will create the file.

Copy link
Contributor Author

@abujeda abujeda Jan 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I have updated.

I did the check for undef for installations that are managing the maintenance.enable file manually and upgrading to the new puppet version will delete the file automatically if available after the upgrade.

I thought that changing from true to undef and the file not being deleted will be easier to spot and fix.


file { '/etc/ood/maintenance.enable':
ensure => $openondemand::maintenance_enabled,
owner => 'root',
group => 'root',
mode => '0644',
}
}

file { '/etc/ood/config':
ensure => 'directory',
owner => 'root',
Expand Down
3 changes: 3 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
# Source for maintenance index.html
# @param maintenance_content
# Content for maintenance index.html
# @param maintenance_enabled
# Enable maintenance mode in OOD
# @param security_csp_frame_ancestors
# ood_portal.yml security_csp_frame_ancestors
# @param security_strict_transport
Expand Down Expand Up @@ -286,6 +288,7 @@
Array $maintenance_ip_allowlist = [],
Optional[String] $maintenance_source = undef,
Optional[String] $maintenance_content = undef,
Optional[Boolean] $maintenance_enabled = undef,
Optional[Variant[String, Boolean]] $security_csp_frame_ancestors = undef,
Boolean $security_strict_transport = true,
String $lua_root = '/opt/ood/mod_ood_proxy/lib',
Expand Down
Loading