2021-01-28 13:31:25 +00:00
|
|
|
from syncthing_monitor.config_xml import parse_api_key, set_listen_ip_to_any
|
2021-01-29 09:59:59 +00:00
|
|
|
from syncthing_monitor.etcd_cluster_info import append_device_id, get_device_list
|
|
|
|
from syncthing_monitor.syncthing_rest import get_device_id, print_debug_info, post_devices
|
2021-01-28 10:56:11 +00:00
|
|
|
|
|
|
|
|
2021-01-28 13:31:25 +00:00
|
|
|
def loop(gui_port="8384", host="sync"):
|
2021-01-28 10:56:11 +00:00
|
|
|
api_key = parse_api_key()
|
|
|
|
print("Found API Key: {0}".format(api_key))
|
|
|
|
|
2021-01-28 13:31:25 +00:00
|
|
|
set_listen_ip_to_any()
|
|
|
|
|
|
|
|
device_id = get_device_id(host, gui_port, api_key)
|
|
|
|
print("Found Device ID: {0}".format(device_id))
|
|
|
|
|
2021-01-29 08:28:35 +00:00
|
|
|
append_device_id(device_id, 'etcd')
|
2021-01-29 09:59:59 +00:00
|
|
|
device_ids = get_device_list('etcd')
|
|
|
|
post_devices(device_ids, host, gui_port, api_key)
|
|
|
|
print_debug_info(host, gui_port, api_key)
|
2021-01-29 08:28:35 +00:00
|
|
|
|
2021-01-28 10:56:11 +00:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
loop()
|