From 92c752b8bb9327c8eb2dedd3fd7ee67e6264e84b Mon Sep 17 00:00:00 2001 From: Paul Lecuq Date: Mon, 14 Jun 2021 23:05:24 +0200 Subject: [PATCH] updated modules --- states/_modules/dkron.py | 2 -- states/_modules/ovhapi.py | 9 --------- states/_modules/syncthing.py | 13 ++++--------- 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/states/_modules/dkron.py b/states/_modules/dkron.py index 9a4c9c8..986732d 100644 --- a/states/_modules/dkron.py +++ b/states/_modules/dkron.py @@ -2,7 +2,6 @@ import requests - def get_jobs(url="http://localhost:8898", verify=False): """get_jobs fetch jobs from dkron""" fullurl = f"{url}/v1/jobs" @@ -16,7 +15,6 @@ def get_jobs(url="http://localhost:8898", verify=False): return ret return None - def set_jobs(url="http://localhost:8898", verify=False, job=None): """set_jobs set jobs on dkron""" fullurl = f"{url}/v1/jobs" diff --git a/states/_modules/ovhapi.py b/states/_modules/ovhapi.py index 456c277..37a6a08 100644 --- a/states/_modules/ovhapi.py +++ b/states/_modules/ovhapi.py @@ -6,12 +6,9 @@ import ovh from salt.exceptions import CommandExecutionError, ArgumentValueError from ovh.exceptions import ResourceNotFoundError, APIError - def __virtual__(): - return True - def _config(): config = __salt__['config.get']('ovh') if not config: @@ -21,7 +18,6 @@ def _config(): return config - def _auth(): cfg = _config() client = ovh.Client( @@ -33,7 +29,6 @@ def _auth(): return client - def domain_get_zone(zone=""): ''' Get DNS zone extraction @@ -83,7 +78,6 @@ def domain_get_record(zone="", fieldType="", subDomain="", target=""): return "Query failed in OVH API" return None - def domain_post_record(zone="", fieldType="", subDomain="", @@ -118,7 +112,6 @@ def domain_post_record(zone="", return req - def domain_put_record(zone="", fieldType="", subDomain="", @@ -161,7 +154,6 @@ def domain_put_record(zone="", return None - def domain_delete_record(zone="", fieldType="", subDomain=""): ''' Delete a DNS record (Don't forget to refresh the zone) @@ -193,7 +185,6 @@ def domain_delete_record(zone="", fieldType="", subDomain=""): return results - def domain_refresh_zone(zone=""): ''' Apply zone modification on DNS servers diff --git a/states/_modules/syncthing.py b/states/_modules/syncthing.py index 21a2acd..9ab84a5 100644 --- a/states/_modules/syncthing.py +++ b/states/_modules/syncthing.py @@ -3,7 +3,6 @@ import xml.etree.ElementTree as ET import requests - def get_apikey(configfile="/root/.config/syncthing/config.xml"): try: tree = ET.parse(configfile) @@ -15,9 +14,8 @@ def get_apikey(configfile="/root/.config/syncthing/config.xml"): return "" - def get_config(url, verify, apikey): - fullurl = "{0}/rest/system/config".format(url) + fullurl = f"{url}/rest/system/config" ret = dict() try: req = requests.request("get", @@ -32,9 +30,8 @@ def get_config(url, verify, apikey): return None - def set_config(url, verify, apikey, config): - fullurl = "{0}/rest/system/config".format(url) + fullurl = f"{url}/rest/system/config" try: req = requests.request("post", fullurl, @@ -48,9 +45,8 @@ def set_config(url, verify, apikey, config): return None - def insync(url, verify, apikey): - fullurl = "{0}/rest/system/config/insync".format(url) + fullurl = f"{url}/rest/system/config/insync" try: req = requests.request("get", fullurl, @@ -64,9 +60,8 @@ def insync(url, verify, apikey): return None - def restart(url, verify, apikey): - fullurl = "{0}/rest/system/restart".format(url) + fullurl = f"{url}/rest/system/restart" try: req = requests.post(fullurl, verify=verify,