Commit 7cea5526 authored by Valentin Reis's avatar Valentin Reis

Fix sudo call in argotk

parent 106eb84e
Pipeline #6136 passed with stages
in 2 minutes and 36 seconds
......@@ -47,6 +47,7 @@ import System.Process.Typed ( readProcessStdout_
, proc
, shell
, setEnv
, setEnvInherit
)
import Text.Show.Pretty
......@@ -57,7 +58,7 @@ cleanLeftovers (WorkingDirectory wd) = do
putText "Cleaning output directory."
runProcess (shell $ toS $ "rm -rf " <> wd) >>= \case
ExitSuccess -> putText "Cleaned output directory"
ExitFailure _ -> putText "Failed running rm -rf on the output directory."
ExitFailure _ -> die "Failed running rm -rf on the output directory."
where
socklist =
[ "/tmp/nrm-downstream-in"
......@@ -97,12 +98,12 @@ prepareDaemon out stdErr test v powercap vars = do
putText "Contents of .argo_nodeos_config_exit_message: "
*> (readFile ".argo_nodeos_config_exit_message" >>= print)
False -> die ("argo_nodeos_config failed with exit code " <> show n)
cleanContainers :: FilePath -> IO ()
cleanContainers :: Text -> IO ()
cleanContainers argo_nodeos_config =
runProcess
(setEnv (castArg <$> vars) $ proc
"sudo"
[argo_nodeos_config, "--clean_config=kill_content:true"]
( proc (toS argo_nodeos_config)
$ toS
<$> [argo_nodeos_config, "--clean_config=kill_content:true"]
)
>>= \case
ExitFailure n -> nodeOsFailure n
......
......@@ -92,7 +92,7 @@ myWhich str =
"" -> die $ "Argo `" <> str <> "` not in $PATH."
p -> printInfo ("Found " <> str <> " at " <> p) $> p
sudoRemoveFile :: (Text -> IO ()) -> Text -> Text -> IO ()
sudoRemoveFile ::(Text -> IO ()) -> Text -> Text -> IO ()
sudoRemoveFile printer desc filePath = do
foundSocket <- doesFileExist $ toS filePath
when foundSocket $ go False
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment