selftest: Fix backup testenv creation on certain host machines
authorTim Beale <timbeale@catalyst.net.nz>
Thu, 8 Nov 2018 22:49:12 +0000 (11:49 +1300)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 9 Nov 2018 16:52:30 +0000 (17:52 +0100)
commit55fa7bc01df1e167af8795bba37f12be6c2e5056
treeb3283a04c69661424a2cfcd3f772981dfb9edd78
parent96d47c21d503e08b00659d8b35f46e8409dc0172
selftest: Fix backup testenv creation on certain host machines

When we created the backup-file for the restoredc/renamedc/labdc
testenvs we weren't explicitly a --configfile on the samba-tool command.
This meant the command tried to use the smb.conf form the default
install location, i.e. /usr/local/samba/etc/smb.conf. On the gitlab CI
runner, there's no samba installed, so it ends up using the default
settings, which is fine. However, if the host machine had an invalid
smb.conf installed there, creating the testenv would fail with an error
like:

ERROR(runtime): uncaught exception - Unable to load default file
File "bin/python/samba/netcmd/__init__.py", line 184, in _run
return self.run(*args, **kwargs)
File "bin/python/samba/netcmd/domain_backup.py", line 222, in run
lp = sambaopts.get_loadparm()
  File "bin/python/samba/getopt.py", line 94, in get_loadparm
    self._lp.load_default()

We can avoid this by always explictly specifying the backupfromdc's
smb.conf when creating the backup file.

Likewise, labdc/customdc also need the config specified when the admin
password is reset.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
selftest/target/Samba4.pm