From aa16b5ccead61bdd3d99972acceb814c44292373 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Sep 08 2020 09:00:38 +0000 Subject: cli: don't require --config in clone-tag Fixes: https://pagure.io/koji/issue/2012 --- diff --git a/cli/koji_cli/commands.py b/cli/koji_cli/commands.py index cce609b..092c440 100644 --- a/cli/koji_cli/commands.py +++ b/cli/koji_cli/commands.py @@ -3431,15 +3431,16 @@ def handle_clone_tag(goptions, session, args): chggrplist = [] # case of brand new dst-tag. if not dsttag: - if not options.config: - parser.error(_('Cannot create tag without specifying --config')) # create a new tag, copy srctag header. if not options.test: - session.createTag(args[1], parent=None, arches=srctag['arches'], - perm=srctag['perm_id'], - locked=srctag['locked'], - maven_support=srctag['maven_support'], - maven_include_all=srctag['maven_include_all']) + if options.config: + session.createTag(args[1], parent=None, arches=srctag['arches'], + perm=srctag['perm_id'], + locked=srctag['locked'], + maven_support=srctag['maven_support'], + maven_include_all=srctag['maven_include_all']) + else: + session.createTag(args[1], parent=None) # store the new tag, need its assigned id. newtag = session.getTag(args[1], strict=True) # get pkglist of src-tag, including inherited packages. diff --git a/tests/test_cli/test_clone_tag.py b/tests/test_cli/test_clone_tag.py index 3e457a3..9e13a8e 100644 --- a/tests/test_cli/test_clone_tag.py +++ b/tests/test_cli/test_clone_tag.py @@ -121,23 +121,6 @@ clone-tag will create the destination tag if it does not already exist self.activate_session.getTag.has_called([mock.call('src-tag'), mock.call('dst-tag')]) - def test_handle_clone_tag_no_config(self): - args = ['src-tag', 'dst-tag'] - self.session.getTag.side_effect = [{'id': 1, - 'locked': False}, - None] - self.assert_system_exit( - handle_clone_tag, - self.options, - self.session, - args, - stderr=self.format_error_message( - "Cannot create tag without specifying --config"), - activate_session=None) - self.activate_session.assert_called_once() - self.activate_session.getTag.has_called([mock.call('src-tag'), - mock.call('dst-tag')]) - @mock.patch('sys.stdout', new_callable=six.StringIO) def test_handle_clone_tag_new_dsttag(self, stdout): args = ['src-tag', 'dst-tag', '--all', '-v']