New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AnsibleModule.set_mode_if_different: handle symlink is in a sticky directory #45198

Open
wants to merge 2 commits into
base: devel
from

Conversation

Projects
None yet
6 participants
@pilou-
Contributor

pilou- commented Sep 5, 2018

SUMMARY

AnsibleModule.set_mode_if_different: handle symlink is in a sticky directory

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

lib/ansible/module_utils/basic.py

ANSIBLE VERSION
ansible 2.8.0.dev0 (devel 65c9090714) last updated 2018/09/05 04:13:42 (GMT +200)
ADDITIONAL INFORMATION

Using this playbooks

- hosts: localhost
  gather_facts: no
  tasks:
    - user:
        name: testuser
    - file:
        path: /tmp/test
        state: absent
    - file:
        src: /home/testuser/test
        dest: /tmp/test
        state: link
        follow: false
        force: yes
        owner: testuser
        group: testuser
        mode: 0640

an exception occurs:

TASK [file] ***
task path: play.yml:9
[...]
The full traceback is:
Traceback (most recent call last):
  File "/root/.ansible/tmp/ansible-tmp-1536116697.501129-164489609739072/AnsiballZ_file.py", line 113, in <module>
    _ansiballz_main()
  File "/root/.ansible/tmp/ansible-tmp-1536116697.501129-164489609739072/AnsiballZ_file.py", line 105, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/root/.ansible/tmp/ansible-tmp-1536116697.501129-164489609739072/AnsiballZ_file.py", line 48, in invoke_module
    imp.load_module('__main__', mod, module, MOD_DESC)
  File "/tmp/ansible_file_payload_B37twr/__main__.py", line 863, in <module>
  File "/tmp/ansible_file_payload_B37twr/__main__.py", line 851, in main
  File "/tmp/ansible_file_payload_B37twr/__main__.py", line 684, in ensure_symlink
  File "/tmp/ansible_file_payload_B37twr/ansible_file_payload.zip/ansible/module_utils/basic.py", line 1546, in set_fs_attributes_if_different
  File "/tmp/ansible_file_payload_B37twr/ansible_file_payload.zip/ansible/module_utils/basic.py", line 1318, in set_mode_if_different
OSError: [Errno 13] Permission denied: '/tmp/test'

fatal: [trusting_swirles]: FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1536116697.501129-164489609739072/AnsiballZ_file.py\", line 113, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1536116697.501129-164489609739072/AnsiballZ_file.py\", line 105, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1536116697.501129-164489609739072/AnsiballZ_file.py\", line 48, in invoke_module\n    imp.load_module('__main__', mod, module, MOD_DESC)\n  File \"/tmp/ansible_file_payload_B37twr/__main__.py\", line 863, in <module>\n  File \"/tmp/ansible_file_payload_B37twr/__main__.py\", line 851, in main\n  File \"/tmp/ansible_file_payload_B37twr/__main__.py\", line 684, in ensure_symlink\n  File \"/tmp/ansible_file_payload_B37twr/ansible_file_payload.zip/ansible/module_utils/basic.py\", line 1546, in set_fs_attributes_if_different\n  File \"/tmp/ansible_file_payload_B37twr/ansible_file_payload.zip/ansible/module_utils/basic.py\", line 1318, in set_mode_if_different\nOSError: [Errno 13] Permission denied: '/tmp/test'\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}
@ansibot

This comment has been minimized.

Contributor

ansibot commented Sep 5, 2018

The test ansible-test sanity --test pep8 [explain] failed with 1 error:

test/units/module_utils/basic/test_set_mode_if_different.py:156:1: E302 expected 2 blank lines, found 1

click here for bot help

@pilou- pilou- force-pushed the pilou-:symlink_sticky_directory branch Sep 5, 2018

@ansibot ansibot added the small_patch label Sep 5, 2018

@jborean93 jborean93 removed the needs_triage label Sep 6, 2018

@pilou- pilou- force-pushed the pilou-:symlink_sticky_directory branch 2 times, most recently from 7845476 to 8946a14 Sep 10, 2018

@ansibot ansibot added small_patch and removed small_patch labels Sep 10, 2018

@pilou-

This comment has been minimized.

Contributor

pilou- commented Sep 10, 2018

Unrelated failures:

  • linux/opensuse42.3/1
    • first run
      19:38 TASK [zypper : run updatecache] 
      
    • 2nd run
      20:22 TASK [zypper : install via URL]
      
  • tower/2.7/1
    02:01 ERROR: Missing or empty Tower configuration value(s): host
    

@pilou- pilou- changed the title from WIP: AnsibleModule.set_mode_if_different: handle symlink is in a sticky directory to AnsibleModule.set_mode_if_different: handle symlink is in a sticky directory Sep 10, 2018

@mscherer

This comment has been minimized.

Contributor

mscherer commented Sep 16, 2018

shipit

@Xaroth

Xaroth approved these changes Nov 29, 2018

@ansibot ansibot removed the needs_revision label Nov 29, 2018

@ansibot ansibot added the core_review label Nov 29, 2018

@pilou- pilou- force-pushed the pilou-:symlink_sticky_directory branch 2 times, most recently from bac71ed to 60e4115 Nov 29, 2018

@ansibot ansibot added needs_revision and removed core_review labels Nov 29, 2018

pilou- and others added some commits Sep 5, 2018

file: handle symlink in a sticky directory
Co-Authored-By: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>

@pilou- pilou- force-pushed the pilou-:symlink_sticky_directory branch from 60e4115 to a807eb4 Nov 30, 2018

@pilou-

This comment has been minimized.

Contributor

pilou- commented Nov 30, 2018

CloudStack failures unrelated to this change:

"CloudStackException: [...] More than 1 default Isolated networks are found for account Acct[79dffa6a-aa16-11e8-bbe5-0242ac110003-admin]; please specify networkIds" 

Rebased in order to trigger the CI.

@ansibot ansibot added the stale_ci label Dec 8, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment