I was meant to fix it from the start
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s
This commit is contained in:
@@ -54,9 +54,9 @@ def Give_current_hour():
|
|||||||
|
|
||||||
def Check_server_supposed_XXX(generated_db_in,wanted_status,Wanted_hour,Wanted_day):
|
def Check_server_supposed_XXX(generated_db_in,wanted_status,Wanted_hour,Wanted_day):
|
||||||
sql_in=""
|
sql_in=""
|
||||||
if wanted_status == "up" or wanted_status == "start":
|
if wanted_status == "up":
|
||||||
sql_in = "select machine.namespace, machine.name, machine.replicas from scenario_hour,machine ,scenario_day_of_week where state_at_" + str(Wanted_hour) + "='1' and state_" + str(Wanted_day) + "='1' and machine.hour_behaviour_id=scenario_hour.id_scenario and machine.day_behaviour_id=scenario_day_of_week.id_scenario;"
|
sql_in = "select machine.namespace, machine.name, machine.replicas from scenario_hour,machine ,scenario_day_of_week where state_at_" + str(Wanted_hour) + "='1' and state_" + str(Wanted_day) + "='1' and machine.hour_behaviour_id=scenario_hour.id_scenario and machine.day_behaviour_id=scenario_day_of_week.id_scenario;"
|
||||||
elif wanted_status == "down" or wanted_status == "stop":
|
elif wanted_status == "down":
|
||||||
sql_in = "select machine.namespace, machine.name, machine.replicas from scenario_hour,machine where state_at_" + str(Wanted_hour) + "='0' and machine.hour_behaviour_id=scenario_hour.id_scenario;"
|
sql_in = "select machine.namespace, machine.name, machine.replicas from scenario_hour,machine where state_at_" + str(Wanted_hour) + "='0' and machine.hour_behaviour_id=scenario_hour.id_scenario;"
|
||||||
else:
|
else:
|
||||||
print("error value")
|
print("error value")
|
||||||
@@ -79,9 +79,9 @@ def all_operations(request,wanted_state,list_machine):
|
|||||||
print(machine_target[1])
|
print(machine_target[1])
|
||||||
|
|
||||||
info_to_display = ""
|
info_to_display = ""
|
||||||
if wanted_state == "running":
|
if wanted_state == "up":
|
||||||
kubernetes_connection.scale_up(request,namespace_name=machine_target[0],deploy_name=machine_target[1],replicas=machine_target[2]);
|
kubernetes_connection.scale_up(request,namespace_name=machine_target[0],deploy_name=machine_target[1],replicas=machine_target[2]);
|
||||||
elif wanted_state == "stopped":
|
elif wanted_state == "down":
|
||||||
kubernetes_connection.scale_down(request,namespace_name=machine_target[0],deploy_name=machine_target[1],replicas=machine_target[2]);
|
kubernetes_connection.scale_down(request,namespace_name=machine_target[0],deploy_name=machine_target[1],replicas=machine_target[2]);
|
||||||
else:
|
else:
|
||||||
print("Incorrect wanted state")
|
print("Incorrect wanted state")
|
||||||
@@ -115,7 +115,7 @@ def main(request):
|
|||||||
print("-----------------UP-----------------------")
|
print("-----------------UP-----------------------")
|
||||||
print("------------------------------------------")
|
print("------------------------------------------")
|
||||||
print(list_servers_up)
|
print(list_servers_up)
|
||||||
print(all_operations(request,"running", list_servers_up))
|
print(all_operations(request,"up", list_servers_up))
|
||||||
|
|
||||||
|
|
||||||
## Server(s) supposed to be DOWN
|
## Server(s) supposed to be DOWN
|
||||||
@@ -125,7 +125,7 @@ def main(request):
|
|||||||
print("----------------DOWN----------------------")
|
print("----------------DOWN----------------------")
|
||||||
print("------------------------------------------")
|
print("------------------------------------------")
|
||||||
print(list_servers_down)
|
print(list_servers_down)
|
||||||
print(all_operations("stopped",list_servers_down))
|
print(all_operations("down",list_servers_down))
|
||||||
|
|
||||||
|
|
||||||
# disconnect from server
|
# disconnect from server
|
||||||
|
|||||||
Reference in New Issue
Block a user