Revision 4dba0480

b/snf-cyclades-app/synnefo/api/actions.py
62 62
        return func
63 63
    return decorator
64 64

  
65

  
65 66
def network_action(name):
66 67
    '''Decorator for functions implementing network actions.
67 68
    `name` is the key in the dict passed by the client.
......
85 86
    #                       buildInProgress (409),
86 87
    #                       overLimit (413)
87 88

  
88
    try:
89
        password = args['adminPass']
90
    except KeyError:
91
        raise BadRequest('Malformed request.')
92

  
93 89
    raise ServiceUnavailable('Changing password is not supported.')
94 90

  
95 91
@server_action('reboot')
......
195 191

  
196 192
    raise ServiceUnavailable('Resize not supported.')
197 193

  
194

  
198 195
@server_action('console')
199 196
def get_console(request, vm, args):
200 197
    """Arrange for an OOB console of the specified type
......
270 267

  
271 268
    return HttpResponse(data, mimetype=mimetype, status=200)
272 269

  
270

  
273 271
@server_action('firewallProfile')
272
@transaction.commit_on_success
274 273
def set_firewall_profile(request, vm, args):
275 274
    # Normal Response Code: 200
276 275
    # Error Response Codes: computeFault (400, 500),
......
281 280
    #                       itemNotFound (404),
282 281
    #                       buildInProgress (409),
283 282
    #                       overLimit (413)
284
    
283

  
285 284
    profile = args.get('profile', '')
286 285
    if profile not in [x[0] for x in NetworkInterface.FIREWALL_PROFILES]:
287 286
        raise BadRequest("Unsupported firewall profile")
......
322 321

  
323 322

  
324 323
@network_action('remove')
324
@transaction.commit_on_success
325 325
def remove(request, net, args):
326 326
    # Normal Response Code: 202
327 327
    # Error Response Codes: computeFault (400, 500),
......
332 332
    #                       itemNotFound (404),
333 333
    #                       overLimit (413)
334 334

  
335
    try: #attachment string: nic-<vm-id>-<nic-index>
335
    try:  # attachment string: nic-<vm-id>-<nic-index>
336 336
        server_id = args.get('attachment', None).split('-')[1]
337 337
        nic_index = args.get('attachment', None).split('-')[2]
338 338
    except IndexError:
b/snf-cyclades-app/synnefo/api/networks.py
36 36
from django.conf.urls.defaults import patterns
37 37
from django.conf import settings
38 38
from django.db.models import Q
39
from django.db import transaction
39 40
from django.http import HttpResponse
40 41
from django.template.loader import render_to_string
41 42
from django.utils import simplejson as json
......
141 142

  
142 143

  
143 144
@util.api_method('POST')
145
@transaction.commit_on_success
144 146
def create_network(request):
145 147
    # Normal Response Code: 202
146 148
    # Error Response Codes: computeFault (400, 500),
......
241 243

  
242 244

  
243 245
@util.api_method('DELETE')
246
@transaction.commit_on_success
244 247
def delete_network(request, network_id):
245 248
    # Normal Response Code: 204
246 249
    # Error Response Codes: computeFault (400, 500),
b/snf-cyclades-app/synnefo/api/servers.py
36 36

  
37 37
from django.conf import settings
38 38
from django.conf.urls.defaults import patterns
39
from django.db import transaction
39 40
from django.http import HttpResponse
40 41
from django.template.loader import render_to_string
41 42
from django.utils import simplejson as json
......
183 184

  
184 185

  
185 186
@util.api_method('POST')
187
@transaction.commit_on_success
186 188
def create_server(request):
187 189
    # Normal Response Code: 202
188 190
    # Error Response Codes: computeFault (400, 500),
......
331 333

  
332 334

  
333 335
@util.api_method('DELETE')
336
@transaction.commit_on_success
334 337
def delete_server(request, server_id):
335 338
    # Normal Response Codes: 204
336 339
    # Error Response Codes: computeFault (400, 500),
......
475 478

  
476 479

  
477 480
@util.api_method('PUT')
481
@transaction.commit_on_success
478 482
def create_metadata_item(request, server_id, key):
479 483
    # Normal Response Code: 201
480 484
    # Error Response Codes: computeFault (400, 500),
......
509 513

  
510 514

  
511 515
@util.api_method('DELETE')
516
@transaction.commit_on_success
512 517
def delete_metadata_item(request, server_id, key):
513 518
    # Normal Response Code: 204
514 519
    # Error Response Codes: computeFault (400, 500),

Also available in: Unified diff