diff options
| author | David Mulder <dmulder@suse.com> | 2020-08-28 08:38:41 -0600 |
|---|---|---|
| committer | Jeremy Allison <jra@samba.org> | 2020-09-02 09:11:30 +0000 |
| commit | dff01a5edf69b10e72c64ab63de1d4aeedb747ce (patch) | |
| tree | 2cba55e672cd3951866c8410fcd09ec4e808f747 /python | |
| parent | 07ce48088824bba2054e029edfa6fbae972c1921 (diff) | |
| download | samba-dff01a5edf69b10e72c64ab63de1d4aeedb747ce.tar.gz samba-dff01a5edf69b10e72c64ab63de1d4aeedb747ce.tar.bz2 samba-dff01a5edf69b10e72c64ab63de1d4aeedb747ce.zip | |
gpo: Test rsop function for success
Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Diffstat (limited to 'python')
| -rw-r--r-- | python/samba/gpclass.py | 4 | ||||
| -rw-r--r-- | python/samba/tests/gpo.py | 10 |
2 files changed, 12 insertions, 2 deletions
diff --git a/python/samba/gpclass.py b/python/samba/gpclass.py index ddb580d7301..243f917e201 100644 --- a/python/samba/gpclass.py +++ b/python/samba/gpclass.py @@ -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) diff --git a/python/samba/tests/gpo.py b/python/samba/tests/gpo.py index a25f1a48875..43a4aacfc14 100644 --- a/python/samba/tests/gpo.py +++ b/python/samba/tests/gpo.py @@ -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') |
