dropbox / nsot

Network Source of Truth is an open source IPAM and network inventory database
https://nsot.readthedocs.io
Other
399 stars 66 forks source link

Fix for issue #219 #245

Closed rmhasan closed 7 years ago

rmhasan commented 7 years ago

Hi I was able to fix the issue. When the request to create a network in a non-existant site is sent, the perform_create method in class NsotViewSet gets called. The line with objects = serializer.save() throws an exc.ObjectDoesNotExist exception because of the non-existant site. This exception is not handled and causes an internal server error, hence the 500 status code error and stacktrace. To fix the issue,I catch the exc.ObjectDoesNotExist exception and raise a BadRequest exception instead which has the 400 status code. This status code was requested by @jathanism in issue #219.

Also, I am adding a description variable with a string value assigned in the BuildStatic class. Whenever you run python setup.py --help-commands you would see "(no description available)" next to the build_static option, which can be seen below.

nodescription

With my changes you would see a description for build_static when you run python setup.py --help-commands, which can be see below

description

The new description will be "builds all front end dependencies"