summaryrefslogtreecommitdiff
path: root/manifests/util/disable_networking.pp
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-01-13 12:59:43 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2022-01-13 14:23:37 +0100
commitfe040d1aa9a01e14c882ead7cb09303aef588804 (patch)
tree318e6cdff8aa9138866fc1f0140e37347fe7bf66 /manifests/util/disable_networking.pp
parentSafeguard machined fact. (diff)
downloadnspawn-fe040d1aa9a01e14c882ead7cb09303aef588804.tar.gz
nspawn-fe040d1aa9a01e14c882ead7cb09303aef588804.tar.xz
Rewrote mots of nspawn.
Diffstat (limited to '')
-rw-r--r--manifests/util/disable_networking.pp3
1 files changed, 2 insertions, 1 deletions
diff --git a/manifests/util/disable_networking.pp b/manifests/util/disable_networking.pp
index 4a9b31b..ac55951 100644
--- a/manifests/util/disable_networking.pp
+++ b/manifests/util/disable_networking.pp
@@ -3,8 +3,9 @@ define nspawn::util::disable_networking (
String $machine_path = "/var/lib/machines/${machine}",
) {
+ $running = $facts['machined-info'][$machine] != undef and $facts['machined-info'][$machine]['State'] == 'running'
- $cmd = if $facts['machined-info'][$machine]['State'] == 'running' {
+ $cmd = if $running {
[ 'systemctl', '-M', $machine, 'disable', 'networking' ]
} else {
[ 'systemd-nspawn', '-M', $machine, '--quiet',