-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
Weird error with shell heredocs in 2.4.1.0 #32334
Comments
the error seems unrelated to the heredoc itself, but caused bye locale settings. can you run with -vvv to get a better view of what is happening? |
Here you go: https://travis-ci.org/karlmdavis/ansible-role-jenkins2#L5476 Blowing up on the apostrophe here: https://github.com/karlmdavis/ansible-role-jenkins2/blob/053a21821770e88699143bc53fc30dfe93918a8e/test/test_basic.yml#L75 |
@bcoca Apologies: the Travis link I included there was no good. Here's a corrected one that points to verbose Ansible log output with the failure: https://travis-ci.org/karlmdavis/ansible-role-jenkins2/builds/297648635#L5481 When you say that this seems to be caused by locale settings, do you mean I could workaround this by adjusting my config somewhere/somehow? |
We specifically recommend against using heredocs and multiline commands via the shell module. See 5e7ee9df0aa Instead, you should use the script module or If you have further questions please stop by IRC or the mailing list:
|
@sivel That's totally fine, of course -- it's your project! However, in terms of making Ansible plays more maintainable, I've found that including short scripts inline like this can really improve readability. Less jumping between files just to figure out what's going on. I'd suggest reconsidering this recommendation in light of that. Ansible already has issues with things getting scattered across too many files, so anything that helps reverse that trend -- even marginally -- can be a big win. |
ISSUE TYPE
COMPONENT NAME
YAML parsing
ANSIBLE VERSION
2.4.1.0
(Apologies, didn't have Travis recording the full
ansible --version
.)CONFIGURATION
Here's the config file used in my tests: ansible.cfg
OS / ENVIRONMENT
N/A
SUMMARY
Started getting a weird test failure in Travis when I tested against 2.4.1.0. Here's the failing build: ansible-role-jenkins2: Job #145.1. I have a separate job in that build that runs the exact same tests against 2.4.0.0, which works fine.
The problem is this task (apologies for the length):
Now, that's not the prettiest thing ever, I confess -- I'll eventually get around to writing a module to clean it up. But the screwy thing here is that if I delete the apostophe in "Jenkin's" on the first comment line, it works just fine.
STEPS TO REPRODUCE
(see above)
EXPECTED RESULTS
I expected this to work.
ACTUAL RESULTS
The text was updated successfully, but these errors were encountered: