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

Don't generate autofs configuration if no drive mappings present

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

View File

@ -114,24 +114,25 @@ class cifs_applier_user(applier_frontend):
drive_list.append(drive_settings)
mount_settings = dict()
mount_settings['drives'] = drive_list
mount_text = self.template_mountpoints.render(**mount_settings)
if len(drive_list) > 0:
mount_settings = dict()
mount_settings['drives'] = drive_list
mount_text = self.template_mountpoints.render(**mount_settings)
with open(self.user_config.resolve(), 'w') as f:
f.truncate()
f.write(mount_text)
f.flush()
with open(self.user_config.resolve(), 'w') as f:
f.truncate()
f.write(mount_text)
f.flush()
autofs_settings = dict()
autofs_settings['home_dir'] = self.home
autofs_settings['mount_file'] = self.user_config.resolve()
autofs_text = self.template_auto.render(**autofs_settings)
autofs_settings = dict()
autofs_settings['home_dir'] = self.home
autofs_settings['mount_file'] = self.user_config.resolve()
autofs_text = self.template_auto.render(**autofs_settings)
with open(self.user_autofs.resolve(), 'w') as f:
f.truncate()
f.write(autofs_text)
f.flush()
with open(self.user_autofs.resolve(), 'w') as f:
f.truncate()
f.write(autofs_text)
f.flush()
subprocess.check_call(['/bin/systemctl', 'restart', 'autofs'])
subprocess.check_call(['/bin/systemctl', 'restart', 'autofs'])