summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhuang.xiangdong <huang.xiangdong@99cloud.net>2019-11-01 11:18:21 +0800
committerhuang.xiangdong <huang.xiangdong@99cloud.net>2019-11-04 09:50:42 +0800
commit561db7ac328417cb9091a21798b8b9e9def35e6a (patch)
tree227f14f17a49fd2fd6a9c1bed98c40682ed08f08
parent0f7244f9dc4403109721d55c2be385d50f9ec9c0 (diff)
downloadoslo-config-561db7ac328417cb9091a21798b8b9e9def35e6a.tar.gz
fix: fix float opt min and max value format errror
"%d" will truncate float and generates wrong format message, use "format" to handle floats correctly. Closes-Bug: 1850879 Change-Id: If0dd3933695ac84f0e9cacefd28a9d7a60dd88d7
-rw-r--r--oslo_config/generator.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/oslo_config/generator.py b/oslo_config/generator.py
index 475b244..ba75c4c 100644
--- a/oslo_config/generator.py
+++ b/oslo_config/generator.py
@@ -255,10 +255,10 @@ class _OptFormatter(object):
lines = self._format_help(help_text)
if getattr(opt.type, 'min', None) is not None:
- lines.append('# Minimum value: %d\n' % opt.type.min)
+ lines.append('# Minimum value: {}\n'.format(opt.type.min))
if getattr(opt.type, 'max', None) is not None:
- lines.append('# Maximum value: %d\n' % opt.type.max)
+ lines.append('# Maximum value: {}\n'.format(opt.type.max))
if getattr(opt.type, 'choices', None):
lines.append('# Possible values:\n')