lineinfile: ugly output and issue with quotes?

98 views
Skip to first unread message

John Oliver

unread,
Aug 27, 2014, 5:47:41 PM8/27/14
to ansible...@googlegroups.com
ansible 1.6.10

  - name: Configure Roundcube to use macsecurity plugin
    lineinfile: dest=/var/www/html/roundcube/config/config.inc.php
                regexp='^\$config[\'plugins\']\ =\ .*'
                line="$config['plugins'] = array('macsecurity');"

Results in:

TASK: [Configure Roundcube to use macsecurity plugin] ************************* 
<jedis-test> ESTABLISH CONNECTION FOR USER: joliver
<jedis-test> REMOTE_MODULE lineinfile dest=/var/www/html/roundcube/config/config.inc.php regexp='^\$config[\'plugins\']\ =\ .*' line="$config['plugins'] = array('macsecurity');"
<jedis-test> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/Users/joliver/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'ConnectTimeout=10', 'jedis-test', "/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1409175269.9-123275515097320 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1409175269.9-123275515097320 && echo $HOME/.ansible/tmp/ansible-tmp-1409175269.9-123275515097320'"]
<jedis-test> PUT /var/folders/67/dk8m_22d413fhslkhh4dwkzr0000gn/T/tmpN9xXtS TO /home/joliver/.ansible/tmp/ansible-tmp-1409175269.9-123275515097320/lineinfile
<jedis-test> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/Users/joliver/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'ConnectTimeout=10', 'jedis-test', u'/bin/sh -c \'sudo -k && sudo -H -S -p "[sudo via ansible, key=bmqjrumylttuzzfdgnjmbdmbgcdrokao] password: " -u root /bin/sh -c \'"\'"\'echo SUDO-SUCCESS-bmqjrumylttuzzfdgnjmbdmbgcdrokao; LC_CTYPE=en_US.UTF-8 LANG=en_US.UTF-8 /usr/bin/python /home/joliver/.ansible/tmp/ansible-tmp-1409175269.9-123275515097320/lineinfile; rm -rf /home/joliver/.ansible/tmp/ansible-tmp-1409175269.9-123275515097320/ >/dev/null 2>&1\'"\'"\'\'']
fatal: [jedis-test] => failed to parse: SUDO-SUCCESS-bmqjrumylttuzzfdgnjmbdmbgcdrokao
Traceback (most recent call last):
  File "/home/joliver/.ansible/tmp/ansible-tmp-1409175269.9-123275515097320/lineinfile", line 1589, in <module>
    main()
  File "/home/joliver/.ansible/tmp/ansible-tmp-1409175269.9-123275515097320/lineinfile", line 330, in main
    supports_check_mode=True
  File "/home/joliver/.ansible/tmp/ansible-tmp-1409175269.9-123275515097320/lineinfile", line 566, in __init__
    (self.params, self.args) = self._load_params()
  File "/home/joliver/.ansible/tmp/ansible-tmp-1409175269.9-123275515097320/lineinfile", line 1135, in _load_params
    items   = shlex.split(args)
  File "/usr/lib64/python2.6/shlex.py", line 279, in split
    return list(lex)
  File "/usr/lib64/python2.6/shlex.py", line 269, in next
    token = self.get_token()
  File "/usr/lib64/python2.6/shlex.py", line 96, in get_token
    raw = self.read_token()
  File "/usr/lib64/python2.6/shlex.py", line 172, in read_token
    raise ValueError, "No closing quotation"
ValueError: No closing quotation


I submitted an issue for the unfriendly output.  I really don't know if the "No closing quotation" is an actual bug in ansible, an issue with parsing, or something I did wrong that I just can't pick out :-)

Michael DeHaan

unread,
Aug 27, 2014, 5:50:26 PM8/27/14
to ansible...@googlegroups.com
Can you please retest this with 1.7.1 and see if you get the same traceback?




--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/1c764b12-60c7-4d6a-a130-c0741b57fd47%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

John Oliver

unread,
Aug 27, 2014, 6:55:35 PM8/27/14
to ansible...@googlegroups.com
Hmm, MacPorts has 1.7 but not 1.7.1 yet.  I'll see if I can get the maintainer to push it.
Reply all
Reply to author
Forward
0 new messages