Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Reis
argotest
Commits
c03f1869
Commit
c03f1869
authored
Dec 20, 2018
by
Valentin Reis
Browse files
[feature] Added a repeating argo_nodeos_config call due to
argo/containers#4
parent
c7cc3f56
Pipeline
#4742
passed with stage
in 41 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
argo/src/Argo/Stack.hs
View file @
c03f1869
...
...
@@ -101,18 +101,7 @@ prepareDaemon sa@StackArgs {..} = do
verboseShell
(
format
(
"sudo chmod u+sw "
%
fp
)
confPath'
)
empty
>>=
\
case
ExitSuccess
->
printInfo
"Set the suid bit.
\n
"
ExitFailure
n
->
die
(
"Setting suid bit failed with exit code "
<>
repr
n
)
verboseShell
(
format
(
fp
%
" --clean_config=kill_content:true"
)
confPath'
)
empty
>>=
\
case
ExitSuccess
->
printInfo
"Cleaned the argo config.
\n
"
ExitFailure
n
->
do
printError
(
"argo_nodeos_config failed with exit code :"
<>
repr
n
<>
"
\n
"
)
testfile
".argo_nodeos_config_exit_message"
>>=
\
case
True
->
do
printInfo
"Contents of .argo_nodeos_config_exit_message:
\n
"
view
$
input
"./argo_nodeos_config_exit_message"
False
->
die
(
"Clean config failed with exit code "
<>
repr
n
)
cleanContainers
confPath'
1
4
export
"ARGO_NODEOS_CONFIG"
(
format
fp
confPath'
)
makeInstrumentedProcess
$
Instrumentation
{
process
=
P
.
proc
"daemon"
[
"--nrm_log"
,
encodeString
nrm_log
]
...
...
@@ -121,6 +110,55 @@ prepareDaemon sa@StackArgs {..} = do
,
messageOut
=
messageDaemonOut
,
messageErr
=
messageDaemonErr
}
where
nodeOsFailure
(
ExitFailure
n
,
_
,
_
)
=
do
printError
(
"argo_nodeos_config failed with exit code :"
<>
repr
n
<>
"
\n
"
)
testfile
".argo_nodeos_config_exit_message"
>>=
\
case
True
->
do
printInfo
"Contents of .argo_nodeos_config_exit_message:
\n
"
view
$
input
"./argo_nodeos_config_exit_message"
False
->
die
(
"argo_nodeos_config failed with exit code "
<>
repr
n
)
cleanContainers
argo_nodeos_config
retryTime
remainingRetries
=
do
let
showConfig
=
inshell
(
format
(
fp
%
" --show_config"
)
argo_nodeos_config
)
empty
(
isClean
::
IO
Bool
)
=
liftIO
(
Turtle
.
Shell
.
fold
(
grep
(
has
"CONTAINER"
)
showConfig
)
Fold
.
length
)
>>=
(
\
x
->
return
$
x
>
5
)
verboseShell'
(
format
(
fp
%
" --clean_config=kill_content:true"
)
argo_nodeos_config
)
empty
>>=
\
case
e
@
(
ExitFailure
n
,
out
,
err
)
->
do
when
(
remainingRetries
==
0
)
$
nodeOsFailure
e
printWarning
(
"the argo_nodeos_config call failed with exit code "
<>
repr
n
<>
". Retrying..
\n
"
)
liftIO
$
sleep
(
retryTime
*
2
)
cleanContainers
argo_nodeos_config
(
retryTime
*
2
)
(
remainingRetries
-
1
)
(
ExitSuccess
,
_
,
_
)
->
do
printInfo
"Cleaned the argo config.
\n
"
l
<-
liftIO
$
Turtle
.
Shell
.
fold
(
grep
(
has
"CONTAINER"
)
showConfig
)
Fold
.
length
if
l
>
0
then
do
printWarning
"the argo_nodeos_config call did not remove containers,
\
\
at least not fast enough. Retrying.."
liftIO
$
sleep
retryTime
cleanContainers
argo_nodeos_config
(
retryTime
*
2
)
(
remainingRetries
-
1
)
else
printInfo
"argo_nodeos_config successfully cleaned the container
\
\
config."
prepareCmdRun
::
StackArgs
->
Shell
(
IO
(
Either
PatternMatched
(
ExitCode
,
()
,
()
)))
...
...
argo/src/Argo/Utils.hs
View file @
c03f1869
...
...
@@ -75,6 +75,9 @@ sudoRemoveFile printer desc filePath = do
verboseShell
::
Text
->
Shell
Line
->
Shell
ExitCode
verboseShell
command
input
=
printCommand
command
>>
shell
command
input
verboseShell'
::
Text
->
Shell
Line
->
Shell
(
ExitCode
,
Text
,
Text
)
verboseShell'
command
input
=
printCommand
command
>>
shellStrictWithErr
command
input
cleanSocket
=
sudoRemoveFile
printError
"socket"
cleanLog
=
sudoRemoveFile
printWarning
"log file"
...
...
argotk/argotk.hs
View file @
c03f1869
...
...
@@ -58,7 +58,7 @@ opts sa = hsubparser
(
runStack
<$>
parseExtendStackArgs
(
sa
{
manifestName
=
"perfwrap.json"
,
app
=
"sleep"
,
args
=
[
"5"
]
,
args
=
[
"
1
5"
]
,
messageDaemonOut
=
Just
"progress"
,
messageDaemonErr
=
Just
"progress"
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment