removed retry annotations for better debugging

This commit is contained in:
B.J. Dweck 2021-02-02 11:53:59 +02:00
parent cd646e2089
commit b647bcf9f6
3 changed files with 0 additions and 12 deletions

View File

@ -2,8 +2,6 @@ import os
import sys import sys
import time import time
from retrying import retry
import syncthing_monitor.config_xml as xml import syncthing_monitor.config_xml as xml
from .etcd_client import EtcdClient from .etcd_client import EtcdClient
from .syncthing_client import SyncthingClient from .syncthing_client import SyncthingClient
@ -43,7 +41,6 @@ class SyncthingMonitor:
self.syncthing_local_hostname = syncthing_local_hostname self.syncthing_local_hostname = syncthing_local_hostname
self.syncthing_config_xml_path = syncthing_config_xml_path self.syncthing_config_xml_path = syncthing_config_xml_path
@retry
def initialize_syncthing(self): def initialize_syncthing(self):
api_key = xml.parse_api_key(self.syncthing_config_xml_path) api_key = xml.parse_api_key(self.syncthing_config_xml_path)
print("Found API Key: {0}".format(api_key)) print("Found API Key: {0}".format(api_key))
@ -55,7 +52,6 @@ class SyncthingMonitor:
self.syncthing = SyncthingClient(api_key, self.syncthing_local_hostname, self.syncthing_gui_port) self.syncthing = SyncthingClient(api_key, self.syncthing_local_hostname, self.syncthing_gui_port)
@retry
def start(self): def start(self):
self.initialize_syncthing() self.initialize_syncthing()

View File

@ -1,7 +1,6 @@
import json import json
import etcd3 as etcd3 import etcd3 as etcd3
from retrying import retry
CLUSTER_INFO_KEY = '/syncthing_monitor/cluster_info' CLUSTER_INFO_KEY = '/syncthing_monitor/cluster_info'
@ -18,7 +17,6 @@ class EtcdClient:
return {'devices': []} return {'devices': []}
return json.loads(raw_value) return json.loads(raw_value)
@retry
def add_device_to_cluster(self, device_id, node_name, address): def add_device_to_cluster(self, device_id, node_name, address):
with self.etcd.lock('syncthing_monitor'): with self.etcd.lock('syncthing_monitor'):
cluster_info = self.load_cluster_info() cluster_info = self.load_cluster_info()
@ -37,7 +35,6 @@ class EtcdClient:
print("Updating etcd value for '{0}': {1}".format(self.key, json.dumps(cluster_info)), flush=True) 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)) self.etcd.put(self.key, json.dumps(cluster_info))
@retry
def get_device_list(self): def get_device_list(self):
device_list = self.load_cluster_info()['devices'] device_list = self.load_cluster_info()['devices']
print("Obtained device_list devices from etcd: {0}".format(json.dumps(device_list)), flush=True) print("Obtained device_list devices from etcd: {0}".format(json.dumps(device_list)), flush=True)

View File

@ -1,7 +1,6 @@
import json import json
import requests import requests
from retrying import retry
class SyncthingClient: class SyncthingClient:
@ -13,7 +12,6 @@ class SyncthingClient:
self.headers = {'X-API-Key': self.api_key} self.headers = {'X-API-Key': self.api_key}
self.myID = None self.myID = None
@retry
def get_my_device_id(self): def get_my_device_id(self):
if self.myID is None: if self.myID is None:
response = self.get("/rest/system/status") response = self.get("/rest/system/status")
@ -102,7 +100,6 @@ class SyncthingClient:
response = self.post("/rest/config/folders", json.dumps(post_data)) response = self.post("/rest/config/folders", json.dumps(post_data))
print("Attempt to add shared folder to syncthing: {0}".format(response.content), flush=True) print("Attempt to add shared folder to syncthing: {0}".format(response.content), flush=True)
@retry
def print_config(self): def print_config(self):
response = self.get("/rest/config/devices") response = self.get("/rest/config/devices")
print("/rest/config/devices: {0}".format(response.content), flush=True) print("/rest/config/devices: {0}".format(response.content), flush=True)
@ -113,12 +110,10 @@ class SyncthingClient:
response = self.get("/rest/config/options") response = self.get("/rest/config/options")
print("/rest/config/options: {0}".format(response.content), flush=True) print("/rest/config/options: {0}".format(response.content), flush=True)
@retry
def config_is_in_sync(self): def config_is_in_sync(self):
response = self.get("/rest/config/insync") response = self.get("/rest/config/insync")
return bool(json.loads(response.content)['configInSync']) return bool(json.loads(response.content)['configInSync'])
@retry
def restart(self): def restart(self):
response = self.post("/rest/system/restart", '') response = self.post("/rest/system/restart", '')
print("System reset: {0}".format(response.content), flush=True) print("System reset: {0}".format(response.content), flush=True)