diff options
author | Tim Beale <timbeale@catalyst.net.nz> | 2018-11-09 11:49:12 +1300 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2018-11-09 17:52:30 +0100 |
commit | 55fa7bc01df1e167af8795bba37f12be6c2e5056 (patch) | |
tree | b3283a04c69661424a2cfcd3f772981dfb9edd78 /selftest | |
parent | 96d47c21d503e08b00659d8b35f46e8409dc0172 (diff) | |
download | samba-55fa7bc01df1e167af8795bba37f12be6c2e5056.tar.gz |
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>
Diffstat (limited to 'selftest')
-rwxr-xr-x | selftest/target/Samba4.pm | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm index 56756003690..5de0a706f35 100755 --- a/selftest/target/Samba4.pm +++ b/selftest/target/Samba4.pm @@ -2670,6 +2670,7 @@ sub get_backup_server_args my $server = $dcvars->{DC_SERVER_IP}; my $server_args = "--server=$server "; $server_args .= "-U$dcvars->{DC_USERNAME}\%$dcvars->{DC_PASSWORD}"; + $server_args .= " $dcvars->{CONFIGURATION}"; return $server_args; } @@ -2980,10 +2981,11 @@ sub setup_labdc my $samba_tool = Samba::bindir_path($self, "samba-tool"); my $cmd = "$samba_tool user setpassword $env->{USERNAME} "; $cmd .= "--newpassword=$env->{PASSWORD} -H $restore_dir/private/sam.ldb"; + $cmd .= " $env->{CONFIGURATION}"; unless(system($cmd) == 0) { warn("Failed to reset admin's password: \n$cmd"); - return -1; + return undef; } # start samba for the restored DC @@ -3073,6 +3075,7 @@ sub setup_customdc my $samba_tool = Samba::bindir_path($self, "samba-tool"); my $cmd = "$samba_tool user setpassword $env->{USERNAME} "; $cmd .= "--newpassword=$password -H $restore_dir/private/sam.ldb"; + $cmd .= " $env->{CONFIGURATION}"; unless(system($cmd) == 0) { warn("Failed to reset admin's password: \n$cmd"); |