Merge "Fix pep8 errors in modules dir"
This commit is contained in:
commit
48ed1f98d5
@ -33,8 +33,8 @@ PASS = config.get('admin', 'password')
|
|||||||
management.call_command('syncdb', interactive=False)
|
management.call_command('syncdb', interactive=False)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
auth_models.User.objects.get(username=USER)
|
auth_models.User.objects.get(username=USER)
|
||||||
print 'Admin user already exists.'
|
print 'Admin user already exists.'
|
||||||
except auth_models.User.DoesNotExist:
|
except auth_models.User.DoesNotExist:
|
||||||
print 'Creating admin user'
|
print 'Creating admin user'
|
||||||
auth_models.User.objects.create_superuser(USER, EMAIL, PASS)
|
auth_models.User.objects.create_superuser(USER, EMAIL, PASS)
|
||||||
|
@ -93,10 +93,10 @@ class TemplateData(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
STATUS = {
|
STATUS = {
|
||||||
0: 'pass',
|
0: 'pass',
|
||||||
1: 'fail',
|
1: 'fail',
|
||||||
2: 'error',
|
2: 'error',
|
||||||
3: 'skip',
|
3: 'skip',
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFAULT_TITLE = 'Unit Test Report'
|
DEFAULT_TITLE = 'Unit Test Report'
|
||||||
@ -536,9 +536,9 @@ class HtmlOutput(testtools.TestResult):
|
|||||||
a_lines = []
|
a_lines = []
|
||||||
for name, value in report_attrs:
|
for name, value in report_attrs:
|
||||||
line = TemplateData.HEADING_ATTRIBUTE_TMPL % dict(
|
line = TemplateData.HEADING_ATTRIBUTE_TMPL % dict(
|
||||||
name=saxutils.escape(name),
|
name=saxutils.escape(name),
|
||||||
value=saxutils.escape(value),
|
value=saxutils.escape(value),
|
||||||
)
|
)
|
||||||
a_lines.append(line)
|
a_lines.append(line)
|
||||||
heading = TemplateData.HEADING_TMPL % dict(
|
heading = TemplateData.HEADING_TMPL % dict(
|
||||||
title=saxutils.escape(TemplateData.DEFAULT_TITLE),
|
title=saxutils.escape(TemplateData.DEFAULT_TITLE),
|
||||||
@ -590,7 +590,7 @@ class HtmlOutput(testtools.TestResult):
|
|||||||
report = TemplateData.REPORT_TMPL % dict(
|
report = TemplateData.REPORT_TMPL % dict(
|
||||||
test_list=''.join(rows),
|
test_list=''.join(rows),
|
||||||
count=str(self.success_count + self.failure_count +
|
count=str(self.success_count + self.failure_count +
|
||||||
self.error_count + self.skip_count),
|
self.error_count + self.skip_count),
|
||||||
Pass=str(self.success_count),
|
Pass=str(self.success_count),
|
||||||
fail=str(self.failure_count),
|
fail=str(self.failure_count),
|
||||||
error=str(self.error_count),
|
error=str(self.error_count),
|
||||||
|
@ -25,8 +25,9 @@ class OpenStackTarDiff:
|
|||||||
def check_env(self):
|
def check_env(self):
|
||||||
""" exit if dist/ directory already exists """
|
""" exit if dist/ directory already exists """
|
||||||
if not self.package and os.path.exists(self.dist_dir):
|
if not self.package and os.path.exists(self.dist_dir):
|
||||||
self.error("dist directory '%s' exist. Please remove it before " \
|
self.error(
|
||||||
"running this script" % self.dist_dir)
|
"dist directory '%s' exist. Please remove it before "
|
||||||
|
"running this script" % self.dist_dir)
|
||||||
|
|
||||||
def validate_args(self):
|
def validate_args(self):
|
||||||
try:
|
try:
|
||||||
@ -108,8 +109,8 @@ class OpenStackTarDiff:
|
|||||||
""" read file list from git archive """
|
""" read file list from git archive """
|
||||||
git_tar = os.path.join(os.getcwd(), '%s.tar' % self.project_name)
|
git_tar = os.path.join(os.getcwd(), '%s.tar' % self.project_name)
|
||||||
try:
|
try:
|
||||||
a_cmd = "git archive -o %s HEAD --prefix=%s" % \
|
a_cmd = ("git archive -o %s HEAD --prefix=%s" %
|
||||||
(git_tar, self.prefix)
|
(git_tar, self.prefix))
|
||||||
self.debug("executing command '%s'" % a_cmd)
|
self.debug("executing command '%s'" % a_cmd)
|
||||||
(status, out) = commands.getstatusoutput(a_cmd)
|
(status, out) = commands.getstatusoutput(a_cmd)
|
||||||
if status != 0:
|
if status != 0:
|
||||||
@ -118,7 +119,7 @@ class OpenStackTarDiff:
|
|||||||
if os.path.exists(git_tar):
|
if os.path.exists(git_tar):
|
||||||
os.unlink(git_tar)
|
os.unlink(git_tar)
|
||||||
self.error('git archive failed: %s' % out)
|
self.error('git archive failed: %s' % out)
|
||||||
except Exception, err:
|
except Exception as err:
|
||||||
if os.path.exists(git_tar):
|
if os.path.exists(git_tar):
|
||||||
os.unlink(git_tar)
|
os.unlink(git_tar)
|
||||||
self.error('git archive failed: %s' % err)
|
self.error('git archive failed: %s' % err)
|
||||||
@ -132,7 +133,7 @@ class OpenStackTarDiff:
|
|||||||
self.git_files = out.split('\n')
|
self.git_files = out.split('\n')
|
||||||
self.debug("Removing git archive ... %s ..." % git_tar)
|
self.debug("Removing git archive ... %s ..." % git_tar)
|
||||||
os.remove(git_tar)
|
os.remove(git_tar)
|
||||||
except Exception, err:
|
except Exception as err:
|
||||||
self.error('unable to read tar: %s' % err)
|
self.error('unable to read tar: %s' % err)
|
||||||
|
|
||||||
def get_sdist_files(self):
|
def get_sdist_files(self):
|
||||||
@ -144,7 +145,7 @@ class OpenStackTarDiff:
|
|||||||
(status, out) = commands.getstatusoutput(sdist_cmd)
|
(status, out) = commands.getstatusoutput(sdist_cmd)
|
||||||
if status != 0:
|
if status != 0:
|
||||||
self.error("command '%s' failed" % sdist_cmd)
|
self.error("command '%s' failed" % sdist_cmd)
|
||||||
except Exception, err:
|
except Exception as err:
|
||||||
self.error("command '%s' failed" % (sdist_cmd, err))
|
self.error("command '%s' failed" % (sdist_cmd, err))
|
||||||
|
|
||||||
self.package = os.listdir(self.dist_dir)[0]
|
self.package = os.listdir(self.dist_dir)[0]
|
||||||
@ -157,7 +158,7 @@ class OpenStackTarDiff:
|
|||||||
self.error("command '%s' failed" % tar_cmd)
|
self.error("command '%s' failed" % tar_cmd)
|
||||||
#self.debug(out)
|
#self.debug(out)
|
||||||
self.sdist_files = out.split('\n')
|
self.sdist_files = out.split('\n')
|
||||||
except Exception, err:
|
except Exception as err:
|
||||||
self.error("command '%s' failed: %s" % (tar_cmd, err))
|
self.error("command '%s' failed: %s" % (tar_cmd, err))
|
||||||
|
|
||||||
def debug(self, msg):
|
def debug(self, msg):
|
||||||
@ -175,8 +176,7 @@ class OpenStackTarDiff:
|
|||||||
stream = sys.stdout
|
stream = sys.stdout
|
||||||
stream.write("usage: %s [--help|h] [-v] "
|
stream.write("usage: %s [--help|h] [-v] "
|
||||||
"[-p|--package=sdist_package.tar.gz] "
|
"[-p|--package=sdist_package.tar.gz] "
|
||||||
"-e|--exclude=filename\n" \
|
"-e|--exclude=filename\n" % os.path.basename(sys.argv[0]))
|
||||||
% os.path.basename(sys.argv[0]))
|
|
||||||
if msg:
|
if msg:
|
||||||
stream.write("\nERROR: " + msg + "\n")
|
stream.write("\nERROR: " + msg + "\n")
|
||||||
exitCode = 1
|
exitCode = 1
|
||||||
|
@ -35,7 +35,7 @@ SEVS = {
|
|||||||
'TRACE': 4,
|
'TRACE': 4,
|
||||||
'WARN': 5,
|
'WARN': 5,
|
||||||
'ERROR': 6
|
'ERROR': 6
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def _html_close():
|
def _html_close():
|
||||||
@ -96,13 +96,15 @@ def escape_html(line):
|
|||||||
|
|
||||||
def link_timestamp(line):
|
def link_timestamp(line):
|
||||||
m = re.match(
|
m = re.match(
|
||||||
'(<span class=\'(?P<class>[^\']+)\'>)?(?P<date>%s)(?P<rest>.*)' % DATEFMT,
|
'(<span class=\'(?P<class>[^\']+)\'>)?(?P<date>%s)(?P<rest>.*)'
|
||||||
line)
|
% DATEFMT, line)
|
||||||
if m:
|
if m:
|
||||||
date = "_" + re.sub('[\s\:\.]', '_', m.group('date'))
|
date = "_" + re.sub('[\s\:\.]', '_', m.group('date'))
|
||||||
|
|
||||||
return "</span><span class='%s %s'><a name='%s' class='date' href='#%s'>%s</a>%s\n" % (
|
return ("</span><span class='%s %s'>"
|
||||||
m.group('class'), date, date, date, m.group('date'), m.group('rest'))
|
"<a name='%s' class='date' href='#%s'>%s</a>%s\n" % (
|
||||||
|
m.group('class'), date, date, date,
|
||||||
|
m.group('date'), m.group('rest')))
|
||||||
else:
|
else:
|
||||||
return line
|
return line
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ class EventProcessor(threading.Thread):
|
|||||||
fields = self._parse_fields(event, fileopts['name'])
|
fields = self._parse_fields(event, fileopts['name'])
|
||||||
log_dir = self._get_log_dir(event)
|
log_dir = self._get_log_dir(event)
|
||||||
source_url = fileopts.get('source-url', self.source_url) + '/' + \
|
source_url = fileopts.get('source-url', self.source_url) + '/' + \
|
||||||
os.path.join(log_dir, fileopts['name'])
|
os.path.join(log_dir, fileopts['name'])
|
||||||
fields["log_url"] = source_url
|
fields["log_url"] = source_url
|
||||||
out_event = {}
|
out_event = {}
|
||||||
out_event["fields"] = fields
|
out_event["fields"] = fields
|
||||||
@ -134,8 +134,9 @@ class Server(object):
|
|||||||
gearclient = gear.Client()
|
gearclient = gear.Client()
|
||||||
gearclient.addServer('localhost')
|
gearclient.addServer('localhost')
|
||||||
gearclient.waitForServer()
|
gearclient.waitForServer()
|
||||||
processor = EventProcessor(publisher, gearclient,
|
processor = EventProcessor(
|
||||||
self.config['source-files'], self.source_url)
|
publisher, gearclient,
|
||||||
|
self.config['source-files'], self.source_url)
|
||||||
self.processors.append(processor)
|
self.processors.append(processor)
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
|
@ -161,7 +161,7 @@ class LogRetriever(threading.Thread):
|
|||||||
try:
|
try:
|
||||||
logging.debug(str(backoff) + " Retrying fetch of: " +
|
logging.debug(str(backoff) + " Retrying fetch of: " +
|
||||||
source_url + "?level=INFO")
|
source_url + "?level=INFO")
|
||||||
logging.debug("Fetching bytes=" + str(content_len) + '-')
|
logging.debug("Fetching bytes=" + str(content_len) + '-')
|
||||||
req = urllib2.Request(source_url + "?level=INFO")
|
req = urllib2.Request(source_url + "?level=INFO")
|
||||||
req.add_header('Range', 'bytes=' + str(content_len) + '-')
|
req.add_header('Range', 'bytes=' + str(content_len) + '-')
|
||||||
r = urllib2.urlopen(req)
|
r = urllib2.urlopen(req)
|
||||||
|
@ -20,8 +20,9 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
DEVSTACK=os.path.expanduser('~/workspace-cache/devstack')
|
DEVSTACK = os.path.expanduser('~/workspace-cache/devstack')
|
||||||
CACHEDIR=os.path.expanduser('~/cache/files')
|
CACHEDIR = os.path.expanduser('~/cache/files')
|
||||||
|
|
||||||
|
|
||||||
def run_local(cmd, status=False, cwd='.', env={}):
|
def run_local(cmd, status=False, cwd='.', env={}):
|
||||||
print "Running:", cmd
|
print "Running:", cmd
|
||||||
|
@ -501,11 +501,13 @@ projects:
|
|||||||
check:
|
check:
|
||||||
- config-compare-xml
|
- config-compare-xml
|
||||||
- gate-config-layout
|
- gate-config-layout
|
||||||
|
- gate-config-pep8
|
||||||
- gate-config-puppet-lint
|
- gate-config-puppet-lint
|
||||||
- gate-config-puppet-syntax
|
- gate-config-puppet-syntax
|
||||||
- gate-ci-docs
|
- gate-ci-docs
|
||||||
gate:
|
gate:
|
||||||
- gate-config-layout
|
- gate-config-layout
|
||||||
|
- gate-config-pep8
|
||||||
- gate-config-puppet-lint
|
- gate-config-puppet-lint
|
||||||
- gate-config-puppet-syntax
|
- gate-config-puppet-syntax
|
||||||
post:
|
post:
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
|
||||||
def set_log_url(item, job, params):
|
def set_log_url(item, job, params):
|
||||||
if hasattr(item.change, 'refspec'):
|
if hasattr(item.change, 'refspec'):
|
||||||
path = "%s/%s/%s/%s" % (
|
path = "%s/%s/%s/%s" % (
|
||||||
|
@ -13,4 +13,3 @@ writer = csv.writer(open(sys.argv[3], 'w'))
|
|||||||
for row in csv.reader(open(sys.argv[2])):
|
for row in csv.reader(open(sys.argv[2])):
|
||||||
if row[0] not in old:
|
if row[0] not in old:
|
||||||
writer.writerow(row)
|
writer.writerow(row)
|
||||||
|
|
||||||
|
@ -19,13 +19,10 @@
|
|||||||
# Soren Hansen wrote the original version of this script.
|
# Soren Hansen wrote the original version of this script.
|
||||||
# James Blair hacked it up to include email addresses from gerrit.
|
# James Blair hacked it up to include email addresses from gerrit.
|
||||||
|
|
||||||
import calendar
|
|
||||||
import datetime
|
import datetime
|
||||||
import json
|
import json
|
||||||
import optparse
|
import optparse
|
||||||
import paramiko
|
import paramiko
|
||||||
from pprint import pprint
|
|
||||||
import sys
|
|
||||||
import csv
|
import csv
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@ -33,6 +30,7 @@ MAILTO_RE = re.compile('mailto:(.*)')
|
|||||||
USERNAME_RE = re.compile('username:(.*)')
|
USERNAME_RE = re.compile('username:(.*)')
|
||||||
accounts = {}
|
accounts = {}
|
||||||
|
|
||||||
|
|
||||||
class Account(object):
|
class Account(object):
|
||||||
def __init__(self, num):
|
def __init__(self, num):
|
||||||
self.num = num
|
self.num = num
|
||||||
@ -40,6 +38,7 @@ class Account(object):
|
|||||||
self.emails = []
|
self.emails = []
|
||||||
self.username = None
|
self.username = None
|
||||||
|
|
||||||
|
|
||||||
def get_account(num):
|
def get_account(num):
|
||||||
a = accounts.get(num)
|
a = accounts.get(num)
|
||||||
if not a:
|
if not a:
|
||||||
@ -78,8 +77,10 @@ for a in accounts.values():
|
|||||||
atcs = []
|
atcs = []
|
||||||
|
|
||||||
optparser = optparse.OptionParser()
|
optparser = optparse.OptionParser()
|
||||||
optparser.add_option('-p', '--project', default='nova', help='Project to generate stats for')
|
optparser.add_option(
|
||||||
optparser.add_option('-o', '--output', default='out.csv', help='Output file')
|
'-p', '--project', default='nova', help='Project to generate stats for')
|
||||||
|
optparser.add_option(
|
||||||
|
'-o', '--output', default='out.csv', help='Output file')
|
||||||
options, args = optparser.parse_args()
|
options, args = optparser.parse_args()
|
||||||
|
|
||||||
QUERY = "project:%s status:merged" % options.project
|
QUERY = "project:%s status:merged" % options.project
|
||||||
@ -87,9 +88,11 @@ QUERY = "project:%s status:merged" % options.project
|
|||||||
client = paramiko.SSHClient()
|
client = paramiko.SSHClient()
|
||||||
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||||
client.load_system_host_keys()
|
client.load_system_host_keys()
|
||||||
client.connect('review.openstack.org', port=29418, key_filename='/home/corvus/.ssh/id_rsa', username='CHANGME')
|
client.connect(
|
||||||
stdin, stdout, stderr = client.exec_command('gerrit query %s --all-approvals --format JSON' %
|
'review.openstack.org', port=29418,
|
||||||
QUERY)
|
key_filename='/home/corvus/.ssh/id_rsa', username='CHANGME')
|
||||||
|
stdin, stdout, stderr = client.exec_command(
|
||||||
|
'gerrit query %s --all-approvals --format JSON' % QUERY)
|
||||||
changes = []
|
changes = []
|
||||||
|
|
||||||
done = False
|
done = False
|
||||||
@ -130,7 +133,9 @@ while not done:
|
|||||||
if approved and account not in atcs:
|
if approved and account not in atcs:
|
||||||
atcs.append(account)
|
atcs.append(account)
|
||||||
if not done:
|
if not done:
|
||||||
stdin, stdout, stderr = client.exec_command('gerrit query %s resume_sortkey:%s --all-approvals --format JSON' % (QUERY, last_sortkey))
|
stdin, stdout, stderr = client.exec_command(
|
||||||
|
'gerrit query %s resume_sortkey:%s --all-approvals'
|
||||||
|
' --format JSON' % (QUERY, last_sortkey))
|
||||||
|
|
||||||
print 'project: %s' % options.project
|
print 'project: %s' % options.project
|
||||||
print 'examined %s changes' % count
|
print 'examined %s changes' % count
|
||||||
|
@ -53,7 +53,8 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
for committer, code in zip(committers, codes):
|
for committer, code in zip(committers, codes):
|
||||||
if settings.EMAIL_USE_SSL:
|
if settings.EMAIL_USE_SSL:
|
||||||
session = smtplib.SMTP_SSL(settings.EMAIL_HOST, settings.EMAIL_PORT)
|
session = smtplib.SMTP_SSL(
|
||||||
|
settings.EMAIL_HOST, settings.EMAIL_PORT)
|
||||||
else:
|
else:
|
||||||
session = smtplib.SMTP(settings.EMAIL_HOST, settings.EMAIL_PORT)
|
session = smtplib.SMTP(settings.EMAIL_HOST, settings.EMAIL_PORT)
|
||||||
if settings.EMAIL_USE_TLS:
|
if settings.EMAIL_USE_TLS:
|
||||||
@ -66,10 +67,8 @@ if __name__ == '__main__':
|
|||||||
code=code,
|
code=code,
|
||||||
signature=settings.EMAIL_SIGNATURE)
|
signature=settings.EMAIL_SIGNATURE)
|
||||||
msg = "From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n%s" % (
|
msg = "From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n%s" % (
|
||||||
settings.EMAIL_FROM,
|
settings.EMAIL_FROM, ','.join(committer.emails),
|
||||||
','.join(committer.emails),
|
settings.EMAIL_SUBJECT, content)
|
||||||
settings.EMAIL_SUBJECT,
|
|
||||||
content)
|
|
||||||
|
|
||||||
session.sendmail(settings.EMAIL_FROM, committer.emails, msg)
|
session.sendmail(settings.EMAIL_FROM, committer.emails, msg)
|
||||||
print "%s,ATC,%s" % (code, committer.name)
|
print "%s,ATC,%s" % (code, committer.name)
|
||||||
|
Loading…
Reference in New Issue
Block a user