Add add_boolean_argument method if missing
This method is persent in python-neutronclient version 2.3.12 but not in 2.3.9. So if the later version is present in a deployment, we add this method via this patch. Change-Id: I3c3cb398b7fb5eaf39504412567d78c4fcf365c3 Closes-bug: 1518671
This commit is contained in:
@@ -11,10 +11,22 @@
|
||||
# under the License.
|
||||
#
|
||||
|
||||
|
||||
import argparse
|
||||
from neutronclient.common import utils as n_utils
|
||||
import re
|
||||
|
||||
|
||||
if not hasattr(n_utils, 'add_boolean_argument'):
|
||||
def add_boolean_argument(parser, name, **kwargs):
|
||||
for keyword in ('metavar', 'choices'):
|
||||
kwargs.pop(keyword, None)
|
||||
default = kwargs.pop('default', argparse.SUPPRESS)
|
||||
parser.add_argument(name, metavar='{True,False}',
|
||||
choices=['True', 'true', 'False', 'false'],
|
||||
default=default, **kwargs)
|
||||
n_utils.add_boolean_argument = add_boolean_argument
|
||||
|
||||
|
||||
def str2dict(strdict):
|
||||
"""Convert key1=value1,key2=value2,... string into dictionary.
|
||||
|
||||
|
Reference in New Issue
Block a user