update infra script
This commit is contained in:
parent
92e0bdeec8
commit
dc57dcd238
|
@ -620,69 +620,71 @@ def shared_server_files():
|
|||
)
|
||||
logger.info(MSG_FIN + HOME_FOLDER + WPCHROOT + des)
|
||||
|
||||
def server_config_files(sbase):
|
||||
"""
|
||||
This function copies specific files used for server builds
|
||||
and configures them based on the provided base (sbase).
|
||||
"""
|
||||
base_config = {
|
||||
"debian": {
|
||||
"scripts_dir": "/server/scripts/debian/",
|
||||
},
|
||||
"devuan": {
|
||||
"scripts_dir": "/server/scripts/devuan/",
|
||||
}
|
||||
# Configuration constants for directory paths
|
||||
BASE_CONFIG = {
|
||||
"debian": {
|
||||
"scripts_dir": "/server/scripts/debian/",
|
||||
},
|
||||
"devuan": {
|
||||
"scripts_dir": "/server/scripts/devuan/",
|
||||
}
|
||||
|
||||
if sbase not in base_config:
|
||||
}
|
||||
|
||||
def server_config_files(sbase):
|
||||
"""
|
||||
This function copies specific server build files adapted for the provided base (sbase).
|
||||
"""
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
if sbase not in BASE_CONFIG:
|
||||
logger.error(f"Unsupported base: {sbase}")
|
||||
return
|
||||
|
||||
logger.info(f"Copy Shared Files for {sbase.capitalize()}")
|
||||
|
||||
src_paths = [
|
||||
os.path.join(base_config[sbase]["scripts_dir"], 'welcome.sh'),
|
||||
os.path.join(base_config[sbase]["scripts_dir"], 'configure_apache2.sh'),
|
||||
os.path.join(base_config[sbase]["scripts_dir"], 'configure_firewalld.sh'),
|
||||
os.path.join(base_config[sbase]["scripts_dir"], 'configure_hostname.sh'),
|
||||
os.path.join(base_config[sbase]["scripts_dir"], 'configure_mariadb.sh'),
|
||||
os.path.join(base_config[sbase]["scripts_dir"], 'configure_nginx.sh'),
|
||||
os.path.join(base_config[sbase]["scripts_dir"], 'configure_php_and_docker.sh'),
|
||||
os.path.join(base_config[sbase]["scripts_dir"], 'configure_postfix.sh'),
|
||||
os.path.join(base_config[sbase]["scripts_dir"], 'configure_postgresql.sh'),
|
||||
os.path.join(base_config[sbase]["scripts_dir"], 'configure_sqlite.sh'),
|
||||
os.path.join(base_config[sbase]["scripts_dir"], 'configure_ssh.sh'),
|
||||
os.path.join(base_config[sbase]["scripts_dir"], 'configure_static_ip.sh'),
|
||||
os.path.join(base_config[sbase]["scripts_dir"], 'create_user.sh'),
|
||||
os.path.join(base_config[sbase]["scripts_dir"], 'update_and_install.sh'),
|
||||
os.path.join(BASE_CONFIG[sbase]["scripts_dir"], 'welcome.sh'),
|
||||
os.path.join(BASE_CONFIG[sbase]["scripts_dir"], 'configure_apache2.sh'),
|
||||
os.path.join(BASE_CONFIG[sbase]["scripts_dir"], 'configure_firewalld.sh'),
|
||||
os.path.join(BASE_CONFIG[sbase]["scripts_dir"], 'configure_hostname.sh'),
|
||||
os.path.join(BASE_CONFIG[sbase]["scripts_dir"], 'configure_mariadb.sh'),
|
||||
os.path.join(BASE_CONFIG[sbase]["scripts_dir"], 'configure_nginx.sh'),
|
||||
os.path.join(BASE_CONFIG[sbase]["scripts_dir"], 'configure_php_and_docker.sh'),
|
||||
os.path.join(BASE_CONFIG[sbase]["scripts_dir"], 'configure_postfix.sh'),
|
||||
os.path.join(BASE_CONFIG[sbase]["scripts_dir"], 'configure_postgresql.sh'),
|
||||
os.path.join(BASE_CONFIG[sbase]["scripts_dir"], 'configure_sqlite.sh'),
|
||||
os.path.join(BASE_CONFIG[sbase]["scripts_dir"], 'configure_ssh.sh'),
|
||||
os.path.join(BASE_CONFIG[sbase]["scripts_dir"], 'configure_static_ip.sh'),
|
||||
os.path.join(BASE_CONFIG[sbase]["scripts_dir"], 'create_user.sh'),
|
||||
os.path.join(BASE_CONFIG[sbase]["scripts_dir"], 'update_and_install.sh'),
|
||||
]
|
||||
|
||||
|
||||
des_paths = [
|
||||
'/usr/local/bin/welcome.sh',
|
||||
'/usr/local/bin/configure_apache2.sh',
|
||||
'/usr/local/bin/configure_firewalld.sh',
|
||||
'/usr/local/bin/configure_hostname.sh',
|
||||
'/usr/local/bin/configure_mariadb.sh',
|
||||
'/usr/local/bin/configure_nginx.sh',
|
||||
'/usr/local/bin/configure_php_and_docker.sh',
|
||||
'/usr/local/bin/configure_postfix.sh',
|
||||
'/usr/local/bin/configure_postgresql.sh',
|
||||
'/usr/local/bin/configure_sqlite.sh',
|
||||
'/usr/local/bin/configure_ssh.sh',
|
||||
'/usr/local/bin/configure_static_ip.sh',
|
||||
'/usr/local/bin/create_user.sh',
|
||||
'/usr/local/bin/update_and_install.sh',
|
||||
'/usr/local/bin',
|
||||
'/usr/local/bin',
|
||||
'/usr/local/bin',
|
||||
'/usr/local/bin',
|
||||
'/usr/local/bin',
|
||||
'/usr/local/bin',
|
||||
'/usr/local/bin',
|
||||
'/usr/local/bin',
|
||||
'/usr/local/bin',
|
||||
'/usr/local/bin',
|
||||
'/usr/local/bin',
|
||||
'/usr/local/bin',
|
||||
'/usr/local/bin',
|
||||
'/usr/local/bin',
|
||||
]
|
||||
|
||||
|
||||
src_q = collections.deque(src_paths)
|
||||
des_q = collections.deque(des_paths)
|
||||
|
||||
while src_q and des_q:
|
||||
src = src_q.popleft()
|
||||
des = des_q.popleft()
|
||||
src_path = os.path.join(HOME_FOLDER, src)
|
||||
des_path = os.path.join(HOME_FOLDER, des)
|
||||
|
||||
src_path = os.path.join(os.environ['HOME'], src)
|
||||
des_path = os.path.join(os.environ['HOME'], WPCHROOT, des)
|
||||
|
||||
logger.info(f"Copying {src_path} to {des_path}")
|
||||
try:
|
||||
shutil.copy2(src_path, des_path)
|
||||
|
@ -691,15 +693,6 @@ def server_config_files(sbase):
|
|||
else:
|
||||
logger.info(f"Successfully copied {src_path} to {des_path}")
|
||||
|
||||
logger.info(f"Configuring server for {sbase.capitalize()}")
|
||||
|
||||
if sbase == "debian":
|
||||
# Add Debian specific configuration logic here
|
||||
pass
|
||||
elif sbase == "devuan":
|
||||
# Add Devuan specific configuration logic here
|
||||
pass
|
||||
|
||||
def boostrap_shared():
|
||||
"""
|
||||
Copy specific folders in the boostrap location
|
||||
|
|
Loading…
Reference in New Issue