Remove membership-map role and its references from other files

Signed-off-by: Pedro Moura <pmoura@redhat.com>
This commit is contained in:
Pedro Moura 2023-09-27 19:11:07 -03:00 committed by phsmoura
parent 55fd3dd3f1
commit bbbc74ffe3
30 changed files with 0 additions and 2772 deletions

View file

@ -65,7 +65,6 @@
# - fedora-web::build (bapp0*)
# - fedora-docs::build (bapp0*)
# - review-stats::build (bapp0*)
# - membership-map::build (bapp0*)
#
## TBD
# - sysctl ip_conntrack_max bits - do we still need this on rhel7?
@ -156,16 +155,3 @@
- name: make sure selinux contexts are right on srv
command: restorecon -R /srv
changed_when: false
- name: Remove membership-map files
hosts: proxies
user: root
gather_facts: True
vars_files:
- /srv/web/infra/ansible/vars/global.yml
- "/srv/private/ansible/vars.yml"
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
roles:
- membership-map

View file

@ -54,8 +54,6 @@
when: master_sundries_node|bool
- role: fedora-docs/translation
when: master_sundries_node|bool
- role: membership-map/build
when: master_sundries_node|bool
- role: developer/build
when: master_sundries_node|bool
- role: fedoraloveskde/build

View file

@ -48,10 +48,6 @@
website: fedoraproject.org
path: /PackageReviewStatus
- role: membership-map/proxy
website: fedoraproject.org
path: /membership-map
- role: apps-fp-o
website: apps.fedoraproject.org
path: /

View file

@ -16,23 +16,6 @@ children:
Tools for everybody -- use these things to manage your Fedora
Account.
children:
- name: Ambassadors Map
data:
url: https://fedoraproject.org/membership-map/ambassadors.html
# TODO -- add source, bugs, and docs urls for this.
description: >
Ambassadors are the representatives of Fedora. Ambassadors
ensure the public understand Fedora's principles and the work
that Fedora is doing. Additionally Ambassadors are responsible
for helping to grow the contributor base, and to act as a
liaison between other FLOSS projects and the Fedora community.
This thing is a map of where all the <a
href="https://fedoraproject.org/wiki/Ambassadors">Fedora
Ambassadors</a> live showing just how vibrant the Fedora
Community really is. (It's easy to <a
href="https://fedoraproject.org/wiki/Fedora_ambassadors_map">add
yourself</a> to the map too, if you can't find yourself on it.)
- name: FedoraPeople
data:
url: https://fedorapeople.org

View file

@ -1 +0,0 @@
48 5 * * * root /usr/local/bin/membership-map.py > /dev/null

View file

@ -1 +0,0 @@
55 5 * * * root /usr/local/bin/membership-mwclient.py > /dev/null

File diff suppressed because it is too large Load diff

View file

@ -1,78 +0,0 @@
<!--
# This script is for rendering ambassadors map.
#
# Copyright (C) 2009, Susmit Shannigrahi, Susmit AT fedoraproject DOT org
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Openlayer.js, Openstreetmap.js, and the map data are copyrighted by their respective
# copyright owners.
-->
<html>
<head>
<script src="OpenLayers.js"></script>
<script type="text/javascript">
var lat=88.360000
var lon=22.50000
var zoom=2
var map;
function init() {
map = new OpenLayers.Map ("map", {
controls:[
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.LayerSwitcher(),
// new OpenLayers.Control.MousePosition(),
new OpenLayers.Control.Attribution()],
// units: 'm',
// projection: new OpenLayers.Projection("EPSG:4326"),
// displayProjection: new OpenLayers.Projection("EPSG:4326")
});
Osm = new OpenLayers.Layer.OSM("Open Street Map");
map.addLayer(Osm);
var center = new OpenLayers.LonLat(lon, lat)
map.setCenter (center, zoom);
var text = new OpenLayers.Layer.Text( "Ambassadors", {location: "./ambassadors_location.txt"} );
map.addLayer(text);
}
</script>
</head>
<body onload="init()">
<center> <h4 id="title"><a href=http://fedoraproject.org/wiki/fedora_ambassadors_map>Fedora Ambassadors Map</a></h4></center>
<div id="map"></div>
<script src="https://apps.fedoraproject.org/fedmenu/js/jquery-1.11.2.min.js"></script>
<script src="https://apps.fedoraproject.org/fedmenu/js/fedmenu.js"></script>
<script>
fedmenu({
'url': 'https://apps.fedoraproject.org/js/data.js',
'mimeType': 'application/javascript',
'position': 'bottom-right',
});
</script>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 405 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 291 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 386 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 350 B

View file

@ -1,64 +0,0 @@
<html>
<head>
<title>Fedora Ambassadors Membership</title>
<style type="text/css" media="screen">
@import url("https://fedorapeople.org/userdefs/css/fedora.css");
@import url("https://fedorapeople.org/userdefs/css/style.css");
</style>
</head>
<body onload="init()">
<div id="wrapper">
<div id="head">
<h1><a href="http://fedoraproject.org/">Fedora</a></h1>
</div>
<div id="sidebar">
<div class="nav">
<h2>Navigation</h2>
<ul>
<li><strong><a href="https://fedoraproject.org/">Home</a></strong></li>
<li><strong><a href="https://join.fedoraproject.org">Join Fedora</a></strong></li>
<li><strong><a href=http://fedoraproject.org/wiki/fedora_ambassadors_map>Add yourself</a></strong></li>
</ul>
</div>
</div>
<!--Content -->
<div>
<br>
<center>
<select name="quicknav" OnChange="location.href=this.options[this.selectedIndex].value">
<option value=".">-- Choose a Page --</option>
<option value="./ambassadors.html">Ambassadors Map</option>
</select>
</center>
</div>
</div>
<div id="bottom">
<div id="footer">
<p class="disclaimer">
The Fedora Project is maintained and driven by the community and sponsored by Red Hat. This is a community maintained site. Red Hat is not responsible for content.
</p>
<ul>
<li class="first"><a href="http://fedoraproject.org/wiki/Legal">Legal</a></li>
<li><a href="http://fedoraproject.org/wiki/Legal/TrademarkGuidelines">Trademark Guidelines</a></li>
</ul>
</div>
</div>
</body>
</html>

View file

@ -1,516 +0,0 @@
div.olMap {
z-index: 0;
padding: 0 !important;
margin: 0 !important;
cursor: default;
}
div.olMapViewport {
text-align: left;
-ms-touch-action: none;
}
div.olLayerDiv {
-moz-user-select: none;
-khtml-user-select: none;
}
.olLayerGoogleCopyright {
left: 2px;
bottom: 2px;
}
.olLayerGoogleV3.olLayerGoogleCopyright {
right: auto !important;
}
.olLayerGooglePoweredBy {
left: 2px;
bottom: 15px;
}
.olLayerGoogleV3.olLayerGooglePoweredBy {
bottom: 15px !important;
}
/* GMaps should not set styles on its container */
.olForeignContainer {
opacity: 1 !important;
}
.olControlAttribution {
font-size: smaller;
right: 3px;
bottom: 4.5em;
position: absolute;
display: block;
}
.olControlScale {
right: 3px;
bottom: 3em;
display: block;
position: absolute;
font-size: smaller;
}
.olControlScaleLine {
display: block;
position: absolute;
left: 10px;
bottom: 15px;
font-size: xx-small;
}
.olControlScaleLineBottom {
border: solid 2px black;
border-bottom: none;
margin-top:-2px;
text-align: center;
}
.olControlScaleLineTop {
border: solid 2px black;
border-top: none;
text-align: center;
}
.olControlPermalink {
right: 3px;
bottom: 1.5em;
display: block;
position: absolute;
font-size: smaller;
}
div.olControlMousePosition {
bottom: 0;
right: 3px;
display: block;
position: absolute;
font-family: Arial;
font-size: smaller;
}
.olControlOverviewMapContainer {
position: absolute;
bottom: 0;
right: 0;
}
.olControlOverviewMapElement {
padding: 10px 18px 10px 10px;
background-color: #00008B;
-moz-border-radius: 1em 0 0 0;
}
.olControlOverviewMapMinimizeButton,
.olControlOverviewMapMaximizeButton {
height: 18px;
width: 18px;
right: 0;
bottom: 80px;
cursor: pointer;
}
.olControlOverviewMapExtentRectangle {
overflow: hidden;
background-image: url("img/blank.gif");
cursor: move;
border: 2px dotted red;
}
.olControlOverviewMapRectReplacement {
overflow: hidden;
cursor: move;
background-image: url("img/overview_replacement.gif");
background-repeat: no-repeat;
background-position: center;
}
.olLayerGeoRSSDescription {
float:left;
width:100%;
overflow:auto;
font-size:1.0em;
}
.olLayerGeoRSSClose {
float:right;
color:gray;
font-size:1.2em;
margin-right:6px;
font-family:sans-serif;
}
.olLayerGeoRSSTitle {
float:left;font-size:1.2em;
}
.olPopupContent {
padding:5px;
overflow: auto;
}
.olControlNavigationHistory {
background-image: url("img/navigation_history.png");
background-repeat: no-repeat;
width: 24px;
height: 24px;
}
.olControlNavigationHistoryPreviousItemActive {
background-position: 0 0;
}
.olControlNavigationHistoryPreviousItemInactive {
background-position: 0 -24px;
}
.olControlNavigationHistoryNextItemActive {
background-position: -24px 0;
}
.olControlNavigationHistoryNextItemInactive {
background-position: -24px -24px;
}
div.olControlSaveFeaturesItemActive {
background-image: url(img/save_features_on.png);
background-repeat: no-repeat;
background-position: 0 1px;
}
div.olControlSaveFeaturesItemInactive {
background-image: url(img/save_features_off.png);
background-repeat: no-repeat;
background-position: 0 1px;
}
.olHandlerBoxZoomBox {
border: 2px solid red;
position: absolute;
background-color: white;
opacity: 0.50;
font-size: 1px;
filter: alpha(opacity=50);
}
.olHandlerBoxSelectFeature {
border: 2px solid blue;
position: absolute;
background-color: white;
opacity: 0.50;
font-size: 1px;
filter: alpha(opacity=50);
}
.olControlPanPanel {
top: 10px;
left: 5px;
}
.olControlPanPanel div {
background-image: url(img/pan-panel.png);
height: 18px;
width: 18px;
cursor: pointer;
position: absolute;
}
.olControlPanPanel .olControlPanNorthItemInactive {
top: 0;
left: 9px;
background-position: 0 0;
}
.olControlPanPanel .olControlPanSouthItemInactive {
top: 36px;
left: 9px;
background-position: 18px 0;
}
.olControlPanPanel .olControlPanWestItemInactive {
position: absolute;
top: 18px;
left: 0;
background-position: 0 18px;
}
.olControlPanPanel .olControlPanEastItemInactive {
top: 18px;
left: 18px;
background-position: 18px 18px;
}
.olControlZoomPanel {
top: 71px;
left: 14px;
}
.olControlZoomPanel div {
background-image: url(img/zoom-panel.png);
position: absolute;
height: 18px;
width: 18px;
cursor: pointer;
}
.olControlZoomPanel .olControlZoomInItemInactive {
top: 0;
left: 0;
background-position: 0 0;
}
.olControlZoomPanel .olControlZoomToMaxExtentItemInactive {
top: 18px;
left: 0;
background-position: 0 -18px;
}
.olControlZoomPanel .olControlZoomOutItemInactive {
top: 36px;
left: 0;
background-position: 0 18px;
}
/*
* When a potential text is bigger than the image it move the image
* with some headers (closes #3154)
*/
.olControlPanZoomBar div {
font-size: 1px;
}
.olPopupCloseBox {
background: url("img/close.gif") no-repeat;
cursor: pointer;
}
.olFramedCloudPopupContent {
padding: 5px;
overflow: auto;
}
.olControlNoSelect {
-moz-user-select: none;
-khtml-user-select: none;
}
.olImageLoadError {
background-color: pink;
opacity: 0.5;
filter: alpha(opacity=50); /* IE */
}
/**
* Cursor styles
*/
.olCursorWait {
cursor: wait;
}
.olDragDown {
cursor: move;
}
.olDrawBox {
cursor: crosshair;
}
.olControlDragFeatureOver {
cursor: move;
}
.olControlDragFeatureActive.olControlDragFeatureOver.olDragDown {
cursor: -moz-grabbing;
}
/**
* Layer switcher
*/
.olControlLayerSwitcher {
position: absolute;
top: 25px;
right: 0;
width: 20em;
font-family: sans-serif;
font-weight: bold;
margin-top: 3px;
margin-left: 3px;
margin-bottom: 3px;
font-size: smaller;
color: white;
background-color: transparent;
}
.olControlLayerSwitcher .layersDiv {
padding-top: 5px;
padding-left: 10px;
padding-bottom: 5px;
padding-right: 10px;
background-color: darkblue;
}
.olControlLayerSwitcher .layersDiv .baseLbl,
.olControlLayerSwitcher .layersDiv .dataLbl {
margin-top: 3px;
margin-left: 3px;
margin-bottom: 3px;
}
.olControlLayerSwitcher .layersDiv .baseLayersDiv,
.olControlLayerSwitcher .layersDiv .dataLayersDiv {
padding-left: 10px;
}
.olControlLayerSwitcher .maximizeDiv,
.olControlLayerSwitcher .minimizeDiv {
width: 18px;
height: 18px;
top: 5px;
right: 0;
cursor: pointer;
}
.olBingAttribution {
color: #DDD;
}
.olBingAttribution.road {
color: #333;
}
.olGoogleAttribution.hybrid, .olGoogleAttribution.satellite {
color: #EEE;
}
.olGoogleAttribution {
color: #333;
}
span.olGoogleAttribution a {
color: #77C;
}
span.olGoogleAttribution.hybrid a, span.olGoogleAttribution.satellite a {
color: #EEE;
}
/**
* Editing and navigation icons.
* (using the editing_tool_bar.png sprint image)
*/
.olControlNavToolbar ,
.olControlEditingToolbar {
margin: 5px 5px 0 0;
}
.olControlNavToolbar div,
.olControlEditingToolbar div {
background-image: url("img/editing_tool_bar.png");
background-repeat: no-repeat;
margin: 0 0 5px 5px;
width: 24px;
height: 22px;
cursor: pointer
}
/* positions */
.olControlEditingToolbar {
right: 0;
top: 0;
}
.olControlNavToolbar {
top: 295px;
left: 9px;
}
/* layouts */
.olControlEditingToolbar div {
float: right;
}
/* individual controls */
.olControlNavToolbar .olControlNavigationItemInactive,
.olControlEditingToolbar .olControlNavigationItemInactive {
background-position: -103px -1px;
}
.olControlNavToolbar .olControlNavigationItemActive ,
.olControlEditingToolbar .olControlNavigationItemActive {
background-position: -103px -24px;
}
.olControlNavToolbar .olControlZoomBoxItemInactive {
background-position: -128px -1px;
}
.olControlNavToolbar .olControlZoomBoxItemActive {
background-position: -128px -24px;
}
.olControlEditingToolbar .olControlDrawFeaturePointItemInactive {
background-position: -77px -1px;
}
.olControlEditingToolbar .olControlDrawFeaturePointItemActive {
background-position: -77px -24px;
}
.olControlEditingToolbar .olControlDrawFeaturePathItemInactive {
background-position: -51px -1px;
}
.olControlEditingToolbar .olControlDrawFeaturePathItemActive {
background-position: -51px -24px;
}
.olControlEditingToolbar .olControlDrawFeaturePolygonItemInactive{
background-position: -26px -1px;
}
.olControlEditingToolbar .olControlDrawFeaturePolygonItemActive {
background-position: -26px -24px;
}
div.olControlZoom {
position: absolute;
top: 8px;
left: 8px;
background: rgba(255,255,255,0.4);
border-radius: 4px;
padding: 2px;
}
div.olControlZoom a {
display: block;
margin: 1px;
padding: 0;
color: white;
font-size: 18px;
font-family: 'Lucida Grande', Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
font-weight: bold;
text-decoration: none;
text-align: center;
height: 22px;
width:22px;
line-height: 19px;
background: #130085; /* fallback for IE - IE6 requires background shorthand*/
background: rgba(0, 60, 136, 0.5);
filter: alpha(opacity=80);
}
div.olControlZoom a:hover {
background: #130085; /* fallback for IE */
background: rgba(0, 60, 136, 0.7);
filter: alpha(opacity=100);
}
@media only screen and (max-width: 600px) {
div.olControlZoom a:hover {
background: rgba(0, 60, 136, 0.5);
}
}
a.olControlZoomIn {
border-radius: 4px 4px 0 0;
}
a.olControlZoomOut {
border-radius: 0 0 4px 4px;
}
/**
* Animations
*/
.olLayerGrid .olTileImage {
-webkit-transition: opacity 0.2s linear;
-moz-transition: opacity 0.2s linear;
-o-transition: opacity 0.2s linear;
transition: opacity 0.2s linear;
}
/* Turn on GPU support where available */
.olTileImage {
-webkit-transform: translateZ(0);
-moz-transform: translateZ(0);
-o-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0);
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-perspective: 1000;
-moz-perspective: 1000;
-ms-perspective: 1000;
perspective: 1000;
}
/* when replacing tiles, do not show tile and backbuffer at the same time */
.olTileReplacing {
display: none;
}
/* override any max-width image settings (e.g. bootstrap.css) */
img.olTileImage {
max-width: none;
}

