Bug 1273589 - [abrt] ansible: shlex.py:172:read_token:ValueError: No closing quotation
[abrt] ansible: shlex.py:172:read_token:ValueError: No closing quotation
Product: Fedora
Classification: Fedora
Component: ansible (Show other bugs)
x86_64 Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Kevin Fenzi
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2015-10-20 14:26 EDT by Michael Cronenworth
Modified: 2016-06-17 13:30 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2016-06-17 13:30:20 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
File: backtrace (1.32 KB, text/plain)
2015-10-20 14:26 EDT, Michael Cronenworth
no flags Details
File: environ (3.23 KB, text/plain)
2015-10-20 14:26 EDT, Michael Cronenworth
no flags Details

  None (edit)
Description Michael Cronenworth 2015-10-20 14:26:46 EDT
Description of problem:
Tried to run a ping across my inventory. Added a password with double quotes in it, which seems to be the cause of the crash.

Version-Release number of selected component:

Additional info:
reporter:       libreport-2.6.2
cmdline:        /usr/bin/python /usr/bin/ansible community -i ./hosts-independent -m ping
dso_list:       python-libs-2.7.10-8.fc22.x86_64
executable:     /usr/bin/ansible
kernel:         4.1.10-200.fc22.x86_64
runlevel:       N 5
type:           Python
uid:            1810

Truncated backtrace:
shlex.py:172:read_token:ValueError: No closing quotation

Traceback (most recent call last):
  File "/usr/bin/ansible", line 197, in <module>
    (runner, results) = cli.run(options, args)
  File "/usr/bin/ansible", line 121, in run
    inventory_manager = inventory.Inventory(options.inventory, vault_password=vault_pass)
  File "/usr/lib/python2.7/site-packages/ansible/inventory/__init__.py", line 128, in __init__
    self.parser = InventoryParser(filename=host_list)
  File "/usr/lib/python2.7/site-packages/ansible/inventory/ini.py", line 43, in __init__
  File "/usr/lib/python2.7/site-packages/ansible/inventory/ini.py", line 47, in _parse
  File "/usr/lib/python2.7/site-packages/ansible/inventory/ini.py", line 108, in _parse_base_groups
    tokens = shlex.split(line)
  File "/usr/lib64/python2.7/shlex.py", line 279, in split
    return list(lex)
  File "/usr/lib64/python2.7/shlex.py", line 269, in next
    token = self.get_token()
  File "/usr/lib64/python2.7/shlex.py", line 96, in get_token
    raw = self.read_token()
  File "/usr/lib64/python2.7/shlex.py", line 172, in read_token
    raise ValueError, "No closing quotation"
ValueError: No closing quotation

Local variables in innermost frame:
self: <shlex.shlex instance at 0x7f0cf6a6bdd0>
nextchar: ''
quoted: True
escapedstate: ' '
Comment 1 Michael Cronenworth 2015-10-20 14:26:52 EDT
Created attachment 1084874 [details]
File: backtrace
Comment 2 Michael Cronenworth 2015-10-20 14:26:53 EDT
Created attachment 1084875 [details]
File: environ
Comment 3 Kevin Fenzi 2015-10-20 18:40:38 EDT
Added where? as a vault password? as a variable? 

If you escape it with \ does it work?
Comment 4 Michael Cronenworth 2015-10-27 13:43:46 EDT
Sorry for the delay, I haven't had the time to respond and I had already fixed the problem variable.

In this case it was in an ansible_ssh_pass= variable in an inventory file.

Example: foo.bar.com ansible_ssh_pass="N#qd3e'$"

Yes, using an escape works, but receiving a traceback and abrt message is not good.
Comment 5 Kevin Fenzi 2015-10-27 22:03:30 EDT

Would you be willing to file an upstream issue on this? Or shall I?
Comment 6 Michael Cronenworth 2016-06-17 13:30:20 EDT
Ansible 2.x seems to have fixed this. Closing.

Note You need to log in before you can comment on or make changes to this bug.