Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
argotk
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
argo
argotk
Commits
8b473ff2
Commit
8b473ff2
authored
Mar 07, 2019
by
Valentin Reis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean_config management simplified.
parent
88c18e58
Pipeline
#5920
passed with stages
in 2 minutes and 20 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
45 deletions
+27
-45
Stack.hs
src/Argo/Stack.hs
+27
-45
No files found.
src/Argo/Stack.hs
View file @
8b473ff2
...
...
@@ -60,17 +60,27 @@ prepareDaemon
->
PowerCap
->
Shell
Instrumentation
prepareDaemon
out
stdErr
test
v
powercap
=
do
_
<-
myWhich
"daemon"
daemonPath
<-
myWhich
"daemon"
let
confPath'
=
"/tmp/argo_nodeos_config"
cleanContainers
confPath'
1
2
cleanContainers
confPath'
export
"ARGO_NODEOS_CONFIG"
(
format
fp
confPath'
)
return
$
Instrumentation
(
P
.
proc
"daemon"
([
"--nrm_log"
,
"./nrm_log"
]
++
toOption
v
++
toOption
powercap
)
)
out
stdErr
test
return
$
case
powercap
of
None
->
Instrumentation
(
P
.
proc
"daemon"
([
"--nrm_log"
,
"./nrm_log"
]
++
toOption
v
))
out
stdErr
test
_
->
Instrumentation
(
P
.
proc
"sudo"
(
[
encodeString
daemonPath
,
"--nrm_log"
,
"./nrm_log"
]
++
toOption
v
++
toOption
powercap
)
)
out
stdErr
test
where
nodeOsFailure
n
=
do
printError
(
"argo_nodeos_config failed with exit code :"
<>
repr
n
)
...
...
@@ -79,43 +89,15 @@ prepareDaemon out stdErr test v powercap = do
printInfo
"Contents of .argo_nodeos_config_exit_message: "
view
$
input
".argo_nodeos_config_exit_message"
False
->
die
(
"argo_nodeos_config failed with exit code "
<>
repr
n
)
cleanContainers
::
FilePath
->
NominalDiffTime
->
Integer
->
Shell
()
cleanContainers
argo_nodeos_config
retryTime
remainingRetries
=
do
let
showConfig
=
inshell
(
format
(
fp
%
" --show_config"
)
argo_nodeos_config
)
empty
cleanContainers
::
FilePath
->
Shell
()
cleanContainers
argo_nodeos_config
=
verboseShell'
(
format
(
fp
%
" --clean_config=kill_content:true"
)
argo_nodeos_config
)
empty
>>=
\
case
(
ExitFailure
n
,
_
,
_
)
->
do
when
(
remainingRetries
==
0
)
$
nodeOsFailure
n
printWarning
(
"the argo_nodeos_config call failed with exit code "
<>
repr
n
<>
". Retrying.."
)
liftIO
$
sleep
(
retryTime
*
2
)
cleanContainers
argo_nodeos_config
(
retryTime
*
2
)
(
remainingRetries
-
1
)
(
ExitSuccess
,
_
,
_
)
->
do
printInfo
"Cleaned the argo config."
len
<-
liftIO
$
Turtle
.
Shell
.
fold
(
grep
(
has
"CONTAINER"
)
showConfig
)
Fold
.
length
if
len
>
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."
(
format
(
"sudo"
%
fp
%
" --clean_config=kill_content:true"
)
argo_nodeos_config
)
empty
>>=
\
case
(
ExitFailure
n
,
_
,
_
)
->
nodeOsFailure
n
(
ExitSuccess
,
_
,
_
)
->
return
()
cmdRunI
::
AppName
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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