We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There seems to be some encoding issues when handing non-json text output inside an output template.
When an output template is not used, the following writes to the console with literal newlines (not the \n character).
\n
c8y events list --type c8y-configuration-plugin \ | c8y events downloadBinary --noProgress --outputTemplate "response.body"
Output
# Add the configurations to be managed by c8y-configuration-plugin files = [ # { path = '/etc/tedge/tedge.toml' }, # { path = '/etc/tedge/mosquitto-conf/c8y-bridge.conf', type = 'c8y-bridge.conf' }, # { path = '/etc/tedge/mosquitto-conf/tedge-mosquitto.conf', type = 'tedge-mosquitto.conf' }, # { path = '/etc/mosquitto/mosquitto.conf', type = 'mosquitto.conf' }, # { path = '/etc/tedge/c8y/example.txt', type = 'example', user = 'tedge', group = 'tedge', mode = 0o444 } ]
However when using a custom output template which should do the same thing,
c8y events list -p 1 --type c8y-configuration-plugin \ | c8y events downloadBinary --noProgress --outputTemplate "response.body"
# Add the configurations to be managed by c8y-configuration-plugin\nfiles = [\n# { path = '/etc/tedge/tedge.toml' },\n# { path = '/etc/tedge/mosquitto-conf/c8y-bridge.conf', type = 'c8y-bridge.conf' },\n# { path = '/etc/tedge/mosquitto-conf/tedge-mosquitto.conf', type = 'tedge-mosquitto.conf' },\n# { path = '/etc/mosquitto/mosquitto.conf', type = 'mosquitto.conf' },\n# { path = '/etc/tedge/c8y/example.txt', type = 'example', user = 'tedge', group = 'tedge', mode = 0o444 }\n]
Workaround
You can use sed to do the replacement of \n with a literal newline:
c8y events list -p 1 --type c8y-configuration-plugin \ | c8y events downloadBinary --noProgress --outputTemplate "'\n\n# Device: ' + request.url + '\n' + output + '\n'" \ | sed 's|\\n|\n|g'
# Device: https://example.c8y.io/event/events/3505464/binaries # Add the configurations to be managed by c8y-configuration-plugin files = [ # { path = '/etc/tedge/tedge.toml' }, # { path = '/etc/tedge/mosquitto-conf/c8y-bridge.conf', type = 'c8y-bridge.conf' }, # { path = '/etc/tedge/mosquitto-conf/tedge-mosquitto.conf', type = 'tedge-mosquitto.conf' }, # { path = '/etc/mosquitto/mosquitto.conf', type = 'mosquitto.conf' }, # { path = '/etc/tedge/c8y/example.txt', type = 'example', user = 'tedge', group = 'tedge', mode = 0o444 } ]
The text was updated successfully, but these errors were encountered:
fix(outputTemplate): unescape string output
ede685e
Resolved #306
Successfully merging a pull request may close this issue.
There seems to be some encoding issues when handing non-json text output inside an output template.
When an output template is not used, the following writes to the console with literal newlines (not the
\n
character).Output
However when using a custom output template which should do the same thing,
Output
Workaround
You can use sed to do the replacement of
\n
with a literal newline:Output
The text was updated successfully, but these errors were encountered: