From 79e5777ae345a3ce41caeb22c6e69d30270c2463 Mon Sep 17 00:00:00 2001
From: deflax
{% else %} - + {% endif %} {% endif %}
diff --git a/app/templates/vmanager/_misc.html b/app/templates/vmanager/_misc.html index 13fd91f..740a997 100644 --- a/app/templates/vmanager/_misc.html +++ b/app/templates/vmanager/_misc.html @@ -52,7 +52,7 @@ addEventListener("DOMContentLoaded", function() {- + diff --git a/app/templates/vmanager/email/adm_unreachable.html b/app/templates/vmanager/email/adm_unreachable.html index b51466a..52abd1f 100644 --- a/app/templates/vmanager/email/adm_unreachable.html +++ b/app/templates/vmanager/email/adm_unreachable.html @@ -1,4 +1,4 @@ -
{{ user.email }} encountered an error working with cube id: {{ cubeid }}
+
{{ user.email }} encountered an error working with id: {{ unit_id }}
Regards,
diff --git a/app/templates/vmanager/email/adm_unreachable.txt b/app/templates/vmanager/email/adm_unreachable.txt
index cfa0f93..dbb7ddd 100644
--- a/app/templates/vmanager/email/adm_unreachable.txt
+++ b/app/templates/vmanager/email/adm_unreachable.txt
@@ -1,4 +1,4 @@
-User {{ user.email }} encountered an error working with cube id: {{ cubeid }}
+User {{ user.email }} encountered an error working with id: {{ unit_id }}
Regards,
Proxadmin
diff --git a/app/vmanager/routes.py b/app/vmanager/routes.py
index 212e160..2ef43c6 100644
--- a/app/vmanager/routes.py
+++ b/app/vmanager/routes.py
@@ -49,9 +49,11 @@ def createvm():
#no switches in the account. create one...
data = { 'clientid': str(current_user.pid),
'clientemail': str(current_user.email),
- 'region': str(selected_region.name)
+ 'region': str(selected_region.name),
+ 'type': 'bridge'
}
- query = contact_proxmaster(data, 'brcreate')
+ #create bridge unit
+ query = contact_proxmaster(data, 'create')
if query is not None:
bridge = Bridge(user_id=int(current_user.pid))
db.session.add(bridge)
@@ -63,12 +65,13 @@ def createvm():
return redirect(url_for('main.dashboard'))
else:
#bridge found. lets see on which slave it is so we can create the instance on the same slave.
- data = {}
- query = contact_proxmaster(data, 'brquery', str(selected_bridge.bridge_id))
+ data = { 'unit_id': int(selected_bridge.bridge_id),
+ 'type': 'bridge' }
+ query = contact_proxmaster(data, 'status')
if query is not None:
newbridge = False
else:
- flash('Point found but cannot be used1')
+ flash('Point found but cannot be used!')
return redirect(url_for('main.dashboard'))
#machine will be installed where the switch physically is
@@ -78,24 +81,23 @@ def createvm():
#create new machine...
data = { 'clientid': str(current_user.pid),
'clientemail': str(current_user.email),
- 'hostname': str(form.servername.data) + '-c' + str(current_user.pid),
+ 'hostname': 'c' + str(current_user.pid) + '-' + str(form.servername.data),
'region': str(selected_region.name),
'slave': str(slave_name),
- 'type': 'kvm',
+ 'type': 'deploy',
'cpu': '1',
'mem': '512',
'hdd': '20',
- 'eth0br': str(bridge_id),
- 'eth0ip': 'AUTO'
+ 'bridge': str(bridge_id)
}
try:
- query = contact_proxmaster(data, 'vmcreate')
+ query = contact_proxmaster(data, 'create')
except:
flash('Region not available! Please try again later...')
return redirect(url_for('main.dashboard'))
if query is not None:
- deployment = Deployment(user_id=int(current_user.pid), machine_alias=query['hostname'], machine_id=query['cube'], machine_cpu=data['cpu'], machine_mem=data['mem'], machine_hdd=data['hdd'], enabled=True, protected=False, daysleft=15, warning=True, discount=0)
+ deployment = Deployment(user_id=int(current_user.pid), machine_alias=query['hostname'], machine_id=query['unit_id'], machine_cpu=data['cpu'], machine_mem=data['mem'], machine_hdd=data['hdd'], enabled=True, protected=False, daysleft=15, warning=True, discount=0)
db.session.add(deployment)
db.session.commit()
flash('New device created successfully in region "{}".'.format(str(selected_region.description)))
@@ -171,7 +173,7 @@ def activate(itemid=0):
'eth1ip': str(selected_address.ip)
}
try:
- query = contact_proxmaster(data, 'vmcreate')
+ query = contact_proxmaster(data, 'create')
except:
flash('Region unreachable! Cannot create router. Please try again later...')
return redirect(url_for('main.dashboard'))
@@ -204,34 +206,35 @@ def activate(itemid=0):
return redirect(url_for('main.dashboard'))
return render_template('vmanager/activate.html', form=form, deploy=deploy, cpu_cost=cpu_cost, mem_cost=mem_cost, hdd_cost=hdd_cost, ppm=ppm, discount=discount, total=total, currency=owner.currency)
-@vmanager.route('/vmremove/