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
francois
slapos
Commits
fef06bdf
Commit
fef06bdf
authored
Feb 25, 2013
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add temporary request-edge recipe
parent
4fb649d2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
1 deletion
+34
-1
setup.py
setup.py
+1
-0
slapos/recipe/request.py
slapos/recipe/request.py
+33
-1
No files found.
setup.py
View file @
fef06bdf
...
...
@@ -159,6 +159,7 @@ setup(name=name,
'pwgen.stable = slapos.recipe.pwgen:StablePasswordGeneratorRecipe'
,
'request = slapos.recipe.request:Recipe'
,
'request.serialised = slapos.recipe.request:Serialised'
,
'request.edge = slapos.recipe.request:RequestEdge'
,
'requestoptional = slapos.recipe.request:RequestOptional'
,
'reverseproxy.nginx = slapos.recipe.reverse_proxy_nginx:Recipe'
,
'seleniumrunner = slapos.recipe.seleniumrunner:Recipe'
,
...
...
slapos/recipe/request.py
View file @
fef06bdf
...
...
@@ -215,7 +215,6 @@ class RequestOptional(Recipe):
update
=
install
class
Serialised
(
Recipe
):
def
_filterForStorage
(
self
,
partition_parameter_kw
):
return
wrap
(
partition_parameter_kw
)
...
...
@@ -225,3 +224,36 @@ class Serialised(Recipe):
return
json
.
loads
(
instance
.
getConnectionParameter
(
JSON_SERIALISED_MAGIC_KEY
))
except
slapmodule
.
NotFoundError
:
return
{}
CONNECTION_PARAMETER_STRING
=
'connection-'
class
RequestEdge
(
Recipe
):
"""
For each country in country-list, do a request.
"""
def
__init__
(
self
,
buildout
,
name
,
options
):
self
.
logger
=
logging
.
getLogger
(
name
)
self
.
options
=
options
self
.
request_dict
=
{}
# Keep a copy of original options dict
original_options
=
options
.
copy
()
for
country
in
options
[
'country-list'
].
split
(
','
):
# Request will have its own copy of options dict
local_options
=
original_options
.
copy
()
local_options
[
'name'
]
=
'%s-%s'
%
(
country
,
name
)
self
.
request_dict
[
country
]
=
Recipe
(
buildout
,
name
,
local_options
)
# "Bubble" all connection parameters
for
option
,
value
in
local_options
.
iteritems
():
if
option
.
startswith
(
CONNECTION_PARAMETER_STRING
):
self
.
options
[
'%s-%s'
%
(
option
,
country
)]
=
value
def
install
(
self
):
for
country
,
request
in
self
.
request_dict
.
iteritems
():
request
.
install
()
return
[]
update
=
install
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