Skip to content

Commit

Permalink
fix handling of undef/empty values
Browse files Browse the repository at this point in the history
  • Loading branch information
fraenki committed Nov 30, 2023
1 parent 8b40533 commit be2855e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,8 @@
}

$_config.each | String $option, Variant[String, Integer, Undef] $value| {
if ($value != '') {
file_line { "set f-upgrade option ${option}":
ensure => 'present',
path => $f_upgrade::config_file,
line => "${option}=\'${$value}\'",
match => "^${option}=",
append_on_no_match => true,
}
} else {
# When $value is set to an empty string, remove the option from
if (($value =~ Undef) or ($value == '')) {
# When no $value is set, remove the option from
# the configuration files.
file_line { "remove f-upgrade option ${option}":
ensure => 'absent',
Expand All @@ -35,6 +27,14 @@
match_for_absence => true,
multiple => true,
}
} else {
file_line { "set f-upgrade option ${option}":
ensure => 'present',
path => $f_upgrade::config_file,
line => "${option}=\'${$value}\'",
match => "^${option}=",
append_on_no_match => true,
}
}
}
}

0 comments on commit be2855e

Please sign in to comment.