diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-01-13 12:59:43 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-01-13 14:23:37 +0100 |
commit | fe040d1aa9a01e14c882ead7cb09303aef588804 (patch) | |
tree | 318e6cdff8aa9138866fc1f0140e37347fe7bf66 /manifests/util/disable_networking.pp | |
parent | Safeguard machined fact. (diff) | |
download | nspawn-fe040d1aa9a01e14c882ead7cb09303aef588804.tar.gz nspawn-fe040d1aa9a01e14c882ead7cb09303aef588804.tar.xz |
Rewrote mots of nspawn.
Diffstat (limited to '')
-rw-r--r-- | manifests/util/disable_networking.pp | 3 |
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', |