Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
slapos
Commits
b4186836
Commit
b4186836
authored
Oct 31, 2012
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use check_call
parent
42a64bd0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
slapos/recipe/accords/accords.py
slapos/recipe/accords/accords.py
+13
-9
No files found.
slapos/recipe/accords/accords.py
View file @
b4186836
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
import
os
import
os
from
slapos
import
slap
from
slapos
import
slap
import
signal
import
signal
import
subprocess
from
subprocess
import
Popen
from
subprocess
import
Popen
import
sys
import
sys
import
time
import
time
...
@@ -44,32 +45,35 @@ def runAccords(accords_conf):
...
@@ -44,32 +45,35 @@ def runAccords(accords_conf):
key_file
=
accords_conf
[
'key_file'
]
key_file
=
accords_conf
[
'key_file'
]
cert_file
=
accords_conf
[
'cert_file'
]
cert_file
=
accords_conf
[
'cert_file'
]
accords_lib_directory
=
accords_conf
[
'accords_lib_directory'
]
accords_lib_directory
=
accords_conf
[
'accords_lib_directory'
]
poc_location
=
accords_conf
[
'poc
_location'
]
accords_location
=
accords_conf
[
'accords
_location'
]
manifest_name
=
accords_conf
[
'manifest_name'
]
manifest_name
=
accords_conf
[
'manifest_name'
]
environment
=
dict
(
environment
=
dict
(
LD_LIBRARY_PATH
=
accords_lib_directory
,
LD_LIBRARY_PATH
=
accords_lib_directory
,
PATH
=
accords_conf
[
'path'
],
PATH
=
accords_conf
[
'path'
],
HOME
=
accords_location
,
)
)
# Set handler to stop ACCORDS when end of world comes
# Set handler to stop ACCORDS when end of world comes
# XXX use subprocess.check_call and add exception handlers
def
sigtermHandler
(
signum
,
frame
):
def
sigtermHandler
(
signum
,
frame
):
Popen
([
'./co-command'
,
'stop'
,
'/service/*'
],
Popen
([
'./co-command'
,
'stop'
,
'/service/*'
],
cwd
=
poc
_location
,
env
=
environment
).
communicate
()
cwd
=
accords
_location
,
env
=
environment
).
communicate
()
Popen
([
'./co-stop'
],
Popen
([
'./co-stop'
],
cwd
=
poc
_location
,
env
=
environment
).
communicate
()
cwd
=
accords
_location
,
env
=
environment
).
communicate
()
sys
.
exit
(
0
)
sys
.
exit
(
0
)
signal
.
signal
(
signal
.
SIGTERM
,
sigtermHandler
)
signal
.
signal
(
signal
.
SIGTERM
,
sigtermHandler
)
# Launch ACCORDS, parse & broke manifest to deploy instance
# Launch ACCORDS, parse & broke manifest to deploy instance
Popen
([
'./co-start'
],
cwd
=
poc_location
,
env
=
environment
).
communicate
()
print
'Starting ACCORDS and friends...'
subprocess
.
check_call
([
'./co-start'
],
cwd
=
accords_location
,
env
=
environment
)
print
'Parsing manifest...'
print
'Parsing manifest...'
Popen
([
'./co-parser'
,
manifest_name
],
subprocess
.
check_call
([
'./co-parser'
,
manifest_name
],
cwd
=
poc_location
,
env
=
environment
).
communicate
(
)
cwd
=
accords_location
,
env
=
environment
)
print
'Brokering manifest...'
print
'Brokering manifest...'
Popen
([
'./co-broker'
,
manifest_name
],
subprocess
.
check_call
([
'./co-broker'
,
manifest_name
],
cwd
=
poc_location
,
env
=
environment
).
communicate
(
)
cwd
=
accords_location
,
env
=
environment
)
print
'Done.'
print
'Done.'
# Parse answer
# Parse answer
...
...
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