Bug 1273589 - [abrt] ansible: shlex.py:172:read_token:ValueError: No closing quotation
Summary: [abrt] ansible: shlex.py:172:read_token:ValueError: No closing quotation
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: ansible
Version: 22
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Kevin Fenzi
QA Contact: Fedora Extras Quality Assurance
URL: https://retrace.fedoraproject.org/faf...
Whiteboard: abrt_hash:ab74d06ebcfc1d3865caa92bec1...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-10-20 18:26 UTC by Michael Cronenworth
Modified: 2016-06-17 17:30 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-06-17 17:30:20 UTC
Type: ---
Embargoed:


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

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.


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