ansible / ansible-modules-extras

Ansible extra modules - these modules ship with ansible
947 stars 1.46k forks source link

composer: Unable to use "working-dir" with spaces #3700

Closed rfdy closed 7 years ago

rfdy commented 7 years ago
ISSUE TYPE
COMPONENT NAME

composer

ANSIBLE VERSION
$ ansible --version
ansible 2.2.0.0
  config file = 
  configured module search path = Default w/o overrides
CONFIGURATION

N/A

OS / ENVIRONMENT

N/A

SUMMARY

The composer module is not able to use "working-dir" with directories that contain a space.

STEPS TO REPRODUCE

mkdir /tmp/test\ directory

# Create a simple composer.json with contents:
{
    "require": {
        "rfd/imagemagick": "*"
    }
}
ansible localhost -m composer -a "working-dir=\"/tmp/test directory\""
EXPECTED RESULTS

Composer is able descend into the requested directory.

ACTUAL RESULTS

Composer complains that the directory doesn't exist, but the error message lists the wrong directory. [RuntimeException] Invalid working directory specified, /tmp/test does not exist.

$ ansible localhost -m composer -a "working-dir=\"/tmp/test directory\"" -vvv
No config file found; using defaults
 [WARNING]: Host file not found: /etc/ansible/hosts

 [WARNING]: provided hosts list is empty, only localhost is available

Using module file /Library/Python/2.7/site-packages/ansible/modules/extras/packaging/language/composer.py
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: tylerlawson
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1484583081.77-153904708810732 `" && echo ansible-tmp-1484583081.77-153904708810732="` echo $HOME/.ansible/tmp/ansible-tmp-1484583081.77-153904708810732 `" ) && sleep 0'
<127.0.0.1> PUT /var/folders/wj/lx9yl6t56nvdwgmq90c642f00000gn/T/tmpmIQHYO TO /Users/tylerlawson/.ansible/tmp/ansible-tmp-1484583081.77-153904708810732/composer.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /Users/tylerlawson/.ansible/tmp/ansible-tmp-1484583081.77-153904708810732/ /Users/tylerlawson/.ansible/tmp/ansible-tmp-1484583081.77-153904708810732/composer.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python /Users/tylerlawson/.ansible/tmp/ansible-tmp-1484583081.77-153904708810732/composer.py; rm -rf "/Users/tylerlawson/.ansible/tmp/ansible-tmp-1484583081.77-153904708810732/" > /dev/null 2>&1 && sleep 0'
localhost | FAILED! => {
    "changed": false, 
    "failed": true, 
    "invocation": {
        "module_args": {
            "arguments": "", 
            "command": "install", 
            "ignore_platform_reqs": false, 
            "no_dev": true, 
            "no_plugins": false, 
            "no_scripts": false, 
            "optimize_autoloader": true, 
            "prefer_dist": false, 
            "prefer_source": false, 
            "working-dir": "/tmp/test directory", 
            "working_dir": "/tmp/test directory"
        }, 
        "module_name": "composer"
    }, 
    "msg": "[RuntimeException] Invalid working directory specified, /tmp/test does not exist.", 
    "stdout": "\n                                                                  \n  [RuntimeException]                                              \n  Invalid working directory specified, /tmp/test does not exist.  \n                                                                  \n\n", 
    "stdout_lines": [
        "", 
        "                                                                  ", 
        "  [RuntimeException]                                              ", 
        "  Invalid working directory specified, /tmp/test does not exist.  ", 
        "                                                                  ", 
        ""
    ]
}
ansibot commented 7 years ago

This repository has been locked. All new issues and pull requests should be filed in https://github.com/ansible/ansible

Please read through the repomerge page in the dev guide.