From 7cd57c29a66cf8ad5dcb2fa644f26bd5b1a4f10d Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Thu, 22 Nov 2012 08:52:42 -0800 Subject: [PATCH] Create gerritx/cmd dir and move things to it. --- .../cmd/close_pull_requests.py | 0 .../cmd/expire_old_reviews.py | 0 .../cmd/fetch_remotes.py | 0 .../cmd/manage_projects.py | 0 .../cmd/notify_impact.py | 0 run_mirror.py => gerritx/cmd/run_mirror.py | 0 .../cmd/update_blueprint.py | 0 update_bug.py => gerritx/cmd/update_bug.py | 0 get_group_uuid.py | 29 -------- update_cla_group.py | 72 ------------------- 10 files changed, 101 deletions(-) rename close_pull_requests.py => gerritx/cmd/close_pull_requests.py (100%) rename expire_old_reviews.py => gerritx/cmd/expire_old_reviews.py (100%) rename fetch_remotes.py => gerritx/cmd/fetch_remotes.py (100%) rename manage_projects.py => gerritx/cmd/manage_projects.py (100%) rename notify_impact.py => gerritx/cmd/notify_impact.py (100%) rename run_mirror.py => gerritx/cmd/run_mirror.py (100%) rename update_blueprint.py => gerritx/cmd/update_blueprint.py (100%) rename update_bug.py => gerritx/cmd/update_bug.py (100%) delete mode 100644 get_group_uuid.py delete mode 100755 update_cla_group.py diff --git a/close_pull_requests.py b/gerritx/cmd/close_pull_requests.py similarity index 100% rename from close_pull_requests.py rename to gerritx/cmd/close_pull_requests.py diff --git a/expire_old_reviews.py b/gerritx/cmd/expire_old_reviews.py similarity index 100% rename from expire_old_reviews.py rename to gerritx/cmd/expire_old_reviews.py diff --git a/fetch_remotes.py b/gerritx/cmd/fetch_remotes.py similarity index 100% rename from fetch_remotes.py rename to gerritx/cmd/fetch_remotes.py diff --git a/manage_projects.py b/gerritx/cmd/manage_projects.py similarity index 100% rename from manage_projects.py rename to gerritx/cmd/manage_projects.py diff --git a/notify_impact.py b/gerritx/cmd/notify_impact.py similarity index 100% rename from notify_impact.py rename to gerritx/cmd/notify_impact.py diff --git a/run_mirror.py b/gerritx/cmd/run_mirror.py similarity index 100% rename from run_mirror.py rename to gerritx/cmd/run_mirror.py diff --git a/update_blueprint.py b/gerritx/cmd/update_blueprint.py similarity index 100% rename from update_blueprint.py rename to gerritx/cmd/update_blueprint.py diff --git a/update_bug.py b/gerritx/cmd/update_bug.py similarity index 100% rename from update_bug.py rename to gerritx/cmd/update_bug.py diff --git a/get_group_uuid.py b/get_group_uuid.py deleted file mode 100644 index 335e944..0000000 --- a/get_group_uuid.py +++ /dev/null @@ -1,29 +0,0 @@ -import argparse -import paramiko -import json - -parser = argparse.ArgumentParser() -parser.add_argument("--host", dest="host", default="review.openstack.org", - help="gerrit host to connect to") -parser.add_argument("--port", dest="port", action='store', type=int, - default=29418, help="gerrit port to connect to") -parser.add_argument("groups", nargs=1) - -options = parser.parse_args() - - -client = paramiko.SSHClient() -client.load_system_host_keys() -client.set_missing_host_key_policy(paramiko.WarningPolicy()) -client.connect(options.host, port=options.port) - -group = options.groups[0] -query = "select group_uuid from account_groups where name = '%s'" % group -command = 'gerrit gsql --format JSON -c "%s"' % query -stdin, stdout, stderr = client.exec_command(command) - -for line in stdout: - row = json.loads(line) - if row['type'] == 'row': - print row['columns']['group_uuid'] - ret = stdout.channel.recv_exit_status() diff --git a/update_cla_group.py b/update_cla_group.py deleted file mode 100755 index 615b256..0000000 --- a/update_cla_group.py +++ /dev/null @@ -1,72 +0,0 @@ -#! /usr/bin/env python -# Copyright (C) 2011 OpenStack, LLC. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -# Add launchpad ids listed in the wiki CLA page to the CLA group in LP. - -import os -import urllib -import re - -from launchpadlib.launchpad import Launchpad -from launchpadlib.uris import LPNET_SERVICE_ROOT - -DEBUG = False - -LP_CACHE_DIR = '~/.launchpadlib/cache' -LP_CREDENTIALS = '~/.launchpadlib/creds' -CONTRIBUTOR_RE = re.compile(r'.*?\|\|\s*(?P.*?)\s*\|\|\s*(?P.*?)\s*\|\|\s*(?P.*?)\s*\|\|.*?') -LINK_RE = re.compile(r'\[\[.*\|\s*(?P.*)\s*\]\]') - -for check_path in (os.path.dirname(LP_CACHE_DIR), - os.path.dirname(LP_CREDENTIALS)): - if not os.path.exists(check_path): - os.makedirs(check_path) - -wiki_members = [] -for line in urllib.urlopen('http://wiki.openstack.org/Contributors?action=raw'): - m = CONTRIBUTOR_RE.match(line) - if m and m.group('login') and m.group('trans'): - login = m.group('login') - if login=="<#c0c0c0>'''Launchpad ID'''": continue - l = LINK_RE.match(login) - if l: - login = l.group('name') - wiki_members.append(login) - -launchpad = Launchpad.login_with('CLA Team Sync', LPNET_SERVICE_ROOT, - LP_CACHE_DIR, - credentials_file = LP_CREDENTIALS, - version='devel') - -lp_members = [] - -team = launchpad.people['openstack-cla'] -for detail in team.members_details: - user = None - # detail.self_link == - # 'https://api.launchpad.net/1.0/~team/+member/${username}' - login = detail.self_link.split('/')[-1] - status = detail.status - lp_members.append(login) - -for wm in wiki_members: - if wm not in lp_members: - print "Need to add %s to LP" % (wm) - try: - person = launchpad.people[wm] - except: - print 'Unable to find %s on LP'%wm - continue - status = team.addMember(person=person, status="Approved")