Use dnf backend for repoclosure on PY3

When yum is not available, it makes no sense to offer it as an option.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2017-12-04 12:30:18 +01:00
parent 60cc3e5d55
commit d5a0316877
4 changed files with 9 additions and 5 deletions

View File

@ -172,7 +172,7 @@ Options
(*str*) -- Select which tool should be used to run repoclosure over created (*str*) -- Select which tool should be used to run repoclosure over created
repositories. By default ``yum`` is used, but you can switch to ``dnf``. repositories. By default ``yum`` is used, but you can switch to ``dnf``.
Please note that when ``dnf`` is used, the build dependencies check is Please note that when ``dnf`` is used, the build dependencies check is
skipped. skipped. On Python 3, only ``dnf`` backend is available.
**compose_type** **compose_type**
(*str*) -- Allows to set default compose type. Type set via a command-line (*str*) -- Allows to set default compose type. Type set via a command-line

View File

@ -614,8 +614,9 @@ def make_schema():
}), }),
"repoclosure_backend": { "repoclosure_backend": {
"type": "string", "type": "string",
"default": "yum", # Gather and repoclosure both have the same backends: yum + dnf
"enum": ["yum", "dnf"], "default": _get_default_gather_backend(),
"enum": _get_gather_backends(),
}, },
"old_composes_per_release_type": { "old_composes_per_release_type": {

View File

@ -427,9 +427,10 @@ class RepoclosureTestCase(ConfigTestCase):
repoclosure_backend='fnd', # Intentionally with a typo repoclosure_backend='fnd', # Intentionally with a typo
) )
options = ['yum', 'dnf'] if six.PY2 else ['dnf']
self.assertValidation( self.assertValidation(
cfg, cfg,
["Failed validation in repoclosure_backend: 'fnd' is not one of ['yum', 'dnf']"]) ["Failed validation in repoclosure_backend: 'fnd' is not one of %s" % options])
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -192,7 +192,9 @@ class TestRepoclosure(PungiTestCase):
@mock.patch('pungi.wrappers.repoclosure.get_repoclosure_cmd') @mock.patch('pungi.wrappers.repoclosure.get_repoclosure_cmd')
@mock.patch('pungi.phases.test.run') @mock.patch('pungi.phases.test.run')
def test_repoclosure_default_backend(self, mock_run, mock_grc): def test_repoclosure_default_backend(self, mock_run, mock_grc):
with mock.patch('six.PY2', new=True):
compose = DummyCompose(self.topdir, {}) compose = DummyCompose(self.topdir, {})
test_phase.run_repoclosure(compose) test_phase.run_repoclosure(compose)
self.assertItemsEqual( self.assertItemsEqual(