Handle case where no auth configuration in /etc

Change-Id: I7bd07cbc9cbf819d5bdfa9abc3dff666dc0d8046
This commit is contained in:
Vitaliy Kharechko 2016-08-01 10:25:35 +03:00
parent d0f40b1445
commit 6395225a49
1 changed files with 11 additions and 8 deletions

View File

@ -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")