Bug #4979

Server creation fails with invalid 'networks' input

Added by Christos Stavrakakis over 10 years ago. Updated over 10 years ago.

Status:Closed Start date:01/24/2014
Priority:High Due date:
Assignee:Christos Stavrakakis % Done:


Category:Cyclades API Spent time: -
Target version:0.15


Code for creating a server seems to not validate the 'networks' field of the
request, and so fails with Type/Attribute erros.

Traceback (most recent call last):

File "/usr/lib/python2.7/dist-packages/snf_django/lib/api/__init__.py", line 119, in wrapper
response = func(request, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/synnefo/api/servers.py", line 401, in create_server
File "/usr/lib/python2.7/dist-packages/django/db/transaction.py", line 224, in inner
return func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/synnefo/logic/servers.py", line 177, in create
ports = create_instance_ports(userid, networks)
File "/usr/lib/python2.7/dist-packages/synnefo/logic/servers.py", line 567, in create_instance_ports
ports = create_ports_for_request(user_id, networks)
File "/usr/lib/python2.7/dist-packages/synnefo/logic/servers.py", line 702, in create_ports_for_request
return [_port_for_request(user_id, network) for network in networks]
File "/usr/lib/python2.7/dist-packages/synnefo/logic/servers.py", line 706, in _port_for_request
port_id = network_dict.get("port")

AttributeError: 'int' object has no attribute 'get'

Associated revisions

Revision 14402edc
Added by Christos Stavrakakis over 10 years ago

cyclades: Validate fields of API requests

Make sure that all fields of a request (user input) have a valid type.
This commit validates 'ports', 'servers' and 'floating_ips' APIs.

Refs #4979

Revision 3d870b05
Added by Dionysis Grigoropoulos over 10 years ago

cyclades: Update api/networks.py and typo fixes

  • Update api/networks.py to use the updated get_attribute from commit
  • Add corresponding test case
  • Typo fix in an error message in api/subnets.py

Refs #4979


#1 Updated by Christos Stavrakakis over 10 years ago

  • Status changed from New to Closed

Also available in: Atom PDF