View file

@ -1,46 +0,0 @@
#
# This first part is building the maps for:
# http://fedoraproject.org/membership-map/ambassadors.html
#
- file: dest=/srv/web/membership-map state=directory
- template: >
src=membership-map.py dest=/usr/local/bin/membership-map.py
owner=root group=root mode=0755
tags:
- membership-map
- membership-map/build
- copy: >
src=membership-map-build dest=/etc/cron.d/membership-map-build
owner=root group=root mode=0644
tags:
- membership-map
- membership-map/build
- synchronize: >
src=www/ dest=/srv/web/membership-map/
#
# This part updates the wiki page at:
# https://fedoraproject.org/wiki/Ambassadors/MembershipService/Verification
#
- package: state=present name=python-mwclient
tags:
- membership-map
- membership-map/build
- template: >
src=membership-mwclient.py dest=/usr/local/bin/membership-mwclient.py
owner=root group=root mode=0755
tags:
- membership-map
- membership-map/build
- copy: >
src=membership-mwclient-build dest=/etc/cron.d/membership-mwclient-build
owner=root group=root mode=0644
tags:
- membership-map
- membership-map/build

View file

@ -1,154 +0,0 @@
#!/usr/bin/python
# This script is for generating output for ambassadors map like this
# http://fedoraproject.org/membership-map
# Copyright (C) 2009, Susmit Shannigrahi, Susmit AT fedoraproject DOT org
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import getpass
from fedora.client.fas2 import AccountSystem
import GeoIP
import cPickle as pickle
import codecs
import datetime
def calc_list():
'''Generate the ambassadors map data'''
output = []
people_list = []
flag = 0
group_name = 'ambassadors'
username = 'fedoradummy'
password = '{{ fedoraDummyUserPassword }}'
{% if env == "staging" %}
base_url = 'https://accounts.stg.fedoraproject.org/'
{% else %}
base_url = 'https://accounts.fedoraproject.org/'
{% endif %}
fas = AccountSystem(base_url=base_url, username=username, password=password)
print 'Generating data file. Wait...'
# Get a dictinary of all people in FAS
data = fas.people_by_key(key='id', search=u'*', fields=['human_name', \
'username', 'email', 'status', 'country_code', 'latitude', 'longitude'])
# print data
#get all data from a group
group_people = fas.group_members(group_name)
#make a list of usernames of a group
for item in group_people:
people_list.append(item['username'])
# get the country list from GeoIP
countries = dict(GeoIP.country_names.items())
#print countries
for person in people_list:
# print person
for item in data.values():
user_name = item['username']
human_name = item['human_name']
country_code = item['country_code']
status = item['status']
email = item['email']
latitude = item['latitude']
latitude = str(latitude)
longitude = item['longitude']
longitude = str(longitude)
if person == user_name:
#print 'match'
if status == 'active': #filter out all inactive accounts
#different values for blank or non-blank fields are
#_____________________________#
# Country Code || Human Name #
#_____________________________#
# None || None/Name #
# ' ' || None/Name #
# 'IN','FR' etc.|| None/Name #
#_____________________________#
if latitude != 'None':
if longitude != 'None': #if lat/long is not provided
if country_code is None:
if human_name is None:
flag = 1
else:
flag = 2
elif country_code == ' ':
if human_name is None:
flag = 1
else:
flag = 2
else: #if there is a country code available
country = countries[country_code]
if human_name is None:
flag = 3
else:
flag = 4
#check flag to decide o/p
if flag == 1:
entry = [user_name, user_name, 'Unknown', email, latitude, longitude]
output.append(entry)
elif flag == 2:
entry = [user_name, human_name, 'Unknown', email, latitude, longitude]
output.append(entry)
elif flag == 3:
entry = [user_name, user_name, country, email, latitude, longitude]
output.append(entry)
else:
entry = [user_name, human_name, country, email, latitude, longitude]
output.append(entry)
#print entry
#open the data file. Be cautions to open as unicode supported.
output_file = codecs.open('/srv/web/membership-map/ambassadors_location.txt', encoding='utf-8', mode='w+')
# write the format, one can also add an "icon" field after description.
#output_file.write('point\ttitle\tdescription\n')
output_file.write('point\ttitle\tdescription\ticon\ticonSize\n')
# write fas data.
for item in output:
output_data = '%s,%s\t<a href=\"http://fedoraproject.org/wiki/user:%s\"target="_blank">%s</a>\t<br> Email: %s AT fedoraproject DOT org <br> Country:%s\t./f-dot.png\t15,15\n'% (item[4], item[5], item[0], item[1], item[0], item[2])
output_file.write(output_data)
output_file.close()
if __name__ == "__main__":
calc_list()

