Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
slapos
Commits
9dac56e8
Commit
9dac56e8
authored
Aug 21, 2023
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
7ca76b9b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
24 deletions
+23
-24
software/ors-amarisoft/config/enb.jinja2.cfg
software/ors-amarisoft/config/enb.jinja2.cfg
+23
-24
No files found.
software/ors-amarisoft/config/enb.jinja2.cfg
View file @
9dac56e8
...
...
@@ -8,18 +8,18 @@
{# jref_of_shared returns original reference used to request shared instance.
it is extracted from slave_reference wh
o
is composed as `partition_id`+'_'+`reference` #}
it is extracted from slave_reference wh
ich
is composed as `partition_id`+'_'+`reference` #}
{%- macro jref_of_shared(slave) %}
{%- set ref = slave['slave_reference'] %}
{%- set partition_id %}{{partition_id}}{%- endset %}
{%- if ref.startswith(partition_id) %}
{%- set ref = ref[len(partition_id):] %}
{%- endif %}
{%- if ref.startswith('_') %}
{%- set ref = ref[1:] %}
{%- endif %}
{{ ref | tojson }}
{%- endmacro %}
{%-
set ref = slave['slave_reference'] %}
{%-
set partition_id %}{{partition_id}}{%- endset %}
{%-
if ref.startswith(partition_id) %}
{%-
set ref = ref[len(partition_id):] %}
{%-
endif %}
{%-
if ref.startswith('_') %}
{%-
set ref = ref[1:] %}
{%-
endif %}
{{
ref | tojson }}
{%- endmacro
%}
{# XXX error(slave, msg) #}
...
...
@@ -41,20 +41,19 @@
{# verify that there is no dangling ru_ref and ruincell_ref #} XXX + resolve those ru*_ref
{# jcell_ru_ref returns RU reference for a cell.
if the cell embeds RU definition, its reference comes as `_<cell_ref>_ru`.
return value is json-encoded to workaround jinja2 macro-ret limitation. #}
{# jcell_ru_ref returns RU reference linked from a cell.
if the cell embeds RU definition, its reference comes as `_<cell_ref>_ru`. #}
# XXX cycle protection
{%- macro jcell_ru_ref(cell) %}
{%-
set ru = cell['ru']
%}
{%-
if ru['ru_type'] == 'ru_ref'
%}
{{ ru['ru_ref'] | tojson }}
{%-
elif ru['ru_type'] == 'ruincell_ref'
%}
{{ jcell_ru_ref(ru['ruincell_ref']) }}
{%-
else
%}
{#
ru definition is embedded into cell
#}
{{
J(jref_of_shared(cell))
{%- macro jcell_ru_ref(cell)
%}
{%-
set ru = cell['ru']
%}
{%-
if ru['ru_type'] == 'ru_ref'
%}
{{ ru['ru_ref'] | tojson
}}
{%-
elif ru['ru_type'] == 'ruincell_ref'
%}
{{ jcell_ru_ref(ru['ruincell_ref'])
}}
{%-
else
%}
{#
ru definition is embedded into cell
#}
{{
('_%s_ru' % J(jref_of_shared(cell))) | tojson }}
{%- endif %}
{%- endmacro %}
...
...
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