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
/
lib /
python3.6 /
site-packages /
salt /
returners /
Delete
Unzip
Name
Size
Permission
Date
Action
__pycache__
[ DIR ]
drwxr-xr-x
2022-10-11 05:09
__init__.py
5.98
KB
-rw-r--r--
2022-05-16 09:16
appoptics_return.py
6.11
KB
-rw-r--r--
2022-05-16 09:16
carbon_return.py
8.24
KB
-rw-r--r--
2022-05-16 09:16
cassandra_cql_return.py
15.17
KB
-rw-r--r--
2022-05-16 09:16
cassandra_return.py
2.07
KB
-rw-r--r--
2022-05-16 09:16
couchbase_return.py
8.91
KB
-rw-r--r--
2022-05-16 09:16
couchdb_return.py
10.35
KB
-rw-r--r--
2022-05-16 09:16
django_return.py
2.27
KB
-rw-r--r--
2022-05-16 09:16
elasticsearch_return.py
12.18
KB
-rw-r--r--
2022-05-16 09:16
etcd_return.py
6.32
KB
-rw-r--r--
2022-05-16 09:16
highstate_return.py
15.59
KB
-rw-r--r--
2022-05-16 09:16
influxdb_return.py
8.03
KB
-rw-r--r--
2022-05-16 09:16
kafka_return.py
2.12
KB
-rw-r--r--
2022-05-16 09:16
librato_return.py
4.29
KB
-rw-r--r--
2022-05-16 09:16
local.py
541
B
-rw-r--r--
2022-05-16 09:16
local_cache.py
17.1
KB
-rw-r--r--
2022-05-16 09:16
mattermost_returner.py
4.08
KB
-rw-r--r--
2022-05-16 09:16
memcache_return.py
5.72
KB
-rw-r--r--
2022-05-16 09:16
mongo_future_return.py
10.08
KB
-rw-r--r--
2022-05-16 09:16
mongo_return.py
6.11
KB
-rw-r--r--
2022-05-16 09:16
multi_returner.py
2.82
KB
-rw-r--r--
2022-05-16 09:16
mysql.py
18.61
KB
-rw-r--r--
2022-05-16 09:16
nagios_nrdp_return.py
4.92
KB
-rw-r--r--
2022-05-16 09:16
odbc.py
7.77
KB
-rw-r--r--
2022-05-16 09:16
pgjsonb.py
17.18
KB
-rw-r--r--
2022-05-16 09:16
postgres.py
10.2
KB
-rw-r--r--
2022-05-16 09:16
postgres_local_cache.py
10.73
KB
-rw-r--r--
2022-05-16 09:16
pushover_returner.py
6.55
KB
-rw-r--r--
2022-05-16 09:16
rawfile_json.py
2.23
KB
-rw-r--r--
2022-05-16 09:16
redis_return.py
8.52
KB
-rw-r--r--
2022-05-16 09:16
sentry_return.py
5.3
KB
-rw-r--r--
2022-05-16 09:16
slack_returner.py
6.02
KB
-rw-r--r--
2022-05-16 09:16
slack_webhook_return.py
11.22
KB
-rw-r--r--
2022-05-16 09:16
sms_return.py
2.64
KB
-rw-r--r--
2022-05-16 09:16
smtp_return.py
8.2
KB
-rw-r--r--
2022-05-16 09:16
splunk.py
6.69
KB
-rw-r--r--
2022-05-16 09:16
sqlite3_return.py
7.73
KB
-rw-r--r--
2022-05-16 09:16
syslog_return.py
5.26
KB
-rw-r--r--
2022-05-16 09:16
telegram_return.py
1.92
KB
-rw-r--r--
2022-05-16 09:16
xmpp_return.py
4.85
KB
-rw-r--r--
2022-05-16 09:16
zabbix_return.py
2.45
KB
-rw-r--r--
2022-05-16 09:16
Save
Rename
""" Return data to an etcd server or cluster :depends: - python-etcd In order to return to an etcd server, a profile should be created in the master configuration file: .. code-block:: yaml my_etcd_config: etcd.host: 127.0.0.1 etcd.port: 2379 It is technically possible to configure etcd without using a profile, but this is not considered to be a best practice, especially when multiple etcd servers or clusters are available. .. code-block:: yaml etcd.host: 127.0.0.1 etcd.port: 2379 Additionally, two more options must be specified in the top-level configuration in order to use the etcd returner: .. code-block:: yaml etcd.returner: my_etcd_config etcd.returner_root: /salt/return The ``etcd.returner`` option specifies which configuration profile to use. The ``etcd.returner_root`` option specifies the path inside etcd to use as the root of the returner system. Once the etcd options are configured, the returner may be used: CLI Example: salt '*' test.ping --return etcd A username and password can be set: .. code-block:: yaml etcd.username: larry # Optional; requires etcd.password to be set etcd.password: 123pass # Optional; requires etcd.username to be set You can also set a TTL (time to live) value for the returner: .. code-block:: yaml etcd.ttl: 5 Authentication with username and password, and ttl, currently requires the ``master`` branch of ``python-etcd``. You may also specify different roles for read and write operations. First, create the profiles as specified above. Then add: .. code-block:: yaml etcd.returner_read_profile: my_etcd_read etcd.returner_write_profile: my_etcd_write """ import logging import salt.utils.jid import salt.utils.json try: import salt.utils.etcd_util HAS_LIBS = True except ImportError: HAS_LIBS = False log = logging.getLogger(__name__) # Define the module's virtual name __virtualname__ = "etcd" def __virtual__(): """ Only return if python-etcd is installed """ if HAS_LIBS: return __virtualname__ return False, "Could not import etcd returner; python-etcd is not installed." def _get_conn(opts, profile=None): """ Establish a connection to etcd """ if profile is None: profile = opts.get("etcd.returner") path = opts.get("etcd.returner_root", "/salt/return") return salt.utils.etcd_util.get_conn(opts, profile), path def returner(ret): """ Return data to an etcd server or cluster """ write_profile = __opts__.get("etcd.returner_write_profile") if write_profile: ttl = __opts__.get(write_profile, {}).get("etcd.ttl") else: ttl = __opts__.get("etcd.ttl") client, path = _get_conn(__opts__, write_profile) # Make a note of this minion for the external job cache client.set( "/".join((path, "minions", ret["id"])), ret["jid"], ttl=ttl, ) for field in ret: # Not using os.path.join because we're not dealing with file paths dest = "/".join((path, "jobs", ret["jid"], ret["id"], field)) client.set(dest, salt.utils.json.dumps(ret[field]), ttl=ttl) def save_load(jid, load, minions=None): """ Save the load to the specified jid """ log.debug("sdstack_etcd returner <save_load> called jid: %s", jid) write_profile = __opts__.get("etcd.returner_write_profile") client, path = _get_conn(__opts__, write_profile) if write_profile: ttl = __opts__.get(write_profile, {}).get("etcd.ttl") else: ttl = __opts__.get("etcd.ttl") client.set( "/".join((path, "jobs", jid, ".load.p")), salt.utils.json.dumps(load), ttl=ttl, ) def save_minions(jid, minions, syndic_id=None): # pylint: disable=unused-argument """ Included for API consistency """ def clean_old_jobs(): """ Included for API consistency """ def get_load(jid): """ Return the load data that marks a specified jid """ log.debug("sdstack_etcd returner <get_load> called jid: %s", jid) read_profile = __opts__.get("etcd.returner_read_profile") client, path = _get_conn(__opts__, read_profile) return salt.utils.json.loads( client.get("/".join((path, "jobs", jid, ".load.p"))).value ) def get_jid(jid): """ Return the information returned when the specified job id was executed """ log.debug("sdstack_etcd returner <get_jid> called jid: %s", jid) ret = {} client, path = _get_conn(__opts__) items = client.get("/".join((path, "jobs", jid))) for item in items.children: if str(item.key).endswith(".load.p"): continue comps = str(item.key).split("/") data = client.get("/".join((path, "jobs", jid, comps[-1], "return"))).value ret[comps[-1]] = {"return": salt.utils.json.loads(data)} return ret def get_fun(fun): """ Return a dict of the last function called for all minions """ log.debug("sdstack_etcd returner <get_fun> called fun: %s", fun) ret = {} client, path = _get_conn(__opts__) items = client.get("/".join((path, "minions"))) for item in items.children: comps = str(item.key).split("/") efun = salt.utils.json.loads( client.get( "/".join((path, "jobs", str(item.value), comps[-1], "fun")) ).value ) if efun == fun: ret[comps[-1]] = str(efun) return ret def get_jids(): """ Return a list of all job ids """ log.debug("sdstack_etcd returner <get_jids> called") ret = [] client, path = _get_conn(__opts__) items = client.get("/".join((path, "jobs"))) for item in items.children: if item.dir is True: jid = str(item.key).split("/")[-1] ret.append(jid) return ret def get_minions(): """ Return a list of minions """ log.debug("sdstack_etcd returner <get_minions> called") ret = [] client, path = _get_conn(__opts__) items = client.get("/".join((path, "minions"))) for item in items.children: comps = str(item.key).split("/") ret.append(comps[-1]) return ret def prep_jid(nocache=False, passed_jid=None): # pylint: disable=unused-argument """ Do any work necessary to prepare a JID, including sending a custom id """ return passed_jid if passed_jid is not None else salt.utils.jid.gen_jid(__opts__)