Fix bug.
This commit is contained in:
parent
4f6f07280a
commit
d3328cf9b4
|
@ -317,6 +317,7 @@ class Admin::SitePanelController < OrbitAdminController
|
||||||
db_name = site_construct.db_name
|
db_name = site_construct.db_name
|
||||||
path = site_construct.path
|
path = site_construct.path
|
||||||
site_construct_id = params[:id]
|
site_construct_id = params[:id]
|
||||||
|
site_construct.update(:status => "creating")
|
||||||
if site_construct.copy_id
|
if site_construct.copy_id
|
||||||
Thread.new do
|
Thread.new do
|
||||||
system("bundle exec rake create_site:copy_site['#{ip}','#{server_port}','#{user}','#{password}','#{site_name}','#{domain_name}','#{port}','#{db_name}','#{path}','#{site_construct_id}','#{site_construct.copy_id}',#{site_construct.only_copy_installed_module}]")
|
system("bundle exec rake create_site:copy_site['#{ip}','#{server_port}','#{user}','#{password}','#{site_name}','#{domain_name}','#{port}','#{db_name}','#{path}','#{site_construct_id}','#{site_construct.copy_id}',#{site_construct.only_copy_installed_module}]")
|
||||||
|
@ -331,6 +332,8 @@ class Admin::SitePanelController < OrbitAdminController
|
||||||
def edit_site
|
def edit_site
|
||||||
case params[:type]
|
case params[:type]
|
||||||
when 'delete'
|
when 'delete'
|
||||||
|
@site_construct = SiteConstruct.find(params[:id])
|
||||||
|
@site_construct.update(:status => "deleting")
|
||||||
Thread.new do
|
Thread.new do
|
||||||
system("bundle exec rake create_site:delete_site[#{params[:id]}]")
|
system("bundle exec rake create_site:delete_site[#{params[:id]}]")
|
||||||
end
|
end
|
||||||
|
|
|
@ -226,12 +226,8 @@
|
||||||
"</div>");
|
"</div>");
|
||||||
}else{
|
}else{
|
||||||
$("#info_texts").html("Do you really want to "+_this.attr('title')+".");
|
$("#info_texts").html("Do you really want to "+_this.attr('title')+".");
|
||||||
if($('#confirm_input').length == 0){
|
$('#confirm_input').remove();
|
||||||
$('#info_texts').after("<input id=\"confirm_input\"/ placeholder=\"<%= t('client_management.please_input_confirm_recreate') %>\" style=\"width: 17em;\">");
|
$('#info_texts').after("<input id=\"confirm_input\"/ placeholder=\"<%= t('client_management.please_input_confirm_recreate') %>\" style=\"width: 17em;\">");
|
||||||
}else{
|
|
||||||
$('#confirm_input').css('display','block');
|
|
||||||
$('#confirm_input').val('');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$( "#dialog-confirm" ).dialog({
|
$( "#dialog-confirm" ).dialog({
|
||||||
resizable: true,
|
resizable: true,
|
||||||
|
@ -285,12 +281,8 @@
|
||||||
"</div>");
|
"</div>");
|
||||||
}else{
|
}else{
|
||||||
$("#info_texts").html("Do you really want to "+$(this).attr('title')+".");
|
$("#info_texts").html("Do you really want to "+$(this).attr('title')+".");
|
||||||
if($('#confirm_input').length == 0){
|
$('#confirm_input').remove();
|
||||||
$('#info_texts').after("<input id=\"confirm_input\"/ placeholder=\"<%= t('client_management.please_input_confirm_delete') %>\" style=\"width: 17em;\">");
|
$('#info_texts').after("<input id=\"confirm_input\"/ placeholder=\"<%= t('client_management.please_input_confirm_delete') %>\" style=\"width: 17em;\">");
|
||||||
}else{
|
|
||||||
$('#confirm_input').css('display','block');
|
|
||||||
$('#confirm_input').val('');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$( "#dialog-confirm" ).dialog({
|
$( "#dialog-confirm" ).dialog({
|
||||||
resizable: true,
|
resizable: true,
|
||||||
|
|
|
@ -48,9 +48,8 @@ namespace :create_site do
|
||||||
extra_exclude_path = ",public/uploads/"
|
extra_exclude_path = ",public/uploads/"
|
||||||
end
|
end
|
||||||
server = SiteServer.where(:server_name => template_site.server_type).first
|
server = SiteServer.where(:server_name => template_site.server_type).first
|
||||||
update_infos("Copying site's files for #{args.site_name}!")
|
ls_out = exec_ssh_command_for_copy(ssh, "if [ ! -d \"#{@site_construct.full_site_path}/app\" ]; then echo 'No such file or directory: #{@site_construct.full_site_path}/app'; fi", false).join("\n")
|
||||||
ls_out = exec_ssh_command_for_copy(ssh, "ls #{@site_construct.full_site_path}/app", false).join("\n")
|
if ls_out.include?("No such file or directory") || org_creating
|
||||||
if ls_out.include?("No such") || org_creating
|
|
||||||
if @site_construct.server_type == template_site.server_type
|
if @site_construct.server_type == template_site.server_type
|
||||||
exec_ssh_command_for_copy(ssh,"rsync -ar --info=progress2 --no-inc-recursive --delete --exclude={tmp/cache/,tmp/unicorn.sock,tmp/pids/*#{extra_exclude_path}} #{template_site.path}/#{template_site.get_site_name}/ #{args.path}/#{@site_construct.get_site_name}/",true)
|
exec_ssh_command_for_copy(ssh,"rsync -ar --info=progress2 --no-inc-recursive --delete --exclude={tmp/cache/,tmp/unicorn.sock,tmp/pids/*#{extra_exclude_path}} #{template_site.path}/#{template_site.get_site_name}/ #{args.path}/#{@site_construct.get_site_name}/",true)
|
||||||
else
|
else
|
||||||
|
@ -141,9 +140,12 @@ namespace :create_site do
|
||||||
end
|
end
|
||||||
def exec_ssh_command_for_copy(session,command,update_outputs=false)
|
def exec_ssh_command_for_copy(session,command,update_outputs=false)
|
||||||
outputs = []
|
outputs = []
|
||||||
|
if update_outputs
|
||||||
|
update_infos_for_exec("")
|
||||||
|
end
|
||||||
session.open_channel do |channel|
|
session.open_channel do |channel|
|
||||||
channel.request_pty do |channel, success|
|
channel.request_pty do |channel, success|
|
||||||
channel.exec("LANG=en.UTF8 #{command}") do |ch, success|
|
channel.exec("LANG=en.UTF8 && #{command}") do |ch, success|
|
||||||
abort "could not execute command: #{command}" unless success
|
abort "could not execute command: #{command}" unless success
|
||||||
channel.on_data do |ch, data|
|
channel.on_data do |ch, data|
|
||||||
data_str = data.to_s
|
data_str = data.to_s
|
||||||
|
|
|
@ -110,9 +110,12 @@ namespace :create_site do
|
||||||
end
|
end
|
||||||
def exec_ssh_command_for_create(session,command,update_outputs=false)
|
def exec_ssh_command_for_create(session,command,update_outputs=false)
|
||||||
outputs = []
|
outputs = []
|
||||||
|
if update_outputs
|
||||||
|
update_infos_for_exec("")
|
||||||
|
end
|
||||||
session.open_channel do |channel|
|
session.open_channel do |channel|
|
||||||
channel.request_pty do |channel, success|
|
channel.request_pty do |channel, success|
|
||||||
channel.exec("LANG=en.UTF8 #{command}") do |ch, success|
|
channel.exec("LANG=en.UTF8 && #{command}") do |ch, success|
|
||||||
abort "could not execute command: #{command}" unless success
|
abort "could not execute command: #{command}" unless success
|
||||||
channel.on_data do |ch, data|
|
channel.on_data do |ch, data|
|
||||||
data_str = data.to_s
|
data_str = data.to_s
|
||||||
|
|
Loading…
Reference in New Issue