Commit 4dbf3d42 authored by Chrysostomos Nanakos's avatar Chrysostomos Nanakos
Browse files

pithos: Refactor Archipelago options parsing

parent 2b82efb8
......@@ -42,10 +42,8 @@ class ArchipelagoBlocker(object):
hashtype = None
def __init__(self, **params):
cfg = {}
bcfg = ConfigParser.ConfigParser()
bcfg.readfp(open(params['archipelago_cfile']))
cfg['blockerb'] = bcfg.getint('mapperd', 'blockerb_port')
cfg = ConfigParser.ConfigParser()
cfg.readfp(open(params['archipelago_cfile']))
blocksize = params['blocksize']
hashtype = params['hashtype']
try:
......@@ -59,7 +57,7 @@ class ArchipelagoBlocker(object):
self.blocksize = blocksize
self.ioctx_pool = glue.WorkerGlue().ioctx_pool
self.dst_port = int(cfg['blockerb'])
self.dst_port = int(cfg.getint('mapperd', 'blockerb_port'))
self.hashtype = hashtype
self.hashlen = len(emptyhash)
self.emptyhash = emptyhash
......
......@@ -46,14 +46,11 @@ class ArchipelagoMapper(object):
def __init__(self, **params):
self.params = params
self.namelen = params['namelen']
cfg = {}
bcfg = ConfigParser.ConfigParser()
bcfg.readfp(open(params['archipelago_cfile']))
cfg['blockerm'] = bcfg.getint('mapperd','blockerm_port')
cfg['mapperd'] = bcfg.getint('vlmcd','mapper_port')
cfg = ConfigParser.ConfigParser()
cfg.readfp(open(params['archipelago_cfile']))
self.ioctx_pool = glue.WorkerGlue().ioctx_pool
self.dst_port = int(cfg['blockerm'])
self.mapperd_port = int(cfg['mapperd'])
self.dst_port = int(cfg.getint('mapperd', 'blockerm_port'))
self.mapperd_port = int(cfg.getint('vlmcd', 'mapper_port'))
def _get_rear_map(self, maphash, create=0):
name = hexlify(maphash)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment