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)
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'