updated modules

This commit is contained in:
Paul 2021-06-14 23:05:24 +02:00
parent 7296c93a78
commit 92c752b8bb
3 changed files with 4 additions and 20 deletions

View File

@ -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"

View File

@ -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

View File

@ -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,