diff options
Diffstat (limited to 'source4/scripting/python')
| -rw-r--r-- | source4/scripting/python/samba/netcmd/domain.py | 22 | ||||
| -rwxr-xr-x | source4/scripting/python/samba/upgradehelpers.py | 2 | 
2 files changed, 16 insertions, 8 deletions
| diff --git a/source4/scripting/python/samba/netcmd/domain.py b/source4/scripting/python/samba/netcmd/domain.py index 1f2c7de957..b0c174b470 100644 --- a/source4/scripting/python/samba/netcmd/domain.py +++ b/source4/scripting/python/samba/netcmd/domain.py @@ -873,6 +873,10 @@ class cmd_domain_samba3upgrade(Command):          if sambaopts.realm:              s3conf.set("realm", sambaopts.realm) +        if targetdir is not None: +            if not os.path.isdir(targetdir): +                os.mkdir(targetdir) +          eadb = True          if use_xattrs == "yes":              eadb = False @@ -882,14 +886,16 @@ class cmd_domain_samba3upgrade(Command):              else:                  tmpfile = tempfile.NamedTemporaryFile(dir=os.path.abspath(os.path.dirname(lp.get("private dir"))))              try: -                samba.ntacls.setntacl(lp, tmpfile.name, -                            "O:S-1-5-32G:S-1-5-32", "S-1-5-32", "native") -                eadb = False -            except Exception: -                # FIXME: Don't catch all exceptions here -                logger.info("You are not root or your system do not support xattr, using tdb backend for attributes. " -                            "If you intend to use this provision in production, rerun the script as root on a system supporting xattrs.") -            tmpfile.close() +                try: +                    samba.ntacls.setntacl(lp, tmpfile.name, +                                "O:S-1-5-32G:S-1-5-32", "S-1-5-32", "native") +                    eadb = False +                except Exception: +                    # FIXME: Don't catch all exceptions here +                    logger.info("You are not root or your system do not support xattr, using tdb backend for attributes. " +                                "If you intend to use this provision in production, rerun the script as root on a system supporting xattrs.") +            finally: +                tmpfile.close()          # Set correct default values from dbdir or testparm          paths = {} diff --git a/source4/scripting/python/samba/upgradehelpers.py b/source4/scripting/python/samba/upgradehelpers.py index 2c7191e707..a75ab75ada 100755 --- a/source4/scripting/python/samba/upgradehelpers.py +++ b/source4/scripting/python/samba/upgradehelpers.py @@ -202,6 +202,8 @@ def get_paths(param, targetdir=None, smbconf=None):      :param smbconf: Path to the smb.conf file      :return: A list with the path of important provision objects"""      if targetdir is not None: +        if not os.path.exists(targetdir): +            os.mkdir(targetdir)          etcdir = os.path.join(targetdir, "etc")          if not os.path.exists(etcdir):              os.makedirs(etcdir) | 
