Bug #4979

Server creation fails with invalid 'networks' input

Added by Christos Stavrakakis about 7 years ago. Updated about 7 years ago.

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

0%

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

Description

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
networks=networks)
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 about 7 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 about 7 years ago

cyclades: Update api/networks.py and typo fixes

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

Refs #4979

History

#1 Updated by Christos Stavrakakis about 7 years ago

  • Status changed from New to Closed

Also available in: Atom PDF