Make unmounting more robust
parent
21e56364f3
commit
ddba8b8a5c
|
@ -169,7 +169,22 @@ class FilesystemLibrary:
|
|||
|
||||
if not mountpoint is None:
|
||||
self.logger.debug(f"Unmounting {mountpoint}")
|
||||
subprocess.run(["/usr/bin/umount", mountpoint], check=True)
|
||||
|
||||
done = False
|
||||
start_time = time.time()
|
||||
timeout = 60
|
||||
|
||||
|
||||
while not done and (time.time() - start_time) < timeout:
|
||||
ret = subprocess.run(["/usr/bin/umount", mountpoint], check=False, capture_output=True, encoding='utf-8')
|
||||
if ret.returncode == 0:
|
||||
done=True
|
||||
else:
|
||||
if "target is busy" in ret.stderr:
|
||||
self.logger.debug("Filesystem busy, waiting. %.1f seconds left", timeout - (time.time() - start_time))
|
||||
time.sleep(0.1)
|
||||
else:
|
||||
raise subprocess.CalledProcessError(ret.returncode, ret.args, output=ret.stdout, stderr=ret.stderr)
|
||||
|
||||
# We've unmounted a new filesystem, update our filesystems list
|
||||
self.update_mounts()
|
||||
|
|
|
@ -302,7 +302,9 @@ class OpengnsysGitLibrary:
|
|||
metadata_file = os.path.join(data["metadata_dir"], "ntfs_secaudit.txt")
|
||||
|
||||
self.logger.debug(f"Unmounting {data['mountpoint']}...")
|
||||
subprocess.run(["/usr/bin/umount", data["mountpoint"]], check = True)
|
||||
self.fs.unmount(mountpoint=data["mountpoint"])
|
||||
#subprocess.run(["/usr/bin/umount", data["mountpoint"]], check = True)
|
||||
|
||||
result = subprocess.run(["/usr/bin/ntfssecaudit", "-b", data["device"]], check=True, capture_output=True)
|
||||
|
||||
self.logger.debug(f"Remounting {data['device']} on {data['mountpoint']}...")
|
||||
|
@ -566,6 +568,7 @@ class OpengnsysGitLibrary:
|
|||
def _getOgRepository(self, name):
|
||||
return f"{self.repo_user}@{self.repo_server}:{self.repo_image_path}/{name}.git"
|
||||
|
||||
|
||||
def _ogGetOsType(self):
|
||||
return "Linux"
|
||||
|
||||
|
|
Loading…
Reference in New Issue