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
|
package drakcluster::server_conf_drakx;
use strict;
use run_program;
use detect_devices;
use network;
use common;
use drakcluster::server_conf;
# for compatibility
sub drakcluster::server_conf::N { &_ }
sub N { &_ }
sub generate_rndc() {
run_program::rooted($::prefix, 'rndc-confgen', '-a');
first(cat_("$::prefix/etc/rndc.key") =~ /secret "(\S*)";/);
}
sub default_conf {
my ($o) = @_;
{
DOMAINNAME => $o->{netc}{DOMAINNAME},
NTPSERVER => $o->{intf}{eth0}{IPADDR},
IPOFFORWARDER => network::dnsServers($o->{netc}),
ORIGIN => $o->{netc}{DOMAINNAME},
};
}
my $force_size;
sub my_gtk::show {
my ($o) = @_;
$o->{rwindow}->set_usize($::windowwidth * 0.9, $::windowheight * 0.9) if $force_size;
$force_size = 0;
$o->{window}->show;
$o->{rwindow}->show;
}
sub main {
my ($o) = @_;
my @network_interfaces = detect_devices::getNet();
my $conf = drakcluster::server_conf::read();
$conf->{DNSKEY} ||= generate_rndc();
my @fields = drakcluster::server_conf::fields($conf, \@network_interfaces, default_conf($o));
$force_size = 1;
$o->ask_from('', N("Cluster Server Configuration"),
[ @fields ], complete => sub {
my $i = eval { find_index { !drakcluster::server_conf::check_field($o, $_) } @fields };
$@ ? 0 : (1, $i);
}) or return;
drakcluster::server_conf::done($conf, \@network_interfaces);
}
1;
|