From e49004f92367b3d7c063119be8cbc85162bf7068 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Thu, 5 Feb 2015 15:02:52 -0500 Subject: [PATCH] if 'versioned' is in obj, just use that before anything Signed-off-by: Alfredo Deza --- radosgw_agent/client.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/radosgw_agent/client.py b/radosgw_agent/client.py index 03bf1bd..01059d2 100644 --- a/radosgw_agent/client.py +++ b/radosgw_agent/client.py @@ -283,6 +283,11 @@ def is_versioned(obj): """ Check if a given object is versioned by inspecting some of its attributes. """ + # before any heuristic, newer versions of RGW will tell if an obj is versioned + # so try that first + if hasattr(obj, 'versioned'): + return obj.versioned + if not hasattr(obj, 'VersionedEpoch'): # overly paranoid here, an object that is not versioned should *never* # have a `VersionedEpoch` attribute -- 2.47.3