oleewere commented on a change in pull request #5: AMBARI-24763. Infra Solr
upgrade (2.7.x): ValueError: invalid literal for float():
URL: https://github.com/apache/ambari-infra/pull/5#discussion_r224647332
##########
File path: ambari-infra-solr-client/src/main/python/migrationHelper.py
##########
@@ -946,9 +946,10 @@ def human_size(size_bytes):
return "%s %s" % (formatted_size, suffix)
def parse_size(human_size):
+ import locale
units = {"bytes": 1, "KB": 1024, "MB": 1024**2, "GB": 1024**3, "TB": 1024**4
}
number, unit = [string.strip() for string in human_size.split()]
- return int(float(number)*units[unit])
+ return int(locale.atof(number)*units[unit])
Review comment:
@adoroszlai right, locale.setlocale( locale.LC_ALL, '' ) is missing before
atof
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services