Skip to content

Commit ff592f6

Browse files
fix: v5c caching crash
1 parent 6a125f6 commit ff592f6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

datapower_net.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ def get_info(self):
149149
verify=False,
150150
timeout=1
151151
)
152+
logger.trace(state)
152153
if state.status_code == 200:
153154
if state.json()['APIConnectGatewayService'].get('V5CompatibilityMode', 'off') == 'on':
154155
self.v5c = True
@@ -283,10 +284,10 @@ def fetch_document_cache_summary(self, suffix=''):
283284
""" fetch data from a status provider """
284285
if self.v5c:
285286
provider = "DocumentCachingSummary"
286-
key = "XMLManager"
287+
status_key = "XMLManager"
287288
else:
288289
provider = "APIDocumentCachingSummary"
289-
key = "APIGateway"
290+
status_key = "APIGateway"
290291
try:
291292
logger.debug("Retrieving cache summary")
292293
url = "https://{}:{}/mgmt/status/{}/{}".format(
@@ -301,12 +302,11 @@ def fetch_document_cache_summary(self, suffix=''):
301302
data = status.get(provider, {})
302303
if type(data) is not list:
303304
data = [data]
304-
305305
for item in data:
306306
try:
307-
name = item[key]['value']
307+
name = item[status_key]['value']
308308
if name in ['webapi', 'webapi-internal', 'apiconnect']:
309-
del item[key]
309+
del item[status_key]
310310
logger.debug(item)
311311
for key in item:
312312
self.trawler.set_gauge(

0 commit comments

Comments
 (0)