From 297f36c02b0cb4585cbc91abb2d5eb36090fd449 Mon Sep 17 00:00:00 2001 From: FrantiĊĦek Zatloukal Date: May 20 2019 14:45:34 +0000 Subject: Reland "update to new bodhi library" Merges: https://pagure.io/taskotron/libtaskotron/pull-request/428 --- diff --git a/docs/source/devguide.rst b/docs/source/devguide.rst index aff7a41..25ffbc9 100644 --- a/docs/source/devguide.rst +++ b/docs/source/devguide.rst @@ -42,6 +42,8 @@ On your Fedora system, install the necessary packages:: createrepo_c \ gcc \ git \ + python2-bodhi-client \ + python3-bodhi-client \ python3-doit \ python2-hawkey \ python3-hawkey \ diff --git a/libtaskotron.spec b/libtaskotron.spec index 16838d0..7dd1746 100644 --- a/libtaskotron.spec +++ b/libtaskotron.spec @@ -23,8 +23,8 @@ Summary: libtaskotron python2 libraries Requires: ansible Requires: createrepo_c Requires: dnf +Requires: python2-bodhi-client Requires: python2-configparser -Requires: python2-fedora Requires: python2-hawkey Requires: python2-jinja2 Requires: python2-koji @@ -39,9 +39,9 @@ Requires: python2-xunitparser # used by 'synchronize' task in ansible Requires: rsync +BuildRequires: python2-bodhi-client BuildRequires: python2-configparser BuildRequires: python2-devel -BuildRequires: python2-fedora BuildRequires: python2-hawkey BuildRequires: python2-koji BuildRequires: python2-mock @@ -78,7 +78,7 @@ Obsoletes: python2-libtaskotron <= %{version}-%{release} Requires: ansible Requires: createrepo_c Requires: dnf -Requires: python3-fedora +Requires: python3-bodhi-client Requires: python3-hawkey Requires: python3-jinja2 Requires: python3-koji @@ -98,8 +98,8 @@ Requires: python3-PyYAML Requires: python3-pyyaml %endif +BuildRequires: python3-bodhi-client BuildRequires: python3-devel -BuildRequires: python3-fedora BuildRequires: python3-hawkey BuildRequires: python3-koji BuildRequires: python3-mock diff --git a/libtaskotron/ext/fedora/bodhi_utils.py b/libtaskotron/ext/fedora/bodhi_utils.py index 9df8ff9..4272604 100644 --- a/libtaskotron/ext/fedora/bodhi_utils.py +++ b/libtaskotron/ext/fedora/bodhi_utils.py @@ -6,7 +6,7 @@ '''Utility functions for dealing with Bodhi''' from __future__ import absolute_import -import fedora.client +import bodhi.client.bindings from libtaskotron import config from libtaskotron import exceptions as exc @@ -20,7 +20,7 @@ from . import rpm_utils class BodhiUtils(object): '''Helper Bodhi methods. - :ivar fedora.client.Bodhi2Client client: Bodhi2 client instance + :ivar bodhi.client.bindings.BodhiClient client: Bodhi client instance ''' #: How many requests to make in a single call. The maximum page limit is @@ -38,7 +38,7 @@ class BodhiUtils(object): self.config = config.get_config() if not client: - self.client = fedora.client.bodhi.Bodhi2Client(staging=self.config.bodhi_staging) + self.client = bodhi.client.bindings.BodhiClient(staging=self.config.bodhi_staging) log.debug('Created Bodhi client to: %s', self.client.base_url) # automatically retry failed requests (HTTP 5xx and similar) self.client.retries = 10 diff --git a/requirements.txt b/requirements.txt index 95888fa..25ed272 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,8 @@ # libtaskotron ansible >= 2.3 -python-fedora >= 0.8.0 +# bodhi-client is currently not installable from pip: https://github.com/fedora-infra/bodhi/issues/2401 +# bodhi-client >= 3.10 configparser >= 3.5.0b2 Jinja2 >= 2.8 munch >= 2.0.2 diff --git a/testing/test_bodhi_utils.py b/testing/test_bodhi_utils.py index 219eb33..c713c47 100644 --- a/testing/test_bodhi_utils.py +++ b/testing/test_bodhi_utils.py @@ -9,7 +9,7 @@ import pytest import mock from munch import Munch -import fedora.client.bodhi +import bodhi.client.bindings from libtaskotron.ext.fedora import bodhi_utils from libtaskotron import exceptions as exc @@ -32,8 +32,8 @@ class TestBodhiUtils(): stg_url = bu_stg.client.base_url assert prod_url != stg_url - assert prod_url == fedora.client.bodhi.BODHI2_BASE_URL - assert stg_url == fedora.client.bodhi.BODHI2_STG_BASE_URL + assert prod_url == bodhi.client.bindings.BASE_URL + assert stg_url == bodhi.client.bindings.STG_BASE_URL class TestGetUpdate():