Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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.core
Commits
66d4dc2d
Commit
66d4dc2d
authored
Jan 11, 2017
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SlapObject.py: clean cron tasks when deleting a slappart
parent
9a5824ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
slapos/grid/SlapObject.py
slapos/grid/SlapObject.py
+15
-1
No files found.
slapos/grid/SlapObject.py
View file @
66d4dc2d
...
@@ -445,6 +445,10 @@ class Partition(object):
...
@@ -445,6 +445,10 @@ class Partition(object):
gid
=
stat_info
.
st_gid
gid
=
stat_info
.
st_gid
return
(
uid
,
gid
)
return
(
uid
,
gid
)
def
getUserName
(
self
):
"""Returns the name of the owner of partition"""
return
pwd
.
getpwuid
(
self
.
getUserGroupId
()[
0
]).
pw_name
def
addServiceToGroup
(
self
,
partition_id
,
runner_list
,
path
,
extension
=
''
):
def
addServiceToGroup
(
self
,
partition_id
,
runner_list
,
path
,
extension
=
''
):
uid
,
gid
=
self
.
getUserGroupId
()
uid
,
gid
=
self
.
getUserGroupId
()
for
runner
in
runner_list
:
for
runner
in
runner_list
:
...
@@ -739,7 +743,17 @@ class Partition(object):
...
@@ -739,7 +743,17 @@ class Partition(object):
except
psutil
.
TimeoutExpired
as
e
:
except
psutil
.
TimeoutExpired
as
e
:
self
.
logger
.
error
(
"Couldn't kill process %s of destroyed partition %s"
self
.
logger
.
error
(
"Couldn't kill process %s of destroyed partition %s"
%
self
.
instance_path
)
%
self
.
instance_path
)
# Clean user crontab and at jobs
user_crontab_path
=
os
.
path
.
join
(
'/'
,
'var'
,
'spool'
,
'cron'
,
self
.
getUserName
())
if
os
.
path
.
exists
(
user_crontab_path
):
os
.
unlink
(
user_crontab_path
)
at_directory
=
os
.
path
.
join
(
'/'
,
'var'
,
'spool'
,
'atjobs'
)
for
at_file_name
in
os
.
listdir
(
at_directory
):
at_file_path
=
os
.
path
.
join
(
at_directory
,
at_file_name
)
if
uid
==
os
.
stat
(
at_file_path
).
st_uid
:
os
.
unlink
(
at_file_path
)
return
True
return
True
...
...
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