Skip to content

Commit

Permalink
update: copy_config move to copy
Browse files Browse the repository at this point in the history
  • Loading branch information
sigee-min committed Aug 1, 2024
1 parent f59184e commit 3cbedc6
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions init_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,24 @@
def copy_configs():
src_directory = "/data/config-tmp/"
dest_directory = "/data/config/"

os.makedirs(dest_directory, exist_ok=True)

files = os.listdir(src_directory)

for file in files:
src_path = os.path.join(src_directory, file)
dest_path = os.path.join(dest_directory, file)

# Check if the destination file exists and remove it
if os.path.exists(dest_path):
os.remove(dest_path)
try:
if os.path.exists(dest_path):
os.remove(dest_path)

shutil.copy2(src_path, dest_path)
print(f"Copied {file} to {dest_path}")

# Move the file from src to dest
shutil.move(src_path, dest_path)
except OSError as e:
print(f"Error copying {file} from {src_path} to {dest_path}: {str(e)}")

print(f"Copied configuration files from {src_directory} to {dest_directory}")

Expand All @@ -28,10 +34,8 @@ def install_plugins():
print("No PLUGIN_URLS environment variable set.")
return

# Ensure the plugins directory exists
os.makedirs(plugin_directory, exist_ok=True)

# Download each plugin from the provided URLs
for url in plugin_urls.split(','):
try:
response = requests.get(url)
Expand Down

0 comments on commit 3cbedc6

Please sign in to comment.