[PATCH] Fix samba-tool gpo commands

Tim Beale timbeale at catalyst.net.nz
Thu Jan 10 04:28:04 UTC 2019


While trying to convert the GPO commands to use the s3 bindings, I
noticed that they were majorly broken in master. Attached is a simple
fix - just a missing python import was the problem. The automated tests
weren't picking it up because they all use the --tmpdir option, which
bypasses the problematic code.

Review appreciated. Thanks.

-------------- next part --------------
From 3c81faaf2bbbae9e9654b24fb1d3567fac9b3135 Mon Sep 17 00:00:00 2001
From: Tim Beale <timbeale at catalyst.net.nz>
Date: Thu, 10 Jan 2019 16:34:27 +1300
Subject: [PATCH] netcmd: Fix broken samba-tool gpo commands

samba-tool gpo create|fetch|backup commands throw exceptions due to a
missing Python import:

ERROR(<class 'NameError'>): uncaught exception - name 'tempfile' is not
defined
  File "bin/python/samba/netcmd/__init__.py", line 184, in _run
    return self.run(*args, **kwargs)
  File "bin/python/samba/netcmd/gpo.py", line 980, in run
    tmpdir, gpodir = self.construct_tmpdir(tmpdir, gpo)
  File "bin/python/samba/netcmd/gpo.py", line 386, in construct_tmpdir
    tmpdir = tempfile.mkdtemp()

Introduced by commit e3320b6d3df7a0c7b refactor.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
---
 python/samba/netcmd/gpo.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/python/samba/netcmd/gpo.py b/python/samba/netcmd/gpo.py
index b65fb7c..a064f44 100644
--- a/python/samba/netcmd/gpo.py
+++ b/python/samba/netcmd/gpo.py
@@ -25,6 +25,7 @@ import ldb
 import re
 import xml.etree.ElementTree as ET
 import shutil
+import tempfile
 
 from samba.auth import system_session
 from samba.netcmd import (
-- 
2.7.4



More information about the samba-technical mailing list