Commit 1d852711 by Bach Dániel

vm: fix test

parent 8328eea8
...@@ -23,6 +23,7 @@ import os.path ...@@ -23,6 +23,7 @@ import os.path
from warnings import warn from warnings import warn
import requests import requests
from salt.client import LocalClient from salt.client import LocalClient
from salt.exceptions import SaltClientError
import salt.utils import salt.utils
from time import time, sleep from time import time, sleep
...@@ -169,11 +170,11 @@ class Node(OperatedMixin, TimeStampedModel): ...@@ -169,11 +170,11 @@ class Node(OperatedMixin, TimeStampedModel):
@method_cache(20) @method_cache(20)
def get_minion_online(self): def get_minion_online(self):
name = self.host.hostname name = self.host.hostname
client = MyLocalClient()
client.opts['timeout'] = 0.2
try: try:
client = MyLocalClient()
client.opts['timeout'] = 0.2
return bool(client.cmd(name, 'test.ping')[name]) return bool(client.cmd(name, 'test.ping')[name])
except KeyError: except (KeyError, SaltClientError):
return False return False
minion_online = property(get_minion_online) minion_online = property(get_minion_online)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment