Prevent redundant commenting by drive-audit
The drive-audit detects error log about a device and comments out it in /etc/fstab. When the error log is generated several times, it comments out the line for each time. This patch makes drive-audit to check if the device is already commented out, and prevents redundant commenting out. Change-Id: Ia542d35b58552dde0f324bb9c42531f98c9058fa
This commit is contained in:
1 changed files with 3 additions and 1 deletions
@@ -126,7 +126,9 @@ def comment_fstab(mount_point):
with open('/etc/fstab.new', 'w') as new_fstab:
for line in fstab:
parts = line.split()
if len(parts) > 2 and line.split()[1] == mount_point:
if len(parts) > 2 \
and parts[1] == mount_point \
and not line.startswith('#'):
new_fstab.write('#' + line)
else:
new_fstab.write(line)
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.