beremiz

a3ec35ee94e7
Fix crash in runtime if PSK secret is missing

./Beremiz_service.py -s $PWD/psk2.txt -n beremiz /tmp/beremiz
Beremiz_service: 1.2-1378c18402c3+

Traceback (most recent call last):
File "./Beremiz_service.py", line 511, in
ensurePSK(servicename, PSKpath)
File "/home/developer/WorkData/PLC/beremiz/beremiz/runtime/Stunnel.py", line 32, in ensurePSK
PSKgen(ID, PSKpath)
File "/home/developer/WorkData/PLC/beremiz/beremiz/runtime/Stunnel.py", line 23, in PSKgen
call(restart_stunnel_cmdline)
File "/home/developer/WorkData/PLC/beremiz/beremiz/runtime/spawn_subprocess.py", line 116, in call
pid = posix_spawn.posix_spawnp(cmd[0], cmd)
File "/home/developer/.local/lib/python2.7/site-packages/posix_spawn/_impl.py", line 120, in posix_spawnp
return _posix_spawn(lib.posix_spawnp, *args, **kwargs)
File "/home/developer/.local/lib/python2.7/site-packages/posix_spawn/_impl.py", line 111, in _posix_spawn
_check_error(res, path)
File "/home/developer/.local/lib/python2.7/site-packages/posix_spawn/_impl.py", line 10, in _check_error
raise OSError(errno, os.strerror(errno), path)
OSError: [Errno 2] No such file or directory: '/etc/init.d/S50stunnel'
include yslt_noindent.yml2
istylesheet xmlns:ppx="http://www.plcopen.org/xml/tc6_0201"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:ns="beremiz"
extension-element-prefixes="ns"
exclude-result-prefixes="ns" {
param "instance_type";
template "text()";
variable "project", "ns:GetProject()";
variable "stdlib", "ns:GetStdLibs()";
variable "extensions", "ns:GetExtensions()";
variable "all_types", "($project | $stdlib | $extensions)/ppx:types";
template "ppx:project" {
apply "ppx:instances/ppx:configurations/ppx:configuration";
}
template "ppx:configuration" {
apply "ppx:globalVars/ppx:variable[ppx:type/ppx:derived] | ppx:resource" {
with "parent_path" > «@name»
}
}
template "ppx:resource" {
param "parent_path";
variable "resource_path" > «$parent_path».«@name»
apply "ppx:globalVars/ppx:variable[ppx:type/ppx:derived] | ppx:pouInstance | ppx:task/ppx:pouInstance" {
with "parent_path" > «$resource_path»
}
}
template "ppx:pouInstance" {
param "parent_path";
variable "pou_instance_path" > «$parent_path».«@name»
choose {
when "@typeName=$instance_type" {
value "ns:AddInstance($pou_instance_path)";
}
otherwise {
variable "type_name" > «@typeName»
apply """$all_types/ppx:pous/ppx:pou[@name=$type_name] | \
$all_types/ppx:dataTypes/ppx:dataType[@name=$type_name]""" {
with "instance_path" > «$pou_instance_path»
}
}
}
}
template "ppx:pou" {
param "instance_path";
apply "ppx:interface/*/ppx:variable[ppx:type/ppx:derived]" {
with "parent_path" > «$instance_path»
}
}
template "ppx:dataType" {
param "instance_path";
apply "ppx:baseType/*[self::ppx:derived or self::ppx:struct or self::ppx:array]" {
with "parent_path" > «$instance_path»
}
}
template "ppx:variable" {
param "parent_path";
variable "variable_path" > «$parent_path».«@name»
apply "ppx:type/ppx:derived" {
with "variable_path" > «$variable_path»
}
}
template "ppx:derived" {
param "variable_path";
choose {
when "@name=$instance_type" {
value "ns:AddInstance($variable_path)";
}
otherwise {
variable "type_name" > «@name»
apply """$all_types/ppx:pous/ppx:pou[@name=$type_name] | \
$all_types/ppx:dataTypes/ppx:dataType[@name=$type_name]""" {
with "instance_path" > «$variable_path»
}
}
}
}
template "ppx:struct" {
param "variable_path";
foreach "ppx:variable[ppx:type/ppx:derived or ppx:type/ppx:struct or ppx:type/ppx:array]" {
variable "element_path" > «$variable_path».«@name»
}
apply "ppx:type/*[self::ppx:derived or self::ppx:struct or self::ppx:array]" {
with "variable_path" > «$element_path»
}
}
template "ppx:array" {
param "variable_path";
apply "ppx:baseType/*[self::ppx:derived or self::ppx:struct or self::ppx:array]" {
with "variable_path" > «$variable_path»
}
}
}