Bug 1309006

Summary: rhncfg-manager removes all directories in a path during rollback transaction
Product: [Community] Spacewalk Reporter: Gennadii Altukhov <galtukho>
Component: ClientsAssignee: Gennadii Altukhov <galtukho>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 2.4CC: tkasparek, tlestach
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-16 08:10:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1484117    

Description Gennadii Altukhov 2016-02-16 17:15:08 UTC
Description of problem:
rhncfg-manager raises an exceptions while handling an exception during a configuration directory deployment.

Version-Release number of selected component:
Spacewalk server 2.4
rhncfg-management-5.10.85-1.el6.noarch

How reproducible:
0) Have an installed Spacewalk 2.4
1) Create a configuration channel
2) In configuration channel chose 'Add Files' -> 'Create File', add a directory, owned by a user that would not be present on the system by default
3) Register a client system in the Spacewalk Server with 'Provisioning' Entitlement
4) On the client system install packages rhncfg*
5) and run:
rhncfg-manager download-channel --topdir=/tmp rmdir_test_channel

Actual results:
[root@test04-64 ~]# rhncfg-manager download-channel --topdir=/tmp rmdir_test_channel
Using server name test01-64.sysmgmt.lab.eng.rdu2.redhat.com
Username: admin
Password: 
Traceback (most recent call last):
  File "/usr/bin/rhncfg-manager", line 46, in <module>
    sys.exit(Main().main() or 0)
  File "/usr/share/rhn/config_common/rhn_main.py", line 207, in main
    handler.run()
  File "/usr/share/rhn/config_management/rhncfg_download_channel.py", line 52, in run
    config_channel=ns)
  File "/usr/share/rhn/config_common/deploy.py", line 65, in deploy_files
    try_rollback(dep_trans, "Error unable to deploy file, information on user '%s' could not be found" % e[0])
  File "/usr/share/rhn/config_common/deploy.py", line 81, in try_rollback
    dep_trans.rollback()
  File "/usr/share/rhn/config_common/transactions.py", line 272, in rollback
    os.rmdir(remove_dir)
OSError: [Errno 39] Directory not empty: '/tmp'

Expected results:
do no try to remove directories which were not created by current transaction

Additional info:

There is another bug 1309003, which is similar to this one, but actually
there is a reason to do it separately.

Comment 1 Gennadii Altukhov 2016-02-25 12:03:23 UTC
Taking...

Comment 2 Gennadii Altukhov 2016-02-29 15:57:07 UTC
spacewalk.git:

4ae6f04cf178172f236984a48b4217c97bb1520a

Comment 3 Tomáš Kašpárek 2016-06-16 08:10:16 UTC
Spacewalk 2.5 was released.

Comment 4 Eric Herget 2017-09-28 18:07:37 UTC
This BZ closed some time during 2.5, 2.6 or 2.7.  Adding to 2.7 tracking bug.