backend/satellite_tools/spacewalk-remove-channel | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
New commits:
commit d4bee4ec00fc89e00dd5c74a684298ebf0e2f686
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Nov 24 14:26:11 2010 +0100
added --skip-channels to spacewalk-remove-channel
this is the way how to remove all packages from the channel(s)
diff --git a/backend/satellite_tools/spacewalk-remove-channel
b/backend/satellite_tools/spacewalk-remove-channel
index 693f244..7e58ab0 100755
--- a/backend/satellite_tools/spacewalk-remove-channel
+++ b/backend/satellite_tools/spacewalk-remove-channel
@@ -47,6 +47,8 @@ options_table = [
help="Remove the channel packages from any other channels too (Not
Recommended)"),
Option("-p", "--skip-packages", action="store_true",
help="Do not remove package metadata or packages from the filesystem (Not
Recommended)"),
+ Option( "--skip-channels", action="store_true",
+ help="Remove only packages from channel not the channel itself."),
]
LOCK = None
@@ -133,7 +135,8 @@ def main():
try:
delete_channels(channels.keys(), force=options.force,
- justdb=options.justdb, skip_packages=options.skip_packages)
+ justdb=options.justdb, skip_packages=options.skip_packages,
+ skip_channels=options.skip_channels)
except:
rhnSQL.rollback()
raise
@@ -278,7 +281,7 @@ def __listChannels():
return labels, parents
-def delete_channels(channelLabels, force=0, justdb=0, skip_packages=0):
+def delete_channels(channelLabels, force=0, justdb=0, skip_packages=0, skip_channels=0):
# Get the package ids
if not channelLabels:
return
@@ -341,16 +344,20 @@ def delete_channels(channelLabels, force=0, justdb=0,
skip_packages=0):
['rhnErrataFileChannel', 'channel_id'],
['rhnErrataNotificationQueue', 'channel_id'],
['rhnChannelErrata', 'channel_id'],
- ['rhnChannelFamilyMembers', 'channel_id'],
['rhnChannelPackage', 'channel_id'],
- ['rhnDistChannelMap', 'channel_id'],
['rhnRegTokenChannels', 'channel_id'],
['rhnServerProfile', 'base_channel'],
['rhnKickstartableTree', 'channel_id'],
- ['rhnReleaseChannelMap', 'channel_id'],
- ['rhnChannel', 'id'],
]
+ if not skip_channels:
+ tables.extend([
+ ['rhnChannelFamilyMembers', 'channel_id'],
+ ['rhnDistChannelMap', 'channel_id'],
+ ['rhnReleaseChannelMap', 'channel_id'],
+ ['rhnChannel', 'id'],
+ ])
+
query = "delete from %s where %s = :channel_id"
for table, field in tables:
log_debug(3, "Processing table %s" % table)