]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
python/samba/tests/blackbox: Preparatory change to support custom share
authorNoel Power <noel.power@suse.com>
Mon, 27 Jul 2020 15:51:12 +0000 (16:51 +0100)
committerJeremy Allison <jra@samba.org>
Mon, 31 Aug 2020 17:44:38 +0000 (17:44 +0000)
tearDown method doesn't handle local file deletion fallback if a share
other than 'tmp' is used

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
python/samba/tests/blackbox/smbcacls.py

index b711530de0275a31c28b8821bd1f265a12c010a9..3eca96020051be26d4b8de70c3d261daac6a7ea6 100644 (file)
@@ -37,6 +37,7 @@ class SmbCaclsBlockboxTestBase(BlackboxTestCase):
         self.creds.set_password(self.passwd)
         self.testdir = os.getenv("TESTDIR", "smbcacls")
         self.share = os.getenv("SHARE", "tmp")
+        self.dirpath = os.path.join(os.environ["LOCAL_PATH"],self.testdir)
 
     def tearDown(self):
         try:
@@ -50,11 +51,10 @@ class SmbCaclsBlockboxTestBase(BlackboxTestCase):
                 raise Exception("deltree: failed without setting errcode")
         except Exception as e:
             print("remote remove failed: %s" % str(e))
-            dirpath = os.path.join(os.environ["LOCAL_PATH"],self.testdir)
-            print("falling back to removing contents of local dir: %s" % dirpath)
-            if os.path.exists(dirpath):
-                for entry in os.listdir(dirpath):
-                    fullpath = os.path.join(dirpath, entry)
+            print("falling back to removing contents of local dir: %s" % self.dirpath)
+            if os.path.exists(self.dirpath):
+                for entry in os.listdir(self.dirpath):
+                    fullpath = os.path.join(self.dirpath, entry)
                     if os.path.isdir(fullpath):
                         import shutil
                         shutil.rmtree(fullpath)