diff options
| author | Rick Harris <rick.harris@rackspace.com> | 2011-05-18 15:14:24 -0500 |
|---|---|---|
| committer | Rick Harris <rick.harris@rackspace.com> | 2011-05-18 15:14:24 -0500 |
| commit | d44a4728c23cebd1eaa7615c3b439e44972750cc (patch) | |
| tree | 59113328d73834ef8ad30f10c0c1060817f4f1da | |
| parent | 01f7b0aa8de984baa27be50171526696aac48c0c (diff) | |
| download | nova-d44a4728c23cebd1eaa7615c3b439e44972750cc.tar.gz nova-d44a4728c23cebd1eaa7615c3b439e44972750cc.tar.xz nova-d44a4728c23cebd1eaa7615c3b439e44972750cc.zip | |
On second thought, removing decorator
| -rw-r--r-- | nova/api/openstack/zones.py | 12 | ||||
| -rw-r--r-- | nova/tests/api/openstack/test_zones.py | 11 |
2 files changed, 3 insertions, 20 deletions
diff --git a/nova/api/openstack/zones.py b/nova/api/openstack/zones.py index 145b24347..af73d8f6d 100644 --- a/nova/api/openstack/zones.py +++ b/nova/api/openstack/zones.py @@ -52,14 +52,6 @@ def _scrub_zone(zone): 'deleted', 'deleted_at', 'updated_at')) -def check_encryption_key(func): - def wrapped(*args, **kwargs): - if not FLAGS.build_plan_encryption_key: - raise exception.FlagNotSet(flag='build_plan_encryption_key') - return func(*args, **kwargs) - return wrapped - - class Controller(common.OpenstackController): _serialization_metadata = { @@ -117,7 +109,6 @@ class Controller(common.OpenstackController): zone = api.zone_update(context, zone_id, env["zone"]) return dict(zone=_scrub_zone(zone)) - @check_encryption_key def select(self, req): """Returns a weighted list of costs to create instances of desired capabilities.""" @@ -138,6 +129,9 @@ class Controller(common.OpenstackController): """Remove all the confidential data and return a sanitized version of the build plan. Include an encrypted full version of the weighting entry so we can get back to it later.""" + if not FLAGS.build_plan_encryption_key: + raise exception.FlagNotSet(flag='build_plan_encryption_key') + encryptor = crypto.encryptor(FLAGS.build_plan_encryption_key) cooked = [] for entry in build_plan: diff --git a/nova/tests/api/openstack/test_zones.py b/nova/tests/api/openstack/test_zones.py index 62a763c6f..fa2e05033 100644 --- a/nova/tests/api/openstack/test_zones.py +++ b/nova/tests/api/openstack/test_zones.py @@ -121,17 +121,6 @@ class ZonesTest(test.TestCase): FLAGS.zone_capabilities = self.old_zone_capabilities super(ZonesTest, self).tearDown() - def test_check_encryption_key(self): - @zones.check_encryption_key - def test_func(): - return 42 - - self.assertRaises(exception.FlagNotSet, test_func) - - FLAGS.build_plan_encryption_key = "something" - ret = test_func() - self.assertEqual(ret, 42) - def test_get_zone_list_scheduler(self): self.stubs.Set(api, '_call_scheduler', zone_get_all_scheduler) req = webob.Request.blank('/v1.0/zones') |
