mirror of
https://github.com/ceph/ceph
synced 2025-01-19 09:32:00 +00:00
Merge pull request #20594 from ceph/wip-rm23004
ceph-volume: log the current running command for easier debugging Reviewed-by: Alfredo Deza <adeza@redhat.com>
This commit is contained in:
commit
9c8afc2365
@ -137,6 +137,7 @@ Ceph Conf: {ceph_path}
|
|||||||
conf.log_path = os.path.join(args.log_path, 'ceph-volume.log')
|
conf.log_path = os.path.join(args.log_path, 'ceph-volume.log')
|
||||||
log.setup()
|
log.setup()
|
||||||
logger = logging.getLogger(__name__)
|
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
|
# set all variables from args and load everything needed according to
|
||||||
# them
|
# them
|
||||||
self.load_ceph_conf_path(cluster_name=args.cluster)
|
self.load_ceph_conf_path(cluster_name=args.cluster)
|
||||||
|
@ -34,6 +34,15 @@ class TestVolume(object):
|
|||||||
main.Volume(argv=['ceph-volume', '--cluster', 'barnacle', 'lvm', '--help'])
|
main.Volume(argv=['ceph-volume', '--cluster', 'barnacle', 'lvm', '--help'])
|
||||||
# make sure we aren't causing an actual error
|
# make sure we aren't causing an actual error
|
||||||
assert error.value.code == 0
|
assert error.value.code == 0
|
||||||
log = caplog.records[0]
|
log = caplog.records[1]
|
||||||
assert log.message == 'ignoring inability to load ceph.conf'
|
assert log.message == 'ignoring inability to load ceph.conf'
|
||||||
assert log.levelname == 'ERROR'
|
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'
|
||||||
|
Loading…
Reference in New Issue
Block a user