make 0 be avaiable value of options
value 0 is regard as not available by swift-ring-builder $ swift-ring-builder testring add --region 0 --zone 1 --ip 127.0.0.2 --port 6000 --device sdb --weight 100 Required argument -r/--region not specified. The on-disk ring builder is unchanged. this patch is to make value 0 available. Change-Id: Id941d44d8dbfe438bf921ed905908b838c88a644 Closes-bug: #1547137
This commit is contained in:
parent
1ac9ceb548
commit
5817f00005
|
@ -616,7 +616,7 @@ def build_dev_from_opts(opts):
|
|||
['port', '-p', '--port'],
|
||||
['device', '-d', '--device'],
|
||||
['weight', '-w', '--weight']):
|
||||
if not getattr(opts, attribute, None):
|
||||
if getattr(opts, attribute, None) is None:
|
||||
raise ValueError('Required argument %s/%s not specified.' %
|
||||
(shortopt, longopt))
|
||||
|
||||
|
|
|
@ -579,7 +579,7 @@ class TestUtils(unittest.TestCase):
|
|||
|
||||
def test_build_dev_from_opts(self):
|
||||
argv = \
|
||||
["--region", "2", "--zone", "3",
|
||||
["--region", "0", "--zone", "3",
|
||||
"--ip", "test.test.com",
|
||||
"--port", "6200",
|
||||
"--replication-ip", "r.test.com",
|
||||
|
@ -588,7 +588,7 @@ class TestUtils(unittest.TestCase):
|
|||
"--meta", "some meta data",
|
||||
"--weight", "3.14159265359"]
|
||||
expected = {
|
||||
'region': 2,
|
||||
'region': 0,
|
||||
'zone': 3,
|
||||
'ip': "test.test.com",
|
||||
'port': 6200,
|
||||
|
|
Loading…
Reference in New Issue