[ansible] Remove fedora fas01 hack
by Nicolas Chauvet
commit 7d7eabe3bfa8d78fd54f9716318ab8bd7db4c24e
Author: Nicolas Chauvet <kwizart(a)gmail.com>
Date: Thu Oct 27 19:51:03 2016 +0200
Remove fedora fas01 hack
roles/fas_server/tasks/main.yml | 8 --------
roles/fas_server/templates/fas.cfg.j2 | 6 +++---
2 files changed, 3 insertions(+), 11 deletions(-)
---
diff --git a/roles/fas_server/tasks/main.yml b/roles/fas_server/tasks/main.yml
index 2c8d470..ff5bc96 100644
--- a/roles/fas_server/tasks/main.yml
+++ b/roles/fas_server/tasks/main.yml
@@ -413,11 +413,3 @@
- fas
- hotfixfas
-- name: HOTFIX make sure only fas01 cleans up sessions
- copy: src={{ roles }}/fas_server/files/controllers.py
- dest=/usr/lib/python2.6/site-packages/fas/controllers.py
- mode=644 owner=root group=root
- tags:
- - config
- - fas
- - hotfixfas
diff --git a/roles/fas_server/templates/fas.cfg.j2 b/roles/fas_server/templates/fas.cfg.j2
index 3718f12..e1de606 100644
--- a/roles/fas_server/templates/fas.cfg.j2
+++ b/roles/fas_server/templates/fas.cfg.j2
@@ -251,9 +251,9 @@ gpgexec = "/usr/bin/gpg"
gpghome = "/etc/fas-gpg"
# Note: gpg_fingerprint and gpg_passphrase are for encrypting password reset mail if the user has
# a gpg key registered. It's currently broken
-gpg_fingerprint = "C199 1E25 D00A D200 2D2E 54D1 BF7F 1647 C54E 8410"
-gpg_passphrase = "{{ fasGpgPassphrase }}"
-gpg_keyserver = "hkp://subkeys.pgp.net"
+gpg_fingerprint = "0FC4 A51E 379A C050 5112 8DF5 94D7 5B22 5B01 F801"
+#gpg_passphrase = "{{ fasGpgPassphrase }}"
+gpg_keyserver = "hkp://keys.fedoraproject.org"
[/rpmfusion-server-ca.cert]
static_filter.on = True
8 years, 1 month
[ansible] Attempt to fix base
by Nicolas Chauvet
commit 3c7338537a76ffd587e7c5f52eb19de7d0d28fa0
Author: Nicolas Chauvet <kwizart(a)gmail.com>
Date: Thu Oct 27 19:31:17 2016 +0200
Attempt to fix base
vars/RedHat.yml | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/vars/RedHat.yml b/vars/RedHat.yml
index d5e7621..d2c0b2b 100644
--- a/vars/RedHat.yml
+++ b/vars/RedHat.yml
@@ -2,7 +2,7 @@
dist_tag: el{{ ansible_distribution_version[0] }}
base_pkgs_inst: ['iptables-services']
base_pkgs_erase: ['firstboot-tui','bluez-utils', 'sendmail', 'firewalld']
-service_disabled: []
-service_enabled: []
+service_disabled: [ ]
+service_enabled: [ ]
is_rhel: True
pythonsitelib: /usr/lib/python2.7/site-packages
8 years, 1 month
[ansible] Add master.html for fas
by Nicolas Chauvet
commit 87d96e5cfb6c7ff7ff71b5470a7f979bcf4b4267
Author: Nicolas Chauvet <kwizart(a)gmail.com>
Date: Thu Oct 27 14:57:08 2016 +0200
Add master.html for fas
roles/fas_server/tasks/main.yml | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/roles/fas_server/tasks/main.yml b/roles/fas_server/tasks/main.yml
index 110357c..2c8d470 100644
--- a/roles/fas_server/tasks/main.yml
+++ b/roles/fas_server/tasks/main.yml
@@ -356,6 +356,16 @@
- fas
- hotfixfas
+- name: HOTFIX adapt master.html
+ copy: src={{ files }}/hotfix/fas/master.html
+ dest=/usr/lib/python2.6/site-packages/fas/templates/master.html
+ mode=644 owner=root group=root
+ tags:
+ - config
+ - fas
+ - hotfixfas
+
+
- name: install /etc/export-bugzilla.cfg file
template: >
src="export-bugzilla.cfg.j2"
8 years, 1 month
[ansible] Add master.html hotfix
by Nicolas Chauvet
commit 2d452da05a976958e642516d2a7e3b1a21fa6954
Author: Nicolas Chauvet <kwizart(a)gmail.com>
Date: Thu Oct 27 14:48:26 2016 +0200
Add master.html hotfix
files/hotfix/fas/master.html | 114 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 114 insertions(+), 0 deletions(-)
---
diff --git a/files/hotfix/fas/master.html b/files/hotfix/fas/master.html
new file mode 100644
index 0000000..46f1c5d
--- /dev/null
+++ b/files/hotfix/fas/master.html
@@ -0,0 +1,114 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:py="http://genshi.edgewall.org/"
+ py:strip="">
+ <?python
+ from turbogears import config
+ import fas.sidebar as sidebar
+ _ = tg.gettext
+ ?>
+ <head py:match="head" py:attrs="select('@*')">
+ <link href="${tg.url('/static/theme/%s/css/style.css') % config.get('theme')}" rel="stylesheet" type="text/css" />
+ <link rel="shortcut icon" href="${tg.url('/static/theme/%s/images/favicon.ico' % config.get('theme'))}" type="image/vnd.microsoft.icon" />
+ <meta py:replace="select('*|text()')" />
+ <jsglobals />
+ <script type="text/javascript" src="${tg.url('/static/js/prototype.js')}"></script>
+ <script type="text/javascript" src="${tg.url('/static/js/prototype.improvements.js')}"></script>
+ <script type="text/javascript" src="${tg.url('/static/js/scriptaculous.js?load=effects')}"></script>
+ <script type="text/javascript" src="${tg.url('/static/js/HelpBalloon.js')}"></script>
+ </head>
+ <body py:match="body" py:attrs="select('@*')">
+ <div id="wrapper">
+ <div id="head" class="head-${config.get('deployment_type', 'dev')}">
+ <h1><a href="http://rpmfusion.org/">${_('RPM Fusion')}</a></h1>
+ <!-- TODO: Make this do something useful, talk about interface :)
+ <div id="searchbox">
+ <form action="" method="post">
+ <label for="q">${_('Search:')}</label>
+ <input type="text" name="q" id="q" />
+ <input type="submit" value="${_('Search')}" />
+ </form>
+ </div>
+ -->
+ <h2 py:if="config.get('deployment_type', 'dev')=='dev'">
+ DEVELOPMENT INSTANCE
+ </h2>
+ <h2 py:if="config.get('deployment_type', 'dev')=='stg'">
+ STAGING INSTANCE
+ </h2>
+ </div>
+ <div id="topnav">
+ <ul>
+ <li class="first"><a href="http://rpmfusion.org/">${_('Learn about RPM Fusion')}</a></li>
+ <li><a href="http://get.fedoraproject.org/">${_('Download Fedora')}</a></li>
+ <li><a href="http://rpmfusion.org/">${_('Projects')}</a></li>
+ <li><a href="http://rpmfusion.org/Contributors">${_('Join RPM Fusion')}</a></li>
+ <li><a href="http://rpmfusion.org/">${_('Communicate')}</a></li>
+ <li><a href="http://rpmfusion.org/">${_('Help/Documentation')}</a></li>
+ <li><a href="https://fedoraproject.org/code-of-conduct">${_('Code of Conduct')}</a></li>
+ </ul>
+ </div>
+ <div id="infobar">
+ <div id="authstatus">
+ <span py:if="not tg.identity.anonymous">
+ <strong>${_('Logged in:')}</strong> ${tg.identity.user.username}
+ </span>
+ </div>
+ <div id="control">
+ <ul class="toolbar" id="#main-toolbar">
+ <li class="toolitem"><a href="${tg.url('/about')}">About</a></li>
+ <logintoolitem href="${tg.url('/user/view/')}" />
+ </ul>
+ </div>
+ </div>
+ <div id="main">
+ <div id="sidebar">
+ <ul>
+ <li class="first"><a href="${tg.url('/home')}">${_('Home')}</a></li>
+ <li py:if="not tg.identity.anonymous"><a href="${tg.url('/user/view/%s' % tg.identity.user.username)}">${_('My Account')}</a></li>
+ <li py:if="not tg.identity.anonymous" py:for="entry in sidebar.getEntries()"><a href="${tg.url(entry[1])}">${_(entry[0])}</a></li>
+ <li><a href="http://fedoramagazine.org/">${_('News')}</a></li>
+ </ul>
+ <div py:if="tg.identity.anonymous and tg.available_languages and len(tg.available_languages) > 1" id="language">
+ <!-- TODO: Should this be available to logged in users to (and actually change their DB entry?) -->
+ <form action="${tg.url('/language')}" method="post">
+ <label for="locale">${_('Locale:')}</label>
+ <select name="locale" id="locale">
+ <option py:for="language in tg.available_languages" value="${language}" py:attrs="{'selected': tg.lang == language and 'selected' or None}">${language}</option>
+ </select>
+ <input type="submit" value="${_('OK')}" />
+ </form>
+ </div>
+ </div>
+ <div id="content">
+ <div py:if="tg_flash" class="flash">
+ ${tg_flash}
+ </div>
+ <div py:replace="select('*|text()')" />
+ </div>
+ <div id="footer">
+ <ul id="footlinks">
+ <li class="first"><a href="${tg.url('/about')}">${_('About')}</a></li>
+ <li><a href="http://rpmfusion.org">${_('Contact Us')}</a></li>
+ <li><a href="http://fedoraproject.org/wiki/Legal">${_('Legal & Privacy')}</a></li>
+ <a href="https://fedoraproject.org/wiki/Legal/TrademarkGuidelines">${_('Trademark Guidelines')}</a>
+ </ul>
+ <p class="version">
+ ${_('FAS version %s') % tg.fas_version}
+ </p>
+ <p class="copy">
+ ${Markup(_('© 2015 Red Hat, Inc. Please send any comments or corrections to the <a href="mailto:%(webmaster)s">websites team</a>.') % {'webmaster': tg.webmaster_email})}
+ </p>
+ <p class="disclaimer">
+ ${_('RPM Fusion is maintained and driven by the community and NOT sponsored by Red Hat. This is a community maintained site. Red Hat is not responsible for content.')}
+ </p>
+ </div>
+ </div>
+ </div> <!-- End wrapper -->
+ </body>
+
+ <xi:include href="${tg.fedora_template('login.html')}" />
+ <xi:include href="${tg.fedora_template('jsglobals.html')}" />
+
+</html>
8 years, 1 month
[ansible] Add existing ca field
by Nicolas Chauvet
commit 599b0bf761e409d8dbdad9e81350ef2f3d0cf4f2
Author: Nicolas Chauvet <kwizart(a)gmail.com>
Date: Thu Oct 27 14:28:12 2016 +0200
Add existing ca field
roles/fas_server/templates/fas.cfg.j2 | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/roles/fas_server/templates/fas.cfg.j2 b/roles/fas_server/templates/fas.cfg.j2
index 9bf080b..3718f12 100644
--- a/roles/fas_server/templates/fas.cfg.j2
+++ b/roles/fas_server/templates/fas.cfg.j2
@@ -227,11 +227,19 @@ openssl_expire = 15552000 # 60*60*24*180 = 6 months
openssl_ca_dir = "/var/lib/rpmfusion-ca"
openssl_ca_newcerts = "/var/lib/rpmfusion-ca/newcerts"
openssl_ca_index = "/var/lib/rpmfusion-ca/index.txt"
+{% if env == "staging" %}
openssl_c = "EU"
openssl_st = "None"
openssl_l = "Freeworld"
openssl_o = "RPM Fusion Project"
openssl_ou = "RPM Fusion User Cert"
+{% else %}
+openssl_c = "EU"
+openssl_st = "France"
+openssl_l = "France"
+openssl_o = "RPM Fusion"
+openssl_ou = "Upload Files"
+{% endif %}
# Source of entrophy for salts, tokens, passwords
# os.urandom will be used if this is false.
8 years, 1 month
[ansible] Adapt fpca.html
by Nicolas Chauvet
commit 40fe87bac5e1c317eca81229fb0ebbefe34ca756
Author: Nicolas Chauvet <kwizart(a)gmail.com>
Date: Thu Oct 27 14:02:56 2016 +0200
Adapt fpca.html
roles/fas_server/tasks/main.yml | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/roles/fas_server/tasks/main.yml b/roles/fas_server/tasks/main.yml
index a69f946..110357c 100644
--- a/roles/fas_server/tasks/main.yml
+++ b/roles/fas_server/tasks/main.yml
@@ -347,6 +347,15 @@
- config
- fas
+- name: HOTFIX adapt fpca.html
+ copy: src={{ files }}/hotfix/fas/fpca.html
+ dest=/usr/lib/python2.6/site-packages/fas/templates/fpca/fpca.html
+ mode=644 owner=root group=root
+ tags:
+ - config
+ - fas
+ - hotfixfas
+
- name: install /etc/export-bugzilla.cfg file
template: >
src="export-bugzilla.cfg.j2"
8 years, 1 month
[ansible] Add fpca.html for fas
by Nicolas Chauvet
commit b64469acadcf7c65ea2b8f4d11d7b26da09f5ec4
Author: Nicolas Chauvet <kwizart(a)gmail.com>
Date: Thu Oct 27 13:59:31 2016 +0200
Add fpca.html for fas
files/hotfix/fas/fpca.html | 92 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 92 insertions(+), 0 deletions(-)
---
diff --git a/files/hotfix/fas/fpca.html b/files/hotfix/fas/fpca.html
new file mode 100644
index 0000000..899d187
--- /dev/null
+++ b/files/hotfix/fas/fpca.html
@@ -0,0 +1,92 @@
+<div id="cla" xml:lang="en">
+<h3>The RPM Fusion Project Contributor Agreement</h3>
+<a href="http://rpmfusion.org/wiki/Legal:RPM Fusion_Project_Contributor_Agreement">http://rpmfusion.org/wiki/Legal:RPM Fusion_Project_Contributor_Agreement</a>
+<p>[Version 2015-02-03]</p>
+
+
+<h3>Goal</h3>
+<p>We require that contributors to RPM Fusion (as defined below) agree to this RPM Fusion Project Contributor Agreement (FPCA) to ensure that contributions to RPM Fusion have acceptable licensing terms.</p>
+
+
+<h3>Non-Goals</h3>
+<p>The FPCA is *not* a copyright assignment agreement.</p>
+<p>The FPCA does *not* somehow supersede the existing licensing terms that apply to RPM Fusion contributions. There are two important subpoints here. First, the FPCA does not apply to upstream code (or other material) that you didn't write; indeed, it would be preposterous for it to attempt to do so. Note the narrow way in which we have defined capital-c "Contribution". Second, the main provision of the FPCA specifies that a default license will apply to code that you wrote, but only to the extent that you have not bothered to put an explicit license on it. Therefore, the FPCA is *not* some sort of special permissive license granted to any party, despite the explicit choice of a more restrictive license by you or by upstream developers.</p>
+
+
+<h3>Terms</h3>
+<h4>0. Definitions.</h4>
+
+<p>"Acceptable License For RPM Fusion" means a license selected from the appropriate categorical sublist of the full list of acceptable licenses for RPM Fusion, currently located at https://rpmfusion.org/wiki/Licensing, as that list may be revised from time to time by the RPM Fusion Project Steering Committee. "Acceptable Licenses For RPM Fusion" means that full list.</p>
+
+<p>"CC-BY-SA" means the Creative Commons Attribution-ShareAlike 3.0 Unported license, as published at <a href="http://creativecommons.org/licenses/by-sa/3.0/legalcode">http://creativecommons.org/licenses/by-sa/3.0/legalcode</a>.</p>
+
+<p>"Code" means (i) software code, (ii) any other functional material whose principal purpose is to control or facilitate the building of packages, such as an RPM spec file, (iii) font files, and (iv) other kinds of copyrightable material that the RPM Fusion Project Steering Committee has classified as "code" rather than "content".</p>
+
+<p>"Content" means any copyrightable material that is not Code, such as, without limitation, (i) non-functional data sets, (ii) documentation, (iii) wiki edits, (iv) music files, (v) graphic image files, (vi) help files, and (vii) other kinds of copyrightable material that the RPM Fusion Project Steering Committee has classified as "content" rather than "code".</p>
+
+<p>"Contribution" means a Work that You created, excluding any portion that was created by someone else. (For example, if You Submit a package to RPM Fusion, the spec file You write may be a Contribution, but all the upstream code in the associated SRPM that You did not write is not a Contribution for purposes of this FPCA.) A Contribution consists either of Code or of Content.</p>
+
+<p>"Current Default License", with respect to a Contribution, means (i) if the Contribution is Code, the MIT License, and (ii) if the Contribution is Content, CC-BY-SA supplemented by Moral Rights Clause Waiver and GPL Relicensing Permission.</p>
+
+<p>"RPM Fusion" means the community project led by the RPM Fusion Project Steering Committee <a href="http://rpmfusion.org/SteeringCommittee">http://rpmfusion.org/SteeringCommittee</a>.</p>
+
+<p>"RPM Fusion Community" means (i) all RPM Fusion participants, and (ii) all persons receiving Contributions directly or indirectly from or through RPM Fusion.</p>
+
+<p>"GPL" means the GNU General Public License, version 2 or any later version published by the Free Software Foundation, or the GNU Affero General Public License, version 3 or any later version published by the Free Software Foundation.</p>
+
+<p>"GPL-Covered Derivative" of a Contribution means an adaptation or derivative work of the Contribution, or a compilation that includes the Contribution (or such adaptation or derivative work), where such adaptation, derivative work, or compilation, if distributed or made available to the public, would be required to be licensed under the GPL because it is based on or includes a Work governed by the GPL.</p>
+
+<p>"GPL Relicensing Permission", with respect to a Contribution licensed under CC-BY-SA, means a grant of additional copyright permission to distribute or make available to the public a copy of a GPL-Covered Derivative of the Contribution under the terms of the applicable version of the GPL, with no conditions of CC-BY-SA that would be treated as "further restrictions" within the meaning of the applicable version of the GPL surviving such distribution with respect to that copy.</p>
+
+<p>"Licensed" means covered by explicit licensing terms that are conspicuous and readily discernible to recipients.</p>
+
+<p>"MIT License" means the license identified as "Modern Style with sublicense" at <a href="https://rpmfusion.org/wiki/Licensing:MIT#Modern_Style_with_sublicense">https://rpmfusion.org/wiki/Licensing:MIT#Modern_Style_with_sublicense</a>.</p>
+
+<p>"Moral Rights Clause Waiver" means a waiver of the right to enforce, and an agreement not to assert, Section 4d of CC-BY-SA against the RPM Fusion Community, to the fullest extent permitted by applicable law.</p>
+
+<p>"Submit" means to use some mode of digital communication (for example, without limitation, mailing lists, bug tracking systems, and source code version control systems administered by RPM Fusion) to voluntarily provide a Contribution to RPM Fusion.</p>
+
+<p>"Unlicensed" means not Licensed.</p>
+
+<p>"Work" means a copyrightable work of authorship. A Work may be a portion of a larger Work, and a Work may be a modification of or addition to another Work.</p>
+
+<p>"You" means the individual accepting this instance of the FPCA.</p>
+
+<h4>1. Copyright Permission Required for All Contributions.</h4>
+
+<p>If You are not the copyright holder of a given Contribution that You wish to Submit to RPM Fusion (for example, if Your employer or university holds copyright in it), it is Your responsibility to first obtain authorization from the copyright holder to Submit the Contribution under the terms of this FPCA on behalf of, or otherwise with the permission of, that copyright holder. One form of such authorization is for the copyright holder to place, or permit You to place, an Acceptable License For RPM Fusion on the Contribution.</p>
+
+
+<h4>2. Licensed Contributions.</h4>
+
+<p>If Your Contribution is Licensed, Your Contribution will be governed by the terms under which it has been licensed.</p>
+
+
+<h4>3. Default Licensing of Unlicensed Contributions.</h4>
+
+<p>If You Submit an Unlicensed Contribution to RPM Fusion, the license to the RPM Fusion Community for that Contribution shall be the Current Default License.</p>
+
+<p>The RPM Fusion Project Steering Committee may, by public announcement, subsequently designate an additional or alternative default license for a given category of Contribution (a "Later Default License"). A Later Default License shall be chosen from the appropriate categorical sublist of Acceptable Licenses For RPM Fusion.</p>
+
+<p>Once a Later Default License has been designated, Your Unlicensed Contribution shall also be licensed to the RPM Fusion Community under that Later Default License. Such designation shall not affect the continuing applicability of the Current Default License to Your Contribution.</p>
+
+<p>You consent to having RPM Fusion provide reasonable notice of Your licensing of Your Contribution under the Current Default License (and, if applicable, a Later Default License) in a manner determined by RPM Fusion.</p>
+
+
+<h4>4. Public Domain United States Government Works.</h4>
+
+<p>Sections 1 through 3 of this FPCA do not apply to any Contribution to the extent that it is a work of the United States Government for which copyright is unavailable under 17 U.S.C. 105.</p>
+
+
+<h4>5. Acceptance.</h4>
+
+<p>You must signify Your assent to the terms of this FPCA through specific electronic means established by RPM Fusion (such as by click-through acceptance means).</p>
+
+ <p>Full name: ${person.human_name}<br/>
+ E-Mail: ${person.email}<br/>
+ Country: ${person.country_code}<br/>
+ Telephone: ${person.telephone}<br/>
+ Facsimile: ${person.facsimile}</p>
+
+
+</div>
8 years, 1 month
[ansible] Disable yubikey fas plugin
by Nicolas Chauvet
commit 0aaeaaa189f94c871327b42dfaf2d232ac979a68
Author: Nicolas Chauvet <kwizart(a)gmail.com>
Date: Thu Oct 27 13:54:17 2016 +0200
Disable yubikey fas plugin
roles/fas_server/tasks/main.yml | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
---
diff --git a/roles/fas_server/tasks/main.yml b/roles/fas_server/tasks/main.yml
index 8a30b79..a69f946 100644
--- a/roles/fas_server/tasks/main.yml
+++ b/roles/fas_server/tasks/main.yml
@@ -5,7 +5,6 @@
yum: pkg={{ item }} state=installed
with_items:
- fas
- - fas-plugin-yubikey
- python-turbojson
- python-tgcaptcha
- httpd
8 years, 1 month
[ansible] Update fas2.py hotfix for current fas
by Nicolas Chauvet
commit eedde1f3f1b0f01055cd192024957c04e6361d78
Author: Nicolas Chauvet <kwizart(a)gmail.com>
Date: Thu Oct 27 12:16:27 2016 +0200
Update fas2.py hotfix for current fas
files/hotfix/python-fedora/fas2.py | 470 ++++++++++++---------
roles/pkgdb2/files/fas2.py | 829 ------------------------------------
2 files changed, 265 insertions(+), 1034 deletions(-)
---
diff --git a/files/hotfix/python-fedora/fas2.py b/files/hotfix/python-fedora/fas2.py
index 5038efb..8649185 100644
--- a/files/hotfix/python-fedora/fas2.py
+++ b/files/hotfix/python-fedora/fas2.py
@@ -2,17 +2,17 @@
#
# Copyright (C) 2008-2012 Ricky Zhou, Red Hat, Inc.
# This file is part of python-fedora
-#
+#
# python-fedora is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
-#
+#
# python-fedora is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
-#
+#
# You should have received a copy of the GNU Lesser General Public
# License along with python-fedora; if not, see <http://www.gnu.org/licenses/>
#
@@ -32,34 +32,47 @@ from bunch import Bunch
from kitchen.text.converters import to_bytes
try:
+ import libravatar
+except ImportError:
+ libravatar = None
+
+try:
from hashlib import md5
except ImportError:
from md5 import new as md5
-from fedora.client import AppError, BaseClient, FasProxyClient, \
- FedoraClientError, FedoraServiceError
-from fedora import __version__, b_
+from fedora.client import (
+ AppError, BaseClient, FasProxyClient,
+ FedoraClientError, FedoraServiceError
+)
+
+from fedora import __version__
### FIXME: To merge:
# /usr/bin/fasClient from fas
# API from Will Woods
# API from MyFedora
+
class FASError(FedoraClientError):
'''FAS Error'''
pass
+
class CLAError(FASError):
'''CLA Error'''
pass
-USERFIELDS = ['affiliation', 'bugzilla_email', 'certificate_serial',
- 'comments', 'country_code', 'creation', 'email', 'emailtoken',
- 'facsimile', 'gpg_keyid', 'human_name', 'id', 'internal_comments',
- 'ircnick', 'latitude', 'last_seen', 'longitude', 'password',
- 'password_changed', 'passwordtoken', 'postal_address', 'privacy',
- 'locale', 'ssh_key', 'status', 'status_change', 'telephone',
- 'unverified_email', 'timezone', 'username', ]
+USERFIELDS = [
+ 'affiliation', 'bugzilla_email', 'certificate_serial',
+ 'comments', 'country_code', 'creation', 'email', 'emailtoken',
+ 'facsimile', 'gpg_keyid', 'human_name', 'id', 'internal_comments',
+ 'ircnick', 'latitude', 'last_seen', 'longitude', 'password',
+ 'password_changed', 'passwordtoken', 'postal_address', 'privacy',
+ 'locale', 'ssh_key', 'status', 'status_change', 'telephone',
+ 'unverified_email', 'timezone', 'username', 'security_question',
+ 'security_answer', ]
+
class AccountSystem(BaseClient):
'''An object for querying the Fedora Account System.
@@ -69,19 +82,38 @@ class AccountSystem(BaseClient):
other details so you can concentrate on the methods that are important to
your program.
+ .. warning::
+
+ If your code is trying to use the AccountSystem object to
+ connect to fas for multiple users you probably want to use
+ :class:`~fedora.client.FasProxyClient` instead. If your code is
+ trying to reuse a single instance of AccountSystem for multiple users
+ you *definitely* want to use :class:`~fedora.client.FasProxyClient`
+ instead. Using AccountSystem in these cases may result in a user
+ being logged in as a different user. (This may be the case even if
+ you instantiate a new AccountSystem object for each user if
+ :attr:cache_session: is True since that creates a file on the file
+ system that can end up loading session credentials for the wrong
+ person.
+
.. versionchanged:: 0.3.26
Added :meth:`~fedora.client.AccountSystem.gravatar_url` that returns
a url to a gravatar for a user.
+ .. versionchanged:: 0.3.33
+ Renamed :meth:`~fedora.client.AccountSystem.gravatar_url` to
+ :meth:`~fedora.client.AccountSystem.avatar_url`.
'''
# proxy is a thread-safe connection to the fas server for verifying
# passwords of other users
proxy = None
- # size that we allow to request from gravatar.com
- _valid_gravatar_sizes = (32, 64, 140)
+ # size that we allow to request from remote avatar providers.
+ _valid_avatar_sizes = (32, 64, 140)
+ # URLs for remote avatar providers.
+ _valid_avatar_services = ['libravatar', 'gravatar']
- def __init__(self, base_url='https://admin.fedoraproject.org/accounts/',
- *args, **kwargs):
+ def __init__(self, base_url='https://admin.rpmfusion.org/accounts/',
+ *args, **kwargs):
'''Create the AccountSystem client object.
:kwargs base_url: Base of every URL used to contact the server.
@@ -98,123 +130,35 @@ class AccountSystem(BaseClient):
on the filesystem between runs.
'''
if 'useragent' not in kwargs:
- kwargs['useragent'] = 'Fedora Account System Client/%s' \
- % __version__
+ kwargs['useragent'] = \
+ 'Fedora Account System Client/%s' % __version__
+
super(AccountSystem, self).__init__(base_url, *args, **kwargs)
# We need a single proxy for the class to verify username/passwords
# against.
if not self.proxy:
self.proxy = FasProxyClient(base_url, useragent=self.useragent,
- session_as_cookie=False, debug=self.debug,
- insecure=self.insecure)
+ session_as_cookie=False,
+ debug=self.debug,
+ insecure=self.insecure)
# Preseed a list of FAS accounts with bugzilla addresses
# This allows us to specify a different email for bugzilla than is
# in the FAS db. It is a hack, however, until FAS has a field for the
# bugzilla address.
self.__bugzilla_email = {
- # Konstantin Ryabitsev: mricon(a)gmail.com
- 100029: 'icon(a)fedoraproject.org',
- # Sean Reifschneider: jafo(a)tummy.com
- 100488: 'jafo-redhat(a)tummy.com',
- # Karen Pease: karen-pease(a)uiowa.edu
- 100281: 'meme(a)daughtersoftiresias.org',
- # Robert Scheck: redhat(a)linuxnetz.de
- 100093: 'redhat-bugzilla(a)linuxnetz.de',
- # Scott Bakers: bakers(a)web-ster.com
- 100881: 'scott(a)perturb.org',
- # Colin Charles: byte(a)aeon.com.my
- 100014: 'byte(a)fedoraproject.org',
- # W. Michael Petullo: mike(a)flyn.org
- 100136: 'redhat(a)flyn.org',
- # Elliot Lee: sopwith+fedora(a)gmail.com
- 100060: 'sopwith(a)redhat.com',
- # Control Center Team: Bugzilla user but email doesn't exist
- 9908: 'control-center-maint(a)redhat.com',
- # Máirín Duffy
- 100548: 'duffy(a)redhat.com',
- # Muray McAllister: murray.mcallister(a)gmail.com
- 102321: 'mmcallis(a)redhat.com',
- # William Jon McCann: mccann(a)jhu.edu
- 102489: 'jmccann(a)redhat.com',
- # Matt Domsch's rebuild script -- bz email goes to /dev/null
- 103590: 'ftbfs(a)fedoraproject.org',
- # Sindre Pedersen Bjørdal: foolish(a)guezz.net
- 100460 : 'sindrepb(a)fedoraproject.org',
- # Jesus M. Rodriguez: jmrodri(a)gmail.com
- 102180: 'jesusr(a)redhat.com',
- # Roozbeh Pournader: roozbeh(a)farsiweb.info
- 100350: 'roozbeh(a)gmail.com',
- # Michael DeHaan: michael.dehaan(a)gmail.com
- 100603: 'mdehaan(a)redhat.com',
- # Sebastian Gosenheimer: sgosenheimer(a)googlemail.com
- 103647: 'sebastian.gosenheimer(a)proio.com',
- # Ben Konrath: bkonrath(a)redhat.com
- 101156: 'ben(a)bagu.org',
- # Kai Engert: kaie(a)redhat.com
- 100399: 'kengert(a)redhat.com',
- # William Jon McCann: william.jon.mccann(a)gmail.com
- 102952: 'jmccann(a)redhat.com',
- # Simon Wesp: simon(a)w3sp.de
- 109464: 'cassmodiah(a)fedoraproject.org',
- # Robert M. Albrecht: romal(a)gmx.de
- 101475: 'mail(a)romal.de',
- # Mathieu Bridon: mathieu.bridon(a)gmail.com
- 100753: 'bochecha(a)fedoraproject.org',
- # Davide Cescato: davide.cescato(a)iaeste.ch
- 123204: 'ceski(a)fedoraproject.org',
- # Nick Bebout: nick(a)bebout.net
- 101458: 'nb(a)fedoraproject.org',
- # Niels Haase: haase.niels(a)gmail.com
- 126862: 'arxs(a)fedoraproject.org',
- # Thomas Janssen: th.p.janssen(a)googlemail.com
- 103110: 'thomasj(a)fedoraproject.org',
- # Michael J Gruber: 'michaeljgruber+fedoraproject(a)gmail.com'
- 105113: 'mjg(a)fedoraproject.org',
- # Juan Manuel Rodriguez Moreno: 'nushio(a)gmail.com'
- 101302: 'nushio(a)fedoraproject.org',
- # Andrew Cagney: 'andrew.cagney(a)gmail.com'
- 102169: 'cagney(a)fedoraproject.org',
- # Jeremy Katz: 'jeremy(a)katzbox.net'
- 100036: 'katzj(a)fedoraproject.org',
- # Dominic Hopf: 'dmaphy(a)gmail.com'
- 124904: 'dmaphy(a)fedoraproject.org',
- # Christoph Wickert: 'christoph.wickert(a)googlemail.com':
- 100271: 'cwickert(a)fedoraproject.org',
- # Elliott Baron: 'elliottbaron(a)gmail.com'
- 106760: 'ebaron(a)fedoraproject.org',
- # Thomas Spura: 'spurath(a)students.uni-mainz.de'
- 111433: 'tomspur(a)fedoraproject.org',
- # Adam Miller: 'maxamillion(a)gmail.com'
- 110673: 'maxamillion(a)fedoraproject.org',
- # Garrett Holmstrom: 'garrett.holmstrom(a)gmail.com'
- 131739: 'gholms(a)fedoraproject.org',
- # Tareq Al Jurf: taljurf.fedora(a)gmail.com
- 109863: 'taljurf(a)fedoraproject.org',
- # Josh Kayse: jokajak(a)gmail.com
- 148243: 'jokajak(a)fedoraproject.org',
- # Behdad Esfahbod: fedora(a)behdad.org
- 100102: 'behdad(a)fedoraproject.org',
- # Daniel Bruno: danielbrunos(a)gmail.com
- 101608: 'dbruno(a)fedoraproject.org',
- # Beth Lynn Eicher: bethlynneicher(a)gmail.com
- 148706: 'bethlynn(a)fedoraproject.org',
- # Andre Robatino: andre.robatino(a)verizon.net
- 114970: 'robatino(a)fedoraproject.org',
- # Jeff Sheltren: jeff(a)tag1consulting.com
- 100058: 'sheltren(a)fedoraproject.org',
- # Josh Boyer: jwboyer(a)gmail.com
- 100115: 'jwboyer(a)redhat.com',
- }
+ # Nicolas Chauvet
+ 160404: 'ctubbsii(a)fedoraproject.org',
+ }
# A few people have an email account that is used in owners.list but
# have setup a bugzilla account for their primary account system email
# address now. Map these here.
self.__alternate_email = {
- # Damien Durand: splinux25(a)gmail.com
- 'splinux(a)fedoraproject.org': 100406,
- # Kevin Fenzi: kevin(a)tummy.com
- 'kevin-redhat-bugzilla(a)tummy.com': 100037,
- }
+ # Damien Durand: splinux25(a)gmail.com
+ 'splinux(a)fedoraproject.org': 100406,
+ # Kevin Fenzi: kevin(a)tummy.com
+ 'kevin-redhat-bugzilla(a)tummy.com': 100037,
+ }
for bugzilla_map in self.__bugzilla_email.items():
self.__alternate_email[bugzilla_map[1]] = bugzilla_map[0]
@@ -237,7 +181,8 @@ class AccountSystem(BaseClient):
def _set_insecure(self, insecure):
self._insecure = insecure
self.proxy = FasProxyClient(self.base_url, useragent=self.useragent,
- session_as_cookie=False, debug=self.debug, insecure=insecure)
+ session_as_cookie=False, debug=self.debug,
+ insecure=insecure)
return insecure
#: If this attribute is set to True, do not check server certificates
#: against their CA's. This means that man-in-the-middle attacks are
@@ -247,7 +192,7 @@ class AccountSystem(BaseClient):
insecure = property(_get_insecure, _set_insecure)
### Groups ###
-
+
def create_group(self, name, display_name, owner, group_type,
invite_only=0, needs_sponsor=0, user_can_remove=1,
prerequisite='', joinmsg='', apply_rules='None'):
@@ -282,21 +227,25 @@ class AccountSystem(BaseClient):
'apply_rules': apply_rules
}
- request = self.send_request('/group/create/%s/%s/%s/%s' % (
+ request = self.send_request(
+ '/group/create/%s/%s/%s/%s' % (
urllib.quote(name),
urllib.quote(display_name),
urllib.quote(owner),
urllib.quote(group_type)),
- req_params=req_params,
- auth=True)
+ req_params=req_params,
+ auth=True
+ )
return request
-
def group_by_id(self, group_id):
'''Returns a group object based on its id'''
params = {'group_id': int(group_id)}
- request = self.send_request('json/group_by_id', auth = True,
- req_params = params)
+ request = self.send_request(
+ 'json/group_by_id',
+ auth=True,
+ req_params=params
+ )
if request['success']:
return request['group']
else:
@@ -305,13 +254,17 @@ class AccountSystem(BaseClient):
def group_by_name(self, groupname):
'''Returns a group object based on its name'''
params = {'groupname': groupname}
- request = self.send_request('json/group_by_name', auth = True,
- req_params = params)
+ request = self.send_request(
+ 'json/group_by_name',
+ auth=True,
+ req_params=params
+ )
if request['success']:
return request['group']
else:
- raise AppError(message=b_('FAS server unable to retrieve group'
- ' %(group)s') % {'group': to_bytes(groupname)},
+ raise AppError(
+ message='FAS server unable to retrieve group'
+ ' %(group)s' % {'group': to_bytes(groupname)},
name='FASError')
def group_members(self, groupname):
@@ -331,10 +284,10 @@ class AccountSystem(BaseClient):
Return a Bunch instead of a DictContainer
'''
request = self.send_request('/group/dump/%s' %
- urllib.quote(groupname), auth=True)
+ urllib.quote(groupname), auth=True)
- return [Bunch(username=user[0], role_type=user[3])
- for user in request['people']]
+ return [Bunch(username=user[0],
+ role_type=user[3]) for user in request['people']]
### People ###
@@ -343,21 +296,24 @@ class AccountSystem(BaseClient):
person_id = int(person_id)
params = {'person_id': person_id}
request = self.send_request('json/person_by_id', auth=True,
- req_params=params)
+ req_params=params)
if request['success']:
if person_id in self.__bugzilla_email:
request['person']['bugzilla_email'] = \
- self.__bugzilla_email[person_id]
+ self.__bugzilla_email[person_id]
else:
- request['person']['bugzilla_email'] = request['person']['email']
- # In a devel version of FAS, membership info was returned separately
+ request['person']['bugzilla_email'] = \
+ request['person']['email']
+
+ # In a devel version of FAS, membership info was returned
+ # separately
# This was later corrected (can remove this code at some point)
if 'approved' in request:
request['person']['approved_memberships'] = request['approved']
if 'unapproved' in request:
request['person']['unapproved_memberships'] = \
- request['unapproved']
+ request['unapproved']
return request['person']
else:
return dict()
@@ -365,8 +321,10 @@ class AccountSystem(BaseClient):
def person_by_username(self, username):
'''Returns a person object based on its username'''
params = {'username': username}
- request = self.send_request('json/person_by_username', auth = True,
- req_params = params)
+ request = self.send_request(
+ 'json/person_by_username',
+ auth=True,
+ req_params=params)
if request['success']:
person = request['person']
@@ -374,58 +332,143 @@ class AccountSystem(BaseClient):
person['bugzilla_email'] = self.__bugzilla_email[person['id']]
else:
person['bugzilla_email'] = person['email']
- # In a devel version of FAS, membership info was returned separately
+ # In a devel version of FAS, membership info was returned
+ # separately
# This was later corrected (can remove this code at some point)
if 'approved' in request:
request['person']['approved_memberships'] = request['approved']
if 'unapproved' in request:
request['person']['unapproved_memberships'] = \
- request['unapproved']
+ request['unapproved']
return person
else:
return dict()
- def gravatar_url(self, username, size=64,
- default=None):
- ''' Returns a URL to a gravatar for a given username.
+ def avatar_url(self, username, size=64,
+ default=None, lookup_email=True,
+ service=None):
+ ''' Returns a URL to an avatar for a given username.
- :arg username: FAS username to construct a gravatar url for
- :kwarg size: size of the gravatar. Allowed sizes are 32, 64, 140.
+ Avatars are drawn from third party services.
+
+ :arg username: FAS username to construct a avatar url for
+ :kwarg size: size of the avatar. Allowed sizes are 32, 64, 140.
Default: 64
- :kwarg default: If gravatar does not have a gravatar image for the
+ :kwarg default: If the service does not have a avatar image for the
email address, this url is returned instead. Default:
the fedora logo at the specified size.
- :raises ValueError: if the size parameter is not allowed
+ :kwarg lookup_email: If true, use the email from FAS for gravatar.com
+ lookups, otherwise just append @fedoraproject.org to the username.
+ For libravatar.org lookups, this is ignored. The openid identifier
+ of the user is used instead.
+ Note that gravatar.com lookups will be much slower if lookup_email
+ is set to True since we'd have to make a query against FAS itself.
+ :kwarg service: One of 'libravatar' or 'gravatar'.
+ Default: 'libravatar'.
+ :raises ValueError: if the size parameter is not allowed or if the
+ service is not one of 'libravatar' or 'gravatar'
:rtype: :obj:`str`
- :returns: url of a gravatar for the user
+ :returns: url of a avatar for the user
- If that user has no gravatar entry, instruct gravatar.com to redirect
- us to the Fedora logo.
+ If that user has no avatar entry, instruct the remote service to
+ redirect us to the Fedora logo.
If that user has no email attribute, then make a fake request to
- gravatar.
+ the third party service.
.. versionadded:: 0.3.26
+ .. versionchanged: 0.3.30
+ Add lookup_email parameter to control whether we generate avatar
+ urls with the email in fas or username(a)fedoraproject.org
+ .. versionchanged: 0.3.33
+ Renamed from `gravatar_url` to `avatar_url`
+ .. versionchanged: 0.3.34
+ Updated libravatar to use the user's openid identifier.
'''
- if size not in self._valid_gravatar_sizes:
- raise ValueError(b_('Size %(size)i disallowed. Must be in'
- ' %(valid_sizes)r') % { 'size': size,
- 'valid_sizes': self._valid_gravatar_sizes})
+
+ if size not in self._valid_avatar_sizes:
+ raise ValueError(
+ 'Size %(size)i disallowed. Must be in %(valid_sizes)r' % {
+ 'size': size,
+ 'valid_sizes': self._valid_avatar_sizes
+ }
+ )
+
+ # If our caller explicitly requested libravatar but they don't have
+ # it installed, then we need to raise a nice error and let them know.
+ if service == 'libravatar' and not libravatar:
+ raise ValueError("Install python-pylibravatar if you want to "
+ "use libravatar as an avatar provider.")
+
+ # If our caller didn't specify a service, let's pick a one for them.
+ # If they have pylibravatar installed, then by all means let freedom
+ # ring! Otherwise, we'll use gravatar.com if we have to.
+ if not service:
+ if libravatar:
+ service = 'libravatar'
+ else:
+ service = 'gravatar'
+
+ # Just double check to make sure they didn't pass us a bogus service.
+ if service not in self._valid_avatar_services:
+ raise ValueError(
+ 'Service %(service)r disallowed. '
+ 'Must be in %(valid_services)r' % {
+ 'service': service,
+ 'valid_services': self._valid_avatar_services
+ }
+ )
if not default:
default = "http://fedoraproject.org/static/images/" + \
- "fedora_infinity_%ix%i.png" % (size, size)
+ "fedora_infinity_%ix%i.png" % (size, size)
+
+ if service == 'libravatar':
+ openid = 'http://%s.id.fedoraproject.org/' % username
+ return libravatar.libravatar_url(
+ openid=openid,
+ size=size,
+ default=default,
+ )
+ else:
+ if lookup_email:
+ person = self.person_by_username(username)
+ email = person.get('email', 'no_email')
+ else:
+ email = "%s(a)rpmfusion.org" % username
+
+ query_string = urllib.urlencode({
+ 's': size,
+ 'd': default,
+ })
+
+ hash = md5(email).hexdigest()
+
+ return "http://www.gravatar.com/avatar/%s?%s" % (
+ hash, query_string)
+
+ def gravatar_url(self, *args, **kwargs):
+ """ *Deprecated* - Use avatar_url.
- query_string = urllib.urlencode({
- 's': size,
- 'd': default,
- })
+ .. versionadded:: 0.3.26
+ .. versionchanged: 0.3.30
+ Add lookup_email parameter to control whether we generate gravatar
+ urls with the email in fas or username(a)fedoraproject.org
+ .. versionchanged: 0.3.33
+ Deprecated in favor of `avatar_url`.
+ """
- person = self.person_by_username(username)
- email = person.get('email', 'no_email')
- hash = md5(email).hexdigest()
+ warnings.warn(
+ "gravatar_url is deprecated and will be removed in"
+ " a future version. Please port your code to use avatar_url(...,"
+ " service='libravatar', ...) instead",
+ DeprecationWarning, stacklevel=2)
- return "http://www.gravatar.com/avatar/%s?%s" % (hash, query_string)
+ if 'service' in kwargs:
+ raise TypeError("'service' is an invalid keyword argument for"
+ " this function. Use avatar_url() instead)")
+
+ return self.avatar_url(*args, service='gravatar', **kwargs)
def user_id(self):
'''Returns a dict relating user IDs to usernames'''
@@ -495,15 +538,15 @@ class AccountSystem(BaseClient):
'''
# Make sure we have a valid key value
if key not in ('id', 'username', 'email'):
- raise KeyError(b_('key must be one of "id", "username", or'
- ' "email"'))
+ raise KeyError('key must be one of "id", "username", or'
+ ' "email"')
if fields:
fields = list(fields)
for field in fields:
if field not in USERFIELDS:
- raise KeyError(b_('%(field)s is not a valid field to'
- ' filter') % {'field': to_bytes(field)})
+ raise KeyError('%(field)s is not a valid field to'
+ ' filter' % {'field': to_bytes(field)})
else:
fields = USERFIELDS
@@ -521,17 +564,22 @@ class AccountSystem(BaseClient):
unrequested_fields.append('email')
fields.append('email')
- request = self.send_request('/user/list?tg_format=json', req_params={'search': search,
- 'fields': [f for f in fields if f != 'bugzilla_email']}, auth=True)
+ request = self.send_request(
+ '/user/list',
+ req_params={
+ 'search': search,
+ 'fields': [f for f in fields if f != 'bugzilla_email']
+ },
+ auth=True)
people = Bunch()
for person in itertools.chain(request['people'],
- request['unapproved_people']):
+ request['unapproved_people']):
# Retrieve bugzilla_email from our list if necessary
if 'bugzilla_email' in fields:
if person['id'] in self.__bugzilla_email:
person['bugzilla_email'] = \
- self.__bugzilla_email[person['id']]
+ self.__bugzilla_email[person['id']]
else:
person['bugzilla_email'] = person['email']
@@ -555,10 +603,11 @@ class AccountSystem(BaseClient):
.. versionchanged:: 0.3.21
Return a Bunch instead of a DictContainer
'''
- warnings.warn(b_("people_by_id() is deprecated and will be removed in"
+ warnings.warn(
+ "people_by_id() is deprecated and will be removed in"
" 0.4. Please port your code to use people_by_key(key='id',"
" fields=['human_name', 'email', 'username', 'bugzilla_email'])"
- " instead"), DeprecationWarning, stacklevel=2)
+ " instead", DeprecationWarning, stacklevel=2)
request = self.send_request('/json/user_id', auth=True)
user_to_id = {}
@@ -612,9 +661,13 @@ class AccountSystem(BaseClient):
returned.
'''
request = self.send_request('config/list/%s/%s/%s' %
- (username, application, attribute), auth=True)
+ (username, application, attribute),
+ auth=True)
if 'exc' in request:
- raise AppError(name = request['exc'], message = request['tg_flash'])
+ raise AppError(
+ name=request['exc'],
+ message=request['tg_flash']
+ )
# Return the value if it exists, else None.
if 'configs' in request and attribute in request['configs']:
@@ -634,10 +687,14 @@ class AccountSystem(BaseClient):
:raises AppError: if the server returns an exception
:returns: A dict mapping ``attribute`` to ``value``.
'''
- request = self.send_request('config/list/%s/%s/%s' %
- (username, application, pattern), auth=True)
+ request = self.send_request(
+ 'config/list/%s/%s/%s' %
+ (username, application, pattern),
+ auth=True)
if 'exc' in request:
- raise AppError(name = request['exc'], message = request['tg_flash'])
+ raise AppError(
+ name=request['exc'],
+ message=request['tg_flash'])
return request['configs']
@@ -653,12 +710,15 @@ class AccountSystem(BaseClient):
:arg value: The value to set this to
:raises AppError: if the server returns an exception
'''
- request = self.send_request('config/set/%s/%s/%s' %
- (username, application, attribute),
- req_params={'value': value}, auth=True)
+ request = self.send_request(
+ 'config/set/%s/%s/%s' %
+ (username, application, attribute),
+ req_params={'value': value}, auth=True)
if 'exc' in request:
- raise AppError(name = request['exc'], message = request['tg_flash'])
+ raise AppError(
+ name=request['exc'],
+ message=request['tg_flash'])
def people_query(self, constraints=None, columns=None):
'''Returns a list of dicts representing database rows
@@ -682,7 +742,8 @@ class AccountSystem(BaseClient):
req_params['columns'] = ','.join(columns)
try:
- request = self.send_request('json/people_query',
+ request = self.send_request(
+ 'json/people_query',
req_params=req_params, auth=True)
if request['success']:
return request['data']
@@ -716,7 +777,7 @@ class AccountSystem(BaseClient):
### fasClient Special Methods ###
- def group_data(self, group_name='*', force_refresh=None):
+ def group_data(self, force_refresh=None):
'''Return administrators/sponsors/users and group type for all groups
:arg force_refresh: If true, the returned data will be queried from the
@@ -732,19 +793,19 @@ class AccountSystem(BaseClient):
params['force_refresh'] = True
try:
- #request = self.send_request('json/fas_client/group_data',
- request = self.send_request('group/list/%s?tg_format=json' % group_name,
+ request = self.send_request(
+ 'json/fas_client/group_data',
req_params=params, auth=True)
- return request
- #if request['success']:
- # return request['data']
- #else:
- # raise AppError(message=b_('FAS server unable to retrieve'
- # ' group members'), name='FASError')
+ if request['success']:
+ return request['data']
+ else:
+ raise AppError(
+ message='FAS server unable to retrieve'
+ ' group members', name='FASError')
except FedoraServiceError:
raise
- def user_data(self, user_key='*'):
+ def user_data(self):
'''Return user data for all users in FAS
Note: If the user is not authorized to see password hashes,
@@ -757,13 +818,12 @@ class AccountSystem(BaseClient):
.. versionadded:: 0.3.8
'''
try:
- request = self.send_request('user/list/%s?tg_format=json' % user_key, auth=True)
- return request
- # if request['success']:
- # return request['data']
- # else:
- # raise AppError(message=b_('FAS server unable to retrieve user'
- # ' information'), name='FASError')
+ request = self.send_request('json/fas_client/user_data', auth=True)
+ if request['success']:
+ return request['data']
+ else:
+ raise AppError(
+ message='FAS server unable to retrieve user'
+ ' information', name='FASError')
except FedoraServiceError:
raise
-
8 years, 1 month
[ansible] Update current location of fas2.py hotfix
by Nicolas Chauvet
commit d78f9e849e7bc2873002ba9afb960f6d35ccfd5f
Author: Nicolas Chauvet <kwizart(a)gmail.com>
Date: Thu Oct 27 12:15:13 2016 +0200
Update current location of fas2.py hotfix
roles/fas_server/tasks/main.yml | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/roles/fas_server/tasks/main.yml b/roles/fas_server/tasks/main.yml
index 081a2b9..8a30b79 100644
--- a/roles/fas_server/tasks/main.yml
+++ b/roles/fas_server/tasks/main.yml
@@ -386,7 +386,7 @@
- fas
- name: HOTFIX fas2.py in python-bugzilla to add a bugzilla override for ticket 4827
- copy: src={{ roles }}/pkgdb2/files/fas2.py
+ copy: src={{ files }}/hotfix/python-fedora/fas2.py
dest=/usr/lib/python2.6/site-packages/fedora/client/fas2.py
mode=644 owner=root group=root
when: master_fas_node == True
8 years, 1 month