Remove deprecated remove-channel/removeChannel

Fixes: https://pagure.io/koji/issue/3356
This commit is contained in:
Jana Cupova 2022-05-11 10:17:34 +02:00 committed by Tomas Kopecek
parent 9a1ee191a6
commit 52026bcfcb
6 changed files with 0 additions and 183 deletions

View file

@ -2467,39 +2467,6 @@ def edit_channel(channelInfo, **kw):
return True
def remove_channel(channel_name, force=False):
"""Remove a channel.
:param str channel_name: channel name
:param bool force: remove channel which has hosts
Channel must have no hosts, unless force is set to True
If a channel has associated tasks, it cannot be removed
and an exception will be raised.
Removing channel will remove also remove complete history
for that channel.
"""
logger.warning("removeChannel call is deprecated and will be removed in 1.30")
context.session.assertPerm('admin')
channel_id = get_channel_id(channel_name, strict=True)
# check for task references
query = QueryProcessor(tables=['task'], clauses=['channel_id=%(channel_id)i'],
values=locals(), columns=['id'], opts={'limit': 1})
# XXX slow query
if query.execute():
raise koji.GenericError('channel %s has task references' % channel_name)
query = QueryProcessor(tables=['host_channels'], clauses=['channel_id=%(channel_id)i'],
values=locals(), columns=['host_id'], opts={'limit': 1})
if query.execute():
if not force:
raise koji.GenericError('channel %s has host references' % channel_name)
delete = """DELETE FROM host_channels WHERE channel_id=%(channel_id)i"""
_dml(delete, locals())
delete = """DELETE FROM channels WHERE id=%(channel_id)i"""
_dml(delete, locals())
def add_channel(channel_name, description=None):
"""Add a channel.
@ -13592,7 +13559,6 @@ class RootExports(object):
removeHostFromChannel = staticmethod(remove_host_from_channel)
renameChannel = staticmethod(rename_channel)
editChannel = staticmethod(edit_channel)
removeChannel = staticmethod(remove_channel)
addChannel = staticmethod(add_channel)
def listHosts(self, arches=None, channelID=None, ready=None, enabled=None, userID=None,