Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions docs/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env python3

import sys
import os.path

file_path = "mms5-layer1-service/src/main/resources/application.conf"
if os.path.exists(file_path):
# open both files
app_example = "mms5-layer1-service/src/main/resources/application.conf.example"
with open(file_path,'r') as firstfile, open(file_path,'w') as secondfile:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is meant to be opening the application.conf.example file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'll edit the comment to reflect that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

application.conf.example should be copied to application.conf, not the other way around. Also, it should only write to the file if it does not exist. I'd suggest using 'x' file flag in the call to open with a try catch.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the application.conf is a hidden file and actually does exist within that directory. The issue was that it was empty and so that would produce the original error. Because of this, the 'w' flag would be more appropriate as the 'x' flag will cause a "FileAlreadyExists" error. I have added the changes.

# read content from first file
for line in firstfile:
# append content to second file
secondfile.write(line)


2 changes: 1 addition & 1 deletion mms5-layer1-service