Skip to content

Commit

Permalink
purge env_file if unmanaged
Browse files Browse the repository at this point in the history
The previous version of this code left the file lying around if the
env_vars values were emptied. Proper practice should make sure that
file is garbage-collected if unmanaged.
  • Loading branch information
anarcat committed Feb 23, 2021
1 parent 809b5bb commit 3e555a4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions manifests/daemon.pp
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,19 @@
'none': {}
}

if $init_style == 'none' and $install_method == 'package' {
if $init_style == 'none' and $install_method == 'package' and !$options.empty {
$env_vars_merged = $env_vars + {
'ARGS' => $options,
}
} else {
$env_vars_merged = $env_vars
}

unless $env_vars_merged.empty {
if $env_vars_merged.empty {
file { "${env_file_path}/${name}":
ensure => absent,
}
} else {
file { "${env_file_path}/${name}":
mode => '0644',
owner => 'root',
Expand Down

0 comments on commit 3e555a4

Please sign in to comment.