Fix bug,
This commit is contained in:
parent
d26b93d039
commit
a27f26bfc1
|
@ -338,11 +338,13 @@ class Admin::SitePanelController < OrbitAdminController
|
||||||
idx = cmds.index('{{create_super_manager}}')
|
idx = cmds.index('{{create_super_manager}}')
|
||||||
cmds[idx] = create_super_manager_cmd(params[:account],params[:password])
|
cmds[idx] = create_super_manager_cmd(params[:account],params[:password])
|
||||||
end
|
end
|
||||||
|
exec_commands_args = {}
|
||||||
if params[:id].blank? && !params[:server_names].blank?
|
if params[:id].blank? && !params[:server_names].blank?
|
||||||
Rake::Task['exec_commands:exec_commands'].execute(Rake::TaskArguments.new([:commands, :type, :server_name], [cmds.join('////'), 'exec_all', params[:server_names].join('////')]))
|
exec_commands_args = {:commands=>cmds.join('////'), :type=>'exec_all', :server_name=>params[:server_names].join('////')}
|
||||||
else
|
else
|
||||||
Rake::Task['exec_commands:exec_commands'].execute(Rake::TaskArguments.new([:site_construct_id, :commands, :type], [params[:id], cmds.join('////'), 'exec_commands']))
|
exec_commands_args = {:site_construct_id=>params[:id], :commands=>cmds.join('////'), :type=>'exec_commands'}
|
||||||
end
|
end
|
||||||
|
system("bundle exec rake exec_commands:exec_commands[\"#{Base64.strict_encode64(exec_commands_args.to_json)}\"]")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
render :json =>{"success"=>true}
|
render :json =>{"success"=>true}
|
||||||
|
|
|
@ -1,8 +1,14 @@
|
||||||
require 'net/ssh'
|
require 'net/ssh'
|
||||||
require 'pathname'
|
require 'pathname'
|
||||||
|
require 'json'
|
||||||
|
require 'base64'
|
||||||
namespace :exec_commands do
|
namespace :exec_commands do
|
||||||
desc "Exec commands Script"
|
desc "Exec commands Script"
|
||||||
task :exec_commands,[:site_construct_id,:commands,:type,:server_name,:rails_env] => :environment do |task,args|
|
task :exec_commands,[:base64_args,:site_construct_id,:commands,:type,:server_name,:rails_env] => :environment do |task,args|
|
||||||
|
if args.base64_args.present?
|
||||||
|
tmp = JSON.parse(Base64.decode64(args.base64_args)) rescue {}
|
||||||
|
args = Rake::TaskArguments.new(tmp.keys, tmp.values)
|
||||||
|
end
|
||||||
@type = args.type
|
@type = args.type
|
||||||
if !args.site_construct_id.blank?
|
if !args.site_construct_id.blank?
|
||||||
@site_construct = SiteConstruct.find(args.site_construct_id)
|
@site_construct = SiteConstruct.find(args.site_construct_id)
|
||||||
|
|
Loading…
Reference in New Issue