# Buggy code
def setup(self):
    if not self.setup_done:
        if not self._options.get("namespace", None):
            msg = "Set a namespace with --oio-ns, OIO_NS\n"
            raise exceptions.CommandError("Missing parameter: \n%s" % msg)
        self.namespace = self._options["namespace"]
        sds_conf = load_namespace_conf(self.namespace) or {}
        if not self._options.get("proxyd_url") and "proxy" in sds_conf:
            proxyd_url = "http://%s" % sds_conf.get("proxy")
            self._options["proxyd_url"] = proxyd_url
        validate_options(self._options)
        LOG.debug("Using parameters %s" % self._options)
        self.setup_done = True
        self._admin_mode = self._options.get("admin_mode")
        if "meta1_digits" in sds_conf:
            self._meta1_digits = int(sds_conf["meta1_digits"])


# Traceback (ConnectionError)
# openio --oio-ns=VCFR1 directory bootstrap --replicas 3 -v --debug
Starting new HTTP connection (1): 172.17.25.5
"GET /v3.0/VCFR1/conscience/list?type=meta1 HTTP/1.1" 200 376
Computing meta1 prefix mapping...
0%
10%
20%
30%
40%
50%
60%
70%
80%
90%
100%
Equilibrating...
META1 Digits = 4
Replicas = 3
Scored positively = 3
Ideal number of prefixes per meta1: 65536
Rebalance moved 0 prefixes
Saving...
Starting new HTTP connection (1): 172.17.25.5
"POST /v3.0/VCFR1/admin/meta0_force HTTP/1.1" 204 0
Assigning rdir services to rawx services...
Starting new HTTP connection (1): 172.17.25.5
"GET /v3.0/VCFR1/conscience/list?type=rawx HTTP/1.1" 200 256
"GET /v3.0/VCFR1/conscience/list?full=1&amp;type=rdir HTTP/1.1" 200 642
Starting new HTTP connection (1): 172.17.25.5
"GET /v3.0/VCFR1/reference/show?acct=_RDIR&amp;ref=172.17.25.7%3A6004&amp;type=rdir HTTP/1.1" 404 59
('Connection aborted.', BadStatusLine("''",))
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/cliff/app.py", line 374, in run_subcommand
result = cmd.run(parsed_args)
File "/usr/lib/python2.7/dist-packages/cliff/command.py", line 54, in run
self.take_action(parsed_args)
File "/usr/lib/python2.7/dist-packages/oio/cli/admin/directory.py", line 60, in take_action
self.app.client_manager.admin.volume.assign_all_rawx()
File "/usr/lib/python2.7/dist-packages/oio/rdir/client.py", line 38, in assign_all_rawx
rdir = self._smart_link_rdir(rawx['addr'], cs, all_rdir)
File "/usr/lib/python2.7/dist-packages/oio/rdir/client.py", line 68, in _smart_link_rdir
polled = cs.poll('rdir', avoid=avoids, known=known)[0]
File "/usr/lib/python2.7/dist-packages/oio/conscience/client.py", line 47, in poll
data=json.dumps(ibody))
File "/usr/lib/python2.7/dist-packages/oio/common/client.py", line 51, in _request
return self._direct_request(method, url, **kwargs)
File "/usr/lib/python2.7/dist-packages/oio/common/client.py", line 37, in _direct_request
**kwargs)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 468, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 426, in send
raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', BadStatusLine("''",))
Exception raised: ('Connection aborted.', BadStatusLine("''",))

# Fixed code
def setup(self):
    if not self.setup_done:
        if not self._options.get("namespace", None):
            msg = "Set a namespace with --oio-ns, OIO_NS\n"
            raise exceptions.CommandError("Missing parameter: \n%s" % msg)
        self.namespace = self._options["namespace"]
        sds_conf = load_namespace_conf(self.namespace) or {}
        if not self._options.get("proxyd_url") and "proxy" in sds_conf:
            proxyd_url = "http://%s" % sds_conf.get("proxy")
            self._options["proxyd_url"] = proxyd_url
        validate_options(self._options)
        LOG.debug("Using parameters %s" % self._options)
        self.setup_done = True
        self._admin_mode = self._options.get("admin_mode")
        if "meta1_digits" in sds_conf:
            self._meta1_digits = int(sds_conf["meta1_digits"])
        self._options["log_level"] = logging.getLevelName(LOG.getEffectiveLevel())