@@ -527,13 +527,15 @@ def test_cli_leader_locator(tmpdir, monkeypatch, caplog):
527
527
caplog .set_level (logging .INFO )
528
528
fake_ctdb = tmpdir / "fake_ctdb.sh"
529
529
monkeypatch .setattr (sambacc .samba_cmds , "_GLOBAL_PREFIX" , [fake_ctdb ])
530
+ monkeypatch .setenv ("SAMBA_SPECIFICS" , "ctdb_leader_admin_command" )
531
+ ldr_admin_cmd = sambacc .samba_cmds .ctdb_leader_admin_cmd ()
530
532
531
533
def _fake_ctdb_script (pnn , recmaster ):
532
534
with open (fake_ctdb , "w" ) as fh :
533
535
fh .write ("#!/bin/sh\n " )
534
536
fh .write ("case $2 in\n " )
535
537
fh .write (f"pnn) { pnn } ;;\n " )
536
- fh .write (f"recmaster ) { recmaster } ;;\n " )
538
+ fh .write (f"{ ldr_admin_cmd } ) { recmaster } ;;\n " )
537
539
fh .write ("esac\n " )
538
540
fh .write ("exit 5\n " )
539
541
os .chmod (fake_ctdb , 0o700 )
@@ -551,18 +553,18 @@ def _fake_ctdb_script(pnn, recmaster):
551
553
with ctdb .CLILeaderLocator () as status :
552
554
assert not status .is_leader ()
553
555
assert "pnn" in caplog .records [- 1 ].getMessage ()
554
- assert "recmaster " not in caplog .records [- 1 ].getMessage ()
556
+ assert "['" + ldr_admin_cmd + "'] " not in caplog .records [- 1 ].getMessage ()
555
557
_fake_ctdb_script (pnn = "echo 1; exit 0" , recmaster = "exit 1" )
556
558
with ctdb .CLILeaderLocator () as status :
557
559
assert not status .is_leader ()
558
560
assert "pnn" not in caplog .records [- 1 ].getMessage ()
559
- assert "recmaster " in caplog .records [- 1 ].getMessage ()
561
+ assert "['" + ldr_admin_cmd + "'] " in caplog .records [- 1 ].getMessage ()
560
562
561
563
os .unlink (fake_ctdb )
562
564
with ctdb .CLILeaderLocator () as status :
563
565
assert not status .is_leader ()
564
566
assert "pnn" in caplog .records [- 2 ].getMessage ()
565
- assert "recmaster " in caplog .records [- 1 ].getMessage ()
567
+ assert "['" + ldr_admin_cmd + "'] " in caplog .records [- 1 ].getMessage ()
566
568
567
569
568
570
def test_check_nodestatus (tmp_path ):
0 commit comments