951: Fix setup Internal server error r=mergify[bot] a=ionutfilip

## What type of PR?
bug-fix

## What does this PR do?
Using invalid docker network subnet generates an "ValueError('%s has host bits set' % self)" which was not handled and results in "Internal server error".

### Related issue(s)
- Closes #924

## Prerequistes
Before we can consider review and merge, please make sure the following list is done and checked.
If an entry in not applicable, you can check it or remove it from the list.

- [x] In case of feature or enhancement: documentation updated accordingly
- [x] Unless it's docs or a minor change: add [changelog](https://mailu.io/master/contributors/guide.html#changelog) entry file.


Co-authored-by: Ionut Filip <ionut.philip@gmail.com>
master
bors[bot] 6 years ago
commit da52c64cd8

@ -90,7 +90,10 @@ def build_app(path):
def submit():
data = flask.request.form.copy()
data['uid'] = str(uuid.uuid4())
try:
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))
return flask.redirect(flask.url_for('.setup', uid=data['uid']))

Loading…
Cancel
Save