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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
slapos
Commits
1656059d
Commit
1656059d
authored
Jul 10, 2013
by
Benjamin Blanc
Committed by
Cédric Le Ninivin
Aug 30, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
request, slapconfiguration: Add feature to define and get instance state.
parent
28418882
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
slapos/recipe/request.py
slapos/recipe/request.py
+11
-1
slapos/recipe/slapconfiguration.py
slapos/recipe/slapconfiguration.py
+6
-2
No files found.
slapos/recipe/request.py
View file @
1656059d
...
@@ -88,8 +88,15 @@ class Recipe(object):
...
@@ -88,8 +88,15 @@ class Recipe(object):
installation of request section will fail.
installation of request section will fail.
Possible names depend on requested partition's software type.
Possible names depend on requested partition's software type.
state (optional)
Requested state, default value is "started".
Output:
Output:
See "return" input key.
See "return" input key.
"instance-state"
The current state of the instance.
"requested-state"
The requested state of the instance.
"""
"""
failed
=
None
failed
=
None
...
@@ -112,6 +119,7 @@ class Recipe(object):
...
@@ -112,6 +119,7 @@ class Recipe(object):
))
))
slave
=
options
.
get
(
'slave'
,
'false'
).
lower
()
in
\
slave
=
options
.
get
(
'slave'
,
'false'
).
lower
()
in
\
librecipe
.
GenericBaseRecipe
.
TRUE_VALUES
librecipe
.
GenericBaseRecipe
.
TRUE_VALUES
requested_state
=
options
.
get
(
'state'
,
'started'
)
slap
=
slapmodule
.
slap
()
slap
=
slapmodule
.
slap
()
slap
.
initializeConnection
(
slap
.
initializeConnection
(
options
[
'server-url'
],
options
[
'server-url'
],
...
@@ -129,7 +137,7 @@ class Recipe(object):
...
@@ -129,7 +137,7 @@ class Recipe(object):
try
:
try
:
self
.
instance
=
request
(
software_url
,
software_type
,
self
.
instance
=
request
(
software_url
,
software_type
,
name
,
partition_parameter_kw
=
partition_parameter_kw
,
name
,
partition_parameter_kw
=
partition_parameter_kw
,
filter_kw
=
filter_kw
,
shared
=
slave
)
filter_kw
=
filter_kw
,
shared
=
slave
,
state
=
requested_state
)
return_parameter_dict
=
self
.
_getReturnParameterDict
(
self
.
instance
,
return_parameter_dict
=
self
.
_getReturnParameterDict
(
self
.
instance
,
return_parameters
)
return_parameters
)
if
not
slave
:
if
not
slave
:
...
@@ -153,6 +161,8 @@ class Recipe(object):
...
@@ -153,6 +161,8 @@ class Recipe(object):
except
KeyError
:
except
KeyError
:
if
self
.
failed
is
None
:
if
self
.
failed
is
None
:
self
.
failed
=
param
self
.
failed
=
param
options
[
'requested-state'
]
=
requested_state
options
[
'instance-state'
]
=
self
.
instance
.
getState
()
def
_filterForStorage
(
self
,
partition_parameter_kw
):
def
_filterForStorage
(
self
,
partition_parameter_kw
):
return
partition_parameter_kw
return
partition_parameter_kw
...
...
slapos/recipe/slapconfiguration.py
View file @
1656059d
...
@@ -78,6 +78,8 @@ class Recipe(object):
...
@@ -78,6 +78,8 @@ class Recipe(object):
Partition parameter whose name cannot be represented unambiguously in
Partition parameter whose name cannot be represented unambiguously in
buildout syntax are ignored. They cannot be accessed from buildout syntax
buildout syntax are ignored. They cannot be accessed from buildout syntax
anyway, and are available through "configuration" output key.
anyway, and are available through "configuration" output key.
instance-state
The instance state.
"""
"""
# XXX: used to detect if a configuration key is a valid section key. This
# XXX: used to detect if a configuration key is a valid section key. This
...
@@ -91,10 +93,12 @@ class Recipe(object):
...
@@ -91,10 +93,12 @@ class Recipe(object):
options
.
get
(
'key'
),
options
.
get
(
'key'
),
options
.
get
(
'cert'
),
options
.
get
(
'cert'
),
)
)
parameter_dict
=
slap
.
registerComputerPartition
(
computer_partition
=
slap
.
registerComputerPartition
(
options
[
'computer'
],
options
[
'computer'
],
options
[
'partition'
],
options
[
'partition'
],
).
getInstanceParameterDict
()
)
parameter_dict
=
computer_partition
.
getInstanceParameterDict
()
options
[
'instance-state'
]
=
computer_partition
.
getState
()
# XXX: those are not partition parameters, strictly speaking.
# XXX: those are not partition parameters, strictly speaking.
# Make them available as individual section keys.
# Make them available as individual section keys.
for
his_key
in
(
for
his_key
in
(
...
...
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