From 43fb086f970a30ebc218d59bd740a6c8edea030c Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Feb 14 2017 16:24:56 +0000 Subject: Fix options.force in import_comps Change from opts.force to opts['force'] was introduced in 434bfb86f42b815ef2a014fc476a169e061dfd1c, but this one is not working now. --- diff --git a/cli/koji b/cli/koji index 4e39dc1..948f82a 100755 --- a/cli/koji +++ b/cli/koji @@ -1800,7 +1800,7 @@ def _import_comps(session, filename, tag, options): """Import comps data using libcomps module""" comps = libcomps.Comps() comps.fromxml_f(filename) - force = options['force'] + force = options.force ptypes = { libcomps.PACKAGE_TYPE_DEFAULT : 'default', libcomps.PACKAGE_TYPE_OPTIONAL : 'optional', @@ -1834,7 +1834,7 @@ def _import_comps_alt(session, filename, tag, options): print 'WARN: yum.comps does not support the biarchonly of group and basearchonly of package' comps = yumcomps.Comps() comps.add(filename) - force = options['force'] + force = options.force for group in comps.groups: print "Group: %(groupid)s (%(name)s)" % vars(group) session.groupListAdd(tag, group.groupid, force=force, display_name=group.name, diff --git a/tests/test_cli/test_import_comps.py b/tests/test_cli/test_import_comps.py index d8ad8fd..5b17a90 100644 --- a/tests/test_cli/test_import_comps.py +++ b/tests/test_cli/test_import_comps.py @@ -286,8 +286,8 @@ class TestImportComps(unittest.TestCase): calls_file, stdout): tag = 'tag' - force = None - options = {'force': force} + options = mock.MagicMock() + options.force = None # Mock out the xmlrpc server session = mock.MagicMock()