Commit 9c4f8c85 authored by Philipp's avatar Philipp

WIP: Adding instance-opcua.jinja.cfg.in in order to request different instance.cfg files.

- Lacking the ability to request nested json files.
- Missing asyncua hence not working
parent 78183016
{%- set parameter_dict = dict(default_parameter_dict, **parameter_dict) %}
{%- set opcua_server_bool = parameter_dict['opcua-server-bool'] %}
{%- if opcua_server_bool == "True" %}
{%- set promises_parts = 'promises' %}
{%- set publish_connection_parameter_parts = 'publish-connection-parameter' %}
{%- else %}
{%- set promises_parts = '' %}
{%- set publish_connection_parameter_parts = '' %}
{%- endif %}
[buildout]
parts =
directory
opcua-xml-url
opcua-to-http-gw-service
download-opcua-to-http-gw
{{ publish_connection_parameter_parts }}
{{ promises_parts }}
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[instance-parameter]
ipv6-enabled = {{ parameter_dict['ipv6-enabled'] }}
opcua-port = {{ parameter_dict['opcua-port'] }}
opcua-xml-url = {{ parameter_dict['opcua-xml-url'] }}
erp5-url = {{ parameter_dict['erp5-url'] }}
erp5-username = {{ parameter_dict['erp5-username'] }}
erp5-password = {{ parameter_dict['erp5-password'] }}
[directory]
recipe = slapos.cookbook:mkdirectory
home = $${buildout:directory}
etc = $${:home}/etc
var = $${:home}/var
script = $${:etc}/run/
service = $${:etc}/service
promise = $${:etc}/promise/
log = $${:var}/log
bin = $${:home}/bin
[opcua-xml-url]
recipe = slapos.recipe.build:download
offline = false
url = https://lab.nexedi.com/Demonkey/osie/raw/philipp_opcua/opcua-to-http-gw/opcua-server-config.xml
destination = $${directory:etc}/schema.xml
[download-opcua-to-http-gw]
recipe = slapos.recipe.build:download
offline = false
# Currently the end of the of the url must match the end of the destination. Here it is /opcua-to-http-gw.py
url = {{ parameter_dict['opcua-to-http-gw-url'] or '' }}
destination = $${buildout:parts-directory}/opcua-to-http-gw.py
[opcua-to-http-gw-service]
recipe = slapos.cookbook:wrapper
{% set command_parts = [
"$${buildout:bin-directory}/py $${download-opcua-to-http-gw:destination}",
"--xml $${opcua-xml-url:destination}",
"--erp5-url $${instance-parameter:erp5-url}",
"--erp5-username $${instance-parameter:erp5-username}",
"--erp5-password $${instance-parameter:erp5-password}",
"--port $${instance-parameter:opcua-port}",
"--ipv6 " ~ ipv6_random,
"--ipv6-enabled $${instance-parameter:ipv6-enabled}"
] -%}
command-line = {{ command_parts|join(' ') }}
wrapper-path = $${directory:service}/{{ parameter_dict['instance-service-name'] }}
output = $${:wrapper-path}
{% if opcua_server_bool == "True" %}
[check-port-listening-promise]
recipe = slapos.cookbook:check_port_listening
path = $${directory:promise}/$${:_buildout_section_name_}
[opcua-to-http-gw-listen-promise]
<= check-port-listening-promise
{%- if ipv6_enabled == "1" %}
hostname = {{ ipv6_random }}
{%- elif ipv4_enabled == "1" %}
hostname = {{ ipv4_random }}
{%- endif %}
port = $${instance-parameter:opcua-port}
[promises]
recipe =
instance-promises =
$${opcua-to-http-gw-listen-promise:path}
[publish-connection-parameter]
recipe = slapos.cookbook:publish
{%- if ipv6_enabled == "1" %}
ipv6 = {{ ipv6_random }}
{%- elif ipv4_enabled == "1" %}
ipv4 = {{ ipv4_random }}
{%- endif %}
{% endif %}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment