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
Boxiang Sun
slapos
Commits
b7c1d8bb
Commit
b7c1d8bb
authored
Jul 26, 2012
by
Antoine Catton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add slapcontainer.promise recipe
parent
00e6958b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
0 deletions
+34
-0
setup.py
setup.py
+1
-0
slapos/recipe/container.py
slapos/recipe/container.py
+33
-0
No files found.
setup.py
View file @
b7c1d8bb
...
@@ -110,6 +110,7 @@ setup(name=name,
...
@@ -110,6 +110,7 @@ setup(name=name,
'siptester = slapos.recipe.siptester:SipTesterRecipe'
,
'siptester = slapos.recipe.siptester:SipTesterRecipe'
,
'simplelogger = slapos.recipe.simplelogger:Recipe'
,
'simplelogger = slapos.recipe.simplelogger:Recipe'
,
'slapcontainer = slapos.recipe.container:Recipe'
,
'slapcontainer = slapos.recipe.container:Recipe'
,
'slapcontainer.promise = slapos.recipe.container:Promise'
,
'slaprunner = slapos.recipe.slaprunner:Recipe'
,
'slaprunner = slapos.recipe.slaprunner:Recipe'
,
'slapmonitor = slapos.recipe.slapmonitor:Recipe'
,
'slapmonitor = slapos.recipe.slapmonitor:Recipe'
,
'slapreport = slapos.recipe.slapreport:Recipe'
,
'slapreport = slapos.recipe.slapreport:Recipe'
,
...
...
slapos/recipe/container.py
View file @
b7c1d8bb
...
@@ -26,6 +26,9 @@
...
@@ -26,6 +26,9 @@
##############################################################################
##############################################################################
import
ConfigParser
import
ConfigParser
import
uuid
import
os
import
subprocess
# XXX : This is in order to get the computer_partition object
# XXX : This is in order to get the computer_partition object
# which exposes the state of the current partition.
# which exposes the state of the current partition.
...
@@ -34,6 +37,36 @@ import ConfigParser
...
@@ -34,6 +37,36 @@ import ConfigParser
# state of the current partition offline. But this is
# state of the current partition offline. But this is
# written to have the most minimal impact.
# written to have the most minimal impact.
from
slapos.recipe.librecipe
import
GenericSlapRecipe
from
slapos.recipe.librecipe
import
GenericSlapRecipe
from
slapos.recipe.librecipe
import
GenericBaseRecipe
def
promise_func
(
args
):
output
=
subprocess
.
check_output
(
[
args
[
'lxc-info'
],
'-n'
,
args
[
'name'
]]
)
if
'RUNNING'
in
output
:
return
0
else
:
return
127
class
Promise
(
GenericBaseRecipe
):
def
install
(
self
):
return
[
self
.
createPythonScript
(
self
.
options
[
'promise'
],
'slapos.recipe.container.promise_func'
,
{
'lxc-info'
:
self
.
options
[
'lxc-info'
],
'name'
:
self
.
options
[
'slapcontainer-name'
]
}
)
]
class
Recipe
(
GenericSlapRecipe
):
class
Recipe
(
GenericSlapRecipe
):
...
...
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