]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: only warn when config file isn't found 46053/head
authorGuillaume Abrioux <gabrioux@redhat.com>
Wed, 27 Apr 2022 12:12:23 +0000 (14:12 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Wed, 27 Apr 2022 12:58:23 +0000 (14:58 +0200)
According to [1], this should only be a warning.

[1] https://github.com/ceph/ceph/commit/0487a9ac60c5ba289b7dd7c730b014a298c5998f

Fixes: https://tracker.ceph.com/issues/47633
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
src/ceph-volume/ceph_volume/main.py
src/ceph-volume/ceph_volume/tests/test_main.py

index 652b0f9c87d13ed5a13506214c370609993303f9..7868665cecbf59e32856be3f38462615947f36d1 100644 (file)
@@ -147,8 +147,8 @@ Ceph Conf: {ceph_path}
             # we warn only here, because it is possible that the configuration
             # file is not needed, or that it will be loaded by some other means
             # (like reading from lvm tags)
-            logger.exception('ignoring inability to load ceph.conf')
-            terminal.red(error)
+            logger.warning('ignoring inability to load ceph.conf', exc_info=1)
+            terminal.yellow(error)
         # dispatch to sub-commands
         terminal.dispatch(self.mapper, subcommand_args)
 
index afe9a23446d94507a31fcf151cafcedbd320d35e..d03d405d5538d099627a0a1bf558d7f636d92571 100644 (file)
@@ -39,7 +39,7 @@ class TestVolume(object):
         assert error.value.code == 0
         log = caplog.records[-1]
         assert log.message == 'ignoring inability to load ceph.conf'
-        assert log.levelname == 'ERROR'
+        assert log.levelname == 'WARNING'
 
     def test_logs_current_command(self, caplog):
         with pytest.raises(SystemExit) as error:
@@ -50,15 +50,15 @@ class TestVolume(object):
         assert log.message == 'Running command: ceph-volume --cluster barnacle lvm --help'
         assert log.levelname == 'INFO'
 
-    def test_logs_set_level_error(self, caplog):
+    def test_logs_set_level_warning(self, caplog):
         with pytest.raises(SystemExit) as error:
-            main.Volume(argv=['ceph-volume', '--log-level', 'error', '--cluster', 'barnacle', 'lvm', '--help'])
+            main.Volume(argv=['ceph-volume', '--log-level', 'warning', '--cluster', 'barnacle', 'lvm', '--help'])
         # make sure we aren't causing an actual error
         assert error.value.code == 0
         assert caplog.records
-        # only log levels of 'ERROR' or above should be captured
+        # only log levels of 'WARNING'
         for log in caplog.records:
-            assert log.levelname in ['ERROR', 'CRITICAL']
+            assert log.levelname == 'WARNING'
 
     def test_logs_incorrect_log_level(self, capsys):
         with pytest.raises(SystemExit) as error: