Fix bug.
This commit is contained in:
parent
9cbf30c14a
commit
3d871aec8f
|
@ -20,6 +20,7 @@ namespace :create_site do
|
||||||
@site_construct = SiteConstruct.find(args.site_construct_id)
|
@site_construct = SiteConstruct.find(args.site_construct_id)
|
||||||
end
|
end
|
||||||
begin
|
begin
|
||||||
|
org_creating = (@site_construct.status == "creating")
|
||||||
@site_construct.update(:status=>"creating")
|
@site_construct.update(:status=>"creating")
|
||||||
@site_construct.update!(:infos=>[])
|
@site_construct.update!(:infos=>[])
|
||||||
begin
|
begin
|
||||||
|
@ -48,7 +49,7 @@ namespace :create_site do
|
||||||
end
|
end
|
||||||
server = SiteServer.where(:server_name => template_site.server_type).first
|
server = SiteServer.where(:server_name => template_site.server_type).first
|
||||||
ls_out = exec_ssh_command_for_create(ssh, "ls #{@site_construct.full_site_path}/app").join("\n")
|
ls_out = exec_ssh_command_for_create(ssh, "ls #{@site_construct.full_site_path}/app").join("\n")
|
||||||
if ls_out.include?("No such")
|
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_create(ssh,"rsync -arv --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_create(ssh,"rsync -arv --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
|
||||||
|
|
|
@ -132,11 +132,17 @@ namespace :create_site do
|
||||||
end
|
end
|
||||||
return outputs.join("\n")
|
return outputs.join("\n")
|
||||||
end
|
end
|
||||||
def update_infos_for_exec(info,update_last=false)
|
def update_infos_for_exec(info,update_last=false,update_array=false)
|
||||||
|
return if @site_construct.nil?
|
||||||
|
info.encode!("UTF-8", :invalid => :replace, :undef => :replace, :replace => '')
|
||||||
if update_last && !@site_construct.infos.empty?
|
if update_last && !@site_construct.infos.empty?
|
||||||
@site_construct.infos[-1] += info
|
@site_construct.infos[-1] += info.to_s
|
||||||
else
|
else
|
||||||
@site_construct.infos = @site_construct.infos.push(info)
|
if update_array
|
||||||
|
@site_construct.infos += info
|
||||||
|
else
|
||||||
|
@site_construct.infos.push(info.to_s)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
@site_construct.save!
|
@site_construct.save!
|
||||||
return @site_construct.infos
|
return @site_construct.infos
|
||||||
|
|
|
@ -158,6 +158,7 @@ namespace :exec_commands do
|
||||||
end
|
end
|
||||||
def update_infos_for_exec(info,update_last=false,update_array=false)
|
def update_infos_for_exec(info,update_last=false,update_array=false)
|
||||||
return if @site_construct.nil?
|
return if @site_construct.nil?
|
||||||
|
info.encode!("UTF-8", :invalid => :replace, :undef => :replace, :replace => '')
|
||||||
if update_last && !@site_construct.infos.empty?
|
if update_last && !@site_construct.infos.empty?
|
||||||
@site_construct.infos[-1] += info.to_s
|
@site_construct.infos[-1] += info.to_s
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue