-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
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
.Stdout in HTTP hook body template seems to always be empty #260
Comments
I think you're right, it looks like it got missed 😨 |
No problem. Unfortunatelly, I really do know nothing about Go, so I can't help by providing a PR, sorry. Do you see any way of temporarily work around this by using the And the long-term question: can you say, if you plan to include the |
@guahki, I'll reference this case for #207 and look into it. Was a bit busy with other things lastly but will continue to work on the PR soon. So far we always tried to avoid redirecting stdout to not alter the default behaviour of Regarding a workaround, how about: {{ $body := tempFile "body-template-file" }}
default:
backup:
schedule-log: '{{ tempFile "log-output" }}'
run-finally:
- echo "Log for {{ .Profile.Name }} @ {{ .Hostname }}:" > '{{ $body }}'
- echo "---------------------------------------------" >> '{{ $body }}'
- cat '{{ tempFile "log-output" }}' >> '{{ $body }}'
- echo "---------------------------------------------" >> '{{ $body }}'
send-finally:
- body-template: '{{ $body }}' Regarding including files in templates. So far we do not provide such an extension. I had thought about it beforehand but had no use case that requires it. Maybe I can add an include function for raw includes in in go templates with one of the next releases. |
Thank you so much @jkellerer for your extensive answer. Would be great to see this implemented (at least since it is available regarding to the docs 😆). I will play around with your great example for a workaround. Did not think about using Finally: take your time on #207 and do not feel bothered by me. I know there is more important things than FOSS projects in life. |
First: thanks for this awesome tool helping to easily deploy restic!
I just tried to use
.Stdout
in thebody-template
of asend-*
action as described in the docs (usingresticprofile
in version 0.23.0). But it seems to always be empty, regardless of error state and output of before running commands.Am I doing something wrong? Do you need to set some undocumented setting for it to work?
Despite not being familiar with Go I tried to find the place where this variable is set, but could not find it. I found the definition of the struct at
resticprofile/monitor/hook/context.go
Line 10 in 61f6015
Stdout
in the diff of this PR and one is the docs, the other the above mentioned definition.The text was updated successfully, but these errors were encountered: