propellor spin
This commit is contained in:
parent
3ba82a1c9c
commit
09e79e6263
|
@ -88,9 +88,10 @@ container name system ps = Container name system ps (Host name [] mempty)
|
||||||
nspawned :: Container -> RevertableProperty
|
nspawned :: Container -> RevertableProperty
|
||||||
nspawned c@(Container name system _ h) = RevertableProperty setup teardown
|
nspawned c@(Container name system _ h) = RevertableProperty setup teardown
|
||||||
where
|
where
|
||||||
setup = propertyList ("nspawned " ++ name) (map toProp steps)
|
setup = propertyList ("nspawned " ++ name) $
|
||||||
teardown = propertyList ("not nspawned " ++ name)
|
map toProp steps ++ [containerprovisioned]
|
||||||
(map (toProp . revert) (reverse steps))
|
teardown = propertyList ("not nspawned " ++ name) $
|
||||||
|
map (toProp . revert) (reverse steps)
|
||||||
steps =
|
steps =
|
||||||
[ enterScript c
|
[ enterScript c
|
||||||
, chrootprovisioned
|
, chrootprovisioned
|
||||||
|
@ -141,6 +142,7 @@ enterScript c@(Container name _ _ _) = RevertableProperty setup teardown
|
||||||
, "if [ -n \"$pid\" ]; then"
|
, "if [ -n \"$pid\" ]; then"
|
||||||
, "\tnsenter -p -u -n -i -m -t \"$pid\""
|
, "\tnsenter -p -u -n -i -m -t \"$pid\""
|
||||||
, "else"
|
, "else"
|
||||||
|
, "\techo container not running >&2"
|
||||||
, "\texit 1"
|
, "\texit 1"
|
||||||
, "fi"
|
, "fi"
|
||||||
]
|
]
|
||||||
|
@ -150,7 +152,7 @@ enterScript c@(Container name _ _ _) = RevertableProperty setup teardown
|
||||||
scriptfile = enterScriptFile c
|
scriptfile = enterScriptFile c
|
||||||
|
|
||||||
enterScriptFile :: Container -> FilePath
|
enterScriptFile :: Container -> FilePath
|
||||||
enterScriptFile (Container name _ _ _ ) = "enter-" ++ mungename name
|
enterScriptFile (Container name _ _ _ ) = "/usr/local/bin/enter-" ++ mungename name
|
||||||
|
|
||||||
enterContainerProcess :: Container -> [String] -> CreateProcess
|
enterContainerProcess :: Container -> [String] -> CreateProcess
|
||||||
enterContainerProcess = proc . enterScriptFile
|
enterContainerProcess = proc . enterScriptFile
|
||||||
|
|
Loading…
Reference in New Issue