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
Ophélie Gagnard
slapos
Commits
5d1f1cd7
Commit
5d1f1cd7
authored
Feb 25, 2013
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add publishsection recipe.
parent
fef06bdf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
setup.py
setup.py
+1
-0
slapos/recipe/publish.py
slapos/recipe/publish.py
+25
-0
No files found.
setup.py
View file @
5d1f1cd7
...
...
@@ -154,6 +154,7 @@ setup(name=name,
'proactive = slapos.recipe.proactive:Recipe'
,
'publish = slapos.recipe.publish:Recipe'
,
'publish.serialised = slapos.recipe.publish:Serialised'
,
'publishsection = slapos.recipe.publish:PublishSection'
,
'publishurl = slapos.recipe.publishurl:Recipe'
,
'pwgen = slapos.recipe.pwgen:Recipe'
,
'pwgen.stable = slapos.recipe.pwgen:StablePasswordGeneratorRecipe'
,
...
...
slapos/recipe/publish.py
View file @
5d1f1cd7
...
...
@@ -28,6 +28,8 @@ import zc.buildout
from
slapos.recipe.librecipe
import
wrap
from
slapos.recipe.librecipe
import
GenericSlapRecipe
CONNECTION_PARAMETER_STRING
=
'connection-'
class
Recipe
(
GenericSlapRecipe
):
def
_install
(
self
):
publish_dict
=
dict
()
...
...
@@ -47,3 +49,26 @@ SERIALISED_MAGIC_KEY = '_'
class
Serialised
(
Recipe
):
def
_setConnectionDict
(
self
,
publish_dict
):
return
super
(
Serialised
,
self
).
_setConnectionDict
(
wrap
(
publish_dict
))
class
PublishSection
(
GenericSlapRecipe
):
"""
Take a list of "request" sections, and publish every connection parameter.
Input:
section-list: String, representing the list of sections to fetch
parameters to publish, in order, separated by a space.
"""
def
_install
(
self
):
publish_dict
=
dict
()
for
section
in
self
.
options
[
'section-list'
].
strip
().
split
():
section
=
section
.
strip
()
options
=
self
.
buildout
[
section
].
copy
()
for
k
,
v
in
options
.
iteritems
():
if
k
.
startswith
(
CONNECTION_PARAMETER_STRING
):
print
k
,
v
publish_dict
[
k
.
lstrip
(
CONNECTION_PARAMETER_STRING
)]
=
v
self
.
setConnectionDict
(
publish_dict
)
return
[]
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