Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos-caddy
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
Guillaume Hervier
slapos-caddy
Commits
dbb800ee
Commit
dbb800ee
authored
Feb 25, 2013
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add publishsection recipe.
parent
5e3fa69d
Changes
2
Show 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 @
dbb800ee
...
...
@@ -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 @
dbb800ee
...
...
@@ -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