diff options
author | Paul Luse <paul.e.luse@intel.com> | 2014-07-02 14:39:42 -0700 |
---|---|---|
committer | John Dickinson <me@not.mn> | 2014-07-02 21:18:10 -0700 |
commit | bfa9139649c0ac7f75e8c9503cb04d06f7bae0b9 (patch) | |
tree | e01b12d2f9061cb7345701727736327bed7c236d /swift/proxy/controllers/base.py | |
parent | 7dbf8324569d45897f2b4f05cd97299366eff23d (diff) | |
download | swift-proposed/2.0.0.tar.gz |
Fix potential missing key error in container_info2.0.0.rc22.0.0proposed/2.0.0
If upgrading from a non-storage policy enabled version of
swift to a storage policy enabled version its possible that
memcached will have an info structure that does not contain
the 'storage_policy" key resulting in an unhandled exception
during the lookup. The fix is to simply make sure we never
return the dict without a storage_policy key defined; if it
doesn't exist its safe to make it '0' as this means you're
in the update scenario and there's xno other possibility.
Change-Id: If8c88f67ba7a3180ad06b586372fe35c65807aac
Diffstat (limited to 'swift/proxy/controllers/base.py')
-rw-r--r-- | swift/proxy/controllers/base.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/swift/proxy/controllers/base.py b/swift/proxy/controllers/base.py index 5d65e3c78..f3cf4f290 100644 --- a/swift/proxy/controllers/base.py +++ b/swift/proxy/controllers/base.py @@ -295,6 +295,7 @@ def get_container_info(env, app, swift_source=None): swift_source=swift_source) if not info: info = headers_to_container_info({}, 0) + info.setdefault('storage_policy', '0') return info @@ -987,6 +988,7 @@ class Controller(object): else: info['partition'] = part info['nodes'] = nodes + info.setdefault('storage_policy', '0') return info def _make_request(self, nodes, part, method, path, headers, query, |