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

util.paths module added

This module is intended to return pathlib objects to common paths in
order to avoid multiple redefinitions in various objects
This commit is contained in:
Игорь Чудов 2020-01-15 15:21:47 +04:00
parent 9b4870f458
commit f39c6282bc
Signed by untrusted user: nir
GPG Key ID: 0F3883600CAE7AAC

31
gpoa/util/paths.py Normal file
View File

@ -0,0 +1,31 @@
import pathlib
def default_policy_path():
'''
Returns path pointing to Default Policy directory.
'''
return pathlib.Path('/usr/share/local-policy/default')
def cache_dir():
'''
Returns path pointing to gpupdate's cache directory
'''
cachedir = pathlib.Path('/var/cache/gpupdate')
if not cachedir.exists():
cachedir.mkdir(parents=True, exist_ok=True)
return cachedir
def local_policy_cache():
'''
Returns path to directory where lies local policy settings cache
transformed into GPT.
'''
lpcache = pathlib.Path.joinpath(cache_dir(), 'local-policy')
if not lpcache.exists():
lpcache.mkdir(parents=True, exist_ok=True)
return lpcache