forked from wangbo/easyai
fix(deploy): 恢复已有覆盖文件中的目标镜像
This commit is contained in:
@@ -44,7 +44,15 @@ allowed = {'scripts/init-security-env.sh'}
|
||||
if any(p not in allowed and not (Path(p).parent == Path('.') and p.endswith('.conf')) for p in collisions):
|
||||
sys.exit('❌ 存在新版仓库会覆盖的其他本地文件;尚未修改配置或容器')
|
||||
if not changed and not collisions:
|
||||
sys.exit(0)
|
||||
existing_override_path = root / 'data/deployment-config/legacy-compose.json'
|
||||
restore_existing_pin = False
|
||||
if restore_images and existing_override_path.exists():
|
||||
if existing_override_path.is_symlink() or not existing_override_path.is_file():
|
||||
sys.exit('❌ 旧配置覆盖文件类型不受支持;尚未修改配置或容器')
|
||||
existing_override = json.loads(existing_override_path.read_text())
|
||||
restore_existing_pin = any('image' in existing_override.get('services', {}).get(service, {}) for service in restore_images)
|
||||
if not restore_existing_pin:
|
||||
sys.exit(0)
|
||||
for name in changed | collisions:
|
||||
if not (root / name).is_file() or (root / name).is_symlink():
|
||||
sys.exit('❌ 配置文件类型不受支持;尚未修改配置或容器')
|
||||
|
||||
Reference in New Issue
Block a user