Skip to content
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

unusual YAML syntax for hooks #117

Open
ramcq opened this issue Mar 27, 2023 · 2 comments · May be fixed by #118
Open

unusual YAML syntax for hooks #117

ramcq opened this issue Mar 27, 2023 · 2 comments · May be fixed by #118

Comments

@ramcq
Copy link

ramcq commented Mar 27, 2023

I have a healthchecks hook set up:

borgmatic_hooks:
  healthchecks: https://hc-ping.com/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

The generated YAML file is as follows:

hooks:
    healthchecks:
        https://hc-ping.com/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
        ...

The ... appears to imply that to_nice_yaml has truncated something, but nothing has been truncated. Perhaps it's harmless but it does look odd. I was digging around to try and find why this was happening, and it does seem that to_nice_yaml has some odd side effects of truncating/splitting tokens longer than 80 characters, which seems extremely undesirable. However, this token is less than 80 characters so adding width= didn't change anything. I can't work out why the ... is being added at all.

ramcq added a commit to ramcq/ansible-role-borgbackup that referenced this issue Mar 28, 2023
Invoking to_nice_yaml on a scalar value generates a two-line YAML document "value\n...\n" which corrupts the value of a hook such as healthcheck which is just a single string URL. Instead of looping over each of the hooks, define a dictionary with hooks at the top level and have to_nice_yaml transform it in a single invocation. Fixes borgbase#117.
@ramcq ramcq linked a pull request Mar 28, 2023 that will close this issue
@ramcq
Copy link
Author

ramcq commented Mar 28, 2023

Oh, this actually broke my healthcheck. Found a potential fix.

@conloos
Copy link
Contributor

conloos commented Mar 29, 2023

Hello @ramcq ,

I have written a macro to generate clean yaml.
Maybe this is a solution.

Greetings Frank

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants