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
Boxiang Sun
slapos.toolbox
Commits
ac5da869
Commit
ac5da869
authored
Apr 28, 2014
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runner: try to improve inconsistant function (config_SR_folder)
parent
ba48d9ed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
18 deletions
+26
-18
slapos/runner/utils.py
slapos/runner/utils.py
+26
-18
No files found.
slapos/runner/utils.py
View file @
ac5da869
...
@@ -23,6 +23,7 @@ from slapos.runner.gittools import cloneRepo
...
@@ -23,6 +23,7 @@ from slapos.runner.gittools import cloneRepo
from
slapos.runner.process
import
Popen
,
isRunning
,
killRunningProcess
,
isPidFileProcessRunning
from
slapos.runner.process
import
Popen
,
isRunning
,
killRunningProcess
,
isPidFileProcessRunning
from
slapos.htpasswd
import
HtpasswdFile
from
slapos.htpasswd
import
HtpasswdFile
import
slapos.slap
import
slapos.slap
from
slapos.grid.utils
import
md5digest
# Setup default flask (werkzeug) parser
# Setup default flask (werkzeug) parser
...
@@ -306,9 +307,31 @@ def runSoftwareWithLock(config, lock=True):
...
@@ -306,9 +307,31 @@ def runSoftwareWithLock(config, lock=True):
def
config_SR_folder
(
config
):
def
config_SR_folder
(
config
):
"""Create a symbolik link for each folder in software folder. That allows
"""Create a symbolik link for each folder in software folder. That allows
the user to customize software release folder"""
the user to customize software release folder"""
list
=
[]
# XXX-Marco do not shadow 'list'
config_name
=
'slaprunner.config'
config_name
=
'slaprunner.config'
def
link_to_folder
(
name
,
folder
):
destination
=
os
.
path
.
join
(
config
[
'software_link'
],
name
)
source
=
os
.
path
.
join
(
config
[
'software_root'
],
folder
)
cfg
=
os
.
path
.
join
(
destination
,
config_name
)
#create symlink
if
os
.
path
.
lexists
(
destination
):
os
.
remove
(
destination
)
os
.
symlink
(
source
,
destination
)
#write config file
if
os
.
path
.
exists
(
source
):
with
open
(
cfg
,
'w'
)
as
cf
:
cf
.
write
(
current_project
+
'#'
+
folder
)
# First create the link for current project
current_project
=
open
(
os
.
path
.
join
(
config
[
'etc_dir'
],
".project"
)).
read
()
profile
=
getCurrentSoftwareReleaseProfile
(
config
)
if
current_project
[
-
1
]
==
'/'
:
current_project
=
current_project
[:
-
1
]
name
=
current_project
.
split
(
'/'
)[
-
1
]
md5sum
=
md5digest
(
profile
)
link_to_folder
(
name
,
md5sum
)
# check other links
# XXX-Marco do not shadow 'list'
list
=
[]
for
path
in
os
.
listdir
(
config
[
'software_link'
]):
for
path
in
os
.
listdir
(
config
[
'software_link'
]):
cfg_path
=
os
.
path
.
join
(
config
[
'software_link'
],
path
,
config_name
)
cfg_path
=
os
.
path
.
join
(
config
[
'software_link'
],
path
,
config_name
)
if
os
.
path
.
exists
(
cfg_path
):
if
os
.
path
.
exists
(
cfg_path
):
...
@@ -322,26 +345,11 @@ def config_SR_folder(config):
...
@@ -322,26 +345,11 @@ def config_SR_folder(config):
return
return
if
not
folder_list
:
if
not
folder_list
:
return
return
current_project
=
open
(
os
.
path
.
join
(
config
[
'etc_dir'
],
".project"
)).
read
()
if
current_project
[
-
1
]
==
'/'
:
current_project
=
current_project
[:
-
1
]
name
=
current_project
.
split
(
'/'
)[
-
1
]
for
folder
in
folder_list
:
for
folder
in
folder_list
:
if
folder
in
list
:
if
folder
in
list
:
continue
# this folder is already registered
continue
# this folder is already registered
else
:
else
:
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
config
[
'software_link'
],
name
)):
link_to_folder
(
folder
,
folder
)
destination
=
os
.
path
.
join
(
config
[
'software_link'
],
name
)
else
:
destination
=
os
.
path
.
join
(
config
[
'software_link'
],
folder
)
source
=
os
.
path
.
join
(
config
[
'software_root'
],
folder
)
cfg
=
os
.
path
.
join
(
destination
,
config_name
)
#create symlink
os
.
symlink
(
source
,
destination
)
#write config file
with
open
(
cfg
,
'w'
)
as
cf
:
cf
.
write
(
current_project
+
'#'
+
folder
)
def
loadSoftwareRList
(
config
):
def
loadSoftwareRList
(
config
):
"""Return list (of dict) of Software Release from symbolik SR folder"""
"""Return list (of dict) of Software Release from symbolik SR folder"""
...
...
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