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

Multiline error messages are unreadable #14549

Closed
mgedmin opened this issue Feb 18, 2016 · 5 comments
Closed

Multiline error messages are unreadable #14549

mgedmin opened this issue Feb 18, 2016 · 5 comments
Labels
affects_2.0 This issue/PR affects Ansible v2.0 affects_2.1 This issue/PR affects Ansible v2.1 affects_2.2 This issue/PR affects Ansible v2.2 bug This issue/PR relates to a bug. support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@mgedmin
Copy link
Contributor

mgedmin commented Feb 18, 2016

ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • core
ANSIBLE VERSION
ansible 2.0.0.2
  config file = /home/mg/src/deployments/provisioning/ansible.cfg
  configured module search path = Default w/o overrides
CONFIGURATION

N/A

OS / ENVIRONMENT

N/A

SUMMARY

Ansible 2.0 reports error messages like this:

RUNNING HANDLER [fridge : reload apache] ***************************************
fatal: [precise]: FAILED! => {"changed": false, "failed": true, "msg": "Warning: DocumentRoot [/home/mg/gedmin.as/] does not exist\nWarning: DocumentRoot [/home/mg/gedmin.as/] does not exist\nWarning: DocumentRoot [/home/sirex/htlog/var/www/] does not exist\nWarning: DocumentRoot [/home/mg/www] does not exist\napache2: Could not reliably determine the server's fully qualified domain name, using 10.0.2.15 for ServerName\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8001, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8001, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8001, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8001, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8001, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8001, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8001, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8001, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8001, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8001, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8001, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8001, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8001, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8001, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8443, the first has precedence\n[Thu Feb 18 06:57:34 2016] [warn] _default_ VirtualHost overlap on port 8001, the first has precedence\n"}

This is, to put it politely, unreadable.

It's especially surprising when Ansible's own nice multi-line YAML errors get squished into a single line with embedded \ns.

STEPS TO REPRODUCE

Create a test.yml like this:

---
- hosts: localhost
  gather_facts: no
  tasks:
    - include: err.yml

Create an err.yml like this:

---
- command: echo hi
  with_items:
    - one
    - two
    - "and a syntax error for fun

Run ansible-playbook test.yml

EXPECTED RESULTS

Ansible 1.9.4 wasn't too bad and used to produce this:

ERROR: Syntax Error while loading YAML script, /path/to/err.yml
Note: The error may actually appear before this position: line 8, column 1



^
ACTUAL RESULTS

Ansible 2.0.0.2 as well as Ansible 2.1.0 (devel 875ea74) produce this:


PLAY ***************************************************************************

TASK [include] *****************************************************************
fatal: [localhost]: FAILED! => {"failed": true, "reason": "ERROR! Syntax Error while loading YAML.\n\n\nThe error appears to have been in '/path/to/err.yml': line 8, column 1, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\n(specified line no longer in file, maybe it changed?)"}

PLAY RECAP *********************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=1   
@jimi-c jimi-c added this to the stable-2.0 milestone Feb 24, 2016
@metalrufflez
Copy link

+1

@ilyapoz
Copy link

ilyapoz commented Sep 28, 2016

+1 please fix this, really a big and totally unneeded hurdle in diagnosing

@aairey
Copy link

aairey commented Oct 18, 2016

+1

Same on v2.1.2.
It seems to happen when you include tasks/roles. If the error happens in one of those tasks it gets printed on one line.

@bcoca bcoca added affects_2.1 This issue/PR affects Ansible v2.1 affects_2.2 This issue/PR affects Ansible v2.2 and removed triage labels Oct 18, 2016
@ansibot
Copy link
Contributor

ansibot commented Apr 11, 2017

@mgedmin Greetings! Thanks for taking the time to open this issue. In order for the community to handle your issue effectively, we need a bit more information.

Here are the items we could not find in your description:

  • component name

Please set the description of this issue with this template:
https://raw.githubusercontent.com/ansible/ansible/devel/.github/ISSUE_TEMPLATE.md

click here for bot help

@ansibot ansibot added needs_info This issue requires further information. Please answer any outstanding questions. needs_template This issue/PR has an incomplete description. Please fill in the proposed template correctly. labels Apr 11, 2017
@ansibot ansibot removed needs_info This issue requires further information. Please answer any outstanding questions. needs_template This issue/PR has an incomplete description. Please fill in the proposed template correctly. labels May 29, 2017
@ansibot ansibot added the support:core This issue/PR relates to code supported by the Ansible Engineering Team. label Jun 29, 2017
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 1, 2018
@mkrizek
Copy link
Contributor

mkrizek commented Sep 3, 2018

I get the following with today's devel branch:

ERROR! Syntax Error while loading YAML.
  found unexpected end of stream

The error appears to have been in '/home/mkrizek/devel/ansible-repro/err.yml': line 6, column 1, but may
be elsewhere in the file depending on the exact syntax problem.

(specified line no longer in file, maybe it changed?)

Closing as per above.

@mkrizek mkrizek closed this as completed Sep 3, 2018
@ansible ansible locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.0 This issue/PR affects Ansible v2.0 affects_2.1 This issue/PR affects Ansible v2.1 affects_2.2 This issue/PR affects Ansible v2.2 bug This issue/PR relates to a bug. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

No branches or pull requests

8 participants