From ee972086c2a2330a8d1024402f5d54091d9bbdef Mon Sep 17 00:00:00 2001 From: Mohammed Junaid Date: Thu, 1 Aug 2013 11:31:39 +0530 Subject: Handle the ring_name variable being none in Ring.__init__ Change-Id: Ifbcf217e525e50f62b98028ed5292be58db64bad Signed-off-by: Mohammed Junaid Reviewed-on: http://review.gluster.org/5459 Reviewed-by: Luis Pabon Tested-by: Luis Pabon --- gluster/swift/common/ring.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/gluster/swift/common/ring.py b/gluster/swift/common/ring.py index d86a534..f4df8da 100644 --- a/gluster/swift/common/ring.py +++ b/gluster/swift/common/ring.py @@ -41,20 +41,24 @@ if not reseller_prefix.endswith('_'): class Ring(ring.Ring): - def __init__(self, serialized_path, *args, **kwargs): + def __init__(self, serialized_path, reload_time=15, ring_name=None): self.false_node = {'zone': 1, 'weight': 100.0, 'ip': '127.0.0.1', 'id': 0, 'meta': '', 'device': 'volume_not_in_ring', 'port': 6012} self.account_list = [] - ring_file = os.path.join(serialized_path, kwargs['ring_name'] - + '.ring.gz') - if not os.path.exists(ring_file): + if ring_name: + _serialized_path = os.path.join(serialized_path, + ring_name + '.ring.gz') + else: + _serialized_path = os.path.join(serialized_path) + + if not os.path.exists(_serialized_path): raise OSError(errno.ENOENT, 'No such file or directory', - 'ring files do not exists under %s, ' - 'aborting proxy-server start.' % serialized_path) + '%s ring file does not exists, aborting ' + 'proxy-server start.' % _serialized_path) - ring.Ring.__init__(self, serialized_path, *args, **kwargs) + ring.Ring.__init__(self, serialized_path, reload_time, ring_name) def _get_part_nodes(self, part): seen_ids = set() -- cgit