Handle setup subnet error

master
Ionut Filip 6 years ago
parent c2f3966604
commit 131406774b

@ -90,7 +90,10 @@ def build_app(path):
def submit(): def submit():
data = flask.request.form.copy() data = flask.request.form.copy()
data['uid'] = str(uuid.uuid4()) data['uid'] = str(uuid.uuid4())
try:
data['dns'] = str(ipaddress.IPv4Network(data['subnet'])[-2]) data['dns'] = str(ipaddress.IPv4Network(data['subnet'])[-2])
except ValueError as err:
return "Error while generating files: " + str(err)
db.set(data['uid'], json.dumps(data)) db.set(data['uid'], json.dumps(data))
return flask.redirect(flask.url_for('.setup', uid=data['uid'])) return flask.redirect(flask.url_for('.setup', uid=data['uid']))

Loading…
Cancel
Save