Skip to content

Commit ffd3aa2

Browse files
committed
Added test for cloud manager token before using it
Signed-off-by: Andrew Perry <[email protected]>
1 parent f609c12 commit ffd3aa2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

manager_net.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,9 @@ def get_webhook_status(self):
161161
"""Get the webhook data from the API Manager
162162
This requires cloud manager access
163163
"""
164-
logger.info("Getting webhook data from API Manager")
164+
if not self.cm_token:
165+
logger.debug("No cloud manager token available. Not getting webhook data")
166+
logger.info("Getting webhook data from Cloud Manager")
165167
try:
166168
url = "https://{}/api/cloud/webhooks".format(self.hostname)
167169
response = requests.get(
@@ -262,7 +264,8 @@ def fish(self):
262264
for catalog in org['catalogs']['results']:
263265
self.process_org_metrics(org['name'], catalog['name'])
264266

265-
self.get_webhook_status()
267+
if self.cm_token:
268+
self.get_webhook_status()
266269

267270
@alog.timed_function(logger.trace)
268271
def process_org_metrics(self, org_name, catalog_name):

0 commit comments

Comments
 (0)