1
0
mirror of https://github.com/altlinux/gpupdate.git synced 2025-03-21 10:50:35 +03:00

CIFS applier file cleanup

This commit is contained in:
Игорь Чудов 2020-05-14 23:20:12 +04:00
parent 338cc5d80f
commit 8b322748a7
Signed by untrusted user: nir
GPG Key ID: 0F3883600CAE7AAC

View File

@ -39,7 +39,7 @@ def storage_get_drives(storage, sid):
def add_line_if_missing(filename, ins_line):
with open(filename, 'r+') as f:
for line in f:
if ins_line in line.strip():
if ins_line == line.strip():
break
else:
f.write(ins_line + '\n')
@ -73,7 +73,11 @@ class cifs_applier_user(applier_frontend):
self.auto_master_d = Path(self.__auto_dir)
self.user_config = self.auto_master_d / conf_file
if os.path.exists(self.user_config.resolve()):
self.user_config.unlink()
self.user_autofs = self.auto_master_d / autofs_file
if os.path.exists(self.user_autofs.resolve()):
self.user_autofs.unlink()
self.user_creds = self.auto_master_d / cred_file
self.mount_dir = Path(os.path.join(self.home, 'net'))