EC2 Discovery ignoring instances with more than one security group, closes #311.
This commit is contained in:
parent
9f8e5cb2c0
commit
23b8b81e15
|
@ -33,6 +33,7 @@ import org.elasticsearch.common.transport.InetSocketTransportAddress;
|
||||||
import org.elasticsearch.common.transport.PortsRange;
|
import org.elasticsearch.common.transport.PortsRange;
|
||||||
import org.elasticsearch.discovery.zen.ping.unicast.UnicastHostsProvider;
|
import org.elasticsearch.discovery.zen.ping.unicast.UnicastHostsProvider;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -87,16 +88,10 @@ public class AwsEc2UnicastHostsProvider extends AbstractComponent implements Uni
|
||||||
for (Reservation reservation : descInstances.getReservations()) {
|
for (Reservation reservation : descInstances.getReservations()) {
|
||||||
if (!groups.isEmpty()) {
|
if (!groups.isEmpty()) {
|
||||||
// lets see if we can filter based on groups
|
// lets see if we can filter based on groups
|
||||||
boolean filter = false;
|
List<String> groupNames = reservation.getGroupNames();
|
||||||
for (String group : reservation.getGroupNames()) {
|
if (Collections.disjoint(groups, groupNames)) {
|
||||||
if (!groups.contains(group)) {
|
logger.trace("filtering out reservation {} based on groups {}, not part of {}", reservation.getReservationId(), groupNames, groups);
|
||||||
logger.trace("filtering out reservation {} based on group {}, not part of {}", reservation.getReservationId(), group, groups);
|
// continue to the next reservation
|
||||||
filter = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (filter) {
|
|
||||||
// if we are filtering, continue to the next reservation
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue