Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FirewallObjects/Hosts: validate host-group Members prop consitency. R…
…efs #2705
- Loading branch information
1 parent
74f4db6
commit 324e549
Showing
6 changed files
with
79 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
root/etc/e-smith/validators/actions/fwobject-hostgroup-remove-member
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/perl | ||
|
||
# | ||
# Copyright (C) 2014 Nethesis S.r.l. | ||
# http://www.nethesis.it - support@nethesis.it | ||
# | ||
# This script is part of NethServer. | ||
# | ||
# NethServer is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, | ||
# or any later version. | ||
# | ||
# NethServer is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with NethServer. If not, see . | ||
# | ||
|
||
use strict; | ||
|
||
use esmith::HostsDB; | ||
|
||
my $dbName = shift || die("Missing DB argument"); | ||
my $hostKey = shift || die("Missing host key argument"); | ||
|
||
my $hdb = esmith::HostsDB->open(); | ||
|
||
my @groups = (); | ||
|
||
foreach my $record ($hdb->get_all_by_prop('type' => 'host-group')) { | ||
if(($record->prop('Members') || '') eq $hostKey) { | ||
push @groups, $record->key; | ||
} | ||
} | ||
|
||
if(@groups) { | ||
print join(', ', @groups) . "\n"; | ||
exit(3); | ||
} | ||
|
||
exit(0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters