mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-15 12:59:06 +00:00
Merge pull request #1169 from GNS3/checking-nio-existance
Added checking if NIO exists (Fixes #1160)
This commit is contained in:
commit
a7297ffca4
@ -16,6 +16,7 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
from aiohttp.web import HTTPConflict
|
||||||
|
|
||||||
from gns3server.web.route import Route
|
from gns3server.web.route import Route
|
||||||
from gns3server.schemas.node import NODE_CAPTURE_SCHEMA
|
from gns3server.schemas.node import NODE_CAPTURE_SCHEMA
|
||||||
@ -219,7 +220,13 @@ class CloudHandler:
|
|||||||
|
|
||||||
builtin_manager = Builtin.instance()
|
builtin_manager = Builtin.instance()
|
||||||
node = builtin_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
node = builtin_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||||
nio = node.nios[int(request.match_info["adapter_number"])]
|
adapter_number = int(request.match_info["adapter_number"])
|
||||||
|
|
||||||
|
try:
|
||||||
|
nio = node.nios[adapter_number]
|
||||||
|
except KeyError:
|
||||||
|
raise HTTPConflict(text="NIO `{}` doesn't exist".format(adapter_number))
|
||||||
|
|
||||||
if "filters" in request.json and nio:
|
if "filters" in request.json and nio:
|
||||||
nio.filters = request.json["filters"]
|
nio.filters = request.json["filters"]
|
||||||
yield from node.update_nio(int(request.match_info["port_number"]), nio)
|
yield from node.update_nio(int(request.match_info["port_number"]), nio)
|
||||||
|
Loading…
Reference in New Issue
Block a user