Module: DataCenterActionHelper

Defined in:
lib/action/module/datacenter_action.rb

Instance Method Summary collapse

Instance Method Details

#module_prepare(datacenter, mdl) ⇒ Object

mdl_friend = ModuleHouse.get_instance.get_by_name “friend” datacenter = DCHouse.get_instance.get_by_name “datacenter” new_conf =

"adr"=>datacenter["host"],
"username"=>datacenter["db01"]["dbuser"],
"port"=>datacenter["db01"]["dbport"],
"passwd"=>datacenter["db01"]["dbpass"],
"dbname"=>mdl_friend["dbname"],
"dbport"=>datacenter["db01"]["dbport"]

MoudleHouse.get_instance.set_new_conf(mdl_friend, new_conf) module_prepare datacenter, mdl_friend


26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/action/module/datacenter_action.rb', line 26

def module_prepare datacenter, mdl	
	if mdl["recoversql"] == 1
		if mdl["dbversion"] == "5.1.30"
			ssh_cmd datacenter["host"], datacenter["user"], datacenter["pass"], "#{datacenter["db01"]["dbpath"]}/bin/mysql -u#{datacenter["db01"]["dbuser"]} -p#{datacenter["db01"]["dbpass"]} #{mdl["dbname"]} < #{datacenter["datacenterpath"]}/#{mdl["basesql"]}"
		end
		if mdl["dbversion"] == "5.22"
			ssh_cmd datacenter["host"], datacenter["user"], datacenter["pass"], "#{datacenter["db02"]["dbpath"]}/bin/mysql -u#{datacenter["db02"]["dbuser"]} -p#{datacenter["db02"]["dbpass"]} #{mdl["dbname"]} < #{datacenter["datacenterpath"]}/#{mdl["basesql"]}"
		end
	end
	if mdl["recoverdata"] == 1
		ssh_cmd datacenter["host"], datacenter["user"], datacenter["pass"], "H #{mdl["h_name"]} -pub #{datacenter["datacenterpath"]}/#{mdl["basedata"]} #{datacenter["datadownloadto"]}"
	end
end