~nova-coresec/nova/ppa-lucid

« back to all changes in this revision

Viewing changes to nova/api/rackspace/images.py

  • Committer: Soren Hansen
  • Date: 2010-10-14 21:26:14 UTC
  • mfrom: (195.1.85 ubuntu-packaging)
  • Revision ID: soren.hansen@rackspace.com-20101014212614-ioz32fe7oleepk4j
Merge ubuntu packaging branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
#    License for the specific language governing permissions and limitations
16
16
#    under the License.
17
17
 
 
18
from webob import exc
 
19
 
 
20
from nova import flags
 
21
from nova import utils
 
22
from nova import wsgi
 
23
from nova.api.rackspace import _id_translator
 
24
import nova.api.rackspace
18
25
import nova.image.service
19
 
from nova.api.rackspace import base
20
 
from nova.api.rackspace import _id_translator
21
 
from webob import exc
22
 
 
23
 
class Controller(base.Controller):
 
26
from nova.api.rackspace import faults
 
27
 
 
28
 
 
29
FLAGS = flags.FLAGS
 
30
 
 
31
class Controller(wsgi.Controller):
24
32
 
25
33
    _serialization_metadata = {
26
34
        'application/xml': {
32
40
    }
33
41
 
34
42
    def __init__(self):
35
 
        self._service = nova.image.service.ImageService.load()
 
43
        self._service = utils.import_object(FLAGS.image_service)
36
44
        self._id_translator = _id_translator.RackspaceAPIIdTranslator(
37
45
                "image", self._service.__class__.__name__)
38
46
 
44
52
    def detail(self, req):
45
53
        """Return all public images in detail."""
46
54
        data = self._service.index()
 
55
        data = nova.api.rackspace.limited(data, req)
47
56
        for img in data:
48
57
            img['id'] = self._id_translator.to_rs_id(img['id'])
49
58
        return dict(images=data)
57
66
 
58
67
    def delete(self, req, id):
59
68
        # Only public images are supported for now.
60
 
        raise exc.HTTPNotFound()
 
69
        raise faults.Fault(exc.HTTPNotFound())
61
70
 
62
71
    def create(self, req):
63
72
        # Only public images are supported for now, so a request to
64
73
        # make a backup of a server cannot be supproted.
65
 
        raise exc.HTTPNotFound()
 
74
        raise faults.Fault(exc.HTTPNotFound())
66
75
 
67
76
    def update(self, req, id):
68
77
        # Users may not modify public images, and that's all that 
69
78
        # we support for now.
70
 
        raise exc.HTTPNotFound()
 
79
        raise faults.Fault(exc.HTTPNotFound())