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
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
Léo-Paul Géneau
slapos
Commits
4247d91d
Commit
4247d91d
authored
Mar 12, 2012
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New wrapper system allowing to fetch informations from instances and stop/delete instance
parent
a80a8be2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
83 additions
and
22 deletions
+83
-22
slapos/recipe/occi/__init__.py
slapos/recipe/occi/__init__.py
+9
-7
slapos/recipe/occi/accords.py
slapos/recipe/occi/accords.py
+74
-0
slapos/recipe/occi/template/accords.in
slapos/recipe/occi/template/accords.in
+0
-13
stack/occi/buildout.cfg
stack/occi/buildout.cfg
+0
-1
stack/occi/instance-occi.cfg
stack/occi/instance-occi.cfg
+0
-1
No files found.
slapos/recipe/occi/__init__.py
View file @
4247d91d
...
...
@@ -24,12 +24,12 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import
os
import
shutil
from
slapos.recipe.librecipe
import
Generic
Base
Recipe
from
slapos.recipe.librecipe
import
Generic
Slap
Recipe
from
subprocess
import
Popen
import
sys
class
Recipe
(
Generic
Base
Recipe
):
class
Recipe
(
Generic
Slap
Recipe
):
def
install
(
self
):
path_list
=
[]
poc_location
=
self
.
buildout
[
'pocdirectory'
][
'poc'
]
...
...
@@ -69,13 +69,15 @@ class Recipe(GenericBaseRecipe):
# Generate wrapper
wrapper_config_dict
=
dict
(
dash_location
=
self
.
options
[
'dash-location'
]
,
python_location
=
sys
.
executable
,
poc_location
=
poc_location
,
manifest_name
=
self
.
options
[
'manifest-name'
],
# XXX this is workaround
accords_lib_directory
=
self
.
options
[
'accords_lib_directory'
])
path_list
.
append
(
self
.
createExecutable
(
self
.
options
[
'accords'
],
self
.
substituteTemplate
(
self
.
getTemplateFilename
(
'accords.in'
),
wrapper_config_dict
)))
wrapper_location
=
self
.
createPythonScript
(
self
.
options
[
'accords'
],
'%s.accords.runAccords'
%
__name__
,
wrapper_config_dict
)
path_list
.
append
(
wrapper_location
)
return
path_list
slapos/recipe/occi/accords.py
0 → 100644
View file @
4247d91d
#!%(python_location)s
##############################################################################
#
# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from
slapos
import
slap
import
signal
from
subprocess
import
Popen
import
time
def
runAccords
(
args
):
"""Launch ACCORDS, parse manifest, broker manifest, send connection
informations to SlapOS Master. Destroy instance and stops ACCORDS at
SIGTERM."""
computer_id
,
computer_partition_id
,
server_url
,
software_release_url
,
\
key_file
,
cert_file
,
\
accords_lib_directory
,
poc_location
,
manifest_name
=
args
environment
=
dict
(
LD_LIBRARY_PATH
=
accords_lib_directory
,
)
# Set handler to stop ACCORDS when end of world comes
def
sigtermHandler
(
signum
,
frame
):
Popen
([
'./co-command'
,
'stop'
,
'/service/*'
],
cwd
=
poc_location
,
env
=
environment
).
communicate
()
Popen
([
'./co-stop'
],
cwd
=
poc_location
,
env
=
environment
).
communicate
()
signal
.
signal
(
signal
.
SIGTERM
,
sigtermHandler
)
# Launch ACCORDS, parse & broke manifest to deploy instance
Popen
([
'./co-start'
],
cwd
=
poc_location
,
env
=
environment
).
communicate
()
Popen
([
'./co-parser'
,
manifest_name
],
cwd
=
poc_location
,
env
=
environment
).
communicate
()
Popen
([
'./co-broker'
,
manifest_name
],
cwd
=
poc_location
,
env
=
environment
).
communicate
()
# Parse answer
# XXX
# Send information about published service to SlapOS Master
slap_connection
=
slap
.
slap
()
slap_connection
.
initializeConnection
(
server_url
,
key_file
,
cert_file
)
computer_partition
=
slap_connection
.
registerComputerPartition
(
computer_id
,
computer_partition_id
)
computer_partition
.
setConnectionDict
()
# Go to sleep, wait kill
while
(
True
):
time
.
sleep
(
60
)
\ No newline at end of file
slapos/recipe/occi/template/accords.in
deleted
100644 → 0
View file @
a80a8be2
#!%(dash_location)s
#Workaround
LD_LIBRARY_PATH=%(accords_lib_directory)s
POC=%(poc_location)s
MANIFEST=%(manifest_name)s
cd $POC
./co-start
./co-parser $MANIFEST
./co-broker $MANIFEST
stack/occi/buildout.cfg
View file @
4247d91d
[buildout]
extends =
../../component/dash/buildout.cfg
../../component/dcron/buildout.cfg
../../component/logrotate/buildout.cfg
../../component/occi/buildout.cfg
...
...
stack/occi/instance-occi.cfg
View file @
4247d91d
...
...
@@ -29,7 +29,6 @@ accords-configuration-file = $${pocdirectory:poc}/accords.ini
manifest-source = ${occi-manifest:target}
manifest-destination = $${pocdirectory:poc}/manifest.xml
manifest-name = $${pocdirectory:poc}/manifest.xml
dash-location = ${dash:location}/bin/dash
# Workaround
accords_lib_directory : ${accords:location}/lib
...
...
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