ansible / ansible-modules-core

Ansible modules - these modules ship with ansible
1.3k stars 1.95k forks source link

Unarchive Issue for a .zip file #3210

Closed rajatguptarg closed 8 years ago

rajatguptarg commented 8 years ago
Issue Type:

Try to Unarchive a ZIP file with all available parameters.


- name: Extracting the service artifact
  unarchive: src={{ deploy_home }}/{{ service_name }}.zip dest={{ deploy_home }}
  args:
    owner: rajat
    group: rajat
    mode: 0751
    copy: no
    creates: yes
    follow: yes
Expected Results:

It should pass.

Actual Results:

fatal: [172.18.75.2]: FAILED! => {"changed": true, "check_results": {"unarchived": false}, "dest": "/usr/local/bial/beacon-registry", "extract_results": {"cmd": "/usr/bin/unzip -o \"/usr/local/bial/beacon-registry/beacon-registry.zip\" -d \"/usr/local/bial/beacon-registry\"", "err": "", "out": "Archive: /usr/local/bial/beacon-registry/beacon-registry.zip\n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/README.md \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/.coveragerc \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/config.py \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/setup.py \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/setup.cfg \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/MANIFEST \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/requirements.txt \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/PKG-INFO \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/tox.ini \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/run.py \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/MANIFEST.in \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/__init__.py \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/templates/view_attachment.jinja \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/templates/unregistration_status.jinja \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/templates/error.jinja \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/templates/attachment.jinja \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/templates/edit_beacon_status.jinja \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/templates/_formhelpers.jinja \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/templates/base.jinja \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/templates/register.jinja \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/templates/view.jinja \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/templates/estimote_details.jinja \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/templates/unregister.jinja \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/templates/registration_status.jinja \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/templates/edit_beacon.jinja \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/templates/beacons.jinja \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/templates/attachment_status.jinja \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/static/js/attachment.js \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/static/js/beacon_listing.js \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/static/js/register.js \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/static/js/base.js \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/static/js/editBeacon.js \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/static/js/view-attachments.js \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/static/images/kempegowdaLogo.png \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/static/images/default_shop.png \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/static/css/base.css \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/portal/__init__.py \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/portal/helper/__init__.py \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/portal/helper/beacon_helper.py \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/portal/helper/url_helper.py \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/portal/models/ibeacon.py \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/portal/models/__init__.py \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/portal/models/eddystone_beacon.py \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/portal/models/beacons.py \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/portal/models/header.py \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/portal/view/__init__.py \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/portal/view/error_handler.py \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/portal/view/views.py \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/portal/controller/__init__.py \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacons/portal/controller/controller.py \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacon_registry.egg-info/not-zip-safe \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacon_registry.egg-info/dependency_links.txt \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacon_registry.egg-info/top_level.txt \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacon_registry.egg-info/PKG-INFO \n inflating: /usr/local/bial/beacon-registry/beacon-registry-0.0.0/beacon_registry.egg-info/SOURCES.txt \n", "rc": 0}, "failed": true, "gid": 100080, "group": "bial", "handler": "ZipArchive", "mode": "0750", "module_stderr": "", "module_stdout": "Traceback (most recent call last):\r\n File \"/tmp/ansible/bial/ansible-tmp-1457427972.31-125341713915278/stat\", line 2344, in <module>\r\n main()\r\n File \"/tmp/ansible/bial/ansible-tmp-1457427972.31-125341713915278/stat\", line 303, in main\r\n path = os.path.expanduser(path)\r\n File \"/usr/lib64/python2.6/posixpath.py\", line 251, in expanduser\r\n if not path.startswith('~'):\r\nAttributeError: 'bool' object has no attribute 'startswith'\r\n", "msg": "MODULE FAILURE", "owner": "bial", "parsed": false, "secontext": "unconfined_u:object_r:usr_t:s0", "size": 4096, "src": "/usr/local/bial/beacon-registry/beacon-registry.zip", "state": "directory", "uid": 50004}

mscherer commented 8 years ago

"creates: yes" is incorrect, since ansible will convert it as boolean (iirc, that's even mandated by yaml standard, but I am not sure). It should a filename or a path, cf the doc: https://docs.ansible.com/ansible/unarchive_module.html

So I am closing this bug report, but you can reopen if you think it was wrongly closed.