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
Thomas Leymonerie
slapos.core
Commits
01c6cd7e
Commit
01c6cd7e
authored
Jun 27, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SlapObject: cleaner handling of sr_symlink
parent
a84d4b79
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
12 deletions
+20
-12
slapos/grid/SlapObject.py
slapos/grid/SlapObject.py
+20
-12
No files found.
slapos/grid/SlapObject.py
View file @
01c6cd7e
...
...
@@ -367,14 +367,25 @@ class Partition(object):
'USER'
:
pwd
.
getpwuid
(
uid
).
pw_name
,
}
def
updateSymlink
(
self
,
sr_symlink
,
software_path
):
if
os
.
path
.
lexists
(
sr_symlink
):
if
not
os
.
path
.
islink
(
sr_symlink
):
self
.
logger
.
debug
(
'Not a symlink: %s, has been ignored'
%
sr_symlink
)
@
property
def
software_release_link
(
self
):
return
os
.
path
.
join
(
self
.
instance_path
,
'software_release'
)
def
update_link_to_sr
(
self
):
link
=
self
.
software_release_link
if
os
.
path
.
lexists
(
link
):
if
not
os
.
path
.
islink
(
link
):
self
.
logger
.
debug
(
'Not a symlink: %s, has been ignored'
,
link
)
return
os
.
unlink
(
sr_symlink
)
os
.
symlink
(
software_path
,
sr_symlink
)
os
.
lchown
(
sr_symlink
,
*
self
.
getUserGroupId
())
os
.
unlink
(
link
)
os
.
symlink
(
self
.
software_path
,
link
)
uid
,
gid
=
self
.
getUserGroupId
()
os
.
lchown
(
link
,
uid
,
gid
)
def
remove_link_to_sr
(
self
):
link
=
self
.
software_release_link
if
os
.
path
.
islink
(
link
):
os
.
unlink
(
link
)
def
install
(
self
):
""" Creates configuration file from template in software_path, then
...
...
@@ -388,8 +399,7 @@ class Partition(object):
raise
PathDoesNotExistError
(
'Please create partition directory %s'
%
self
.
instance_path
)
sr_symlink
=
os
.
path
.
join
(
self
.
instance_path
,
'software_release'
)
self
.
updateSymlink
(
sr_symlink
,
self
.
software_path
)
self
.
update_link_to_sr
()
instance_stat_info
=
os
.
stat
(
self
.
instance_path
)
permission
=
stat
.
S_IMODE
(
instance_stat_info
.
st_mode
)
...
...
@@ -599,9 +609,7 @@ class Partition(object):
os
.
unlink
(
f
)
# better to manually remove symlinks because rmtree might choke on them
sr_symlink
=
os
.
path
.
join
(
self
.
instance_path
,
'software_release'
)
if
os
.
path
.
islink
(
sr_symlink
):
os
.
unlink
(
sr_symlink
)
self
.
remove_link_to_sr
()
for
root
,
dirs
,
file_list
in
os
.
walk
(
self
.
instance_path
):
for
directory
in
dirs
:
...
...
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