Skip to content

Commit

Permalink
Closes-Bug: #1605381 - SM-Lite fails due to wrong boolean translation
Browse files Browse the repository at this point in the history
SM Lite Testbed parser wrongly parses boolean as string for new params

Patch 2:
Changed if condition

Change-Id: I30c7ecc3bb6c021271c857aa0b5eff3009b2fb91
  • Loading branch information
nitishkrishna committed Jul 25, 2016
1 parent c4e3a29 commit 4229f36
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/client/testbed_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ def set_if_defined(self, source_variable_name,
function = kwargs.get('function', getattr)
to_string = kwargs.get('to_string', True)
to_lower = kwargs.get('to_lower', False)
is_boolean = kwargs.get('is_boolean', False)
log.debug('Adding Variable (%s)' % destination_variable_name)
log.debug('Source Variable: (%s) Destination Variable: (%s) ' \
'Source Variable Name (%s) Destination Variable Name (%s) ' \
Expand All @@ -633,6 +634,8 @@ def set_if_defined(self, source_variable_name,
if to_string:
if to_lower:
value = str(value).lower()
elif is_boolean:
value = (str(value).lower() == "true")
else:
value = str(value)

Expand Down Expand Up @@ -847,10 +850,12 @@ def _initialize(self):
function_to_use=getattr
source_variable_name = allowed_key
if data_format == "boolean":
to_lower = True
is_boolean = True
else:
is_boolean = False
self.set_if_defined(source_variable_name, dest_var, source_variable=source_variable,
destination_variable_name=str(dest_var_name), to_lower=to_lower,
function=function_to_use)
is_boolean=is_boolean, function=function_to_use)
return cluster_dict

def generate_json_file(self):
Expand Down

0 comments on commit 4229f36

Please sign in to comment.