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
Kirill Smelkov
slapos.toolbox
Commits
716109c1
Commit
716109c1
authored
Apr 18, 2020
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runner: Invoke slapos node format instead re-implement the same thing
parent
ecf144ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
40 deletions
+16
-40
slapos/runner/run.py
slapos/runner/run.py
+1
-0
slapos/runner/utils.py
slapos/runner/utils.py
+15
-40
No files found.
slapos/runner/run.py
View file @
716109c1
...
@@ -117,6 +117,7 @@ def serve(config):
...
@@ -117,6 +117,7 @@ def serve(config):
app
.
config
.
update
(
app
.
config
.
update
(
software_log
=
config
.
software_root
.
rstrip
(
'/'
)
+
'.log'
,
software_log
=
config
.
software_root
.
rstrip
(
'/'
)
+
'.log'
,
instance_log
=
config
.
instance_root
.
rstrip
(
'/'
)
+
'.log'
,
instance_log
=
config
.
instance_root
.
rstrip
(
'/'
)
+
'.log'
,
format_log
=
config
.
instance_root
.
rstrip
(
'/'
)
+
'.log'
,
workspace
=
workdir
,
workspace
=
workdir
,
software_link
=
software_link
,
software_link
=
software_link
,
instance_profile
=
'instance.cfg'
,
instance_profile
=
'instance.cfg'
,
...
...
slapos/runner/utils.py
View file @
716109c1
...
@@ -176,44 +176,12 @@ def updateProxy(config):
...
@@ -176,44 +176,12 @@ def updateProxy(config):
Send current Software Release to Slapproxy for compilation and deployment.
Send current Software Release to Slapproxy for compilation and deployment.
"""
"""
startProxy
(
config
)
startProxy
(
config
)
if
not
os
.
path
.
exists
(
config
[
'instance_root'
]):
os
.
mkdir
(
config
[
'instance_root'
])
slap
=
slapos
.
slap
.
slap
()
slap
=
slapos
.
slap
.
slap
()
profile
=
getCurrentSoftwareReleaseProfile
(
config
)
profile
=
getCurrentSoftwareReleaseProfile
(
config
)
slap
.
initializeConnection
(
config
[
'master_url'
])
slap
.
initializeConnection
(
config
[
'master_url'
])
slap
.
registerSupply
().
supply
(
profile
,
computer_guid
=
config
[
'computer_id'
])
slap
.
registerSupply
().
supply
(
profile
,
computer_guid
=
config
[
'computer_id'
])
computer
=
slap
.
registerComputer
(
config
[
'computer_id'
])
prefix
=
'slappart'
runFormatWithLock
(
config
,
lock
=
True
)
slap_config
=
{
'address'
:
config
[
'ipv4_address'
],
'instance_root'
:
config
[
'instance_root'
],
'netmask'
:
'255.255.255.255'
,
'partition_list'
:
[],
'reference'
:
config
[
'computer_id'
],
'software_root'
:
config
[
'software_root'
]
}
for
i
in
range
(
int
(
config
[
'partition_amount'
])):
partition_reference
=
'%s%s'
%
(
prefix
,
i
)
partition_path
=
os
.
path
.
join
(
config
[
'instance_root'
],
partition_reference
)
if
not
os
.
path
.
exists
(
partition_path
):
os
.
mkdir
(
partition_path
)
os
.
chmod
(
partition_path
,
0o750
)
slap_config
[
'partition_list'
].
append
({
'address_list'
:
[
{
'addr'
:
config
[
'ipv4_address'
],
'netmask'
:
'255.255.255.255'
},
{
'addr'
:
config
[
'ipv6_address'
],
'netmask'
:
'ffff:ffff:ffff::'
},
],
'path'
:
partition_path
,
'reference'
:
partition_reference
,
'tap'
:
{
'name'
:
partition_reference
}})
computer
.
updateConfiguration
(
xml_marshaller
.
xml_marshaller
.
dumps
(
slap_config
))
return
True
return
True
...
@@ -293,19 +261,18 @@ def runSlapgridWithLock(config, step, process_name, lock=False):
...
@@ -293,19 +261,18 @@ def runSlapgridWithLock(config, step, process_name, lock=False):
if
sup_process
.
isRunning
(
config
,
process_name
):
if
sup_process
.
isRunning
(
config
,
process_name
):
return
1
return
1
root_folder
=
config
[
"%s_root"
%
step
]
log_file
=
config
[
"%s_log"
%
step
]
log_file
=
config
[
"%s_log"
%
step
]
if
not
os
.
path
.
exists
(
root_folder
):
os
.
mkdir
(
root_folder
)
# XXX Hackish and unreliable
# XXX Hackish and unreliable
if
os
.
path
.
exists
(
log_file
):
if
os
.
path
.
exists
(
log_file
):
os
.
remove
(
log_file
)
os
.
remove
(
log_file
)
if
not
updateProxy
(
config
):
if
step
!=
"format"
and
not
updateProxy
(
config
):
return
1
return
1
if
step
==
'instance'
and
not
requestInstance
(
config
):
if
step
==
'instance'
and
not
requestInstance
(
config
):
return
1
return
1
try
:
try
:
sup_process
.
runProcess
(
config
,
process_name
)
sup_process
.
runProcess
(
config
,
process_name
)
if
lock
:
if
lock
:
...
@@ -313,7 +280,7 @@ def runSlapgridWithLock(config, step, process_name, lock=False):
...
@@ -313,7 +280,7 @@ def runSlapgridWithLock(config, step, process_name, lock=False):
#Saves the current compile software for re-use
#Saves the current compile software for re-use
if
step
==
'software'
:
if
step
==
'software'
:
config_SR_folder
(
config
)
config_SR_folder
(
config
)
return
sup_process
.
returnCode
(
config
,
process_name
)
return
sup_process
.
returnCode
(
config
,
process_name
)
except
xmlrpclib
.
Fault
:
except
xmlrpclib
.
Fault
:
return
1
return
1
...
@@ -334,6 +301,14 @@ def runInstanceWithLock(config, lock=False):
...
@@ -334,6 +301,14 @@ def runInstanceWithLock(config, lock=False):
return
runSlapgridWithLock
(
config
,
'instance'
,
'slapgrid-cp'
,
lock
)
return
runSlapgridWithLock
(
config
,
'instance'
,
'slapgrid-cp'
,
lock
)
def
runFormatWithLock
(
config
,
lock
=
False
):
"""
Use Slapgrid to deploy current Software Release and wait until
deployment is done.
"""
return
runSlapgridWithLock
(
config
,
'format'
,
'slapformat'
,
lock
)
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"""
...
...
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