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