]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: log the current running command for easier debugging 20594/head
authorAndrew Schoen <aschoen@redhat.com>
Mon, 26 Feb 2018 16:04:07 +0000 (10:04 -0600)
committerAndrew Schoen <aschoen@redhat.com>
Mon, 26 Feb 2018 16:13:59 +0000 (10:13 -0600)
Fixes: http://tracker.ceph.com/issues/23004
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
src/ceph-volume/ceph_volume/main.py
src/ceph-volume/ceph_volume/tests/test_main.py

index 70cb6be87df04d5d8305efa31f9be00f9f1ba870..b3543b1a21d63e86b4daf40d3a689febf118bb97 100644 (file)
@@ -137,6 +137,7 @@ Ceph Conf: {ceph_path}
             conf.log_path = os.path.join(args.log_path, 'ceph-volume.log')
         log.setup()
         logger = logging.getLogger(__name__)
+        logger.info("Running command: ceph-volume %s %s", " ".join(main_args), " ".join(subcommand_args))
         # set all variables from args and load everything needed according to
         # them
         self.load_ceph_conf_path(cluster_name=args.cluster)
index db1a49909326a06d191fa2e11ada6e39b1f37526..42fbec155865fe928c79c16db33530f7c7c2a74d 100644 (file)
@@ -34,6 +34,15 @@ class TestVolume(object):
             main.Volume(argv=['ceph-volume', '--cluster', 'barnacle', 'lvm', '--help'])
         # make sure we aren't causing an actual error
         assert error.value.code == 0
-        log = caplog.records[0]
+        log = caplog.records[1]
         assert log.message == 'ignoring inability to load ceph.conf'
         assert log.levelname == 'ERROR'
+
+    def test_logs_current_command(self, caplog):
+        with pytest.raises(SystemExit) as error:
+            main.Volume(argv=['ceph-volume', '--cluster', 'barnacle', 'lvm', '--help'])
+        # make sure we aren't causing an actual error
+        assert error.value.code == 0
+        log = caplog.records[0]
+        assert log.message == 'Running command: ceph-volume --cluster barnacle lvm --help'
+        assert log.levelname == 'INFO'