Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
slapos.toolbox
Commits
beaae534
Commit
beaae534
authored
Jan 26, 2015
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runner: do not remove whole instance root directory, but only instance home directories.
parent
8fbf647f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
slapos/runner/utils.py
slapos/runner/utils.py
+14
-7
No files found.
slapos/runner/utils.py
View file @
beaae534
...
@@ -11,6 +11,7 @@ import os
...
@@ -11,6 +11,7 @@ import os
import
sup_process
import
sup_process
import
re
import
re
import
shutil
import
shutil
import
stat
import
thread
import
thread
import
time
import
time
import
urllib
import
urllib
...
@@ -464,13 +465,19 @@ def removeInstanceRoot(config):
...
@@ -464,13 +465,19 @@ def removeInstanceRoot(config):
"""Clean instance directory and stop all its running processes"""
"""Clean instance directory and stop all its running processes"""
if
os
.
path
.
exists
(
config
[
'instance_root'
]):
if
os
.
path
.
exists
(
config
[
'instance_root'
]):
svcStopAll
(
config
)
svcStopAll
(
config
)
for
root
,
dirs
,
_
in
os
.
walk
(
config
[
'instance_root'
]):
for
instance_directory
in
os
.
listdir
(
config
[
'instance_root'
]):
for
fname
in
dirs
:
instance_directory
=
os
.
path
.
join
(
config
[
'instance_root'
],
instance_directory
)
fullPath
=
os
.
path
.
join
(
root
,
fname
)
# XXX: hardcoded
if
not
os
.
access
(
fullPath
,
os
.
W_OK
):
if
stat
.
S_ISSOCK
(
os
.
stat
(
instance_directory
).
st_mode
)
or
os
.
path
.
isfile
(
instance_directory
):
# Some directories may be read-only, preventing to remove files in it
# Ignore non-instance related files
os
.
chmod
(
fullPath
,
0744
)
continue
shutil
.
rmtree
(
config
[
'instance_root'
])
for
root
,
dirs
,
_
in
os
.
walk
(
instance_directory
):
for
fname
in
dirs
:
fullPath
=
os
.
path
.
join
(
root
,
fname
)
if
not
os
.
access
(
fullPath
,
os
.
W_OK
):
# Some directories may be read-only, preventing to remove files in it
os
.
chmod
(
fullPath
,
0744
)
shutil
.
rmtree
(
instance_directory
)
def
getSvcStatus
(
config
):
def
getSvcStatus
(
config
):
...
...
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