Skip to content

Commit cf7e499

Browse files
committed
Fix for error when installing openidconnect
For me env_file[0] resulted in following: File "../LayersBox/layersbox", line 717, in create_databases with open(join(servicedir, service_name, env_file[0])) as infile: IOError: [Errno 2] No such file or directory: './services/openidconnect/o' I don’t know why there was env_file[0], but fix assumes that sometimes it is a list or a tuple and env_file[0] is needed.
1 parent 43a5a5f commit cf7e499

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

layersbox

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,9 @@ def create_databases(dir, service_name, database_env_files):
714714
db_username = ""
715715
db_file = ""
716716
db_exists = False
717-
with open(join(servicedir, service_name, env_file[0])) as infile:
717+
if isinstance(env_file, (tuple, list)):
718+
env_file = env_file[0]
719+
with open(join(servicedir, service_name, env_file)) as infile:
718720
for line in infile:
719721
if "_DB_NAME" in line:
720722
db_key = line.split("_DB_NAME=")[0]
@@ -737,7 +739,7 @@ def create_databases(dir, service_name, database_env_files):
737739
mysqlcreate_output = subprocess.check_output(["docker-compose", "run", "mysqlcreate"])
738740
db_password = mysqlcreate_output.split(" -p")[1].split(" -hmysql")[0]
739741
# write password to env file
740-
with open(join(servicedir, service_name, env_file[0]), "a") as outfile:
742+
with open(join(servicedir, service_name, env_file), "a") as outfile:
741743
outfile.write("\n{}_DB_PASS={}".format(db_key, db_password))
742744

743745
# clean up and delete secret.env content, otherwise db is created again

0 commit comments

Comments
 (0)