opencas-test-framework/test_tools/fstab.py
Katarzyna Treder ae9b036b47 Rename systemd to systemctl and move it to tools
Signed-off-by: Katarzyna Treder <katarzyna.treder@h-partners.com>
2024-12-10 14:46:04 +01:00

21 lines
590 B
Python

#
# Copyright(c) 2019-2021 Intel Corporation
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
# SPDX-License-Identifier: BSD-3-Clause
#
from test_tools import fs_utils, systemctl
def add_mountpoint(device, mount_point, fs_type, mount_now=True):
fs_utils.append_line("/etc/fstab",
f"{device.path} {mount_point} {fs_type.name} defaults 0 0")
systemctl.reload_daemon()
if mount_now:
systemctl.restart_service("local-fs.target")
def remove_mountpoint(device):
fs_utils.remove_lines("/etc/fstab", device.path)
systemctl.reload_daemon()