ELB Watcher now respects SECURITYGROUP_INSTANCE_DETAIL config value.
from security_monkey.cloudaux_watcher import CloudAuxWatcher
from cloudaux.aws.elb import describe_load_balancers
from cloudaux.orchestration.aws.elb import get_load_balancer
+from security_monkey import app
class ELB(CloudAuxWatcher):
@@ -10,6 +11,7 @@ class ELB(CloudAuxWatcher):
honor_ephemerals = False
ephemeral_paths = list()
service_name = 'elb'
+ detail = app.config.get('SECURITYGROUP_INSTANCE_DETAIL', 'FULL')
def get_name_from_list_output(self, item):
return item['LoadBalancerName']
@@ -18,4 +20,9 @@ class ELB(CloudAuxWatcher):
return describe_load_balancers(**kwargs)
def get_method(self, item, **kwargs):
- return get_load_balancer(item, **kwargs)
+ result = get_load_balancer(item, **kwargs)
+ if self.detail == 'NONE' or self.detail == None:
+ result.pop('Instances', None)
+ elif self.detail == 'SUMMARY':
+ result['Instances'] = '{len} Instance(s)'.format(len=len(result.get('Instances', [])))
+ return result
