CORD-880 allow password from file
Change-Id: I7af1e7e5c4e033b94ec914d5d301199d7a9c06f6
diff --git a/xos/synchronizers/new_base/modelaccessor.py b/xos/synchronizers/new_base/modelaccessor.py
index d8f2692..bc1d74f 100644
--- a/xos/synchronizers/new_base/modelaccessor.py
+++ b/xos/synchronizers/new_base/modelaccessor.py
@@ -9,6 +9,7 @@
"""
import functools
+import os
from xos.config import Config
class ModelAccessor(object):
@@ -112,6 +113,13 @@
grpcapi_username = getattr(Config(), "observer_accessor_username", "xosadmin@opencord.org")
grpcapi_password = getattr(Config(), "observer_accessor_password")
+ # if password starts with "@", then retreive the password from a file
+ if grpcapi_password.startswith("@"):
+ fn = grpcapi_password[1:]
+ if not os.path.exists(fn):
+ raise Exception("%s does not exist" % fn)
+ grpcapi_password = open(fn).readline().strip()
+
from xosapi.xos_grpc_client import SecureClient
from twisted.internet import reactor