summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Prince <dprince@redhat.com>2012-12-06 10:40:36 -0500
committerDan Prince <dprince@redhat.com>2012-12-06 10:41:15 -0500
commit27b2ff42ce6bf13c394cf5516b220e8abc87a968 (patch)
treec81a1a3f89ef66917f1d5c6df9736125f2693d90
parentec7a2ee73ffa86d0a1b9b490798d13dc53d20706 (diff)
downloadoslo-27b2ff42ce6bf13c394cf5516b220e8abc87a968.tar.gz
oslo-27b2ff42ce6bf13c394cf5516b220e8abc87a968.tar.xz
oslo-27b2ff42ce6bf13c394cf5516b220e8abc87a968.zip
Add deprecated --logfile common opt.
This adds a deprecated common options for --logfile which is an alias for --log_file. This resolves some backwards compatability issues with the most recent oslo common code where --logfile was no longer a valid opt. Change-Id: I17b1277da94a2d81ae439d650a6d7321420dfe14
-rw-r--r--openstack/common/cfg.py3
-rw-r--r--tests/unit/test_cfg.py11
2 files changed, 13 insertions, 1 deletions
diff --git a/openstack/common/cfg.py b/openstack/common/cfg.py
index acef6fb..f5b3a84 100644
--- a/openstack/common/cfg.py
+++ b/openstack/common/cfg.py
@@ -1756,11 +1756,12 @@ class CommonConfigOpts(ConfigOpts):
'Default: %(default)s'),
StrOpt('log-file',
metavar='PATH',
+ deprecated_name='logfile',
help='(Optional) Name of log file to output to. '
'If not set, logging will go to stdout.'),
StrOpt('log-dir',
help='(Optional) The directory to keep log files in '
- '(will be prepended to --logfile)'),
+ '(will be prepended to --log-file)'),
BoolOpt('use-syslog',
default=False,
help='Use syslog for logging.'),
diff --git a/tests/unit/test_cfg.py b/tests/unit/test_cfg.py
index e7d58ec..0279c6a 100644
--- a/tests/unit/test_cfg.py
+++ b/tests/unit/test_cfg.py
@@ -1608,6 +1608,17 @@ class CommonOptsTestCase(BaseTestCase):
self.assertEquals(self.conf.use_syslog, False)
+ def test_log_file(self):
+ log_file = '/some/path/foo-bar.log'
+ self.conf(['--log-file', log_file])
+ self.assertEquals(self.conf.log_file, log_file)
+
+ def test_logfile(self):
+ logfile = '/some/other/path/foo-bar.log'
+ #NOTE(dprince): this is now a deprecated option for --log-file
+ self.conf(['--logfile', logfile])
+ self.assertEquals(self.conf.log_file, logfile)
+
class ConfigParserTestCase(unittest.TestCase):
def test_no_section(self):