Bug 1632273 - Removing cluster logging failed at TASK [openshift_logging : Cleaning up temp dir]
Summary: Removing cluster logging failed at TASK [openshift_logging : Cleaning up temp...
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Logging
Version: 3.10.0
Hardware: All
OS: Unspecified
Target Milestone: ---
: 3.10.z
Assignee: ewolinet
QA Contact: Qiaoling Tang
Depends On:
TreeView+ depends on / blocked
Reported: 2018-09-24 14:16 UTC by mikolaj.ciecierski
Modified: 2018-12-13 17:09 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: Inconsistent user usage when creating and removing temp dirs. Consequence: Removing can fail if user does not have proper access. Fix: Update so tasks use same become:false settings Result: Removing doesn't fail when using different user.
Clone Of:
Last Closed: 2018-12-13 17:09:08 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:3750 None None None 2018-12-13 17:09:14 UTC

Description mikolaj.ciecierski 2018-09-24 14:16:53 UTC
Description of problem:
Removing logging stack failed at TASK [openshift_logging : Cleaning up temp dir] .

Version-Release number of the following components:
rpm -q openshift-ansible - openshift-ansible-3.10.47-1.git.0.95bc2d2.el7_5.noarch
rpm -q ansible - ansible-
ansible --version - ansible

How reproducible:

Steps to Reproduce:
1.Run playbook responsible for removing logging stack for OCP 3.10

Actual results:
Temporary folder is not deleted at the end of uninstallation process causing ansible to fail. The temp directory is created as a root in task [openshift_logging : Create temp directory for doing work in], [openshift_logging : Cleaning up temp dir] task has become flag set to false.

TASK [openshift_logging : Cleaning up temp dir] ********************************************************
he full traceback is:
  File "/tmp/ansible_ezDs7G/ansible_module_file.py", line 278, in main
    shutil.rmtree(b_path, ignore_errors=False)
  File "/usr/lib64/python2.7/shutil.py", line 239, in rmtree
    onerror(os.listdir, path, sys.exc_info())
  File "/usr/lib64/python2.7/shutil.py", line 237, in rmtree
    names = os.listdir(path)

fatal: [master]: FAILED! => {
    "changed": false, 
    "invocation": {
        "module_args": {
            "attributes": null, 
            "backup": null, 
            "content": null, 
            "delimiter": null, 
            "diff_peek": null, 
            "directory_mode": null, 
            "follow": false, 
            "force": false, 
            "group": null, 
            "mode": null, 
            "original_basename": null, 
            "owner": null, 
            "path": "/tmp/openshift-logging-ansible-bJjNgu", 
            "recurse": false, 
            "regexp": null, 
            "remote_src": null, 
            "selevel": null, 
            "serole": null, 
            "setype": null, 
            "seuser": null, 
            "src": null, 
            "state": "absent", 
            "unsafe_writes": null, 
            "validate": null
    "msg": "rmtree failed: [Errno 13] Permission denied: '/tmp/openshift-logging-ansible-bJjNgu'"

Expected results:
[openshift_logging : Cleaning up temp dir] task removes temp directory. 

Additional info:

Comment 1 ewolinet 2018-10-16 16:00:09 UTC
Can verify you are using the version of openshift-ansible you're specifying?

This commit [1] shows that we have ansible_become: false for the creation of that temp dir.

[1] https://github.com/openshift/openshift-ansible/pull/9093/commits/6faa9063e62cacdcb2ceded52ccfc39f28f8d517

Comment 2 mikolaj.ciecierski 2018-10-17 07:46:15 UTC
I am using openshift-ansible-3.10.47-1.git.0.95bc2d2.el7_5.noarch.
I think the problem is in different place, in these two tasks:

Cleaning up temp dir task removes folder which path is registered in 'mtemp' variable.

Comment 3 ewolinet 2018-10-23 14:50:39 UTC

Sorry for the delay. It looks like the issue may be that we create the mktemp dir without 'become: false' but when we clean it up we have 'become: false' on the task.

Can you verify that is able to resolve the issue for you?

Comment 4 mikolaj.ciecierski 2018-10-25 12:53:18 UTC
Yes, this fix will resolve my issue.

Comment 9 Qiaoling Tang 2018-11-29 06:33:58 UTC
Verified in:

Comment 11 errata-xmlrpc 2018-12-13 17:09:08 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.