Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: report: Check if mounted.ocfs2 command exists before using it (bsc#1236220) #1669

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion crmsh/report/collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ def collect_info(cmd: str, fs_type: str, output_file: str) -> None:
crmutils.str2file(out_string, target_f)

# Collect OCFS2 information
collect_info("mounted.ocfs2 -d", "OCFS2", constants.OCFS2_F)
if shutil.which("mounted.ocfs2"):
collect_info("mounted.ocfs2 -d", "OCFS2", constants.OCFS2_F)

# Collect GFS2 information
collect_info('mount|grep "type gfs2"', "GFS2", constants.GFS2_F)
Expand Down
4 changes: 3 additions & 1 deletion test/unittests/test_report_collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,9 @@ def test_collect_qdevice_info(self, mock_service, mock_quorum, mock_qdevice, moc
@mock.patch("crmsh.report.collect.lsof_cluster_fs_device")
@mock.patch("crmsh.report.collect.dump_D_process")
@mock.patch("crmsh.report.collect.ShellUtils")
def test_collect_cluster_fs_info(self, mock_run, mock_dump, mock_lsof, mock_cluster, mock_debug, mock_real_path, mock_str2file, mock_error):
@mock.patch("shutil.which")
def test_collect_cluster_fs_info(self, mock_which, mock_run, mock_dump, mock_lsof, mock_cluster, mock_debug, mock_real_path, mock_str2file, mock_error):
mock_which.return_value = True
mock_run_inst = mock.Mock()
mock_run.return_value = mock_run_inst
mock_run_inst.get_stdout_stderr.side_effect = [
Expand Down