]> WPIA git - infra.git/commitdiff
fix: wait for systemd socket when lxc starts
authorFelix Dörre <felix@dogcraft.de>
Sat, 22 Dec 2018 17:17:15 +0000 (18:17 +0100)
committerFelix Dörre <felix@dogcraft.de>
Sun, 23 Dec 2018 09:22:24 +0000 (10:22 +0100)
currently there is a race-condition between starting a lxc
and executing the first systemctl-command within.

This change let's the starting container wait until the
socket exists before continuing.

Change-Id: I4828bd317172b887f6fc42d649a39c4d0b593c99

modules/lxc/manifests/init.pp

index 4b7b64222461cc461d0b5f7053b2ae08c3dc3c90..0f4101d8da7aa7dfad0d53aae5190dcfee28e7d3 100644 (file)
@@ -75,9 +75,9 @@ class lxc {
         } -> exec {"lxc-$contname-started":
             path => '/usr/bin',
             refreshonly   => true,
-            refresh   => "/usr/bin/lxc-stop -n $contname ; /usr/bin/lxc-start -dn $contname",
+            refresh   => "/usr/bin/lxc-stop -n $contname ; /usr/bin/lxc-start -dn $contname; /usr/bin/lxc-attach -n $contname -- bash -c 'while ! [[ -S /run/systemd/private ]]; do sleep 1; done'",
         }-> exec {"lxc-$contname-started1":
-            command   => "/usr/bin/lxc-start -dn $contname",
+            command   => "/usr/bin/lxc-start -dn $contname; /usr/bin/lxc-attach -n $contname -- bash -c 'while ! [[ -S /run/systemd/private ]]; do sleep 1; done'",
             unless    => "/usr/bin/[ \"\$(lxc-info -Hsn $contname)\" != \"STOPPED\" ]",
         }
         $dir.each |String $in| {