2 # Update the configuration for a module on multiple hosts
4 require './cluster-webmin-lib.pl';
5 require '../config-lib.pl';
7 &error_setup($text{'config_err'});
9 # Get the current config
10 @hosts = &list_webmin_hosts();
11 @servers = &list_servers();
12 ($getfrom) = grep { $_->{'id'} == $in{'_getfrom'} } @hosts;
13 ($serv) = grep { $_->{'id'} == $getfrom->{'id'} } @servers;
14 &remote_foreign_require($serv->{'host'}, "webmin", "webmin-lib.pl");
15 %fconfig = &remote_foreign_call($serv->{'host'}, "webmin", "foreign_config",
18 # Call the config parser
19 $mdir = &module_root_directory($in{'mod'});
20 if (-r "$mdir/config_info.pl") {
21 # Module has a custom config editor
22 &foreign_require($in{'mod'}, "config_info.pl");
23 if (&foreign_defined($in{'mod'}, "config_save")) {
25 &foreign_call($in{'mod'}, "config_save", \%fconfig);
29 # Use config.info to parse config inputs
30 &parse_config(\%fconfig, "$mdir/config.info", $in{'mod'});
33 # Write out to all hosts
34 foreach $hid (split(/\0/, $in{'_host'})) {
35 ($serv) = grep { $_->{'id'} == $hid } @servers;
36 if ($hid != $getfrom->{'id'}) {
37 &remote_foreign_require($serv->{'host'}, "webmin", "webmin-lib.pl");
39 &remote_foreign_call($serv->{'host'}, "webmin", "save_module_config",
40 \%fconfig, $in{'mod'});
42 &redirect("edit_mod.cgi?mod=$in{'mod'}");