mirror of https://github.com/apache/jclouds.git
JCLOUDS-1307: Invalidate SG on removal even if already externally deleted
This commit is contained in:
parent
b77ea06950
commit
65ba26eca7
|
@ -24,6 +24,7 @@ import static com.google.common.collect.Iterables.transform;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
@ -105,12 +106,17 @@ public class AWSEC2SecurityGroupExtension extends EC2SecurityGroupExtension {
|
||||||
|
|
||||||
if (group != null) {
|
if (group != null) {
|
||||||
client.getSecurityGroupApi().get().deleteSecurityGroupInRegionById(region, groupId);
|
client.getSecurityGroupApi().get().deleteSecurityGroupInRegionById(region, groupId);
|
||||||
// TODO: test this clear happens
|
|
||||||
groupCreator.invalidate(new RegionNameAndIngressRules(region, group.getName(), null, false, null));
|
groupCreator.invalidate(new RegionNameAndIngressRules(region, group.getName(), null, false, null));
|
||||||
return true;
|
return true;
|
||||||
|
} else {
|
||||||
|
for (Map.Entry<RegionAndName, String> cachedSg : groupCreator.asMap().entrySet()) {
|
||||||
|
if (groupId.equals(cachedSg.getValue())) {
|
||||||
|
groupCreator.invalidate(cachedSg.getKey());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue