This is an automated email from the ASF dual-hosted git repository. oleewere pushed a commit to branch branch-2.7 in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/branch-2.7 by this push: new f15d4b9 AMBARI-24763. Infra Solr upgrade (2.7.x): ValueError: invalid literal for float() (#2443) f15d4b9 is described below commit f15d4b9053e92656af4bcdb10ce3f16dcd5083ad Author: Olivér Szabó <oleew...@gmail.com> AuthorDate: Fri Oct 12 13:31:25 2018 +0200 AMBARI-24763. Infra Solr upgrade (2.7.x): ValueError: invalid literal for float() (#2443) * AMBARI-24763. Infra Solr upgrade (2.7.x): ValueError: invalid literal for float() * AMBARI-24763. Use setlocale --- .../ambari-infra-solr-client/src/main/python/migrationHelper.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ambari-infra/ambari-infra-solr-client/src/main/python/migrationHelper.py b/ambari-infra/ambari-infra-solr-client/src/main/python/migrationHelper.py index b2e835b..498c61b 100755 --- a/ambari-infra/ambari-infra-solr-client/src/main/python/migrationHelper.py +++ b/ambari-infra/ambari-infra-solr-client/src/main/python/migrationHelper.py @@ -946,9 +946,11 @@ 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]) + locale.setlocale(locale.LC_ALL,'') + return int(locale.atof(number)*units[unit]) def get_replica_index_size(config, core_url, replica): request = CORE_DETAILS_URL.format(core_url) @@ -2076,4 +2078,4 @@ if __name__=="__main__": print 30 * "-" print "Command elapsed time: {0}".format(time_to_print) print 30 * "-" - print "Migration helper command {0}FINISHED{1}".format(colors.OKGREEN, colors.ENDC) \ No newline at end of file + print "Migration helper command {0}FINISHED{1}".format(colors.OKGREEN, colors.ENDC)