Handle hostnames with upper-case letters
[webmin.git] / bacula-backup / delete_groups.cgi
1 #!/usr/local/bin/perl
2 # Delete multiple node groups
3
4 require './bacula-backup-lib.pl';
5 &ReadParse();
6 $conf = &get_director_config();
7 $parent = &get_director_config_parent();
8 @clients = &find("Client", $conf);
9
10 @nodegroups = &list_node_groups();
11
12 &error_setup($text{'groups_derr'});
13 @d = split(/\0/, $in{'d'});
14 @d || &error($text{'filesets_ednone'});
15
16 &lock_file($parent->{'file'});
17 foreach $d (@d) {
18         $client = &find_by("Name", "ocgroup_".$d, \@clients);
19         if ($client) {
20                 $child = &find_dependency("Client", $d, [ "Job", "JobDefs" ], $conf);
21                 $child && &error(&text('client_echild', $child));
22                 &save_directive($conf, $parent, $client, undef, 0);
23
24                 ($nodegroup) = grep { $_->{'name'} eq $d } @nodegroups;
25                 if ($nodegroup) {
26                         &sync_group_clients($nodegroup);
27                         }
28                 }
29         }
30 &flush_file_lines($parent->{'file'});
31 &unlock_file($parent->{'file'});
32 &webmin_log("delete", "groups", scalar(@d));
33 &redirect("list_groups.cgi");
34