Skip to content

Commit a64cc00

Browse files
committed
Fix hostgroup membership list
1 parent 7eee05c commit a64cc00

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Revision history for Rex
1212
- Fix parsing FreeBSD memory details
1313
- Recognize laundry memory on FreeBSD
1414
- Fix command existence checks without which
15+
- Fix hostgroup membership list
1516

1617
[DOCUMENTATION]
1718

lib/Rex/Group.pm

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use attributes;
1515
use Rex::Group::Entry::Server;
1616

1717
use vars qw(%groups);
18-
use List::Util 1.45 qw(uniq);
18+
use List::Util 1.45 qw(any uniq);
1919
use Data::Dumper;
2020

2121
sub new {
@@ -24,8 +24,16 @@ sub new {
2424
my $self = {@_};
2525

2626
bless( $self, $proto );
27+
2728
for my $srv ( @{ $self->{servers} } ) {
2829
$srv->append_to_group( $self->{name} );
30+
31+
for my $group ( keys %groups ) {
32+
33+
if ( any { $_ eq $srv } $groups{$group}->get_servers ) {
34+
$srv->append_to_group($group);
35+
}
36+
}
2937
}
3038

3139
return $self;

0 commit comments

Comments
 (0)