added output flush
This commit is contained in:
parent
f1fd7f3802
commit
728f35b52c
|
@ -48,7 +48,7 @@ class SyncthingMonitor:
|
|||
api_key = xml.parse_api_key(self.syncthing_config_xml_path)
|
||||
print("Found API Key: {0}".format(api_key))
|
||||
|
||||
print("Configuring Syncthing to listen on 0.0.0.0...")
|
||||
print("Configuring Syncthing to listen on 0.0.0.0...", flush=True)
|
||||
xml.set_listen_ip_to_any(self.syncthing_config_xml_path,
|
||||
self.syncthing_config_xml_path,
|
||||
self.syncthing_gui_port)
|
||||
|
@ -60,7 +60,7 @@ class SyncthingMonitor:
|
|||
self.initialize_syncthing()
|
||||
|
||||
self.my_device_id = self.syncthing.get_my_device_id()
|
||||
print("Found My Device ID: {0}".format(self.my_device_id))
|
||||
print("Found My Device ID: {0}".format(self.my_device_id), flush=True)
|
||||
|
||||
self.syncthing.disable_announce_discovery_and_relay()
|
||||
self.syncthing.create_shared_folder(SHARED_FOLDER_ID, SHARED_FOLDER_LABEL, self.syncthing_data_path,
|
||||
|
|
|
@ -33,13 +33,13 @@ class EtcdClient:
|
|||
|
||||
cluster_info['devices'].append(new_device)
|
||||
|
||||
print("Updating etcd value for '{0}': {1}".format(self.key, json.dumps(cluster_info)))
|
||||
print("Updating etcd value for '{0}': {1}".format(self.key, json.dumps(cluster_info)), flush=True)
|
||||
self.etcd.put(self.key, json.dumps(cluster_info))
|
||||
|
||||
@retry
|
||||
def get_device_list(self):
|
||||
device_list = self.load_cluster_info()['devices']
|
||||
print("Obtained device_list devices from etcd: {0}".format(json.dumps(device_list)))
|
||||
print("Obtained device_list devices from etcd: {0}".format(json.dumps(device_list)), flush=True)
|
||||
return device_list
|
||||
|
||||
def register_device_update_handler(self, device_update_handler):
|
||||
|
|
|
@ -50,7 +50,7 @@ class SyncthingClient:
|
|||
"maxRequestKiB": 0
|
||||
}
|
||||
response = self.post("/rest/config/devices", json.dumps(post_data))
|
||||
print("Attempt to add device {0} to syncthing: {1}".format(device, response.content))
|
||||
print("Attempt to add device {0} to syncthing: {1}".format(device, response.content), flush=True)
|
||||
|
||||
def create_shared_folder(self, folder_id, label, path, devices):
|
||||
post_data = {
|
||||
|
@ -100,18 +100,18 @@ class SyncthingClient:
|
|||
post_data['devices'].append(folder_device)
|
||||
|
||||
response = self.post("/rest/config/folders", json.dumps(post_data))
|
||||
print("Attempt to add shared folder to syncthing: {0}".format(response.content))
|
||||
print("Attempt to add shared folder to syncthing: {0}".format(response.content), flush=True)
|
||||
|
||||
@retry
|
||||
def print_config(self):
|
||||
response = self.get("/rest/config/devices")
|
||||
print("/rest/config/devices: {0}".format(response.content))
|
||||
print("/rest/config/devices: {0}".format(response.content), flush=True)
|
||||
|
||||
response = self.get("/rest/config/folders")
|
||||
print("/rest/config/folders: {0}".format(response.content))
|
||||
print("/rest/config/folders: {0}".format(response.content), flush=True)
|
||||
|
||||
response = self.get("/rest/config/options")
|
||||
print("/rest/config/options: {0}".format(response.content))
|
||||
print("/rest/config/options: {0}".format(response.content), flush=True)
|
||||
|
||||
@retry
|
||||
def config_is_in_sync(self):
|
||||
|
@ -121,7 +121,7 @@ class SyncthingClient:
|
|||
@retry
|
||||
def restart(self):
|
||||
response = self.post("/rest/system/restart", '')
|
||||
print("System reset: {0}".format(response.content))
|
||||
print("System reset: {0}".format(response.content), flush=True)
|
||||
|
||||
def sync_config(self):
|
||||
if not self.config_is_in_sync():
|
||||
|
@ -135,7 +135,7 @@ class SyncthingClient:
|
|||
"announceLANAddresses": False,
|
||||
}
|
||||
response = self.patch("/rest/config/options", json.dumps(config_patch))
|
||||
print("Patched syncthing configuration: {0}".format(response.content))
|
||||
print("Patched syncthing configuration: {0}".format(response.content), flush=True)
|
||||
|
||||
def make_url(self, endpoint):
|
||||
return "http://{0}:{1}{2}".format(self.host, self.port, endpoint)
|
||||
|
|
Loading…
Reference in New Issue
Block a user