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 | |
parent | Safeguard machined fact. (diff) | |
download | nspawn-fe040d1aa9a01e14c882ead7cb09303aef588804.tar.gz nspawn-fe040d1aa9a01e14c882ead7cb09303aef588804.tar.xz |
Rewrote mots of nspawn.
Diffstat (limited to 'manifests/util')
-rw-r--r-- | manifests/util/disable_networking.pp | 3 | ||||
-rw-r--r-- | manifests/util/enable_networkd.pp | 5 |
2 files changed, 4 insertions, 4 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', diff --git a/manifests/util/enable_networkd.pp b/manifests/util/enable_networkd.pp index 8e447b9..f9b4d2e 100644 --- a/manifests/util/enable_networkd.pp +++ b/manifests/util/enable_networkd.pp @@ -3,9 +3,8 @@ define nspawn::util::enable_networkd ( String $machine_path = "/var/lib/machines/${machine}", ) { - # TODO only do this if the directory is empty networking::networkd_instance { "Initial networking on ${machine}": - priority => 50, + priority => 99, filename => 'puppet-initial', path => "${machine_path}/${networking::networkd::path}", content => { @@ -19,7 +18,7 @@ define nspawn::util::enable_networkd ( }, } - $running = $facts['machined-info'][$machine] != Undef or $facts['machined-info'][$machine]['State'] == 'running' + $running = $facts['machined-info'][$machine] != undef and $facts['machined-info'][$machine]['State'] == 'running' $cmd = if $running { [ 'systemctl', '-M', $machine, 'enable', 'systemd-networkd' ] |