mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Adding deprecation decorator to zabbix modules for 3009.
This commit is contained in:
parent
4818aa6e9c
commit
db9ed96d0d
11 changed files with 162 additions and 99 deletions
|
@ -37,6 +37,12 @@ from salt.utils.versions import Version
|
|||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
__deprecated__ = (
|
||||
3009,
|
||||
"zabbix",
|
||||
"https://github.com/salt-extensions/saltext-zabbix",
|
||||
)
|
||||
|
||||
INTERFACE_DEFAULT_PORTS = [10050, 161, 623, 12345]
|
||||
|
||||
ZABBIX_TOP_LEVEL_OBJECTS = (
|
||||
|
|
|
@ -22,6 +22,12 @@ import os
|
|||
# Define the module's virtual name
|
||||
__virtualname__ = "zabbix"
|
||||
|
||||
__deprecated__ = (
|
||||
3009,
|
||||
"zabbix",
|
||||
"https://github.com/salt-extensions/saltext-zabbix",
|
||||
)
|
||||
|
||||
|
||||
def __virtual__():
|
||||
if zbx():
|
||||
|
@ -91,4 +97,4 @@ def returner(ret):
|
|||
)
|
||||
|
||||
if not changes and not errors:
|
||||
zabbix_send("salt.trap.info", "SALT {} OK".format(job_minion_id))
|
||||
zabbix_send("salt.trap.info", f"SALT {job_minion_id} OK")
|
||||
|
|
|
@ -13,6 +13,12 @@ from salt.exceptions import SaltException
|
|||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
__deprecated__ = (
|
||||
3009,
|
||||
"zabbix",
|
||||
"https://github.com/salt-extensions/saltext-zabbix",
|
||||
)
|
||||
|
||||
|
||||
def __virtual__():
|
||||
"""
|
||||
|
|
|
@ -12,6 +12,12 @@ from copy import deepcopy
|
|||
import salt.utils.dictdiffer
|
||||
import salt.utils.json
|
||||
|
||||
__deprecated__ = (
|
||||
3009,
|
||||
"zabbix",
|
||||
"https://github.com/salt-extensions/saltext-zabbix",
|
||||
)
|
||||
|
||||
|
||||
def __virtual__():
|
||||
"""
|
||||
|
@ -85,14 +91,14 @@ def present(host, groups, interfaces, **kwargs):
|
|||
ret = {"name": host, "changes": {}, "result": False, "comment": ""}
|
||||
|
||||
# Comment and change messages
|
||||
comment_host_created = "Host {} created.".format(host)
|
||||
comment_host_updated = "Host {} updated.".format(host)
|
||||
comment_host_notcreated = "Unable to create host: {}. ".format(host)
|
||||
comment_host_exists = "Host {} already exists.".format(host)
|
||||
comment_host_created = f"Host {host} created."
|
||||
comment_host_updated = f"Host {host} updated."
|
||||
comment_host_notcreated = f"Unable to create host: {host}. "
|
||||
comment_host_exists = f"Host {host} already exists."
|
||||
changes_host_created = {
|
||||
host: {
|
||||
"old": "Host {} does not exist.".format(host),
|
||||
"new": "Host {} created.".format(host),
|
||||
"old": f"Host {host} does not exist.",
|
||||
"new": f"Host {host} created.",
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -206,7 +212,7 @@ def present(host, groups, interfaces, **kwargs):
|
|||
try:
|
||||
groupids.append(int(groupid[0]["groupid"]))
|
||||
except TypeError:
|
||||
ret["comment"] = "Invalid group {}".format(group)
|
||||
ret["comment"] = f"Invalid group {group}"
|
||||
return ret
|
||||
else:
|
||||
groupids.append(group)
|
||||
|
@ -224,23 +230,23 @@ def present(host, groups, interfaces, **kwargs):
|
|||
{
|
||||
"output": "proxyid",
|
||||
"selectInterface": "extend",
|
||||
"filter": {"host": "{}".format(proxy_host)},
|
||||
"filter": {"host": f"{proxy_host}"},
|
||||
},
|
||||
**connection_args
|
||||
**connection_args,
|
||||
)[0]["proxyid"]
|
||||
except TypeError:
|
||||
ret["comment"] = "Invalid proxy_host {}".format(proxy_host)
|
||||
ret["comment"] = f"Invalid proxy_host {proxy_host}"
|
||||
return ret
|
||||
# Otherwise lookup proxy_host as proxyid
|
||||
else:
|
||||
try:
|
||||
proxy_hostid = __salt__["zabbix.run_query"](
|
||||
"proxy.get",
|
||||
{"proxyids": "{}".format(proxy_host), "output": "proxyid"},
|
||||
**connection_args
|
||||
{"proxyids": f"{proxy_host}", "output": "proxyid"},
|
||||
**connection_args,
|
||||
)[0]["proxyid"]
|
||||
except TypeError:
|
||||
ret["comment"] = "Invalid proxy_host {}".format(proxy_host)
|
||||
ret["comment"] = f"Invalid proxy_host {proxy_host}"
|
||||
return ret
|
||||
|
||||
# Selects if the current inventory should be substituted by the new one
|
||||
|
@ -459,7 +465,7 @@ def present(host, groups, interfaces, **kwargs):
|
|||
useip=interface["useip"],
|
||||
port=interface["port"],
|
||||
details=interface["details"],
|
||||
**connection_args
|
||||
**connection_args,
|
||||
)
|
||||
else:
|
||||
interfaceid = interfaceid_by_type[interface["type"]].pop(0)
|
||||
|
@ -472,7 +478,7 @@ def present(host, groups, interfaces, **kwargs):
|
|||
useip=interface["useip"],
|
||||
port=interface["port"],
|
||||
details=interface["details"],
|
||||
**connection_args
|
||||
**connection_args,
|
||||
)
|
||||
return ret
|
||||
|
||||
|
@ -516,7 +522,7 @@ def present(host, groups, interfaces, **kwargs):
|
|||
proxy_hostid=proxy_hostid,
|
||||
inventory=new_inventory,
|
||||
visible_name=visible_name,
|
||||
**sum_kwargs
|
||||
**sum_kwargs,
|
||||
)
|
||||
|
||||
if "error" not in host_create:
|
||||
|
@ -556,13 +562,13 @@ def absent(name, **kwargs):
|
|||
ret = {"name": name, "changes": {}, "result": False, "comment": ""}
|
||||
|
||||
# Comment and change messages
|
||||
comment_host_deleted = "Host {} deleted.".format(name)
|
||||
comment_host_notdeleted = "Unable to delete host: {}. ".format(name)
|
||||
comment_host_notexists = "Host {} does not exist.".format(name)
|
||||
comment_host_deleted = f"Host {name} deleted."
|
||||
comment_host_notdeleted = f"Unable to delete host: {name}. "
|
||||
comment_host_notexists = f"Host {name} does not exist."
|
||||
changes_host_deleted = {
|
||||
name: {
|
||||
"old": "Host {} exists.".format(name),
|
||||
"new": "Host {} deleted.".format(name),
|
||||
"old": f"Host {name} exists.",
|
||||
"new": f"Host {name} deleted.",
|
||||
}
|
||||
}
|
||||
connection_args = {}
|
||||
|
@ -670,7 +676,7 @@ def assign_templates(host, templates, **kwargs):
|
|||
hostids=hostid,
|
||||
output='[{"hostid"}]',
|
||||
selectParentTemplates='["templateid"]',
|
||||
**connection_args
|
||||
**connection_args,
|
||||
)
|
||||
for template_id in host_templates[0]["parentTemplates"]:
|
||||
curr_template_ids.append(template_id["templateid"])
|
||||
|
@ -684,7 +690,7 @@ def assign_templates(host, templates, **kwargs):
|
|||
requested_template_ids.append(template_id)
|
||||
except TypeError:
|
||||
ret["result"] = False
|
||||
ret["comment"] = "Unable to find template: {}.".format(template)
|
||||
ret["comment"] = f"Unable to find template: {template}."
|
||||
return ret
|
||||
|
||||
# remove any duplications
|
||||
|
|
|
@ -5,6 +5,11 @@ Management of Zabbix host groups.
|
|||
|
||||
|
||||
"""
|
||||
__deprecated__ = (
|
||||
3009,
|
||||
"zabbix",
|
||||
"https://github.com/salt-extensions/saltext-zabbix",
|
||||
)
|
||||
|
||||
|
||||
def __virtual__():
|
||||
|
@ -45,13 +50,13 @@ def present(name, **kwargs):
|
|||
ret = {"name": name, "changes": {}, "result": False, "comment": ""}
|
||||
|
||||
# Comment and change messages
|
||||
comment_hostgroup_created = "Host group {} created.".format(name)
|
||||
comment_hostgroup_notcreated = "Unable to create host group: {}. ".format(name)
|
||||
comment_hostgroup_exists = "Host group {} already exists.".format(name)
|
||||
comment_hostgroup_created = f"Host group {name} created."
|
||||
comment_hostgroup_notcreated = f"Unable to create host group: {name}. "
|
||||
comment_hostgroup_exists = f"Host group {name} already exists."
|
||||
changes_hostgroup_created = {
|
||||
name: {
|
||||
"old": "Host group {} does not exist.".format(name),
|
||||
"new": "Host group {} created.".format(name),
|
||||
"old": f"Host group {name} does not exist.",
|
||||
"new": f"Host group {name} created.",
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,13 +114,13 @@ def absent(name, **kwargs):
|
|||
ret = {"name": name, "changes": {}, "result": False, "comment": ""}
|
||||
|
||||
# Comment and change messages
|
||||
comment_hostgroup_deleted = "Host group {} deleted.".format(name)
|
||||
comment_hostgroup_notdeleted = "Unable to delete host group: {}. ".format(name)
|
||||
comment_hostgroup_notexists = "Host group {} does not exist.".format(name)
|
||||
comment_hostgroup_deleted = f"Host group {name} deleted."
|
||||
comment_hostgroup_notdeleted = f"Unable to delete host group: {name}. "
|
||||
comment_hostgroup_notexists = f"Host group {name} does not exist."
|
||||
changes_hostgroup_deleted = {
|
||||
name: {
|
||||
"old": "Host group {} exists.".format(name),
|
||||
"new": "Host group {} deleted.".format(name),
|
||||
"old": f"Host group {name} exists.",
|
||||
"new": f"Host group {name} deleted.",
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,12 @@ Management of Zabbix mediatypes.
|
|||
|
||||
"""
|
||||
|
||||
__deprecated__ = (
|
||||
3009,
|
||||
"zabbix",
|
||||
"https://github.com/salt-extensions/saltext-zabbix",
|
||||
)
|
||||
|
||||
|
||||
def __virtual__():
|
||||
"""
|
||||
|
@ -49,14 +55,14 @@ def present(name, mediatype, **kwargs):
|
|||
ret = {"name": name, "changes": {}, "result": False, "comment": ""}
|
||||
|
||||
# Comment and change messages
|
||||
comment_mediatype_created = "Mediatype {} created.".format(name)
|
||||
comment_mediatype_updated = "Mediatype {} updated.".format(name)
|
||||
comment_mediatype_notcreated = "Unable to create mediatype: {}. ".format(name)
|
||||
comment_mediatype_exists = "Mediatype {} already exists.".format(name)
|
||||
comment_mediatype_created = f"Mediatype {name} created."
|
||||
comment_mediatype_updated = f"Mediatype {name} updated."
|
||||
comment_mediatype_notcreated = f"Unable to create mediatype: {name}. "
|
||||
comment_mediatype_exists = f"Mediatype {name} already exists."
|
||||
changes_mediatype_created = {
|
||||
name: {
|
||||
"old": "Mediatype {} does not exist.".format(name),
|
||||
"new": "Mediatype {} created.".format(name),
|
||||
"old": f"Mediatype {name} does not exist.",
|
||||
"new": f"Mediatype {name} created.",
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -214,7 +220,7 @@ def present(name, mediatype, **kwargs):
|
|||
smtp_server=kwargs["smtp_server"],
|
||||
smtp_helo=kwargs["smtp_helo"],
|
||||
smtp_email=kwargs["smtp_email"],
|
||||
**connection_args
|
||||
**connection_args,
|
||||
)
|
||||
if "error" in updated_email:
|
||||
error.append(updated_email["error"])
|
||||
|
@ -236,7 +242,7 @@ def present(name, mediatype, **kwargs):
|
|||
updated_email_security = __salt__["zabbix.mediatype_update"](
|
||||
mediatypeid,
|
||||
smtp_security=kwargs["smtp_security"],
|
||||
**connection_args
|
||||
**connection_args,
|
||||
)
|
||||
if "error" in updated_email_security:
|
||||
error.append(updated_email_security["error"])
|
||||
|
@ -247,7 +253,7 @@ def present(name, mediatype, **kwargs):
|
|||
updated_email_verify_peer = __salt__["zabbix.mediatype_update"](
|
||||
mediatypeid,
|
||||
smtp_verify_peer=kwargs["smtp_verify_peer"],
|
||||
**connection_args
|
||||
**connection_args,
|
||||
)
|
||||
if "error" in updated_email_verify_peer:
|
||||
error.append(updated_email_verify_peer["error"])
|
||||
|
@ -258,7 +264,7 @@ def present(name, mediatype, **kwargs):
|
|||
updated_email_verify_host = __salt__["zabbix.mediatype_update"](
|
||||
mediatypeid,
|
||||
smtp_verify_host=kwargs["smtp_verify_host"],
|
||||
**connection_args
|
||||
**connection_args,
|
||||
)
|
||||
if "error" in updated_email_verify_host:
|
||||
error.append(updated_email_verify_host["error"])
|
||||
|
@ -271,7 +277,7 @@ def present(name, mediatype, **kwargs):
|
|||
username=kwargs["username"],
|
||||
passwd=kwargs["passwd"],
|
||||
smtp_authentication=kwargs["smtp_authentication"],
|
||||
**connection_args
|
||||
**connection_args,
|
||||
)
|
||||
if "error" in updated_email_auth:
|
||||
error.append(updated_email_auth["error"])
|
||||
|
@ -286,7 +292,7 @@ def present(name, mediatype, **kwargs):
|
|||
mediatypeid,
|
||||
type=mediatype,
|
||||
exec_path=kwargs["exec_path"],
|
||||
**connection_args
|
||||
**connection_args,
|
||||
)
|
||||
if "error" in updated_script:
|
||||
error.append(updated_script["error"])
|
||||
|
@ -307,7 +313,7 @@ def present(name, mediatype, **kwargs):
|
|||
mediatypeid,
|
||||
type=mediatype,
|
||||
gsm_modem=kwargs["gsm_modem"],
|
||||
**connection_args
|
||||
**connection_args,
|
||||
)
|
||||
if "error" in updated_sms:
|
||||
error.append(updated_sms["error"])
|
||||
|
@ -320,7 +326,7 @@ def present(name, mediatype, **kwargs):
|
|||
type=mediatype,
|
||||
username=kwargs["username"],
|
||||
passwd=kwargs["passwd"],
|
||||
**connection_args
|
||||
**connection_args,
|
||||
)
|
||||
if "error" in updated_jabber:
|
||||
error.append(updated_jabber["error"])
|
||||
|
@ -334,7 +340,7 @@ def present(name, mediatype, **kwargs):
|
|||
username=kwargs["username"],
|
||||
passwd=kwargs["passwd"],
|
||||
exec_path=kwargs["exec_path"],
|
||||
**connection_args
|
||||
**connection_args,
|
||||
)
|
||||
if "error" in updated_eztext:
|
||||
error.append(updated_eztext["error"])
|
||||
|
@ -404,13 +410,13 @@ def absent(name, **kwargs):
|
|||
ret = {"name": name, "changes": {}, "result": False, "comment": ""}
|
||||
|
||||
# Comment and change messages
|
||||
comment_mediatype_deleted = "Mediatype {} deleted.".format(name)
|
||||
comment_mediatype_notdeleted = "Unable to delete mediatype: {}. ".format(name)
|
||||
comment_mediatype_notexists = "Mediatype {} does not exist.".format(name)
|
||||
comment_mediatype_deleted = f"Mediatype {name} deleted."
|
||||
comment_mediatype_notdeleted = f"Unable to delete mediatype: {name}. "
|
||||
comment_mediatype_notexists = f"Mediatype {name} does not exist."
|
||||
changes_mediatype_deleted = {
|
||||
name: {
|
||||
"old": "Mediatype {} exists.".format(name),
|
||||
"new": "Mediatype {} deleted.".format(name),
|
||||
"old": f"Mediatype {name} exists.",
|
||||
"new": f"Mediatype {name} deleted.",
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,12 @@ from salt.exceptions import SaltException
|
|||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
__deprecated__ = (
|
||||
3009,
|
||||
"zabbix",
|
||||
"https://github.com/salt-extensions/saltext-zabbix",
|
||||
)
|
||||
|
||||
TEMPLATE_RELATIONS = ["groups", "hosts", "macros"]
|
||||
TEMPLATE_COMPONENT_ORDER = (
|
||||
"applications",
|
||||
|
|
|
@ -6,6 +6,12 @@ Management of Zabbix users.
|
|||
|
||||
"""
|
||||
|
||||
__deprecated__ = (
|
||||
3009,
|
||||
"zabbix",
|
||||
"https://github.com/salt-extensions/saltext-zabbix",
|
||||
)
|
||||
|
||||
|
||||
import logging
|
||||
from copy import deepcopy
|
||||
|
@ -192,14 +198,14 @@ def present(alias, passwd, usrgrps, medias=None, password_reset=False, **kwargs)
|
|||
ret = {"name": alias, "changes": {}, "result": False, "comment": ""}
|
||||
|
||||
# Comment and change messages
|
||||
comment_user_created = "User {} created.".format(alias)
|
||||
comment_user_updated = "User {} updated.".format(alias)
|
||||
comment_user_notcreated = "Unable to create user: {}. ".format(alias)
|
||||
comment_user_exists = "User {} already exists.".format(alias)
|
||||
comment_user_created = f"User {alias} created."
|
||||
comment_user_updated = f"User {alias} updated."
|
||||
comment_user_notcreated = f"Unable to create user: {alias}. "
|
||||
comment_user_exists = f"User {alias} already exists."
|
||||
changes_user_created = {
|
||||
alias: {
|
||||
"old": "User {} does not exist.".format(alias),
|
||||
"new": "User {} created.".format(alias),
|
||||
"old": f"User {alias} does not exist.",
|
||||
"new": f"User {alias} created.",
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -342,7 +348,7 @@ def present(alias, passwd, usrgrps, medias=None, password_reset=False, **kwargs)
|
|||
usrgrp_diff = list(set(usrgrps) - set(cur_usrgrps))
|
||||
|
||||
if usrgrp_diff and update_usrgrps:
|
||||
error.append("Unable to update group(s): {}".format(usrgrp_diff))
|
||||
error.append(f"Unable to update group(s): {usrgrp_diff}")
|
||||
|
||||
else:
|
||||
if update_usrgrps:
|
||||
|
@ -360,9 +366,7 @@ def present(alias, passwd, usrgrps, medias=None, password_reset=False, **kwargs)
|
|||
usrgrp_diff = list(set(usrgrps) - set(cur_usrgrps))
|
||||
|
||||
if usrgrp_diff:
|
||||
error.append(
|
||||
"Unable to update group(s): {}".format(usrgrp_diff)
|
||||
)
|
||||
error.append(f"Unable to update group(s): {usrgrp_diff}")
|
||||
|
||||
ret["changes"]["usrgrps"] = str(updated_groups)
|
||||
|
||||
|
@ -391,7 +395,7 @@ def present(alias, passwd, usrgrps, medias=None, password_reset=False, **kwargs)
|
|||
period=media["period"],
|
||||
sendto=media["sendto"],
|
||||
severity=media["severity"],
|
||||
**connection_args
|
||||
**connection_args,
|
||||
)
|
||||
|
||||
if "error" in updatemed:
|
||||
|
@ -449,13 +453,13 @@ def absent(name, **kwargs):
|
|||
ret = {"name": name, "changes": {}, "result": False, "comment": ""}
|
||||
|
||||
# Comment and change messages
|
||||
comment_user_deleted = "USer {} deleted.".format(name)
|
||||
comment_user_notdeleted = "Unable to delete user: {}. ".format(name)
|
||||
comment_user_notexists = "User {} does not exist.".format(name)
|
||||
comment_user_deleted = f"USer {name} deleted."
|
||||
comment_user_notdeleted = f"Unable to delete user: {name}. "
|
||||
comment_user_notexists = f"User {name} does not exist."
|
||||
changes_user_deleted = {
|
||||
name: {
|
||||
"old": "User {} exists.".format(name),
|
||||
"new": "User {} deleted.".format(name),
|
||||
"old": f"User {name} exists.",
|
||||
"new": f"User {name} deleted.",
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,12 @@ Management of Zabbix user groups.
|
|||
|
||||
"""
|
||||
|
||||
__deprecated__ = (
|
||||
3009,
|
||||
"zabbix",
|
||||
"https://github.com/salt-extensions/saltext-zabbix",
|
||||
)
|
||||
|
||||
|
||||
def __virtual__():
|
||||
"""
|
||||
|
@ -50,14 +56,14 @@ def present(name, **kwargs):
|
|||
ret = {"name": name, "changes": {}, "result": False, "comment": ""}
|
||||
|
||||
# Comment and change messages
|
||||
comment_usergroup_created = "User group {} created.".format(name)
|
||||
comment_usergroup_updated = "User group {} updated.".format(name)
|
||||
comment_usergroup_notcreated = "Unable to create user group: {}. ".format(name)
|
||||
comment_usergroup_exists = "User group {} already exists.".format(name)
|
||||
comment_usergroup_created = f"User group {name} created."
|
||||
comment_usergroup_updated = f"User group {name} updated."
|
||||
comment_usergroup_notcreated = f"Unable to create user group: {name}. "
|
||||
comment_usergroup_exists = f"User group {name} already exists."
|
||||
changes_usergroup_created = {
|
||||
name: {
|
||||
"old": "User group {} does not exist.".format(name),
|
||||
"new": "User group {} created.".format(name),
|
||||
"old": f"User group {name} does not exist.",
|
||||
"new": f"User group {name} created.",
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -219,13 +225,13 @@ def absent(name, **kwargs):
|
|||
ret = {"name": name, "changes": {}, "result": False, "comment": ""}
|
||||
|
||||
# Comment and change messages
|
||||
comment_usergroup_deleted = "User group {} deleted.".format(name)
|
||||
comment_usergroup_notdeleted = "Unable to delete user group: {}. ".format(name)
|
||||
comment_usergroup_notexists = "User group {} does not exist.".format(name)
|
||||
comment_usergroup_deleted = f"User group {name} deleted."
|
||||
comment_usergroup_notdeleted = f"Unable to delete user group: {name}. "
|
||||
comment_usergroup_notexists = f"User group {name} does not exist."
|
||||
changes_usergroup_deleted = {
|
||||
name: {
|
||||
"old": "User group {} exists.".format(name),
|
||||
"new": "User group {} deleted.".format(name),
|
||||
"old": f"User group {name} exists.",
|
||||
"new": f"User group {name} deleted.",
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,12 @@ Management of Zabbix usermacros.
|
|||
|
||||
"""
|
||||
|
||||
__deprecated__ = (
|
||||
3009,
|
||||
"zabbix",
|
||||
"https://github.com/salt-extensions/saltext-zabbix",
|
||||
)
|
||||
|
||||
|
||||
def __virtual__():
|
||||
"""
|
||||
|
@ -54,26 +60,26 @@ def present(name, value, hostid=None, **kwargs):
|
|||
name, hostid
|
||||
)
|
||||
comment_usermacro_notcreated = (
|
||||
"Unable to create usermacro: {} on hostid {}. ".format(name, hostid)
|
||||
f"Unable to create usermacro: {name} on hostid {hostid}. "
|
||||
)
|
||||
comment_usermacro_exists = "Usermacro {} already exists on hostid {}.".format(
|
||||
name, hostid
|
||||
)
|
||||
changes_usermacro_created = {
|
||||
name: {
|
||||
"old": "Usermacro {} does not exist on hostid {}.".format(name, hostid),
|
||||
"new": "Usermacro {} created on hostid {}.".format(name, hostid),
|
||||
"old": f"Usermacro {name} does not exist on hostid {hostid}.",
|
||||
"new": f"Usermacro {name} created on hostid {hostid}.",
|
||||
}
|
||||
}
|
||||
else:
|
||||
comment_usermacro_created = "Usermacro {} created.".format(name)
|
||||
comment_usermacro_updated = "Usermacro {} updated.".format(name)
|
||||
comment_usermacro_notcreated = "Unable to create usermacro: {}. ".format(name)
|
||||
comment_usermacro_exists = "Usermacro {} already exists.".format(name)
|
||||
comment_usermacro_created = f"Usermacro {name} created."
|
||||
comment_usermacro_updated = f"Usermacro {name} updated."
|
||||
comment_usermacro_notcreated = f"Unable to create usermacro: {name}. "
|
||||
comment_usermacro_exists = f"Usermacro {name} already exists."
|
||||
changes_usermacro_created = {
|
||||
name: {
|
||||
"old": "Usermacro {} does not exist.".format(name),
|
||||
"new": "Usermacro {} created.".format(name),
|
||||
"old": f"Usermacro {name} does not exist.",
|
||||
"new": f"Usermacro {name} created.",
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -203,25 +209,25 @@ def absent(name, hostid=None, **kwargs):
|
|||
name, hostid
|
||||
)
|
||||
comment_usermacro_notdeleted = (
|
||||
"Unable to delete usermacro: {} from hostid {}.".format(name, hostid)
|
||||
f"Unable to delete usermacro: {name} from hostid {hostid}."
|
||||
)
|
||||
comment_usermacro_notexists = (
|
||||
"Usermacro {} does not exist on hostid {}.".format(name, hostid)
|
||||
f"Usermacro {name} does not exist on hostid {hostid}."
|
||||
)
|
||||
changes_usermacro_deleted = {
|
||||
name: {
|
||||
"old": "Usermacro {} exists on hostid {}.".format(name, hostid),
|
||||
"new": "Usermacro {} deleted from {}.".format(name, hostid),
|
||||
"old": f"Usermacro {name} exists on hostid {hostid}.",
|
||||
"new": f"Usermacro {name} deleted from {hostid}.",
|
||||
}
|
||||
}
|
||||
else:
|
||||
comment_usermacro_deleted = "Usermacro {} deleted.".format(name)
|
||||
comment_usermacro_notdeleted = "Unable to delete usermacro: {}.".format(name)
|
||||
comment_usermacro_notexists = "Usermacro {} does not exist.".format(name)
|
||||
comment_usermacro_deleted = f"Usermacro {name} deleted."
|
||||
comment_usermacro_notdeleted = f"Unable to delete usermacro: {name}."
|
||||
comment_usermacro_notexists = f"Usermacro {name} does not exist."
|
||||
changes_usermacro_deleted = {
|
||||
name: {
|
||||
"old": "Usermacro {} exists.".format(name),
|
||||
"new": "Usermacro {} deleted.".format(name),
|
||||
"old": f"Usermacro {name} exists.",
|
||||
"new": f"Usermacro {name} deleted.",
|
||||
}
|
||||
}
|
||||
if hostid:
|
||||
|
|
|
@ -13,6 +13,12 @@ from salt.exceptions import SaltException
|
|||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
__deprecated__ = (
|
||||
3009,
|
||||
"zabbix",
|
||||
"https://github.com/salt-extensions/saltext-zabbix",
|
||||
)
|
||||
|
||||
|
||||
def __virtual__():
|
||||
"""
|
||||
|
|
Loading…
Add table
Reference in a new issue