forked from richm/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bug157377-nl.pl
69 lines (60 loc) · 1.55 KB
/
bug157377-nl.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
use NDSAdminNL qw(my_ldap_url_parse createInstance check_mesg createAndSetupReplica);
my $sroot = $ENV{SERVER_ROOT};
my $host1 = "localhost.localdomain";
my $host2 = $host1;
my $cfgport = 7100;
my ($m1, $m2, $h1, $h2, $c1, $c2);
#$ENV{USE_DBX} = 1;
$m1 = createAndSetupReplica({
cfgdshost => $host1,
cfgdsport => $cfgport,
cfgdsuser => 'admin',
cfgdspwd => 'admin',
newrootpw => 'password',
newhost => $host1,
newport => $cfgport+10,
newinst => 'm1',
newsuffix => 'dc=example,dc=com',
verbose => 1
},
{
suffix => "dc=example,dc=com",
bename => "userRoot",
binddn => "cn=replrepl,cn=config",
bindcn => "replrepl",
bindpw => "replrepl",
log => 1
});
delete $ENV{USE_DBX};
#$ENV{USE_DBX} = 1;
$h1 = createAndSetupReplica({
cfgdshost => $host1,
cfgdsport => $cfgport,
cfgdsuser => 'admin',
cfgdspwd => 'admin',
newrootpw => 'password',
newhost => $host2,
newport => $cfgport+20,
newinst => 'h1',
newsuffix => 'dc=example,dc=com',
verbose => 1
},
{
suffix => "dc=example,dc=com",
bename => "userRoot",
binddn => "cn=replrepl,cn=config",
bindcn => "replrepl",
bindpw => "replrepl",
type => 2,
log => 1
});
delete $ENV{USE_DBX};
my $initfile = "$m1->{sroot}/slapd-$m1->{inst}/ldif/Example.ldif";
$m1->importLDIF($initfile, 0, "userRoot", 1);
print "create agreements and init consumers\n";
my $saveport = $h1->{port};
$h1->{port} = 0;
my $agmtm1toh1 = $m1->setupAgreement($h1, "dc=example,dc=com", "cn=replrepl,cn=config", "replrepl");
$h1->{port} = $saveport;
$m1->startReplication_async($agmtm1toh1);
$m1->waitForReplInit($agmtm1toh1);