diff options
| author | Trey Morris <trey.morris@rackspace.com> | 2010-12-29 13:33:51 -0600 |
|---|---|---|
| committer | Trey Morris <trey.morris@rackspace.com> | 2010-12-29 13:33:51 -0600 |
| commit | 0afb4a06dcb94ae41d04b3d78304746b0cc5b26f (patch) | |
| tree | 15acd853b027a38a32b3049697b0dc8e5a85548f | |
| parent | b6e5c68d65701b840006cea49367879ee88c9b80 (diff) | |
refactor
| -rw-r--r-- | nova/api/openstack/servers.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py index 8b837e6fc..292a664b7 100644 --- a/nova/api/openstack/servers.py +++ b/nova/api/openstack/servers.py @@ -58,14 +58,15 @@ def checks_lock(function): req = args[2] context = req.environ['nova.context'] except: - logging.error(_("CheckLock: argument error")) - - # if locked and admin call function, otherwise 404 - if(compute_api.ComputeAPI().get_lock(context, _id)): - if(req.environ['nova.context'].is_admin): - function(*args, **kwargs) - # return 404 - return faults.Fault(exc.HTTPUnprocessableEntity()) + logging.error(_("CheckLock: argument error: |%s|, |%s|"), args, + kwargs) + # if admin or unlocked call function, otherwise 404 + locked = compute_api.ComputeAPI().get_lock(context, _id) + admin = req.environ['nova.context'].is_admin + if(admin or not locked): + return function(*args, **kwargs) + + return faults.Fault(exc.HTTPNotFound()) return decorated_function |
