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
HongzheWang
slapos
Commits
bfd63e6f
Commit
bfd63e6f
authored
Mar 16, 2012
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not manually create json file. Use module instead.
Mother of god, why did I do that monstrosity?
parent
72aefdbf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
12 deletions
+8
-12
slapos/recipe/generic_kvm_frontend/__init__.py
slapos/recipe/generic_kvm_frontend/__init__.py
+8
-6
slapos/recipe/generic_kvm_frontend/template/proxytable-resource-snippet.json.in
...kvm_frontend/template/proxytable-resource-snippet.json.in
+0
-6
No files found.
slapos/recipe/generic_kvm_frontend/__init__.py
View file @
bfd63e6f
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#
#
##############################################################################
##############################################################################
from
slapos.recipe.librecipe
import
GenericBaseRecipe
from
slapos.recipe.librecipe
import
GenericBaseRecipe
import
json
from
json
import
loads
as
unjson
from
json
import
loads
as
unjson
class
Recipe
(
GenericBaseRecipe
):
class
Recipe
(
GenericBaseRecipe
):
...
@@ -70,14 +71,15 @@ class Recipe(GenericBaseRecipe):
...
@@ -70,14 +71,15 @@ class Recipe(GenericBaseRecipe):
def
_getProxyTableContent
(
self
,
rewrite_rule_list
):
def
_getProxyTableContent
(
self
,
rewrite_rule_list
):
"""Generate proxy table file content from rewrite rules list"""
"""Generate proxy table file content from rewrite rules list"""
proxy_table
_content
=
'{'
proxy_table
=
dict
()
for
rewrite_rule
in
rewrite_rule_list
:
for
rewrite_rule
in
rewrite_rule_list
:
rewrite_part
=
self
.
substituteTemplate
(
proxy_table
[
rewrite_rule
[
'resource'
]]
=
{
self
.
getTemplateFilename
(
'proxytable-resource-snippet.json.in'
),
'port'
:
rewrite_rule
[
'port'
],
rewrite_rule
)
'host'
:
rewrite_rule
[
'host'
],
proxy_table_content
+=
"%s,"
%
rewrite_part
'https'
:
rewrite_rule
[
'https'
],
}
proxy_table_content
+=
'}
\
n
'
proxy_table_content
=
json
.
dumps
(
proxy_table
)
return
proxy_table_content
return
proxy_table_content
def
install
(
self
):
def
install
(
self
):
...
...
slapos/recipe/generic_kvm_frontend/template/proxytable-resource-snippet.json.in
deleted
100644 → 0
View file @
72aefdbf
"/%(resource)s": {
"port": %(port)s,
"host": "%(host)s",
"https": %(https)s
}
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