Don't parse of sispmctl output (doesn't work)

This commit is contained in:
Martin Bauer 2020-07-13 11:33:18 +00:00
parent 349861ad7c
commit b4f8f24785
1 changed files with 9 additions and 8 deletions

View File

@ -49,20 +49,21 @@ class SispmctlHost:
async with self._session.get(url, timeout=3) as resp: async with self._session.get(url, timeout=3) as resp:
if resp.status == 200: if resp.status == 200:
result = await resp.json() result = await resp.json()
await self.notify_switches(result) #await self.notify_switches(result)
else: else:
await self.set_switches_unreachable() await self.set_switches_unreachable()
except ClientConnectionError: except ClientConnectionError:
await self.set_switches_unreachable() await self.set_switches_unreachable()
async def update_state(self): async def update_state(self):
url = f"http://{self.hostname}:{self.port}" pass
async with self._session.get(url, timeout=3) as resp: #url = f"http://{self.hostname}:{self.port}"
if resp.status == 200: #async with self._session.get(url, timeout=3) as resp:
result = await resp.json() # if resp.status == 200:
await self.notify_switches(result) # result = await resp.json()
else: # await self.notify_switches(result)
await self.set_switches_unreachable() # else:
# await self.set_switches_unreachable()
async def notify_switches(self, response): async def notify_switches(self, response):
for i, switch in enumerate(self._switch_objects): for i, switch in enumerate(self._switch_objects):