Revision 23b41f6f snf-pithos-backend/pithos/backends/modular.py
b/snf-pithos-backend/pithos/backends/modular.py | ||
---|---|---|
124 | 124 |
logger = logging.getLogger(__name__) |
125 | 125 |
|
126 | 126 |
|
127 |
def backend_method(func): |
|
128 |
@wraps(func) |
|
129 |
def wrapper(self, *args, **kw): |
|
130 |
self.success_status = getattr(self, 'success_status', False) |
|
131 |
try: |
|
132 |
result = func(self, *args, **kw) |
|
133 |
return result |
|
134 |
except: |
|
135 |
self.backend.success_status = False |
|
136 |
raise |
|
137 |
return wrapper |
|
138 |
|
|
139 |
|
|
127 | 140 |
def debug_method(func): |
128 | 141 |
@wraps(func) |
129 | 142 |
def wrapper(self, *args, **kw): |
... | ... | |
255 | 268 |
|
256 | 269 |
self.lock_container_path = False |
257 | 270 |
|
258 |
def pre_exec(self, lock_container_path=False): |
|
259 |
self.lock_container_path = lock_container_path |
|
271 |
def __enter__(self): |
|
260 | 272 |
self.wrapper.execute() |
273 |
return self |
|
261 | 274 |
|
262 |
def post_exec(self, success_status=True): |
|
275 |
def __exit__(self, type, value, traceback): |
|
276 |
success_status = getattr(self, 'success_status', True) |
|
263 | 277 |
if success_status: |
264 | 278 |
# send messages produced |
265 | 279 |
for m in self.messages: |
... | ... | |
292 | 306 |
accept_serials=[], |
293 | 307 |
reject_serials=self.serials) |
294 | 308 |
self.wrapper.rollback() |
309 |
self.close() |
|
295 | 310 |
|
296 | 311 |
def close(self): |
297 | 312 |
self.wrapper.close() |
Also available in: Unified diff