From 2191946088a2cc798ba5b1fa7a3b766ed0eceaf4 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 28 Aug 2019 16:48:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index d9ab31b8d..38b4bea4d 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -348,7 +348,8 @@ class ShixunsController < ApplicationController sub_type.each do |mirror| ShixunMirrorRepository.create!(:shixun_id => @shixun.id, :mirror_repository_id => mirror) # 实训子镜像服务配置 - ShixunServiceConfig.create!(:shixun_id => @shixun.id, :mirror_repository_id => mirror) + name = MirrorRepository.find_by(id: mirror).try(:name) #查看镜像是否有名称,如果没有名称就不用服务配置 + ShixunServiceConfig.create!(:shixun_id => @shixun.id, :mirror_repository_id => mirror) if name.present? end end @@ -422,6 +423,7 @@ class ShixunsController < ApplicationController # 超级管理员和运营人员才能保存 中间层服务器pod信息的配置 if current_user.admin? || current_user.business? @shixun.shixun_service_configs.destroy_all + logger.info("######service_config_params[:shixun_service_configs]:#{service_config_params[:shixun_service_configs]}") @shixun.shixun_service_configs.create!(service_config_params[:shixun_service_configs]) end rescue Exception => e