diff options
| author | Rick Harris <rick.harris@rackspace.com> | 2011-06-15 19:30:48 +0000 |
|---|---|---|
| committer | Rick Harris <rick.harris@rackspace.com> | 2011-06-15 19:30:48 +0000 |
| commit | aa726953eb3818b7282044314599bfa3bc22793b (patch) | |
| tree | d63edbb798f78e95256664f46327ccab1d261bab /nova/api | |
| parent | 211b0eb5385acdfcd7a7da6efda8d7f3fbda3c55 (diff) | |
Fixing private-ips test
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/ips.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/nova/api/openstack/ips.py b/nova/api/openstack/ips.py index abea71830..71646b6d3 100644 --- a/nova/api/openstack/ips.py +++ b/nova/api/openstack/ips.py @@ -32,25 +32,24 @@ class Controller(object): self.compute_api = nova.compute.API() self.builder = nova.api.openstack.views.addresses.ViewBuilderV10() - def index(self, req, server_id): + def _get_instance(self, req, server_id): try: - instance = self.compute_api.get(req.environ['nova.context'], id) + instance = self.compute_api.get( + req.environ['nova.context'], server_id) except nova.exception.NotFound: return faults.Fault(exc.HTTPNotFound()) + return instance + + def index(self, req, server_id): + instance = self._get_instance(req, server_id) return {'addresses': self.builder.build(instance)} def public(self, req, server_id): - try: - instance = self.compute_api.get(req.environ['nova.context'], id) - except nova.exception.NotFound: - return faults.Fault(exc.HTTPNotFound()) + instance = self._get_instance(req, server_id) return {'public': self.builder.build_public_parts(instance)} def private(self, req, server_id): - try: - instance = self.compute_api.get(req.environ['nova.context'], id) - except nova.exception.NotFound: - return faults.Fault(exc.HTTPNotFound()) + instance = self._get_instance(req, server_id) return {'private': self.builder.build_private_parts(instance)} def show(self, req, server_id, id): |
