change: 优化helm chart的k8s-init.sh和core-webui-cm-sync.py的输出
This commit is contained in:
@@ -43,8 +43,8 @@ class ConfigObserverHandler(FileSystemEventHandler):
|
|||||||
"""配置文件变化的事件处理器"""
|
"""配置文件变化的事件处理器"""
|
||||||
def on_modified(self, event):
|
def on_modified(self, event):
|
||||||
if os.path.abspath(event.src_path) in target_files:
|
if os.path.abspath(event.src_path) in target_files:
|
||||||
print(
|
print(f'[{datetime.now().strftime("%Y-%m-%d %H:%M:%S")}] File `{event.src_path}` was modified. '
|
||||||
f'[{datetime.now().strftime("%Y-%m-%d %H:%M:%S")}] File `{event.src_path}` was modified. Start to sync...')
|
f'Start to sync...')
|
||||||
with open(event.src_path, "r", encoding="utf-8") as _f:
|
with open(event.src_path, "r", encoding="utf-8") as _f:
|
||||||
current_data = _f.read()
|
current_data = _f.read()
|
||||||
new_cm = {
|
new_cm = {
|
||||||
@@ -52,6 +52,7 @@ class ConfigObserverHandler(FileSystemEventHandler):
|
|||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
set_configmap(new_cm)
|
set_configmap(new_cm)
|
||||||
|
print(f'\tSync done.')
|
||||||
except client.exceptions.ApiException as _e:
|
except client.exceptions.ApiException as _e:
|
||||||
print(f'\tError while setting configmap:\n'
|
print(f'\tError while setting configmap:\n'
|
||||||
f'\t\tStatus Code: {_e.status}\n'
|
f'\t\tStatus Code: {_e.status}\n'
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ mkdir -p /MaiMBot/data/plugins
|
|||||||
mkdir -p /MaiMBot/data/logs
|
mkdir -p /MaiMBot/data/logs
|
||||||
if [ ! -d "/MaiMBot/statistics" ]
|
if [ ! -d "/MaiMBot/statistics" ]
|
||||||
then
|
then
|
||||||
echo "[K8s Init] Statistics volume disabled."
|
echo "[K8s Init] Statistics volume is disabled."
|
||||||
else
|
else
|
||||||
touch /MaiMBot/statistics/index.html
|
touch /MaiMBot/statistics/index.html
|
||||||
fi
|
fi
|
||||||
@@ -47,7 +47,7 @@ then
|
|||||||
ln -s /MaiMBot/webui-cm-sync/bot_config.toml /MaiMBot/config/bot_config.toml
|
ln -s /MaiMBot/webui-cm-sync/bot_config.toml /MaiMBot/config/bot_config.toml
|
||||||
echo "[K8s Init] Config files middle layer for WebUI created."
|
echo "[K8s Init] Config files middle layer for WebUI created."
|
||||||
else
|
else
|
||||||
echo "[K8s Init] WebUI disabled."
|
echo "[K8s Init] WebUI is disabled."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 启动麦麦
|
# 启动麦麦
|
||||||
|
|||||||
Reference in New Issue
Block a user