cli: don't require --config in clone-tag
Fixes: https://pagure.io/koji/issue/2012
This commit is contained in:
parent
bd1c51e4dd
commit
aa16b5ccea
2 changed files with 8 additions and 24 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue