# Buggy code
def build_option_parser(self, description, version):
    parser = super(OpenIOShell, self).build_option_parser(description, version)

    parser.add_argument(
        "--oio-ns",
        metavar="<namespace>",
        dest="ns",
        default=utils.env("OIO_NS"),
        help="Namespace name (Env: OIO_NS)",
    )
    parser.add_argument(
        "--oio-account",
        metavar="<account>",
        dest="account_name",
        default=utils.env("OIO_ACCOUNT"),
        help="Account name (Env: OIO_ACCOUNT)",
    )
    parser.add_argument(
        "--oio-proxyd-url",
        metavar="<proxyd url>",
        dest="proxyd_url",
        default=utils.env("OIO_PROXYD_URL"),
        help="Proxyd URL (Env: OIO_PROXYD_URL)",
    )
    parser.add_argument(
        "--admin",
        dest="admin_mode",
        action="store_true",
        help="passing commands into admin mode",
    )

    return clientmanager.build_plugin_option_parser(parser)


# 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 build_option_parser(self, description, version):
    parser = super(OpenIOShell, self).build_option_parser(description, version)

    parser.add_argument(
        "--oio-ns",
        metavar="<namespace>",
        dest="ns",
        default=utils.env("OIO_NS"),
        help="Namespace name (Env: OIO_NS)",
    )
    parser.add_argument(
        "--oio-account",
        metavar="<account>",
        dest="account_name",
        default=utils.env("OIO_ACCOUNT"),
        help="Account name (Env: OIO_ACCOUNT)",
    )
    parser.add_argument(
        "--oio-proxyd-url",
        metavar="<proxyd url>",
        dest="proxyd_url",
        default=utils.env("OIO_PROXYD_URL"),
        help="Proxyd URL (Env: OIO_PROXYD_URL)",
    )
    parser.add_argument(
        "--admin",
        dest="admin_mode",
        action="store_true",
        help="Add 'admin mode' flag to all proxy requests",
    )

    return clientmanager.build_plugin_option_parser(parser)