From 26d7af59d3a413b89c478372ce8a820ed7a3eec8 Mon Sep 17 00:00:00 2001 From: Stephen Coady Date: Tue, 19 May 2020 11:35:57 +0100 Subject: [PATCH 1/5] Add option for new AAA backend this commit adds the ability to query users from the freeipa backend instead of fas. the freeipa_backend config variable will be added to the ansible repo and turned to False by default. Signed-off-by: Stephen Coady --- pdcupdater/services.py | 12 ++++++++++-- setup.py | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/pdcupdater/services.py b/pdcupdater/services.py index 541dd85..669f1ed 100644 --- a/pdcupdater/services.py +++ b/pdcupdater/services.py @@ -1,9 +1,12 @@ import logging import operator +import os import bs4 import requests +from fasjson_client import Client + import pdcupdater.handlers.compose import pdcupdater.utils @@ -72,13 +75,18 @@ def old_composes(base_url): @pdcupdater.utils.with_ridiculous_timeout -def fas_persons(base_url, username, password): +def fas_persons(base_url, username, password, freeipa_backend): """ Return the list of users in the Fedora Account System. """ + log.info("Connecting to Account System at %r" % base_url) + if freeipa_backend: + client = Client(url=base_url) + response = client.users.list_users().response().result + return response['result'] + import fedora.client import fedora.client.fas2 - log.info("Connecting to FAS at %r" % base_url) fasclient = fedora.client.fas2.AccountSystem( base_url=base_url, username=username, password=password) diff --git a/setup.py b/setup.py index 99524f0..ea3c736 100644 --- a/setup.py +++ b/setup.py @@ -12,6 +12,7 @@ 'pdc-client', 'six', 'modulemd', + 'fasjson-client', ] From fa5a7661a56b95b25bc2b4b64e219aa15fb11d8a Mon Sep 17 00:00:00 2001 From: Stephen Coady Date: Tue, 19 May 2020 15:23:03 +0100 Subject: [PATCH 2/5] add check for result Signed-off-by: Stephen Coady --- pdcupdater/services.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pdcupdater/services.py b/pdcupdater/services.py index 669f1ed..f4b614e 100644 --- a/pdcupdater/services.py +++ b/pdcupdater/services.py @@ -82,7 +82,8 @@ def fas_persons(base_url, username, password, freeipa_backend): if freeipa_backend: client = Client(url=base_url) response = client.users.list_users().response().result - return response['result'] + people = response.get('result', []) + return people import fedora.client import fedora.client.fas2 From 07ca162e879bbcf8292fb3fc78b3c8486fc9eb51 Mon Sep 17 00:00:00 2001 From: Stephen Coady Date: Wed, 27 May 2020 09:48:08 +0100 Subject: [PATCH 3/5] fixed api. updated vagrant box and CI. Signed-off-by: Stephen Coady --- .travis-Dockerfile | 7 +++---- Vagrantfile | 2 +- pdcupdater/services.py | 2 +- pdcupdater/tests/vcr-request-data.tar.gz | Bin 23460808 -> 0 bytes 4 files changed, 5 insertions(+), 6 deletions(-) delete mode 100644 pdcupdater/tests/vcr-request-data.tar.gz diff --git a/.travis-Dockerfile b/.travis-Dockerfile index 8a0af3e..3b2e712 100644 --- a/.travis-Dockerfile +++ b/.travis-Dockerfile @@ -14,14 +14,13 @@ RUN yum -y update && \ libffi-devel \ libyaml-devel \ openssl-devel \ - python27 \ - python-devel \ - python-pip \ + python3-devel \ + python3-pip \ redhat-rpm-config \ swig \ zeromq-devel \ rpm-devel \ - python2-koji \ + python3-koji \ libmodulemd && \ yum clean all diff --git a/Vagrantfile b/Vagrantfile index 68eac95..61baf36 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -21,7 +21,7 @@ $script = <