diff options
author | Rick Harris <rconradharris@gmail.com> | 2012-03-21 20:14:39 +0000 |
---|---|---|
committer | Rick Harris <rconradharris@gmail.com> | 2012-03-21 20:14:39 +0000 |
commit | 521108d5b91d7a7aa2ff1e594f3dc48d0c2a7311 (patch) | |
tree | 7ced572cdcbd63082c41fcb3764a4fe3a59e189a /nova/context.py | |
parent | 4944a612e0926cfe542e0cb146cc9fabf70256f6 (diff) | |
download | nova-521108d5b91d7a7aa2ff1e594f3dc48d0c2a7311.tar.gz nova-521108d5b91d7a7aa2ff1e594f3dc48d0c2a7311.tar.xz nova-521108d5b91d7a7aa2ff1e594f3dc48d0c2a7311.zip |
Fail-fast for invalid read_deleted values
Fixes bug 961588
Change-Id: Ib02d89485cdf4626698b959a2136841109cdc51f
Diffstat (limited to 'nova/context.py')
-rw-r--r-- | nova/context.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/nova/context.py b/nova/context.py index 78dca3ffc..160699a11 100644 --- a/nova/context.py +++ b/nova/context.py @@ -55,9 +55,6 @@ class RequestContext(object): :param kwargs: Extra arguments that might be present, but we ignore because they possibly came in from older rpc messages. """ - if read_deleted not in ('no', 'yes', 'only'): - raise ValueError(_("read_deleted can only be one of 'no', " - "'yes' or 'only', not %r") % read_deleted) if kwargs: LOG.warn(_('Arguments dropped when creating context: %s') % str(kwargs)) @@ -85,6 +82,21 @@ class RequestContext(object): if overwrite or not hasattr(local.store, 'context'): self.update_store() + def _get_read_deleted(self): + return self._read_deleted + + def _set_read_deleted(self, read_deleted): + if read_deleted not in ('no', 'yes', 'only'): + raise ValueError(_("read_deleted can only be one of 'no', " + "'yes' or 'only', not %r") % read_deleted) + self._read_deleted = read_deleted + + def _del_read_deleted(self): + del self._read_deleted + + read_deleted = property(_get_read_deleted, _set_read_deleted, + _del_read_deleted) + def update_store(self): local.store.context = self |