[PATCH 13/26] gpo: fix up some formatting in samba_gpoupdate

abartlet at samba.org abartlet at samba.org
Thu Jun 5 04:07:18 MDT 2014


From: Garming Sam <garming at catalyst.net.nz>

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
---
 source4/scripting/bin/samba_gpoupdate | 54 ++++++++++++++++++-----------------
 1 file changed, 28 insertions(+), 26 deletions(-)

diff --git a/source4/scripting/bin/samba_gpoupdate b/source4/scripting/bin/samba_gpoupdate
index e30389e..98b8824 100755
--- a/source4/scripting/bin/samba_gpoupdate
+++ b/source4/scripting/bin/samba_gpoupdate
@@ -14,20 +14,20 @@ import optparse
 from samba import getopt as options
 from samba.gpclass import *
 
-#Finds all GPO Files ending in inf
+# Finds all GPO Files ending in inf
 def gp_path_list(path):
 
-	GPO_LIST = []
-	for ext in gp_extensions:
-		GPO_LIST.append((ext, ext.list(path)))
+    GPO_LIST = []
+    for ext in gp_extensions:
+        GPO_LIST.append((ext, ext.list(path)))
 
-	return GPO_LIST
+    return GPO_LIST
 
-#Reads the GPOs and sends them to their proper handlers
+# Reads the GPOs and sends them to their proper handlers
 def gpo_parser(GPO_LIST, ldb):
-	for entry in GPO_LIST:
-		(ext, thefile) = entry
-		ext.parse(thefile, ldb)
+    for entry in GPO_LIST:
+        (ext, thefile) = entry
+        ext.parse(thefile, ldb)
 
 
 parser = optparse.OptionParser("testsearchdn [options]")
@@ -59,8 +59,9 @@ else:
 #########################
 #Inialize Samba Database#
 #########################
+
 test_ldb = SamDB(url, session_info=session,
- credentials=creds,lp=lp)
+                 credentials=creds,lp=lp)
 
 schemadn = test_ldb.get_schema_basedn()
 
@@ -73,7 +74,7 @@ sys_log = '%s/%s' % (lp.get("path", "sysvol"), 'syslog.txt')
 '''Returns dict from previous logfile, then scraps the logfile '''
 previous_scanned_version = {'a' : 4}
 if os.path.isfile(sys_log):
-	previous_scanned_version = scan_log(sys_log)
+    previous_scanned_version = scan_log(sys_log)
 sys_log = open(sys_log, "w")
 
 '''Establishes the hierarchy TODO - insert the link fom Microsoft and vouch why we dont care about site or local'''
@@ -90,18 +91,19 @@ hierarchy_gpos.establish_hierarchy()
 
 
 for guid_eval in hierarchy_gpos.sorted_full:
-	guid = guid_eval[0]
-	gp_extensions = [gp_sec_ext()]
-	local_path = path + '/' + guid + '/'
-	version = gpo.gpo_get_sysvol_gpt_version(local_path)[1]
-
-	gpolist = gp_path_list(local_path)
-	print local_path
-
-	'''If an important GPO parse it. Will not parse if it has not changed, is empty, or is not in the right container'''
-	if guid_eval[1]:
-		if gpolist[0][1]:
-			if (version != previous_scanned_version.get(guid)) and (version != 0):
-				print ('GPO %s has changed' % guid)
-				gpo_parser(gpolist, test_ldb)
-	sys_log.write('%s %i\n' % (guid,version))
+    guid = guid_eval[0]
+    gp_extensions = [gp_sec_ext()]
+    local_path = path + '/' + guid + '/'
+    version = gpo.gpo_get_sysvol_gpt_version(local_path)[1]
+
+    gpolist = gp_path_list(local_path)
+    print local_path
+
+    '''If an important GPO parse it. Will not parse if it has not changed, is empty, or is not in the right container'''
+    if guid_eval[1]:
+        if gpolist[0][1]:
+            if (version != previous_scanned_version.get(guid)) and (version != 0):
+                print ('GPO %s has changed' % guid)
+                gpo_parser(gpolist, test_ldb)
+
+    sys_log.write('%s %i\n' % (guid,version))
-- 
1.9.3



More information about the samba-technical mailing list