summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/Bcfg2/Options/Parser.py2
-rw-r--r--testsuite/Testsrc/Testlib/TestOptions/TestConfigFiles.py8
2 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/Bcfg2/Options/Parser.py b/src/lib/Bcfg2/Options/Parser.py
index af1af976b..ced61c591 100644
--- a/src/lib/Bcfg2/Options/Parser.py
+++ b/src/lib/Bcfg2/Options/Parser.py
@@ -302,7 +302,7 @@ class Parser(argparse.ArgumentParser):
# check whether the specified bcfg2.conf exists
if not self.unit_test and not os.path.exists(bootstrap.config):
- self.error("Could not read %s" % bootstrap.config)
+ sys.stderr.write("Could not read %s\n" % bootstrap.config)
self.add_config_file(self.configfile.dest, bootstrap.config,
reparse=False)
diff --git a/testsuite/Testsrc/Testlib/TestOptions/TestConfigFiles.py b/testsuite/Testsrc/Testlib/TestOptions/TestConfigFiles.py
index 78acadf1f..4277c8efe 100644
--- a/testsuite/Testsrc/Testlib/TestOptions/TestConfigFiles.py
+++ b/testsuite/Testsrc/Testlib/TestOptions/TestConfigFiles.py
@@ -45,6 +45,10 @@ class TestConfigFiles(OptionTestCase):
inner1()
@mock.patch("os.path.exists", mock.Mock(return_value=False))
- def test_no_config_file(self):
+ @make_config()
+ def test_no_config_file(self, config):
"""fail to read config file."""
- self.assertRaises(SystemExit, self.parser.parse, [])
+ try:
+ self.parser.parse(['-C', config])
+ except SystemExit:
+ self.fail('Missing config file should not raise SystemExit')