Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.recipe.template
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
slapos.recipe.template
Commits
fc8dcbb8
Commit
fc8dcbb8
authored
Dec 13, 2021
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
default: add support for inline templates
parent
0f8a8b27
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
3 deletions
+17
-3
slapos/recipe/template/__init__.py
slapos/recipe/template/__init__.py
+17
-3
No files found.
slapos/recipe/template/__init__.py
View file @
fc8dcbb8
...
...
@@ -29,6 +29,7 @@ import os
import
stat
import
tempfile
import
zc.buildout
from
zc.buildout
import
UserError
if
str
is
bytes
:
str2bytes
=
lambda
s
:
s
...
...
@@ -72,9 +73,22 @@ class Recipe(object):
def
_init
(
self
,
name
,
options
):
self
.
output
=
options
[
'output'
]
rendered
=
options
.
get
(
'inline'
)
try
:
url
=
options
[
'url'
]
except
KeyError
:
if
rendered
is
None
:
raise
if
self
.
md5sum
:
raise
UserError
(
"options 'inline' & 'md5sum' conflict"
)
self
.
md5sum
=
True
# tell update() to do nothing
self
.
rendered
=
rendered
else
:
if
rendered
:
raise
UserError
(
"options 'inline' & 'url' conflict"
)
options_sub
=
options
.
_sub
self
.
rendered
=
'$'
.
join
(
options_sub
(
s
,
None
)
for
s
in
self
.
_read
(
options
[
'url'
]
).
split
(
'$$'
))
for
s
in
self
.
_read
(
url
).
split
(
'$$'
))
def
_read
(
self
,
url
,
*
args
):
path
,
is_temp
=
zc
.
buildout
.
download
.
Download
(
...
...
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