dev done license

This commit is contained in:
Yan
2017-11-20 19:15:32 +06:30
parent b046086ea4
commit 22b5421603
2 changed files with 52 additions and 6 deletions

View File

@@ -74,7 +74,7 @@ class License
def detail_with_local_file()
has_license = verify_license()
has_license = true # verify_license()
if has_license
puts "VERIFIED"
@@ -95,7 +95,7 @@ class License
sym_path = "/home/yan/symmetric/"
response = create_symmetric_config(sym_path, db_host, db_schema, db_user, db_password)
if(response["status"])
run_symmetric(sym_path)
response = run_symmetric(sym_path)
end
end
else
@@ -238,7 +238,53 @@ class License
# Run Symmetric
def run_symmetric(sym_path)
check_sym_proc = system(sym_path)
check_sym_proc_str = `#{sym_path + "bin/sym_service status"}`
check_sym_proc_str = check_sym_proc_str.split("\n")
sym_install_status = check_sym_proc_str[0].split(": ")
# sym_run_status = check_sym_proc_str[1].split(": ")
# Check Sym Installed
if sym_install_status[1] == "false"
response = { "status": false, "message": "Activation is success but Symmetric service not Installed. \n Please contact code2lab call center!"}
end
# Run Sym Service
sym_run_status = check_sym_running(check_sym_proc_str[1], sym_path)
if sym_run_status
# Create Sym Table
check_sym_table = system(sym_path + "bin/symadmin --engine sx create-sym-tables")
if check_sym_table
sym_sql = Rails.root + "db/sym_master.sql"
if File.exist? (sym_sql)
# Import Sym Sql to db and start sym
run_sym_sql = system(sym_path + "bin/dbimport --engine sx " + sym_sql)
run_sym = system(sym_path + "bin/sym")
if run_sym
response = { "status": true, "message": "Activation is success and Configuration done..."}
end
else
response = { "status": false, "message": "Activation is success but Symmetric Sql not Found. \n Please contact code2lab call center!"}
end
end
end
end
# Check Symmetric Running
def check_sym_running(status, sym_path)
# Run Sym Service
if status.include? "Server is already running"
return true
elsif status.include? "false"
sym_start_str = `#{sym_path + "bin/sym_service start"}`
if sym_start_str.include? "Started"
return true
else
check_sym_running(sym_start_status[0])
end
else
return true
end
end
# Delete License File

View File

@@ -82,10 +82,10 @@ delete from sym_node;
# Create Node Groups and Links
insert into sym_node_group (node_group_id) values ('sx');
insert into sym_node_group (node_group_id) values ('store');
insert into sym_node_group (node_group_id) values ('cloud');
insert into sym_node_group_link (source_node_group_id, target_node_group_id, data_event_action) values ('sx', 'store', 'W');
insert into sym_node_group_link (source_node_group_id, target_node_group_id, data_event_action) values ('store', 'sx', 'P');
insert into sym_node_group_link (source_node_group_id, target_node_group_id, data_event_action) values ('sx', 'cloud', 'W');
insert into sym_node_group_link (source_node_group_id, target_node_group_id, data_event_action) values ('cloud', 'sx', 'P');
# Create Trigger for Setting Channel