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
Łukasz Nowak
slapos
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
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 @
dbb800ee
...
@@ -154,6 +154,7 @@ setup(name=name,
...
@@ -154,6 +154,7 @@ setup(name=name,
'proactive = slapos.recipe.proactive:Recipe'
,
'proactive = slapos.recipe.proactive:Recipe'
,
'publish = slapos.recipe.publish:Recipe'
,
'publish = slapos.recipe.publish:Recipe'
,
'publish.serialised = slapos.recipe.publish:Serialised'
,
'publish.serialised = slapos.recipe.publish:Serialised'
,
'publishsection = slapos.recipe.publish:PublishSection'
,
'publishurl = slapos.recipe.publishurl:Recipe'
,
'publishurl = slapos.recipe.publishurl:Recipe'
,
'pwgen = slapos.recipe.pwgen:Recipe'
,
'pwgen = slapos.recipe.pwgen:Recipe'
,
'pwgen.stable = slapos.recipe.pwgen:StablePasswordGeneratorRecipe'
,
'pwgen.stable = slapos.recipe.pwgen:StablePasswordGeneratorRecipe'
,
...
...
slapos/recipe/publish.py
View file @
dbb800ee
...
@@ -28,6 +28,8 @@ import zc.buildout
...
@@ -28,6 +28,8 @@ import zc.buildout
from
slapos.recipe.librecipe
import
wrap
from
slapos.recipe.librecipe
import
wrap
from
slapos.recipe.librecipe
import
GenericSlapRecipe
from
slapos.recipe.librecipe
import
GenericSlapRecipe
CONNECTION_PARAMETER_STRING
=
'connection-'
class
Recipe
(
GenericSlapRecipe
):
class
Recipe
(
GenericSlapRecipe
):
def
_install
(
self
):
def
_install
(
self
):
publish_dict
=
dict
()
publish_dict
=
dict
()
...
@@ -47,3 +49,26 @@ SERIALISED_MAGIC_KEY = '_'
...
@@ -47,3 +49,26 @@ SERIALISED_MAGIC_KEY = '_'
class
Serialised
(
Recipe
):
class
Serialised
(
Recipe
):
def
_setConnectionDict
(
self
,
publish_dict
):
def
_setConnectionDict
(
self
,
publish_dict
):
return
super
(
Serialised
,
self
).
_setConnectionDict
(
wrap
(
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