View file

@ -1,305 +0,0 @@
#!/usr/bin/python
''' This script is for generating output for
https://fedoraproject.org/wiki/Ambassadors/MembershipService/Verification.'''
#
# Copyright (C) 2010, Susmit Shannigrahi, Susmit AT fedoraproject DOT org
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import getpass
from fedora.client.fas2 import AccountSystem
import datetime
import GeoIP
from kitchen.text.converters import to_bytes
import mwclient
#from maxmind array
#changes are: 'RS': 'EU', 'ME': 'EU', 'AU': 'AS', 'NZ': 'AS'
#https://fedorahosted.org/fedora-infrastructure/ticket/2921
#changes are: 'IL': 'EU', 'KG': 'EU', 'LB': 'EU', 'SA': 'EU', 'AE': 'EU'
CONTINENT_MAP = {'AP': 'AS', 'EU': 'EU', 'AD': 'EU', 'AE': 'EU', 'AF': 'AS', \
'AG': 'SA', 'AI': 'SA', 'AL': 'EU', 'AM': 'AS', 'AN': 'SA', 'AO': 'EU', \
'AQ': 'AN', 'AR': 'SA', 'AS': 'OC', 'AT': 'EU', 'AU': 'OC', 'AW': 'SA', \
'AX': 'EU', 'AZ': 'AS', 'BA': 'EU', 'BB': 'SA', 'BD': 'AS', 'BE': 'EU', \
'BF': 'EU', 'BG': 'EU', 'BH': 'AS', 'BI': 'EU', 'BJ': 'EU', 'BM': 'SA', \
'BN': 'AS', 'BO': 'SA', 'BR': 'SA', 'BS': 'SA', 'BT': 'AS', 'BV': 'EU', \
'BW': 'EU', 'BY': 'EU', 'BZ': 'SA', 'CA': 'NA', 'CC': 'AS', 'CD': 'EU', \
'CF': 'EU', 'CG': 'EU', 'CH': 'EU', 'CI': 'EU', 'CK': 'OC', 'CL': 'SA', \
'CM': 'EU', 'CN': 'AS', 'CO': 'SA', 'CR': 'SA', 'CU': 'SA', 'CV': 'EU', \
'CX': 'AS', 'CY': 'AS', 'CZ': 'EU', 'DE': 'EU', 'DJ': 'EU', 'DK': 'EU', \
'DM': 'SA', 'DO': 'SA', 'DZ': 'EU', 'EC': 'SA', 'EE': 'EU', 'EG': 'EU', \
'EH': 'EU', 'ER': 'EU', 'ES': 'EU', 'ET': 'EU', 'FI': 'EU', 'FJ': 'OC', \
'FK': 'SA', 'FM': 'OC', 'FO': 'EU', 'FR': 'EU', 'FX': 'EU', 'GA': 'EU', \
'GB': 'EU', 'GD': 'SA', 'GE': 'AS', 'GF': 'SA', 'GG': 'EU', 'GH': 'EU', \
'GI': 'EU', 'GL': 'SA', 'GM': 'EU', 'GN': 'EU', 'GP': 'SA', 'GQ': 'EU', \
'GR': 'EU', 'GS': 'SA', 'GT': 'SA', 'GU': 'OC', 'GW': 'EU', 'GY': 'SA', \
'HK': 'AS', 'HM': 'EU', 'HN': 'SA', 'HR': 'EU', 'HT': 'SA', 'HU': 'EU', \
'ID': 'AS', 'IE': 'EU', 'IL': 'EU', 'IM': 'EU', 'IN': 'AS', 'IO': 'AS', \
'IQ': 'AS', 'IR': 'AS', 'IS': 'EU', 'IT': 'EU', 'JE': 'EU', 'JM': 'SA', \
'JO': 'AS', 'JP': 'AS', 'KE': 'EU', 'KG': 'EU', 'KH': 'AS', 'KI': 'OC', \
'KM': 'EU', 'KN': 'SA', 'KP': 'AS', 'KR': 'AS', 'KW': 'AS', 'KY': 'SA', \
'KZ': 'AS', 'LA': 'AS', 'LB': 'EU', 'LC': 'SA', 'LI': 'EU', 'LK': 'AS', \
'LR': 'EU', 'LS': 'EU', 'LT': 'EU', 'LU': 'EU', 'LV': 'EU', 'LY': 'EU', \
'MA': 'EU', 'MC': 'EU', 'MD': 'EU', 'MG': 'EU', 'MH': 'OC', 'MK': 'EU', \
'ML': 'EU', 'MM': 'AS', 'MN': 'AS', 'MO': 'AS', 'MP': 'OC', 'MQ': 'SA', \
'MR': 'EU', 'MS': 'SA', 'MT': 'EU', 'MU': 'EU', 'MV': 'AS', 'MW': 'EU', \
'MX': 'NA', 'MY': 'AS', 'MZ': 'EU', 'NA': 'EU', 'NC': 'OC', 'NE': 'EU', \
'NF': 'OC', 'NG': 'EU', 'NI': 'SA', 'NL': 'EU', 'NO': 'EU', 'NP': 'AS', \
'NR': 'OC', 'NU': 'OC', 'NZ': 'AS', 'OM': 'AS', 'PA': 'SA', 'PE': 'SA', \
'PF': 'OC', 'PG': 'OC', 'PH': 'AS', 'PK': 'AS', 'PL': 'EU', 'PM': 'SA', \
'PN': 'OC', 'PR': 'SA', 'PS': 'AS', 'PT': 'EU', 'PW': 'OC', 'PY': 'SA', \
'QA': 'AS', 'RE': 'EU', 'RO': 'EU', 'RU': 'EU', 'RW': 'EU', 'SA': 'AS', \
'SB': 'OC', 'SC': 'EU', 'SD': 'EU', 'SE': 'EU', 'SG': 'AS', 'SH': 'EU', \
'SI': 'EU', 'SJ': 'EU', 'SK': 'EU', 'SL': 'EU', 'SM': 'EU', 'SN': 'EU', \
'SO': 'EU', 'SR': 'SA', 'ST': 'EU', 'SV': 'SA', 'SY': 'AS', 'SZ': 'EU', \
'TC': 'SA', 'TD': 'EU', 'TF': 'EU', 'TG': 'EU', 'TH': 'AS', 'TJ': 'AS', \
'TK': 'OC', 'TM': 'AS', 'TN': 'EU', 'TO': 'OC', 'TP': 'AS', 'TR': 'EU', \
'TT': 'SA', 'TV': 'OC', 'TW': 'AS', 'TZ': 'EU', 'UA': 'EU', 'UG': 'EU', \
'UM': 'OC', 'US': 'NA', 'UY': 'SA', 'UZ': 'AS', 'VA': 'EU', 'VC': 'SA', \
'VE': 'SA', 'VG': 'SA', 'VI': 'SA', 'VN': 'AS', 'VU': 'OC', 'WF': 'OC', \
'WS': 'OC', 'YE': 'AS', 'YT': 'EU', 'YU': 'EU', 'ZA': 'EU', 'ZM': 'EU', \
'ZR': 'EU', 'ZW': 'EU', 'RS': 'EU', 'ME': 'EU', 'AU': 'AS'}
def calc_list():
'''Calculate the contributors list categorised by country'''
output = []
people_list = []
country_list = []
inactive_list = []
flag = 0
final_output_list_as = []
final_output_list_eu = []
final_output_list_na = []
final_output_list_latam = []
final_output_list_unknown = []
full_name = {'AS' : 'APAC', 'NA' : 'North America', \
'SA' : 'LATAM', 'EU' : 'EMEA', 'Unknown' : 'Unknown'}
group_name = 'ambassadors'
username = 'fedoradummy'
password = '{{ fedoraDummyUserPassword }}'
# username = raw_input('Username: ').strip()
# password = getpass.getpass('Password: ')
{% if env == "staging" %}
base_url = 'https://accounts.stg.fedoraproject.org/'
{% else %}
base_url = 'https://accounts.fedoraproject.org/'
{% endif %}
fas = AccountSystem(base_url=base_url, username=username, password=password, timeout=600)
# Call fedoraproject API with mwclient
{% if env == "staging" %}
site = mwclient.Site(('https', 'stg.fedoraproject.org'), path='/w/')
{% else %}
site = mwclient.Site(('https', 'fedoraproject.org'), path='/w/')
{% endif %}
site.login(username, password) # Optional
# Specify which page to edit
page = site.Pages['Ambassadors/MembershipService/Verification2']
#delete all the erswhile contents.
page.text()
blank_page = "updating..."
page.save(blank_page)
print 'This takes loooooong time to execute...'
#get all data from a group
group_people = fas.group_members(group_name)
#make a list of usernames of a group
for item in group_people:
people_list.append(item['username'])
# get the country list from GeoIP
countries = dict(GeoIP.country_names.items())
# Get a dictinary of all people in FAS
data = fas.people_by_key(key='id', search=u'*', \
fields=['human_name', 'username', 'email', 'status', 'country_code'])
for person in people_list:
# break
for item in data.values():
user_name = item['username']
human_name = item['human_name']
country_code = item['country_code']
status = item['status']
email = item['username'] + '@fedoraproject.org'
if person == user_name:
if status == 'inactive':
inactive_list.append(user_name)
#print 'match'
elif status == 'active': #filter out all inactive accounts
if country_code is None or country_code == 'O1' \
or country_code == ' ':
continent_code = 'Unknown'
else:
continent_code = CONTINENT_MAP[country_code]
#different values for blank or non-blank fields are
#_____________________________________________________#
# Country Code || Human Name || Number of tickets|| #
#_____________________________________________________#
# None || None/Name || 0/n #
# ' ' || None/Name || #
# 'IN','FR' etc.|| None/Name || #
#_____________________________________________________#
if country_code is None:
if human_name is None:
flag = 1
else:
flag = 2
elif country_code == ' ':
if human_name is None:
flag = 1
else:
flag = 2
else: #if there is a country code available
country = countries[country_code]
if human_name is None:
flag = 3
else:
flag = 4
#check flag to decide o/p
if flag == 1:
entry = [user_name, user_name, 'Unknown', email, \
'Unknown']
output.append(entry)
elif flag == 2:
entry = [user_name, human_name, 'Unknown', email, \
'Unknown']
output.append(entry)
elif flag == 3:
entry = [user_name, user_name, country, email, \
continent_code]
output.append(entry)
else:
entry = [user_name, human_name, country, email, \
continent_code]
output.append(entry)
# Now we have a output list like
#[['rdsharma4u', 'Ravi Datta Sharma','India','rdsharma4u@gmail.com','1','AS'],
#['red', 'Sandro Mathys', 'Switzerland', 'sm@sandro-mathys.ch', '10', 'EU']]
for item in output:
#break
continent_code = item[4]
if continent_code == 'AS' or continent_code == 'AU':
final_output_list_as.append(item)
elif continent_code == 'NA':
final_output_list_na.append(item)
elif continent_code == 'SA':
final_output_list_latam.append(item)
elif continent_code == 'EU':
final_output_list_eu.append(item)
elif continent_code == 'Unknown':
final_output_list_unknown.append(item)
# sort the list according to countries
final_string = ''
for final_output_list in [final_output_list_as, \
final_output_list_na, final_output_list_latam, final_output_list_eu, \
final_output_list_unknown]:
country_list = []
#print final_output_list
# print the full continent name from entry zero of list
try:
continent_code = final_output_list[0][4]
full_cont_name = full_name[continent_code]
full_cont_name = "<h3> %s (%s) </h3>" \
% (full_cont_name, len(final_output_list))
final_string = final_string + full_cont_name
#print final_string
for item in final_output_list:
country = item[2]
if country_list.count(country) == 0:
country_list.append(country)
country_list.sort()
except IndexError:
pass
#print country_list
final_output_country_list = \
[[]*len(country_list) for i in range(len(country_list))]
for item in final_output_list:
# find the index of this entry (country) from county_list
index = country_list.index(item[2])
final_output_country_list[index].append(item)
#print final_output_country_list
#final_string = ''
for item in final_output_country_list:
#reverse mapping to print the country
pos = final_output_country_list.index(item)
num = len(item) #number of ambassador in a country.
cnt_lst = "<h4> %s (%s) </h4>" % (country_list[pos], num)
# add country and table formatting to string.
final_string = final_string + cnt_lst + '<table><th style="color: white; background-color: #3074c2; font-weight: bold" align="justified">Index</th><th style="color: white; background-color: #3074c2; font-weight: bold" align="justified">Name</th><th style="color: white; background-color: #3074c2; font-weight: bold" align="justified">Email</th>'
index = 0
for entries in item:
#print entries
#break
index = index + 1
user_name = entries[0]
human_name = entries[1]
email = user_name + ' AT fedoraproject DOT org'
#add detals.
final = "<tr><td>%s</td><td> [[User:%s| %s]]</td><td>%s</td></tr>" % (to_bytes(index), to_bytes(user_name), to_bytes(human_name), to_bytes(email))
final_string = final_string + final
final_string = final_string + '</table>'
time = datetime.datetime.utcnow()
page.text()
page.save(final_string, summary = time)
{% raw %}
note = "{{admon/note | Last Updated : %s UTC. %s active contributors \
listed here against %s total.}}" % (time, len(output), len(people_list))
{% endraw %}
page = site.Pages['Ambassadors/MembershipService/VerificationStats']
page.text()
page.save(note, summary = time)
page = site.Pages['Ambassadors/MembershipService/Inactives']
page.text()
page.save(inactive_list, summary = time)
if __name__ == "__main__":
calc_list()

