summaryrefslogtreecommitdiff
path: root/manifests/util/disable_networking.pp
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-01-13 23:15:11 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2022-01-13 23:53:26 +0100
commitdfa81fe29a6be169d6ed2803c4bedcd211b16d72 (patch)
tree77bd0d72e5fe48e07b5d7be5f7532b776f9c53ba /manifests/util/disable_networking.pp
parentRewrote mots of nspawn. (diff)
downloadnspawn-dfa81fe29a6be169d6ed2803c4bedcd211b16d72.tar.gz
nspawn-dfa81fe29a6be169d6ed2803c4bedcd211b16d72.tar.xz
Nspawn cleanup.
Diffstat (limited to 'manifests/util/disable_networking.pp')
-rw-r--r--manifests/util/disable_networking.pp14
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