host variables

Hi staff,
I just find a small bug, tell me if you knew it.
I was using an old version (1.1 !) and launched playbooks like that :

in /etc/ansible/hosts :
myserver mysql_password=“123456”
using {{ mysql_password }} somewhere in the code.

in playbook :

  • host = $host

and at command line :
ansible-playbook myplaybook.yml -e host=myserver

All works find, but… I just update ansible to 1.7, interested by the stat command.
First I find that in playbook I must now say :

  • hosts : “{{ host }}”
    instead of $host. OK no problem, I haven’t tons of playbooks !
    But I had a host like this in hosts file:
    otherserver mysql_password=“12#3456”

and got the error :

File “/usr/lib64/python2.6/shlex.py”, line 172, in read_token
raise ValueError, “No closing quotation”
ValueError: No closing quotation

I’ve found that I must escape the # (“12#3456”) to have it to work. Seems to return the right password without the "". I know that I could check all this password to escape the #, but I’m so lazy, and as the string is quoted, it looks like a bug, isn’t it ?
Other characters like “$” “%” “,” “;” are not problematic.

Thanks
Frank

Tracebacks are errors, so please report this one on GitHub with how to reproduce it.

Thanks!