From 6395225a4941f2fa23a52e990091f928d3dc8578 Mon Sep 17 00:00:00 2001 From: Vitaliy Kharechko <vitaliy.kharechko@axilera.com> Date: Mon, 1 Aug 2016 10:25:35 +0300 Subject: [PATCH] Handle case where no auth configuration in /etc Change-Id: I7bd07cbc9cbf819d5bdfa9abc3dff666dc0d8046 --- broadview_lib/config/agentconnection.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/broadview_lib/config/agentconnection.py b/broadview_lib/config/agentconnection.py index f620904..c13ecde 100644 --- a/broadview_lib/config/agentconnection.py +++ b/broadview_lib/config/agentconnection.py @@ -98,14 +98,17 @@ class AgentConnection(): auth["username"] = None auth["password"] = None - conf = self._swconfig.getByIP(self.host) - if conf: - if "username" in conf: - auth["username"] = conf["username"] - if "password" in conf: - auth["password"] = conf["password"] - if "auth" in conf: - auth["auth"] = conf["auth"] + try: + conf = self._swconfig.getByIP(self.host) + if conf: + if "username" in conf: + auth["username"] = conf["username"] + if "password" in conf: + auth["password"] = conf["password"] + if "auth" in conf: + auth["auth"] = conf["auth"] + except: + pass if auth["auth"] == None: auth["auth"] = os.getenv("BV_AUTH")