]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
gpo: Test rsop function for success
authorDavid Mulder <dmulder@suse.com>
Fri, 28 Aug 2020 14:38:41 +0000 (08:38 -0600)
committerJeremy Allison <jra@samba.org>
Wed, 2 Sep 2020 09:11:30 +0000 (09:11 +0000)
Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
python/samba/gpclass.py
python/samba/tests/gpo.py
selftest/knownfail.d/gpo [new file with mode: 0644]

index ddb580d7301bb1889438218071ada0af61e42acc..243f917e2011697a14830952099da4749a41021f 100644 (file)
@@ -16,7 +16,7 @@
 
 
 import sys
-import os
+import os, shutil
 import errno
 import tdb
 sys.path.insert(0, "bin/python")
@@ -504,7 +504,7 @@ def rsop(lp, creds, gp_extensions, target):
 
     print('Resultant Set of Policy')
     print('%s Policy\n' % target)
-    term_width = os.get_terminal_size()[0]
+    term_width = shutil.get_terminal_size(fallback=(120, 50))[0]
     for gpo in gpos:
         print('GPO: %s' % gpo.display_name)
         print('='*term_width)
index a25f1a48875ae3e74cb1896731c3557bc71bb2f4..43a4aacfc14896fff3992d8e956c64fa72de4201 100644 (file)
@@ -66,6 +66,12 @@ def gpupdate_unapply(lp):
 
     return Popen(gpupdate, stdout=PIPE, stderr=PIPE).wait()
 
+def rsop(lp):
+    gpupdate = lp.get('gpo update command')
+    gpupdate.append('--rsop')
+
+    return Popen(gpupdate, stdout=PIPE).wait()
+
 def stage_file(path, data):
     dirname = os.path.dirname(path)
     if not os.path.exists(dirname):
@@ -571,6 +577,10 @@ class GPOTests(tests.TestCase):
             unstage_file(gpofile % g.name)
             unstage_file(reg_pol % g.name)
 
+        # Check that a call to gpupdate --rsop also succeeds
+        ret = rsop(self.lp)
+        self.assertEquals(ret, 0, 'gpupdate --rsop failed!')
+
     def test_gp_unapply(self):
         logger = logging.getLogger('gpo_tests')
         cache_dir = self.lp.get('cache directory')
diff --git a/selftest/knownfail.d/gpo b/selftest/knownfail.d/gpo
new file mode 100644 (file)
index 0000000..b1c8285
--- /dev/null
@@ -0,0 +1 @@
+samba.tests.gpo.samba.tests.gpo.GPOTests.test_rsop