summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-11-29 14:48:55 +0000
committerGerrit Code Review <review@openstack.org>2012-11-29 14:48:55 +0000
commit2c705107f69fa9e3e845ab9f9910a78c8bb77821 (patch)
tree76dcd3161698dd9edb2523182879b7b5c0acd543
parentcf705c59615fb68cdbfe664e7827e4a275a4a282 (diff)
parentceb4aa7fe9e05b762f451045c1b92a3d7b696eac (diff)
downloadoslo-2c705107f69fa9e3e845ab9f9910a78c8bb77821.tar.gz
oslo-2c705107f69fa9e3e845ab9f9910a78c8bb77821.tar.xz
oslo-2c705107f69fa9e3e845ab9f9910a78c8bb77821.zip
Merge "Fix broken --help with CommonConfigOpts"
-rw-r--r--openstack/common/cfg.py6
-rw-r--r--tests/unit/test_cfg.py9
2 files changed, 12 insertions, 3 deletions
diff --git a/openstack/common/cfg.py b/openstack/common/cfg.py
index c8a15d7..6206a5a 100644
--- a/openstack/common/cfg.py
+++ b/openstack/common/cfg.py
@@ -1652,12 +1652,12 @@ class CommonConfigOpts(ConfigOpts):
metavar='FORMAT',
help='A logging.Formatter log message format string which may '
'use any of the available logging.LogRecord attributes. '
- 'Default: %default'),
+ 'Default: %(default)s'),
StrOpt('log-date-format',
default=DEFAULT_LOG_DATE_FORMAT,
metavar='DATE_FORMAT',
- help='Format string for %(asctime)s in log records. '
- 'Default: %default'),
+ help='Format string for %%(asctime)s in log records. '
+ 'Default: %(default)s'),
StrOpt('log-file',
metavar='PATH',
help='(Optional) Name of log file to output to. '
diff --git a/tests/unit/test_cfg.py b/tests/unit/test_cfg.py
index bd9e914..a9fdc13 100644
--- a/tests/unit/test_cfg.py
+++ b/tests/unit/test_cfg.py
@@ -1532,6 +1532,15 @@ class CommonOptsTestCase(BaseTestCase):
super(CommonOptsTestCase, self).setUp()
self.conf = CommonConfigOpts()
+ def test_print_help(self):
+ f = StringIO.StringIO()
+ self.conf([])
+ self.conf.print_help(file=f)
+ self.assertTrue('debug' in f.getvalue())
+ self.assertTrue('verbose' in f.getvalue())
+ self.assertTrue('log-config' in f.getvalue())
+ self.assertTrue('log-format' in f.getvalue())
+
def test_debug_verbose(self):
self.conf(['--debug', '--verbose'])