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:
parent
9b4870f458
commit
f39c6282bc
31
gpoa/util/paths.py
Normal file
31
gpoa/util/paths.py
Normal 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user