Skip to content
Snippets Groups Projects
Commit cf6e0b20 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

SW-415: do not overwrite file, but append to it if existing. Issue warning to...

SW-415: do not overwrite file, but append to it if existing. Issue warning to fill in the new credentials
parent 76fa2809
No related branches found
No related tags found
1 merge request!87Lsmr epic
......@@ -189,10 +189,11 @@ class DBCredentials:
new_path = os.path.join(user_info.pw_dir, '.lofar', 'dbcredentials', database+extension)
if not os.path.exists(os.path.dirname(new_path)):
os.makedirs(os.path.dirname(new_path))
with open(new_path, 'w') as new_file:
with open(new_path, 'w+') as new_file:
new_file.write("[database:%s]\nhost=localhost\nuser=%s\npassword=unknown\ntype=unknown\nport=0\ndatabase=%s"
% (database,user_info.pw_name,database))
logger.info("created default dbcredentials file for database=%s at %s", database, new_path)
logger.info("Created default dbcredentials file for database=%s at %s", database, new_path)
logger.warning(" *** Please fill in the proper credentials for database=%s in new empty credentials file: '%s' ***", database, new_path)
def get(self, database):
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment