Merge "Log warning when --boolean-key and --key are used"
This commit is contained in:
commit
752646a4ba
@ -339,6 +339,10 @@ def main(argv=sys.argv):
|
||||
OS_CONFIG_FILES_PATH_OLD)
|
||||
opts.metadata = load_list_from_json(OS_CONFIG_FILES_PATH_OLD)
|
||||
|
||||
if opts.key and opts.boolean_key:
|
||||
logger.warning('--key is not compatible with --boolean-key.'
|
||||
' --boolean-key ignored.')
|
||||
|
||||
try:
|
||||
if opts.templates is None:
|
||||
raise exc.ConfigException('missing option --templates')
|
||||
|
@ -210,6 +210,15 @@ class TestRunOSConfigApplier(testtools.TestCase):
|
||||
self.path, '--boolean-key', 'x'])
|
||||
self.assertEqual(-1, rcode)
|
||||
|
||||
def test_boolean_key_and_key(self):
|
||||
rcode = apply_config.main(['os-apply-config', '--metadata',
|
||||
self.path, '--boolean-key', 'btrue',
|
||||
'--key', 'x'])
|
||||
self.assertEqual(0, rcode)
|
||||
self.stdout.seek(0)
|
||||
self.assertEqual(self.stdout.read().strip(), 'foo')
|
||||
self.assertIn('--boolean-key ignored', self.logger.output)
|
||||
|
||||
def test_os_config_files(self):
|
||||
with tempfile.NamedTemporaryFile() as fake_os_config_files:
|
||||
with tempfile.NamedTemporaryFile() as fake_config:
|
||||
|
Loading…
Reference in New Issue
Block a user