From fe040d1aa9a01e14c882ead7cb09303aef588804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 13 Jan 2022 12:59:43 +0100 Subject: Rewrote mots of nspawn. --- manifests/util/disable_networking.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'manifests/util/disable_networking.pp') 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', -- cgit v1.2.3