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

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_ ...@@ -47,6 +47,7 @@ import System.Process.Typed ( readProcessStdout_
, proc , proc
, shell , shell
, setEnv , setEnv
, setEnvInherit
) )
import Text.Show.Pretty import Text.Show.Pretty
...@@ -57,7 +58,7 @@ cleanLeftovers (WorkingDirectory wd) = do ...@@ -57,7 +58,7 @@ cleanLeftovers (WorkingDirectory wd) = do
putText "Cleaning output directory." putText "Cleaning output directory."
runProcess (shell $ toS $ "rm -rf " <> wd) >>= \case runProcess (shell $ toS $ "rm -rf " <> wd) >>= \case
ExitSuccess -> putText "Cleaned output directory" 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 where
socklist = socklist =
[ "/tmp/nrm-downstream-in" [ "/tmp/nrm-downstream-in"
...@@ -97,12 +98,12 @@ prepareDaemon out stdErr test v powercap vars = do ...@@ -97,12 +98,12 @@ prepareDaemon out stdErr test v powercap vars = do
putText "Contents of .argo_nodeos_config_exit_message: " putText "Contents of .argo_nodeos_config_exit_message: "
*> (readFile ".argo_nodeos_config_exit_message" >>= print) *> (readFile ".argo_nodeos_config_exit_message" >>= print)
False -> die ("argo_nodeos_config failed with exit code " <> show n) False -> die ("argo_nodeos_config failed with exit code " <> show n)
cleanContainers :: FilePath -> IO () cleanContainers :: Text -> IO ()
cleanContainers argo_nodeos_config = cleanContainers argo_nodeos_config =
runProcess runProcess
(setEnv (castArg <$> vars) $ proc ( proc (toS argo_nodeos_config)
"sudo" $ toS
[argo_nodeos_config, "--clean_config=kill_content:true"] <$> [argo_nodeos_config, "--clean_config=kill_content:true"]
) )
>>= \case >>= \case
ExitFailure n -> nodeOsFailure n ExitFailure n -> nodeOsFailure n
......
...@@ -92,7 +92,7 @@ myWhich str = ...@@ -92,7 +92,7 @@ myWhich str =
"" -> die $ "Argo `" <> str <> "` not in $PATH." "" -> die $ "Argo `" <> str <> "` not in $PATH."
p -> printInfo ("Found " <> str <> " at " <> p) $> p p -> printInfo ("Found " <> str <> " at " <> p) $> p
sudoRemoveFile :: (Text -> IO ()) -> Text -> Text -> IO () sudoRemoveFile ::(Text -> IO ()) -> Text -> Text -> IO ()
sudoRemoveFile printer desc filePath = do sudoRemoveFile printer desc filePath = do
foundSocket <- doesFileExist $ toS filePath foundSocket <- doesFileExist $ toS filePath
when foundSocket $ go False 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