diff options
Diffstat (limited to '')
-rw-r--r-- | manifests/util/disable_networking.pp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/manifests/util/disable_networking.pp b/manifests/util/disable_networking.pp index ac55951..22d431f 100644 --- a/manifests/util/disable_networking.pp +++ b/manifests/util/disable_networking.pp @@ -1,18 +1,20 @@ define nspawn::util::disable_networking ( - String $machine = $name, - String $machine_path = "/var/lib/machines/${machine}", + String $template_name = $name, + String $template_dir = $nspawn::template_dir, + String $template_path = "${template_dir}/${template_name}.base", ) { - $running = $facts['machined-info'][$machine] != undef and $facts['machined-info'][$machine]['State'] == 'running' + $running = $facts['machined-info'][$template_name] != undef + and $facts['machined-info'][$template_name]['State'] == 'running' $cmd = if $running { - [ 'systemctl', '-M', $machine, 'disable', 'networking' ] + [ 'systemctl', '-M', $template_name, 'disable', 'networking' ] } else { - [ 'systemd-nspawn', '-M', $machine, '--quiet', + [ 'systemd-nspawn', '-M', $template_name, '--quiet', 'systemctl', 'disable', 'networking' ] } - exec { "Disable networking on ${machine}": + exec { "Disable networking on ${template_name}": command => $cmd, path => [ '/bin', '/usr/bin', ], # among others |