| 1 |
#!/usr/bin/python3 |
| 2 |
# |
| 3 |
# Copyright 2011 Canonical Ltd. |
| 4 |
# |
| 5 |
# This program is free software: you can redistribute it and/or modify it |
| 6 |
# under the terms of the GNU General Public License version 3, as published |
| 7 |
# by the Free Software Foundation. |
| 8 |
# |
| 9 |
# This program is distributed in the hope that it will be useful, but |
| 10 |
# WITHOUT ANY WARRANTY; without even the implied warranties of |
| 11 |
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 12 |
# PURPOSE. See the GNU General Public License for more details. |
| 13 |
# |
| 14 |
# You should have received a copy of the GNU General Public License along |
| 15 |
# with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 |
|
| 17 |
"""Remove members from a Launchpad team. |
| 18 |
|
| 19 |
Usage: lp-remove-team-members TEAM MEMBER... |
| 20 |
""" |
| 21 |
|
| 22 |
import socket |
| 23 |
import sys |
| 24 |
|
| 25 |
from lptools.config import ( |
| 26 |
get_launchpad) |
| 27 |
|
| 28 |
|
| 29 |
def main(args): |
| 30 |
if len(args) < 3: |
| 31 |
print(__doc__) |
| 32 |
return 1 |
| 33 |
lp = get_launchpad('lptools on %s' % (socket.gethostname(),)) |
| 34 |
team_name = args[1] |
| 35 |
team = lp.people[team_name] |
| 36 |
members_details = team.members_details |
| 37 |
for exile_name in args[2:]: |
| 38 |
print('remove %s from %s...' % (exile_name, team_name), end=' ') |
| 39 |
for m in members_details: |
| 40 |
if m.member.name == exile_name: |
| 41 |
m.setStatus(status='Deactivated') |
| 42 |
print('done') |
| 43 |
break |
| 44 |
else: |
| 45 |
print('not a member?') |
| 46 |
|
| 47 |
|
| 48 |
if __name__ == '__main__': |
| 49 |
sys.exit(main(sys.argv)) |