Commit 0eda9ef5 authored by Aleksey Shirokih's avatar Aleksey Shirokih
Browse files

Revert "Move to python3. initial"

This reverts commit 8cddd645.
parent 8cddd645
......@@ -14,5 +14,4 @@ share/
include/
lib/
share/
var/
venv/
var/
\ No newline at end of file
......@@ -5,15 +5,15 @@ certifi==2016.9.26
paramiko==2.1.2
cffi>=0.8.5
futures>=2.2.0
future==0.16.0
peewee==2.10.2
pycparser>=2.10
singledispatch>=3.4.0.0
six>=1.8.0
tornado==4.5.2
tornado==4.4.2
ansible
setuptools>=11.3
packaging
appdirs
netaddr
jmespath==0.9.3
#gittornado
jmespath==0.9.3
\ No newline at end of file
......@@ -7,7 +7,6 @@
# ----------------------------------------------------------------------
# Python modules
from builtins import object
import base64
# Third-party modules
......@@ -15,7 +14,6 @@ import tornado.web
# Tower modules
from tower.models.user import User
from future.utils import with_metaclass
class BaseHandler(tornado.web.RequestHandler):
......@@ -73,7 +71,8 @@ def open_api(method):
return method
class API(with_metaclass(APIBase, object)):
class API(object):
__metaclass__ = APIBase
name = None
def __init__(self, handler):
......
......@@ -7,9 +7,6 @@
# ----------------------------------------------------------------------
from __future__ import absolute_import
from builtins import str
from builtins import zip
from builtins import range
import datetime
# Python modules
import logging
......@@ -213,7 +210,7 @@ class DeployHandler(BaseHandler):
def on_data(self, data):
def qlog(x):
if x.decode('utf-8').endswith("\n"):
if x.endswith("\n"):
return x[:-1]
else:
return x
......@@ -235,7 +232,7 @@ class DeployHandler(BaseHandler):
except tornado.iostream.StreamClosedError:
pass
recap = [0, 0, 0, 0]
for v in self.recap.values():
for v in self.recap.itervalues():
recap = [(x + y) for x, y in zip(recap, v)]
with db.atomic():
self.job_log.complete_ts = datetime.datetime.now()
......
......@@ -8,7 +8,6 @@
# Python modules
from __future__ import absolute_import
from builtins import str
import json
import logging
import peewee
......@@ -45,7 +44,7 @@ class JSONRPCHandler(BaseHandler):
raise HTTPError(404, "Invalid API: %s" % api_name)
# Parse request
try:
req = json.loads(self.request.body.decode('utf-8'))
req = json.loads(self.request.body)
except ValueError as why:
raise HTTPError(400, "Bad request: %s" % why)
# Parse request
......
......@@ -8,7 +8,6 @@
# Third-party modules
from __future__ import absolute_import
from builtins import str
import peewee
from .base import API, api, APIError
......
......@@ -8,8 +8,6 @@
# Python modules
from __future__ import absolute_import
from builtins import str
from builtins import range
import os
# Third-party modules
......@@ -57,7 +55,7 @@ class ServiceAPI(API):
if "forms" not in cfg or not cfg["forms"]:
return r
sc = cfg["forms"][service]
for k, v in sc.items():
for k, v in sc.iteritems():
if "description" in k:
continue
r[k] = v.get("default", None)
......@@ -80,7 +78,7 @@ class ServiceAPI(API):
"autoheight": "true",
"template": descr.get("description", "")
}
for k, v in descr.items():
for k, v in descr.iteritems():
if "description" in k:
continue
c = {
......
......@@ -54,7 +54,7 @@ class UIHandler(tornado.web.RequestHandler):
ssize = len(js)
js = jsmin.jsmin(js)
logger.info("Minifying JS: %s -> %s", ssize, len(js))
self.hash = hashlib.sha256(js.encode(encoding='utf-8')).hexdigest()[:8]
self.hash = hashlib.sha256(js).hexdigest()[:8]
cache_path = os.path.join(self.CACHE_ROOT, "%s.js" % self.hash)
if not os.path.isfile(cache_path):
logger.info("Writing cached JS to %s", cache_path)
......@@ -72,6 +72,6 @@ class UIHandler(tornado.web.RequestHandler):
if fp.startswith("/ui/"):
fp = fp[4:]
fp = os.path.join(self.root, fp)
with open(fp, 'r') as f:
hash = hashlib.sha256(f.read().encode(encoding='utf-8')).hexdigest()[:8]
with open(fp) as f:
hash = hashlib.sha256(f.read()).hexdigest()[:8]
return "%s?%s" % (path, hash)
......@@ -7,10 +7,7 @@
# -----------------------------------------------------------------------
from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from builtins import range
import queue
import Queue
import argparse
# Python modules
import os
......@@ -63,7 +60,7 @@ def collect_crashinfo(options, args):
env = Environment.get(Environment.name == options.env)
except Environment.DoesNotExist:
die("Invalid environment: '%s'" % options.env)
q = queue.Queue()
q = Queue.Queue()
# Start workers
workers = []
for i in range(options.jobs):
......
......@@ -33,7 +33,7 @@ class OrderedDictYAMLLoader(yaml.Loader):
key = self.construct_object(key_node, deep=deep)
try:
hash(key)
except TypeError as exc:
except TypeError, exc:
raise yaml.constructor.ConstructorError('while constructing a mapping',
node.start_mark, 'found unacceptable key (%s)' % exc,
key_node.start_mark)
......
from builtins import object
from peewee import Model, CharField, TextField
class Settings(Model):
class Meta(object):
class Meta:
db_table = "settings"
key = CharField(primary_key=True)
......
from builtins import object
from peewee import Model, CharField, BooleanField
class User(Model):
class Meta(object):
class Meta:
db_table = "user"
name = CharField(unique=True)
......
from builtins import object
from peewee import Model, CharField, BooleanField
def migrate(migrator):
class User(Model):
class Meta(object):
class Meta:
database = migrator.db
db_table = "user"
......
from builtins import object
from peewee import Model, CharField, TextField
class Environment(Model):
class Meta(object):
class Meta:
db_table = "environment"
name = CharField(unique=True)
......
from builtins import object
from peewee import Model, CharField, TextField
class Datacenter(Model):
class Meta(object):
class Meta:
db_table = "datacenter"
name = CharField(unique=True)
......
from builtins import object
from peewee import Model, CharField, TextField, ForeignKeyField
class Environment(Model):
class Meta(object):
class Meta:
db_table = "environment"
class Pool(Model):
class Meta(object):
class Meta:
db_table = "pool"
indexes = (
(("environment_id", "name"), True),
......
from builtins import object
from peewee import Model, CharField, TextField, ForeignKeyField
class Environment(Model):
class Meta(object):
class Meta:
db_table = "environment"
class Datacenter(Model):
class Meta(object):
class Meta:
db_table = "datacenter"
class Node(Model):
class Meta(object):
class Meta:
db_table = "node"
indexes = (
(("environment", "name"), True),
......
from builtins import object
from peewee import (Model, CharField, TextField, ForeignKeyField,
DateTimeField, BooleanField, IntegerField)
class Environment(Model):
class Meta(object):
class Meta:
db_table = "environment"
class JobLog(Model):
class Meta(object):
class Meta:
db_table = "joblog"
start_ts = DateTimeField()
......
from builtins import object
from peewee import Model, CharField, IntegerField, ForeignKeyField
class Environment(Model):
class Meta(object):
class Meta:
db_table = "environment"
class Pool(Model):
class Meta(object):
class Meta:
db_table = "pool"
class Node(Model):
class Meta(object):
class Meta:
db_table = "node"
class Service(Model):
class Meta(object):
class Meta:
db_table = "service"
environment = ForeignKeyField(Environment, on_delete="RESTRICT")
......
from builtins import object
from peewee import (Model, CharField, TextField, ForeignKeyField,
DateTimeField, BooleanField)
class Environment(Model):
class Meta(object):
class Meta:
db_table = "environment"
class PullLog(Model):
class Meta(object):
class Meta:
db_table = "pulllog"
start_ts = DateTimeField()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment