From e234a2e57f881ce7819b8b6b370ece9ee9a8d4ef Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 20 Jun 2019 19:14:05 +0800 Subject: [PATCH] =?UTF-8?q?=E9=95=9C=E5=83=8F=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 37 +++++++++++++---------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 483a4ff3..161bc328 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -346,13 +346,13 @@ class ManagementsController < ApplicationController if mirror.blank? raise("choose_update_mirror exception") end - shixun_tomcat = Redmine::Configuration['shixun_tomcat'] - params = {imageName: mirror.name, imageID: old_id, flag: flag} - uri = "#{shixun_tomcat}/bridge/docker/updateImage" - res = uri_exec uri, params - if (res && res['code'] != 0) + #shixun_tomcat = Redmine::Configuration['shixun_tomcat'] + #params = {imageName: mirror.name, imageID: old_id, flag: flag} + #uri = "#{shixun_tomcat}/bridge/docker/updateImage" + #res = uri_exec uri, params + # if (res && res['code'] != 0) raise("choose_update_mirror exception") - end + #end if flag == 0 mirror.update_attributes(:mirrorID => change_id, :status => 0) # 用户操作的的行为需要记录 user_id, 中间层操作的行为user_id = -1 @@ -720,20 +720,25 @@ class ManagementsController < ApplicationController shixun_tomcat = Redmine::Configuration['shixun_tomcat'] params = {imageName: @mirror.name} # 主从节点同步镜像 - uri = "#{shixun_tomcat}/bridge/docker/syncImage" - res = uri_exec uri, params - if (res && res['code'] != 0) - raise("Synchronize Mirror exception") - end + #uri = "#{shixun_tomcat}/bridge/docker/syncImage" + #res = uri_exec uri, params + #if (res && res['code'] != 0) + # raise("Synchronize Mirror exception") + #end end if @_params[:type_name] != @mirror.type_name - MirrorOperationRecord.create!(:mirror_repository_id => @mirror.id, :status => 5, :user_id => User.current.id, :old_tag => @mirror.type_name, :new_tag => @_params[:type_name]) + MirrorOperationRecord.create!(:mirror_repository_id => @mirror.id, :status => 5, + :user_id => User.current.id, :old_tag => @mirror.type_name, + :new_tag => @_params[:type_name]) elsif @_params[:status].to_i != @mirror.status - MirrorOperationRecord.create!(:mirror_repository_id => @mirror.id, :status => 6, :user_id => User.current.id, :old_tag => @mirror.status, :new_tag => @_params[:status]) + MirrorOperationRecord.create!(:mirror_repository_id => @mirror.id, :status => 6, + :user_id => User.current.id, :old_tag => @mirror.status, + :new_tag => @_params[:status]) end - @mirror.update_attributes(:description => @_params[:description], :status => @_params[:status], :main_type => @_params[:mirror_type], - :type_name => @_params[:type_name], :resource_limit => @_params[:mirror_resource_limit], :cpu_limit => @_params[:mirror_cpu_limit], - :memory_limit => @_params[:mirror_memory_limit], :time_limit => @_params[:mirror_time_limit]) + @mirror.update_attributes(:description => @_params[:description], :status => @_params[:status], + :main_type => @_params[:mirror_type], :type_name => @_params[:type_name], + :resource_limit => @_params[:mirror_resource_limit], :cpu_limit => @_params[:mirror_cpu_limit], + :memory_limit => @_params[:mirror_memory_limit], :time_limit => @_params[:mirror_time_limit]) @index = MirrorRepository.order("created_at desc").map(&:id).index(@mirror.id) respond_to do |format| format.js