Bug 1273589

Summary: [abrt] ansible: shlex.py:172:read_token:ValueError: No closing quotation
Product: [Fedora] Fedora Reporter: Michael Cronenworth <mike>
Component: ansibleAssignee: Kevin Fenzi <kevin>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: a.badger, athmanem, kevin, kupo, maxim
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
URL: https://retrace.fedoraproject.org/faf/reports/bthash/daf12fa509ba01fd674eeec7ca35a732f7bf7e6b
Whiteboard: abrt_hash:ab74d06ebcfc1d3865caa92bec1fb28a83f93cb0;
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-17 17:30:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
File: backtrace
none
File: environ none

Description Michael Cronenworth 2015-10-20 18:26:46 UTC
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:
ansible-1.9.3-2.fc22

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__
    self._parse()
  File "/usr/lib/python2.7/site-packages/ansible/inventory/ini.py", line 47, in _parse
    self._parse_base_groups()
  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 18:26:52 UTC
Created attachment 1084874 [details]
File: backtrace

Comment 2 Michael Cronenworth 2015-10-20 18:26:53 UTC
Created attachment 1084875 [details]
File: environ

Comment 3 Kevin Fenzi 2015-10-20 22:40:38 UTC
Added where? as a vault password? as a variable? 

If you escape it with \ does it work?

Comment 4 Michael Cronenworth 2015-10-27 17:43:46 UTC
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-28 02:03:30 UTC
Agreed. 

Would you be willing to file an upstream issue on this? Or shall I?

Comment 6 Michael Cronenworth 2016-06-17 17:30:20 UTC
Ansible 2.x seems to have fixed this. Closing.