Commit ff1fe0fc authored by William Grzybowski's avatar William Grzybowski
Browse files

Remove core files after setting up system dataset

Ticket:	NAS-109454
(cherry picked from commit 325ecdb7)
No related merge requests found
Showing with 9 additions and 8 deletions
+9 -8
......@@ -8,6 +8,7 @@ import errno
import os
import shutil
import uuid
from pathlib import Path
SYSDATASET_PATH = '/var/db/system'
......@@ -289,6 +290,14 @@ class SystemDatasetService(ConfigService):
await run('sysctl', f"kern.corefile='{corepath}/%N.core'")
os.chmod(corepath, 0o775)
if await self.middleware.call('keyvalue.get', 'run_migration', False):
try:
cores = Path(corepath)
for corefile in cores.iterdir():
corefile.unlink()
except Exception:
self.logger.warning("Failed to clear old core files.", exc_info=True)
await self.__nfsv4link(config)
await self.middleware.call('smb.setup_directories')
# The following should be backgrounded since they may be quite
......
import asyncio
from datetime import datetime, date, timezone
from pathlib import Path
from middlewared.event import EventSource
from middlewared.i18n import set_language
from middlewared.logger import CrashReporting
......@@ -1681,12 +1680,5 @@ async def setup(middleware):
CRASH_DIR = '/data/crash'
os.makedirs(CRASH_DIR, exist_ok=True)
os.chmod(CRASH_DIR, 0o775)
if await middleware.call('keyvalue.get', 'run_migration', False):
try:
cores = Path("/var/db/system/cores")
for corefile in cores.iterdir():
corefile.unlink()
except Exception:
self.logger.warning("Failed to clear old core files.", exc_info=True)
middleware.register_hook('system.post_license_update', hook_license_update, sync=False)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment