backend/satellite_tools/spacewalk-remove-channel | 23 ++++++++++++++++-------
backend/spacewalk-backend.spec | 6 +++++-
rel-eng/packages/spacewalk-backend | 2 +-
3 files changed, 22 insertions(+), 9 deletions(-)
New commits:
commit c55bc93f02dd4f001821d91f29e01b0d79b72712
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Jan 31 14:58:20 2014 +0100
Automatic commit of package [spacewalk-backend] release [2.1.47-1].
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index 3ada77f..5eb9f0a 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -11,7 +11,7 @@ Name: spacewalk-backend
Summary: Common programs needed to be installed on the Spacewalk servers/proxies
Group: Applications/Internet
License: GPLv2
-Version: 2.1.46
+Version: 2.1.47
Release: 1%{?dist}
URL:
https://fedorahosted.org/spacewalk
Source0:
https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -628,6 +628,10 @@ rm -f %{rhnconf}/rhnSecret.py*
%{pythonrhnroot}/satellite_tools/exporter/xmlWriter.py*
%changelog
+* Fri Jan 31 2014 Michael Mraka <michael.mraka(a)redhat.com> 2.1.47-1
+- 1058431 - don't remove files referenced from other distributions/trees
+- 1058431 - propagate --skip-kickstart-trees to delete_channels()
+
* Wed Jan 29 2014 Michael Mraka <michael.mraka(a)redhat.com> 2.1.46-1
- fixed man page for spacewalk-remove-channel
- added option to skip kickstart trees removal
diff --git a/rel-eng/packages/spacewalk-backend b/rel-eng/packages/spacewalk-backend
index 2c4c8c1..8b88e28 100644
--- a/rel-eng/packages/spacewalk-backend
+++ b/rel-eng/packages/spacewalk-backend
@@ -1 +1 @@
-2.1.46-1 backend/
+2.1.47-1 backend/
commit 8eedd31b92166c53b622a76f252cf307c757d451
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Jan 31 14:53:43 2014 +0100
1058431 - don't remove files referenced from other distributions/trees
diff --git a/backend/satellite_tools/spacewalk-remove-channel
b/backend/satellite_tools/spacewalk-remove-channel
index f36a71d..3ca931d 100755
--- a/backend/satellite_tools/spacewalk-remove-channel
+++ b/backend/satellite_tools/spacewalk-remove-channel
@@ -551,16 +551,23 @@ def _get_package_paths(package_ids, sources=0):
def _delete_ks_files(channel_labels):
sql = """
select kt.base_path
- from rhnChannel c
- left join rhnKickstartableTree kt on c.id = kt.channel_id
- where c.label in (%s);
+ from rhnChannel c
+ join rhnKickstartableTree kt on c.id = kt.channel_id
+ where c.label in (%s) and not exists (
+ select 1
+ from rhnKickstartableTree ktx
+ join rhnChannel cx on cx.id = ktx.channel_id
+ where replace(ktx.base_path, :mnt_point, '') =
+ replace(kt.base_path, :mnt_point, '')
+ and cx.label not in (%s));
"""
params, bind_params = _bind_many(channel_labels)
+ params['mnt_point'] = CFG.MOUNT_POINT + '/'
bind_params = string.join(bind_params, ', ')
- h = rhnSQL.prepare(sql % (bind_params))
+ h = rhnSQL.prepare(sql % (bind_params, bind_params))
h.execute(**params)
- list = h.fetchall_dict()
+ list = h.fetchall_dict() or []
for map in list:
path = os.path.join(CFG.MOUNT_POINT, str(map['base_path']))
commit 2938b15e4612600dd25424839402e6d69f9d278f
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Jan 31 14:52:28 2014 +0100
1058431 - propagate --skip-kickstart-trees to delete_channels()
diff --git a/backend/satellite_tools/spacewalk-remove-channel
b/backend/satellite_tools/spacewalk-remove-channel
index 5e0a1c8..f36a71d 100755
--- a/backend/satellite_tools/spacewalk-remove-channel
+++ b/backend/satellite_tools/spacewalk-remove-channel
@@ -148,7 +148,8 @@ def main():
try:
delete_channels(channels.keys(), force=options.force,
justdb=options.justdb, skip_packages=options.skip_packages,
- skip_channels=options.skip_channels)
+ skip_channels=options.skip_channels,
+ skip_kickstart_trees=options.skip_kickstart_trees)
except:
rhnSQL.rollback()
raise
@@ -285,7 +286,8 @@ def __listChannels():
return labels, parents
-def delete_channels(channelLabels, force=0, justdb=0, skip_packages=0, skip_channels=0):
+def delete_channels(channelLabels, force=0, justdb=0, skip_packages=0, skip_channels=0,
+ skip_kickstart_trees=0):
# Get the package ids
if not channelLabels:
return