Bug 1040529

Summary: spacewalk-remove-channel does not clear the cache properly
Product: Red Hat Satellite 5 Reporter: Dimitar Yordanov <dyordano>
Component: ServerAssignee: Jan Dobes <jdobes>
Status: CLOSED DEFERRED QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: low Docs Contact:
Priority: low    
Version: 560CC: 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: 2018-04-09 11:06:52 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: 924189    
Attachments:
Description Flags
patch none

Description Dimitar Yordanov 2013-12-11 15:16:02 UTC
Description of problem:
spacewalk-remove-channel does not clear the cache properly.
The tool removes the repodata for the channel but does not remove file

 /var/cache/rhn/list_all_packages-${channel_name}

Version-Release number of selected component (if applicable):
spacewalk-backend-tools-2.0.3-18

How reproducible:
Always

Steps to Reproduce:

1. Have a Satellite with Channel that has the repodata generated and file /var/cache/rhn/list_all_packages-${channel_name} created.

2. Delete the channel with spacewalk-remove-channel 
     spacewalk-remove-channel -c ${channel_name}

Actual results:
File /var/cache/rhn/list_all_packages-${channel_name} is not removed.

Expected results:
File /var/cache/rhn/list_all_packages-${channel_name} is removed as well.



Additional info:
Example with channel redhat-rhn-proxy-5.6-server-x86_64-6.

#ll /var/cache/rhn/
total 4568
-rw-r--r--.  1 apache apache   29894 Oct 17 08:54 list_all_packages-redhat-rhn-proxy-5.6-server-x86_64-6
-rw-r--r--.  1 apache apache 3675446 Oct 29 12:55 list_all_packages-rhel-x86_64-server-6
drwxr-xr-x. 12 root   root      4096 Dec  9 08:54 repodata
drwxr-xr-x.  4 root   root      4096 Oct 29 15:33 reposync
drwxr-xr-x.  7 root   root      4096 Oct 15 20:36 satsync
-rw-r--r--.  1 root   root       764 Dec 10 11:08 virt_state.cache

# ll /var/cache/rhn/repodata/
total 40
drwxr-xr-x. 2 root root 4096 Oct 17 08:55 redhat-rhn-proxy-5.6-server-x86_64-5
drwxr-xr-x. 2 root root 4096 Oct 17 09:07 redhat-rhn-proxy-5.6-server-x86_64-6
drwxr-xr-x. 2 root root 4096 Dec  9 14:39 rhel-i386-server-6
drwxr-xr-x. 2 root root 4096 Dec  9 14:36 rhel-x86_64-server-5
drwxr-xr-x. 2 root root 4096 Dec  9 14:42 rhel-x86_64-server-6
drwxr-xr-x. 2 root root 4096 Dec  9 14:42 rhel-x86_64-server-vt-5
drwxr-xr-x. 2 root root 4096 Dec  9 14:42 rhn-tools-rhel-x86_64-server-5
drwxr-xr-x. 2 root root 4096 Dec  9 14:42 rhn-tools-rhel-x86_64-server-6

# spacewalk-remove-channel -l
rhel-i386-server-6
rhel-x86_64-server-5
	redhat-rhn-proxy-5.6-server-x86_64-5
	rhel-x86_64-server-vt-5
	rhn-tools-rhel-x86_64-server-5
rhel-x86_64-server-6
	redhat-rhn-proxy-5.6-server-x86_64-6
	rhn-tools-rhel-x86_64-server-6

# spacewalk-remove-channel -c redhat-rhn-proxy-5.6-server-x86_64-6
Deleting package metadata (76):
                  ________________________________________
Removing:         ######################################## - complete

# ll /var/cache/rhn/repodata/
total 36
drwxr-xr-x. 2 root root 4096 Oct 17 08:55 redhat-rhn-proxy-5.6-server-x86_64-5
drwxr-xr-x. 2 root root 4096 Dec  9 14:39 rhel-i386-server-6
drwxr-xr-x. 2 root root 4096 Dec  9 14:36 rhel-x86_64-server-5
drwxr-xr-x. 2 root root 4096 Dec  9 14:42 rhel-x86_64-server-6
drwxr-xr-x. 2 root root 4096 Dec  9 14:42 rhel-x86_64-server-vt-5
drwxr-xr-x. 2 root root 4096 Dec  9 14:42 rhn-tools-rhel-x86_64-server-5
drwxr-xr-x. 2 root root 4096 Dec  9 14:42 rhn-tools-rhel-x86_64-server-6

# ll /var/cache/rhn/
total 4568
-rw-r--r--.  1 apache apache   29894 Oct 17 08:54 list_all_packages- redhat-rhn-proxy-5.6-server-x86_64-6
-rw-r--r--.  1 apache apache 3675446 Oct 29 12:55 list_all_packages-rhel-x86_64-server-6
drwxr-xr-x. 11 root   root      4096 Dec 10 11:24 repodata
drwxr-xr-x.  4 root   root      4096 Oct 29 15:33 reposync
drwxr-xr-x.  7 root   root      4096 Oct 15 20:36 satsync
-rw-r--r--.  1 root   root       764 Dec 10 11:24 virt_state.cache

Comment 1 Dimitar Yordanov 2013-12-12 14:05:10 UTC
Created attachment 835812 [details]
patch

Comment 3 Jan Dobes 2016-02-24 16:27:56 UTC
Yes, this should be fixed, however list_all_packages-<label> is not the only file which can be created so this patch is incomplete. I looked at some satellites and I can see files with prefix like list_all_packages_checksum-<label>.

And after I looked into code, there is more prefixes that can occur (but I don't know when):

$ git grep "cache_prefix="
backend/server/rhnChannel.py:    return _list_packages(channel, cache_prefix="list_packages",
backend/server/rhnChannel.py:    return _list_packages(channel, cache_prefix="list_all_packages",
backend/server/rhnChannel.py:    return _list_packages(channel, cache_prefix="list_all_packages_checksum",
backend/server/rhnChannel.py:    return _list_packages(channel, cache_prefix="list_all_packages_complete",

Comment 4 Tomas Lestach 2018-04-09 11:06:52 UTC
We have re-reviewed this bug, as part of an ongoing effort to improve Satellite/Proxy feature and bug updates, review and backlog.

This is a low priority bug and has no currently open customer cases. While this bug may still valid, we do not see it being implemented prior to the EOL of the Satellite 5.x product. As such, this is being CLOSED DEFERRED. 

Closing now to help set customer expectations as early as possible. You are welcome to re-open this bug if needed.