View file

@ -1 +0,0 @@
10,40 * * * * root /usr/bin/rsync -a --delete sundries01::membership-map/* /srv/web/membership-map/ >& /dev/null

View file

@ -1,25 +0,0 @@
- name: Ensure dir for content exists
file: dest=/srv/web/membership-map owner=root group=root mode=0755 state=directory
tags:
- membership-map
- membership-map/proxy
- name: Put the proxy config in place
template: >
src=membership-map.conf
dest=/etc/httpd/conf.d/{{website}}/membership-map.conf
owner=root group=root mode=0644
notify:
- reload httpd
tags:
- membership-map
- membership-map/proxy
- name: Install the sync-membership-map cronjob to pull content from builder
copy: >
src=sync-membership-map.cron dest=/etc/cron.d/sync-membership-map.cron
owner=root group=root mode=0644
tags:
- cron
- membership-map
- membership-map/proxy

View file

@ -1,6 +0,0 @@
Alias {{path}} /srv/web/membership-map
<Directory /srv/web/membership-map>
Options Indexes
AllowOverride None
</Directory>

View file

@ -1,45 +0,0 @@
---
- name: Remove files installed in membership-map/build
file:
path: "{{ item }}"
state: absent
with_items:
- /usr/local/bin/membership-map.py
- /etc/cron.d/membership-map-build
- /srv/web/membership-map/
- /usr/local/bin/membership-mwclient.py
- /etc/cron.d/membership-mwclient-build
tags:
- cleanup
- name: Remove files installed in membership-map/proxy
file:
path: "{{ item }}"
state: absent
with_items:
- /etc/httpd/conf.d/fedoraproject.org/membership-map.conf
- /etc/cron.d/sync-membership-map.cron
tags:
- cleanup
- name: Remove interactive map file from mirror manager
file:
path: /var/www/mirrormanager-statistics/map/{{ item }}
state: absent
with_items:
- OpenLayers.js
- img/east-mini.png
- img/layer-switcher-maximize.png
- img/layer-switcher-minimize.png
- img/north-mini.png
- img/slider.png
- img/south-mini.png
- img/west-mini.png
- img/zoombar.png
- img/zoom-minus-mini.png
- img/zoom-plus-mini.png
- theme/default/style.css
- mirrors.html
- f-dot.png
tags:
- cleanup

View file

@ -72,10 +72,6 @@
- /var/www/mirrormanager-statistics
- /var/www/mirrormanager-statistics/data
- /var/www/mirrormanager-statistics/data/propagation
- /var/www/mirrormanager-statistics/map
- /var/www/mirrormanager-statistics/map/img
- /var/www/mirrormanager-statistics/map/theme
- /var/www/mirrormanager-statistics/map/theme/default
tags:
- mm2_frontend
- config
@ -91,7 +87,6 @@
- /var/log/mirrormanager/crawler
- /var/www/mirrormanager-statistics
- /var/www/mirrormanager-statistics/data
- /var/www/mirrormanager-statistics/map
tags:
- mm2_frontend
- config
@ -121,32 +116,3 @@
tags:
- mm2_frontend
- config
- name: install interactive map file
copy: src={{ roles_path }}/membership-map/build/files/www/{{ item }}
dest=/var/www/mirrormanager-statistics/map/{{ item }}
owner=mirrormanager group=mirrormanager mode=0444
with_items:
- OpenLayers.js
- img/east-mini.png
- img/layer-switcher-maximize.png
- img/layer-switcher-minimize.png
- img/north-mini.png
- img/slider.png
- img/south-mini.png
- img/west-mini.png
- img/zoombar.png
- img/zoom-minus-mini.png
- img/zoom-plus-mini.png
- theme/default/style.css
tags:
- mm2_frontend
- name: install interactive map file
copy: src={{ item }} dest=/var/www/mirrormanager-statistics/map/{{ item }}
owner=mirrormanager group=mirrormanager mode=0444
with_items:
- mirrors.html
- f-dot.png
tags:
- mm2_frontend

View file

@ -22,14 +22,6 @@ gid = root
read only = yes
hosts allow = 10.3.160.0/255.255.224.0 192.168.0.0/255.255.0.0
[membership-map]
comment = Ambassadors Membership Map
path = /srv/web/membership-map
uid = root
gid = root
read only = yes
hosts allow = 10.3.160.0/255.255.224.0 192.168.0.0/255.255.0.0
[review-stats]
comment = Package Review Stats
path = /srv/web/review-stats

View file

@ -22,14 +22,6 @@ gid = root
read only = yes
hosts allow = 10.5.126.0/255.255.255.0 192.168.0.0/255.255.0.0 10.5.128.0/255.255.255.0 10.3.160.0/255.255.224.0
[membership-map]
comment = Ambassadors Membership Map
path = /srv/web/membership-map
uid = root
gid = root
read only = yes
hosts allow = 10.5.126.0/255.255.255.0 192.168.0.0/255.255.0.0 10.5.128.0/255.255.255.0 10.3.160.0/255.255.224.0
[review-stats]
comment = Package Review Stats
path = /srv/web/review-stats