updated modules
This commit is contained in:
parent
7296c93a78
commit
92c752b8bb
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
|
||||||
def get_jobs(url="http://localhost:8898", verify=False):
|
def get_jobs(url="http://localhost:8898", verify=False):
|
||||||
"""get_jobs fetch jobs from dkron"""
|
"""get_jobs fetch jobs from dkron"""
|
||||||
fullurl = f"{url}/v1/jobs"
|
fullurl = f"{url}/v1/jobs"
|
||||||
@ -16,7 +15,6 @@ def get_jobs(url="http://localhost:8898", verify=False):
|
|||||||
return ret
|
return ret
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def set_jobs(url="http://localhost:8898", verify=False, job=None):
|
def set_jobs(url="http://localhost:8898", verify=False, job=None):
|
||||||
"""set_jobs set jobs on dkron"""
|
"""set_jobs set jobs on dkron"""
|
||||||
fullurl = f"{url}/v1/jobs"
|
fullurl = f"{url}/v1/jobs"
|
||||||
|
@ -6,12 +6,9 @@ import ovh
|
|||||||
from salt.exceptions import CommandExecutionError, ArgumentValueError
|
from salt.exceptions import CommandExecutionError, ArgumentValueError
|
||||||
from ovh.exceptions import ResourceNotFoundError, APIError
|
from ovh.exceptions import ResourceNotFoundError, APIError
|
||||||
|
|
||||||
|
|
||||||
def __virtual__():
|
def __virtual__():
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def _config():
|
def _config():
|
||||||
config = __salt__['config.get']('ovh')
|
config = __salt__['config.get']('ovh')
|
||||||
if not config:
|
if not config:
|
||||||
@ -21,7 +18,6 @@ def _config():
|
|||||||
|
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
||||||
def _auth():
|
def _auth():
|
||||||
cfg = _config()
|
cfg = _config()
|
||||||
client = ovh.Client(
|
client = ovh.Client(
|
||||||
@ -33,7 +29,6 @@ def _auth():
|
|||||||
|
|
||||||
return client
|
return client
|
||||||
|
|
||||||
|
|
||||||
def domain_get_zone(zone=""):
|
def domain_get_zone(zone=""):
|
||||||
'''
|
'''
|
||||||
Get DNS zone extraction
|
Get DNS zone extraction
|
||||||
@ -83,7 +78,6 @@ def domain_get_record(zone="", fieldType="", subDomain="", target=""):
|
|||||||
return "Query failed in OVH API"
|
return "Query failed in OVH API"
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def domain_post_record(zone="",
|
def domain_post_record(zone="",
|
||||||
fieldType="",
|
fieldType="",
|
||||||
subDomain="",
|
subDomain="",
|
||||||
@ -118,7 +112,6 @@ def domain_post_record(zone="",
|
|||||||
|
|
||||||
return req
|
return req
|
||||||
|
|
||||||
|
|
||||||
def domain_put_record(zone="",
|
def domain_put_record(zone="",
|
||||||
fieldType="",
|
fieldType="",
|
||||||
subDomain="",
|
subDomain="",
|
||||||
@ -161,7 +154,6 @@ def domain_put_record(zone="",
|
|||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def domain_delete_record(zone="", fieldType="", subDomain=""):
|
def domain_delete_record(zone="", fieldType="", subDomain=""):
|
||||||
'''
|
'''
|
||||||
Delete a DNS record (Don't forget to refresh the zone)
|
Delete a DNS record (Don't forget to refresh the zone)
|
||||||
@ -193,7 +185,6 @@ def domain_delete_record(zone="", fieldType="", subDomain=""):
|
|||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
def domain_refresh_zone(zone=""):
|
def domain_refresh_zone(zone=""):
|
||||||
'''
|
'''
|
||||||
Apply zone modification on DNS servers
|
Apply zone modification on DNS servers
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
|
||||||
def get_apikey(configfile="/root/.config/syncthing/config.xml"):
|
def get_apikey(configfile="/root/.config/syncthing/config.xml"):
|
||||||
try:
|
try:
|
||||||
tree = ET.parse(configfile)
|
tree = ET.parse(configfile)
|
||||||
@ -15,9 +14,8 @@ def get_apikey(configfile="/root/.config/syncthing/config.xml"):
|
|||||||
|
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
def get_config(url, verify, apikey):
|
def get_config(url, verify, apikey):
|
||||||
fullurl = "{0}/rest/system/config".format(url)
|
fullurl = f"{url}/rest/system/config"
|
||||||
ret = dict()
|
ret = dict()
|
||||||
try:
|
try:
|
||||||
req = requests.request("get",
|
req = requests.request("get",
|
||||||
@ -32,9 +30,8 @@ def get_config(url, verify, apikey):
|
|||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def set_config(url, verify, apikey, config):
|
def set_config(url, verify, apikey, config):
|
||||||
fullurl = "{0}/rest/system/config".format(url)
|
fullurl = f"{url}/rest/system/config"
|
||||||
try:
|
try:
|
||||||
req = requests.request("post",
|
req = requests.request("post",
|
||||||
fullurl,
|
fullurl,
|
||||||
@ -48,9 +45,8 @@ def set_config(url, verify, apikey, config):
|
|||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def insync(url, verify, apikey):
|
def insync(url, verify, apikey):
|
||||||
fullurl = "{0}/rest/system/config/insync".format(url)
|
fullurl = f"{url}/rest/system/config/insync"
|
||||||
try:
|
try:
|
||||||
req = requests.request("get",
|
req = requests.request("get",
|
||||||
fullurl,
|
fullurl,
|
||||||
@ -64,9 +60,8 @@ def insync(url, verify, apikey):
|
|||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def restart(url, verify, apikey):
|
def restart(url, verify, apikey):
|
||||||
fullurl = "{0}/rest/system/restart".format(url)
|
fullurl = f"{url}/rest/system/restart"
|
||||||
try:
|
try:
|
||||||
req = requests.post(fullurl,
|
req = requests.post(fullurl,
|
||||||
verify=verify,
|
verify=verify,
|
||||||
|
Loading…
Reference in New Issue
Block a user