V5.2.9 | XFS, hosting to partner platforms #1

Merged
clore merged 6 commits from xfs into main 2024-12-08 22:24:00 +00:00
2 changed files with 22 additions and 1 deletions
Showing only changes of commit 081840e0e8 - Show all commits

View File

@ -6,6 +6,7 @@ import ipaddress
import socket
import psutil
import sys
import os
config = config_module.config
log = logging_lib.log
@ -95,4 +96,20 @@ def is_ip_in_network(ip: str, network: str) -> bool:
except ValueError as e:
# If there's an error with the input values, print the error and return False
log.debug(f"NETWORKING | is_ip_in_network() | Error: {e}")
return False
return False
def purge_clore_interfaces():
network_interfaces = get_network_interfaces_with_subnet()
if type(network_interfaces) != dict:
log.error("Failed to load network interfaces, restarting...")
os._exit(1)
clore_subnets = [ "172.17.0.1/16" ] # I can include the docker default subnet here
for clore_default_network in config.clore_default_networks:
clore_subnets.append(clore_default_network["subnet"])
for network_interface in network_interfaces.keys():
if network_interface == "docker0" or network_interface[:3] == "br-":
subnet = network_interfaces[network_interface]
if subnet in clore_subnets or network_interface == "docker0":
utils.run_command(f"ip link delete {network_interface}")

View File

@ -2,6 +2,7 @@
from lib import ensure_packages_installed
from lib import logging as logging_lib
from lib import docker_interface
from lib import networking
from lib import utils
import asyncio
@ -70,6 +71,9 @@ def migrate():
code, stdout, stderr = utils.run_command(
f"systemctl stop docker && rm -rf {DOCKER_ROOT} && fallocate -l {str(data_img_size)}M {DOCKER_DATA_IMG} && mkfs.xfs {DOCKER_DATA_IMG}"
)
networking.purge_clore_interfaces()
if code == 0:
docker_config_success = configure_docker_daemon()
if code == 0 and docker_config_success: