|
|
|
@ -143,17 +143,27 @@ def proxysql_common_argument_spec(): |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def save_config_to_disk(cursor, variable=None): |
|
|
|
|
def save_config_to_disk(cursor, save_what, variable=None): |
|
|
|
|
if variable and variable.startswith("admin"): |
|
|
|
|
cursor.execute("SAVE ADMIN VARIABLES TO DISK") |
|
|
|
|
config_type = "ADMIN" |
|
|
|
|
elif save_what == "SCHEDULER": |
|
|
|
|
config_type = "" |
|
|
|
|
else: |
|
|
|
|
cursor.execute("SAVE MYSQL VARIABLES TO DISK") |
|
|
|
|
config_type = "MYSQL" |
|
|
|
|
|
|
|
|
|
cursor.execute("SAVE {0} {1} TO DISK".format(config_type, save_what)) |
|
|
|
|
|
|
|
|
|
return True |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def load_config_to_runtime(cursor, variable=None): |
|
|
|
|
def load_config_to_runtime(cursor, save_what, variable=None): |
|
|
|
|
if variable and variable.startswith("admin"): |
|
|
|
|
cursor.execute("LOAD ADMIN VARIABLES TO RUNTIME") |
|
|
|
|
config_type = "ADMIN" |
|
|
|
|
elif save_what == "SCHEDULER": |
|
|
|
|
config_type = "" |
|
|
|
|
else: |
|
|
|
|
cursor.execute("LOAD MYSQL VARIABLES TO RUNTIME") |
|
|
|
|
config_type = "MYSQL" |
|
|
|
|
|
|
|
|
|
cursor.execute("LOAD {0} {1} TO RUNTIME".format(config_type, save_what)) |
|
|
|
|
|
|
|
|
|
return True |
|
|
|
|