mirror of
https://github.com/altlinux/gpupdate.git
synced 2025-03-21 10:50:35 +03:00
In util/preg.py fixes:
---------------------- - Line: 20 pylint: wrong-import-order / standard import "import logging" should be placed before "from storage import registry_factory" - Line: 21 pylint: wrong-import-order / standard import "import os" should be placed before "from storage import registry_factory" pylint: unused-import / Unused import os - Line: 23 pylint: unused-import / Unused get_dc_hostname imported from samba.gpclass - Line: 24 pylint: unused-import / Unused netcmd_get_domain_infos_via_cldap imported from samba.netcmd.common - Line: 25 pylint: unused-import / Unused import samba.gpo - Line: 27 pylint: wrong-import-order / standard import "from xml.etree import ElementTree" should be placed before "from storage import registry_factory" - Few Lines: expected 2 blank lines
This commit is contained in:
parent
7abe9d6468
commit
12a11ef38d
@ -15,20 +15,16 @@
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
from storage import registry_factory
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
from samba.gpclass import get_dc_hostname
|
||||
from samba.netcmd.common import netcmd_get_domain_infos_via_cldap
|
||||
import samba.gpo
|
||||
|
||||
from xml.etree import ElementTree
|
||||
from storage import registry_factory
|
||||
|
||||
from samba.gp_parse.gp_pol import GPPolParser
|
||||
|
||||
from .logging import slogm
|
||||
|
||||
|
||||
def load_preg(file_path):
|
||||
'''
|
||||
Check if file extension is .xml and load preg object from XML
|
||||
@ -38,6 +34,7 @@ def load_preg(file_path):
|
||||
return load_xml_preg(file_path)
|
||||
return load_pol_preg(file_path)
|
||||
|
||||
|
||||
def load_xml_preg(xml_path):
|
||||
'''
|
||||
Parse XML/PReg file and return its preg object
|
||||
@ -50,6 +47,7 @@ def load_xml_preg(xml_path):
|
||||
|
||||
return gpparser.pol_file
|
||||
|
||||
|
||||
def load_pol_preg(polfile):
|
||||
'''
|
||||
Parse PReg file and return its preg object
|
||||
@ -65,6 +63,7 @@ def load_pol_preg(polfile):
|
||||
#print(gpparser.pol_file.__ndr_print__())
|
||||
return gpparser.pol_file
|
||||
|
||||
|
||||
def preg_keymap(preg):
|
||||
pregfile = load_preg(preg)
|
||||
keymap = dict()
|
||||
@ -75,6 +74,7 @@ def preg_keymap(preg):
|
||||
|
||||
return keymap
|
||||
|
||||
|
||||
def merge_polfile(preg, sid=None):
|
||||
pregfile = load_preg(preg)
|
||||
logging.info(slogm('Loaded PReg {}'.format(preg)))
|
||||
@ -86,6 +86,7 @@ def merge_polfile(preg, sid=None):
|
||||
else:
|
||||
storage.add_hkcu_entry(entry, sid)
|
||||
|
||||
|
||||
class entry:
|
||||
def __init__(self, e_keyname, e_valuename, e_type, e_data):
|
||||
self.keyname = e_keyname
|
||||
@ -93,6 +94,7 @@ class entry:
|
||||
self.type = e_type
|
||||
self.data = e_data
|
||||
|
||||
|
||||
def preg2entries(preg_obj):
|
||||
entries = []
|
||||
for elem in prej_obj.entries:
|
||||
|
Loading…
x
Reference in New Issue
Block a user