Module: check_mk
Branch: master
Commit: 9e01e90eaf8634463d39c2adf2d0d4775ad72aaa
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9e01e90eaf8634…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Fri Apr 26 11:54:44 2019 +0200
agent_aws: Removed duplicate code
Change-Id: I836b5dac0b2aaa425ea9b8343f6d7db5da4bae01
---
cmk/special_agents/agent_aws.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/cmk/special_agents/agent_aws.py b/cmk/special_agents/agent_aws.py
index 1da0bba..15d63df 100644
--- a/cmk/special_agents/agent_aws.py
+++ b/cmk/special_agents/agent_aws.py
@@ -2156,9 +2156,6 @@ class ELBv2Limits(AWSSectionLimits):
# > Limits für Elastic Load Balancing
load_balancer['Rules'] = [rule for rule in rules if not
rule['IsDefault']]
- response = self._client.describe_target_groups(LoadBalancerArn=lb_arn)
- load_balancer['TargetGroups'] = self._get_response_content(response,
'TargetGroups')
-
response = self._client.describe_account_limits()
limits = self._get_response_content(response, 'Limits')
return load_balancers, limits
@@ -2257,9 +2254,12 @@ class ELBv2TargetGroups(AWSSectionGeneric):
# Just to be sure, that we do not describe target groups of other lbs
continue
- load_balancer_arn = load_balancer['LoadBalancerArn']
- response =
self._client.describe_target_groups(LoadBalancerArn=load_balancer_arn)
- target_groups = self._get_response_content(response, 'TargetGroups')
+ if 'TargetGroups' not in load_balancer:
+ response = self._client.describe_target_groups(
+ LoadBalancerArn=load_balancer['LoadBalancerArn'])
+ load_balancer['TargetGroups'] =
self._get_response_content(response, 'TargetGroups')
+
+ target_groups = load_balancer.get('TargetGroups', [])
for target_group in target_groups:
response = self._client.describe_target_health(
TargetGroupArn=target_group['TargetGroupArn'])