diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index f75dd7147..84ceacd26 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -400,13 +400,14 @@ class ShixunsController < ApplicationController @shixun.shixun_info.update_attributes(shixun_info_params) # 镜像变动 @shixun.shixun_mirror_repositories.where.not(mirror_repository_id: old_mirror_ids).destroy_all - @shixun.shixun_mirror_repositories.create!(new_mirror_id) + @shixun.shixun_mirror_repositories.create!(new_mirror_id) if new_mirror_id.present? # 镜像变动要更换服务配置 @shixun.shixun_service_configs.where.not(mirror_repository_id: old_mirror_ids).destroy_all - @shixun.shixun_service_configs.create!(service_create_params) + @shixun.shixun_service_configs.create!(service_create_params) if service_create_params.present? service_update_params&.map do |service| smr = @shixun.shixun_service_configs.find_by(mirror_repository_id: service[:mirror_repository_id]) - smr.update_attributes(service) + logger.info("########smr: #{smr}") + smr.update_attributes(service) if smr.present? end # 添加第二仓库(管理员权限) if params[:is_secret_repository]