fix the order sort and include the machine seed

This commit is contained in:
deflax 2018-04-05 12:43:36 +03:00
parent 9db5a448b0
commit 7fbbe5c6d0
5 changed files with 13 additions and 14 deletions

View file

@ -89,7 +89,6 @@ if app.config['DEBUG'] == 1:
file_handler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]')) file_handler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]'))
app.logger.addHandler(file_handler) app.logger.addHandler(file_handler)
app.logger.setLevel(logging.DEBUG) app.logger.setLevel(logging.DEBUG)
#app.logger.info('Proxadmin started.')
@app.errorhandler(403) @app.errorhandler(403)
def forbidden(e): def forbidden(e):

View file

@ -38,8 +38,8 @@ def index():
@fresh_login_required @fresh_login_required
@admin_required @admin_required
def list_orders(): def list_orders():
NewOrders = Order.query.filter_by(status='new').all() NewOrders = Order.query.filter_by(status='new').order_by(Order.date_created.asc()).all()
AcceptedOrders = Order.query.filter_by(status='accepted').all() AcceptedOrders = Order.query.filter_by(status='accepted').order_by(Order.date_created.asc()).all()
return render_template('admin/list_orders.html', neworders=NewOrders, oldorders=AcceptedOrders) return render_template('admin/list_orders.html', neworders=NewOrders, oldorders=AcceptedOrders)
@admin.route("/listdeployments", methods=['GET']) @admin.route("/listdeployments", methods=['GET'])

View file

@ -232,6 +232,7 @@ class Order(db.Model):
__tablename__ = 'orders' __tablename__ = 'orders'
pid = db.Column(db.Integer, primary_key=True) pid = db.Column(db.Integer, primary_key=True)
user_id = db.Column(db.ForeignKey('users.pid')) #FK user_id = db.Column(db.ForeignKey('users.pid')) #FK
date_created = db.Column(db.DateTime, default=datetime.utcnow)
status = db.Column(db.String) status = db.Column(db.String)
recipe_id = db.Column(db.ForeignKey('recipes.pid')) #FK recipe_id = db.Column(db.ForeignKey('recipes.pid')) #FK
region_id = db.Column(db.ForeignKey('regions.pid')) #FK region_id = db.Column(db.ForeignKey('regions.pid')) #FK

View file

@ -3,7 +3,7 @@
################################################################################ ################################################################################
d-i debian-installer/locale string en_US.UTF-8 d-i debian-installer/locale string en_US.UTF-8
d-i localechooser/supported-locales multiselect en_US.UTF-8, de_DE.UTF-8 d-i localechooser/supported-locales multiselect en_US.UTF-8, bg_BG.UTF-8
d-i localechooser/translation/warn-light boolean true d-i localechooser/translation/warn-light boolean true
d-i localechooser/translation/warn-severe boolean true d-i localechooser/translation/warn-severe boolean true
d-i console-setup/ask_detect boolean false d-i console-setup/ask_detect boolean false
@ -104,15 +104,13 @@ d-i apt-setup/security_path string /ubuntu
tasksel tasksel/first multiselect server tasksel tasksel/first multiselect server
# Individual additional packages to install # Individual additional packages to install
d-i pkgsel/include string \ d-i pkgsel/include string apt-transport-https curl openssh-server python
apt-transport-https \
curl \
openssh-server
# see https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1317602 # see https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1317602
#d-i pkgsel/upgrade select none #d-i pkgsel/upgrade select none
d-i pgsel/upgrade select full-upgrade
d-i pkgsel/language-packs multiselect de, en d-i pkgsel/language-packs multiselect en, bg
d-i pkgsel/update-policy select unattended-upgrades d-i pkgsel/update-policy select unattended-upgrades
################################################################################ ################################################################################
@ -127,7 +125,7 @@ d-i grub-installer/with_other_os boolean true
################################################################################ ################################################################################
d-i finish-install/reboot_in_progress note d-i finish-install/reboot_in_progress note
d-i debian-installer/exit/poweroff boolean true #d-i debian-installer/exit/poweroff boolean true
################################################################################ ################################################################################
### X configuration ### X configuration
@ -145,3 +143,4 @@ xserver-xorg xserver-xorg/config/monitor/mode-list select 1024x768 @ 60 Hz
################################################################################ ################################################################################
d-i preseed/late_command string in-target /bin/sh -c 'wget -q -O - https://www.datapoint.bg/static/datapoint.sh | bash' d-i preseed/late_command string in-target /bin/sh -c 'wget -q -O - https://www.datapoint.bg/static/datapoint.sh | bash'

View file

@ -79,12 +79,12 @@ def vmcreate(orderid):
data = { 'clientid': str(order.user_id), data = { 'clientid': str(order.user_id),
'clientemail': str(order.owner.email), 'clientemail': str(order.owner.email),
'hostname': 'c' + str(order.user_id) + '-' + str(order.parameter1), 'hostname': 'c' + str(order.user_id) + '-' + str(order.parameter1),
'region': str(order.region.name),
'slave': str(selectedslave.name), 'slave': str(selectedslave.name),
'region': str(order.region.name),
'type': 'kvm', 'type': 'kvm',
'cpu': str(int(order.parameter2)), 'cpu': str(int(float(order.parameter2))),
'mem': str(int(order.parameter3)), 'mem': str(int(float(order.parameter3))),
'hdd': str(int(order.parameter4)), 'hdd': str(int(float(order.parameter4))),
'net0if': 'vmbr7' 'net0if': 'vmbr7'
} }
try: try: