code stringlengths 114 1.05M | path stringlengths 3 312 | quality_prob float64 0.5 0.99 | learning_prob float64 0.2 1 | filename stringlengths 3 168 | kind stringclasses 1
value |
|---|---|---|---|---|---|
import re
from salt.exceptions import CommandExecutionError
def __virtual__():
"""
This state is only available on Minions which support sysctl
"""
if "sysctl.show" in __salt__:
return True
return (False, "sysctl module could not be loaded")
def present(name, value, config=None):
""... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/sysctl.py | 0.416678 | 0.277608 | sysctl.py | pypi |
def __virtual__():
if "ddns.update" in __salt__:
return "ddns"
return (False, "ddns module could not be loaded")
def present(name, zone, ttl, data, rdtype="A", **kwargs):
"""
Ensures that the named DNS record is present with the given ttl.
name
The host portion of the DNS record, ... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/ddns.py | 0.79858 | 0.330363 | ddns.py | pypi |
import re
from salt.defaults import DEFAULT_TARGET_DELIM
def exists(name, delimiter=DEFAULT_TARGET_DELIM):
"""
Ensure that a grain is set
name
The grain name
delimiter
A delimiter different from the default can be provided.
Check whether a grain exists. Does not attempt to chec... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/grains.py | 0.650467 | 0.343012 | grains.py | pypi |
def present(name=None, data=None, ensure_data=True, **api_opts):
"""
This will ensure that a host with the provided name exists.
This will try to ensure that the state of the host matches the given data
If the host is not found then one will be created.
When trying to update a hostname ensure `name... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/infoblox_host_record.py | 0.685318 | 0.387632 | infoblox_host_record.py | pypi |
import copy
import requests
import salt.utils.json
from salt.utils.dictdiffer import DictDiffer
def __virtual__():
"""
Only load if grafana v2.0 is configured.
"""
if __salt__["config.get"]("grafana_version", 1) == 2:
return True
return (False, "Not configured for grafana_version 2")
_D... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/grafana_dashboard.py | 0.590189 | 0.19309 | grafana_dashboard.py | pypi |
def __virtual__():
"""
Only load if the XMPP module is available in __salt__
"""
if "xmpp.send_msg" in __salt__:
return "xmpp"
return (False, "xmpp module could not be loaded")
def send_msg(name, recipient, profile):
"""
Send a message to an XMPP user
.. code-block:: yaml
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/xmpp.py | 0.556882 | 0.16228 | xmpp.py | pypi |
import collections
def __virtual__():
"""
Only load if the mssql module is present
"""
if "mssql.version" in __salt__:
return True
return (False, "mssql module could not be loaded")
def _normalize_options(options):
if type(options) in [dict, collections.OrderedDict]:
return [... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/mssql_user.py | 0.532425 | 0.187449 | mssql_user.py | pypi |
__virtualname__ = "neutron_subnet"
def __virtual__():
if "neutronng.list_subnets" in __salt__:
return __virtualname__
return (
False,
"The neutronng execution module failed to load: shade python module is not available",
)
def present(name, auth=None, **kwargs):
"""
Ensur... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/neutron_subnet.py | 0.713931 | 0.22563 | neutron_subnet.py | pypi |
import logging
log = logging.getLogger(__name__)
def _check_cron(user, path, mask, cmd):
"""
Return the changes
"""
arg_mask = mask.split(",")
arg_mask.sort()
lst = __salt__["incron.list_tab"](user)
if cmd.endswith("\n"):
cmd = cmd[:-1]
for cron in lst["crons"]:
if pa... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/incron.py | 0.508544 | 0.191933 | incron.py | pypi |
import salt.utils.path
def __virtual__():
"""
Only work with nfs tools installed
"""
cmd = "exportfs"
if salt.utils.path.which(cmd):
return bool(cmd)
return (
False,
"The nfs_exports state module failed to load: "
"the exportfs binary is not in the path",
)... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/nfs_export.py | 0.460289 | 0.210219 | nfs_export.py | pypi |
import inspect
import logging
import salt.exceptions
log = logging.getLogger(__name__)
def create_alert(name=None, api_key=None, reason=None, action_type="Create"):
"""
Create an alert in OpsGenie. Example usage with Salt's requisites and other
global state arguments could be found above.
Required ... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/opsgenie.py | 0.728652 | 0.264109 | opsgenie.py | pypi |
import copy
import datetime
import logging
import math
import sys
import salt.utils.dictupdate as dictupdate
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s %(name)s %(levelname)s %(message)s",
stream=sys.stdout,
)
log = logging.getLogger()
class GsiNotUpdatableError(Exception):
"""Rais... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/boto_dynamodb.py | 0.490968 | 0.172555 | boto_dynamodb.py | pypi |
import logging
from functools import wraps
import salt.utils.azurearm
__virtualname__ = "azurearm_dns"
log = logging.getLogger(__name__)
def __virtual__():
"""
Only make this state available if the azurearm_dns module is available.
"""
if "azurearm_dns.zones_list_by_resource_group" in __salt__:
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/azurearm_dns.py | 0.845783 | 0.161519 | azurearm_dns.py | pypi |
__virtualname__ = "keystone_domain"
def __virtual__():
if "keystoneng.domain_get" in __salt__:
return __virtualname__
return (
False,
"The keystoneng execution module failed to load: shade python module is not"
" available",
)
def present(name, auth=None, **kwargs):
"... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/keystone_domain.py | 0.729134 | 0.156201 | keystone_domain.py | pypi |
__monitor__ = [
"loadavg",
"process",
]
def loadavg(name, maximum=None, minimum=None):
"""
Return the current load average for the specified minion. Available values
for name are `1-min`, `5-min` and `15-min`. `minimum` and `maximum` values
should be passed in as strings.
"""
# Monitor... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/status.py | 0.853272 | 0.366306 | status.py | pypi |
def __virtual__():
"""
Only load if the victorops module is available in __salt__
"""
if "victorops.create_event" in __salt__:
return "victorops"
return (False, "victorops module could not be loaded")
def create_event(name, message_type, routing_key="everyone", **kwargs):
"""
Creat... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/victorops.py | 0.75183 | 0.237311 | victorops.py | pypi |
import logging
log = logging.getLogger(__name__)
def __virtual__():
if "libcloud_loadbalancer.list_balancers" in __salt__:
return True
return (False, "libcloud_loadbalancer module could not be loaded")
def state_result(result, message, name, changes=None):
if changes is None:
changes = ... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/libcloud_loadbalancer.py | 0.724383 | 0.156298 | libcloud_loadbalancer.py | pypi |
import collections
def __virtual__():
"""
Only load if the mssql module is present
"""
if "mssql.version" in __salt__:
return True
return (False, "mssql module could not be loaded")
def _normalize_options(options):
if type(options) in [dict, collections.OrderedDict]:
return [... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/mssql_login.py | 0.502441 | 0.228044 | mssql_login.py | pypi |
def __virtual__():
"""
Only load if the influxdb module is available
"""
if "influxdb.db_exists" in __salt__:
return "influxdb_continuous_query"
return (False, "influxdb module could not be loaded")
def present(
name, database, query, resample_time=None, coverage_period=None, **client_... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/influxdb_continuous_query.py | 0.788502 | 0.265428 | influxdb_continuous_query.py | pypi |
import logging
import xml.etree.ElementTree as ET
import salt.utils.compat
import salt.utils.json
log = logging.getLogger(__name__)
__virtualname__ = "boto_cfn"
def __virtual__():
"""
Only load if elementtree xml library and boto are available.
"""
if "boto_cfn.exists" in __salt__:
return T... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/boto_cfn.py | 0.614394 | 0.216405 | boto_cfn.py | pypi |
def __virtual__():
"""
Only load if aws is available.
"""
if __salt__["cmd.has_exec"]("aws"):
return "aws_sqs"
return (False, "aws command not found")
def exists(name, region, user=None, opts=False):
"""
Ensure the SQS queue exists.
name
Name of the SQS queue.
reg... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/aws_sqs.py | 0.581897 | 0.193433 | aws_sqs.py | pypi |
def license_present(name):
"""
Ensures that the specified PowerPath license key is present
on the host.
name
The license key to ensure is present
"""
ret = {"name": name, "changes": {}, "result": False, "comment": ""}
if not __salt__["powerpath.has_powerpath"]():
ret["resul... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/powerpath.py | 0.646683 | 0.20831 | powerpath.py | pypi |
import salt.exceptions
import salt.utils.path
def __virtual__():
"""
Ensure the racadm command is installed
"""
if salt.utils.path.which("racadm"):
return True
return (False, "racadm command not found")
def present(name, password, permission):
"""
Ensure the user exists on the De... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/drac.py | 0.462716 | 0.190103 | drac.py | pypi |
import logging
import salt.utils.data
import salt.utils.platform
import salt.utils.win_update
log = logging.getLogger(__name__)
__virtualname__ = "wua"
def __virtual__():
"""
Only valid on Windows machines
"""
if not salt.utils.platform.is_windows():
return False, "WUA: Only available on Wi... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/win_wua.py | 0.779825 | 0.239466 | win_wua.py | pypi |
import requests
def __virtual__():
"""Only load if grafana v2.0 is configured."""
if __salt__["config.get"]("grafana_version", 1) == 2:
return True
return (False, "Not configured for grafana_version 2")
def present(
name,
type,
url,
access="proxy",
user="",
password="",
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/grafana_datasource.py | 0.657978 | 0.290993 | grafana_datasource.py | pypi |
import re
def __virtual__():
"""
Only load if Chef execution module is available.
"""
if "chef.client" in __salt__:
return True
return (False, "chef module could not be loaded")
def client(name, **kwargs):
"""
name
Unique identifier for the state. Does not affect the Chef... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/chef.py | 0.58676 | 0.220217 | chef.py | pypi |
import logging
import salt.exceptions
# Get Logging Started
log = logging.getLogger(__name__)
LOGIN_DETAILS = {}
def __virtual__():
return "esxdatacenter"
def mod_init(low):
return True
def datacenter_configured(name):
"""
Makes sure a datacenter exists.
If the state is run by an ``esxdatac... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/esxdatacenter.py | 0.471467 | 0.255587 | esxdatacenter.py | pypi |
__virtualname__ = "debconf"
def __virtual__():
"""
Confirm this module is on a Debian based system
"""
if __grains__["os_family"] != "Debian":
return (False, "debconf state only runs on Debian systems")
# Check that debconf was loaded
if "debconf.show" not in __salt__:
return (... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/debconfmod.py | 0.589598 | 0.179333 | debconfmod.py | pypi |
r"""
Manage the Windows registry
===========================
Many python developers think of registry keys as if they were python keys in a
dictionary which is not the case. The windows registry is broken down into the
following components:
Hives
-----
This is the top level of the registry. They all begin with HKEY.... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/reg.py | 0.814459 | 0.376566 | reg.py | pypi |
def __virtual__():
if "wordpress.show_plugin" in __salt__:
return True
return (False, "wordpress module could not be loaded")
def installed(name, user, admin_user, admin_password, admin_email, title, url):
"""
Run the initial setup of wordpress
name
path to the wordpress installat... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/wordpress.py | 0.453988 | 0.194349 | wordpress.py | pypi |
def __virtual__():
"""
Only load if the mssql module is present
"""
if "mssql.version" in __salt__:
return True
return (False, "mssql module could not be loaded")
def present(name, owner=None, grants=None, **kwargs):
"""
Ensure that the named database is present with the specified ... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/mssql_role.py | 0.575349 | 0.212497 | mssql_role.py | pypi |
def __virtual__():
"""
Only make these states available if Open vSwitch module is available.
"""
if "openvswitch.bridge_create" in __salt__:
return True
return (False, "openvswitch module could not be loaded")
def present(name):
"""
Ensures that the named bridge exists, eventually ... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/openvswitch_bridge.py | 0.732496 | 0.175662 | openvswitch_bridge.py | pypi |
import logging
from datetime import datetime
from salt.utils.odict import OrderedDict
log = logging.getLogger(__name__)
# Define the state's virtual name
__virtualname__ = "zfs"
# Compare modifiers for zfs.schedule_snapshot
comp_hour = {"minute": 0}
comp_day = {"minute": 0, "hour": 0}
comp_month = {"minute": 0, "ho... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/zfs.py | 0.579043 | 0.261195 | zfs.py | pypi |
import logging
import salt.utils.data
import salt.utils.platform
log = logging.getLogger(__name__)
__virtualname__ = "powercfg"
def __virtual__():
"""
Only work on Windows
"""
if not salt.utils.platform.is_windows():
return False, "PowerCFG: Module only works on Windows"
return __virtua... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/win_powercfg.py | 0.781581 | 0.230866 | win_powercfg.py | pypi |
def __virtual__():
"""
Only load if the postgres module is present
"""
if "postgres.privileges_grant" not in __salt__:
return (
False,
"Unable to load postgres module. Make sure `postgres.bins_dir` is set.",
)
return True
def present(
name,
object_n... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/postgres_privileges.py | 0.718397 | 0.227319 | postgres_privileges.py | pypi |
def __virtual__():
"""
Only make these states available if Zabbix module is available.
"""
if "zabbix.usermacro_create" in __salt__:
return True
return (False, "zabbix module could not be loaded")
def present(name, value, hostid=None, **kwargs):
"""
Creates a new usermacro.
:p... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/zabbix_usermacro.py | 0.721253 | 0.202148 | zabbix_usermacro.py | pypi |
from salt.exceptions import CommandExecutionError, CommandNotFoundError
def __virtual__():
"""
Only load if the bower module is available in __salt__
"""
if "bower.list" in __salt__:
return "bower"
return (False, "bower module could not be loaded")
def installed(name, dir, pkgs=None, use... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/bower.py | 0.631253 | 0.175361 | bower.py | pypi |
import logging
__virtualname__ = "nxos"
__virtual_aliases__ = ("nxos_upgrade",)
log = logging.getLogger(__name__)
def __virtual__():
return __virtualname__
def image_running(name, system_image, kickstart_image=None, issu=True, **kwargs):
"""
Ensure the NX-OS system image is running on the device.
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/nxos_upgrade.py | 0.607547 | 0.151278 | nxos_upgrade.py | pypi |
from salt.utils.dictdiffer import deep_diff
def __virtual__():
"""Only load if grafana4 module is available"""
if "grafana4.get_datasource" in __salt__:
return True
return (False, "grafana4 module could not be loaded")
def present(
name,
type,
url,
access=None,
user=None,
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/grafana4_datasource.py | 0.606265 | 0.275714 | grafana4_datasource.py | pypi |
def __virtual__():
"""
Check if we have peer access ?
"""
return True
def _send_command(cmd, worker, lbn, target, profile="default", tgt_type="glob"):
"""
Send a command to the modjk loadbalancer
The minion need to be able to publish the commands to the load balancer
cmd:
work... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/modjk_worker.py | 0.758332 | 0.261932 | modjk_worker.py | pypi |
import logging
import salt.utils.path
from salt.exceptions import CommandExecutionError
from salt.output import nested
log = logging.getLogger(__name__)
class ForwardingMapping:
"""
Represents a port forwarding statement mapping a local port to a remote
port for a specific protocol (TCP or UDP)
"""
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/firewalld.py | 0.775987 | 0.17252 | firewalld.py | pypi |
import pathlib
import re
__virtualname__ = "idem"
def __virtual__():
if "idem.hub" in __utils__:
return __virtualname__
else:
return False, "idem is not available"
def _get_refs(sources, tree):
"""
Determine where the sls sources are
"""
sls_sources = []
SLSs = []
if... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/idem.py | 0.499756 | 0.210624 | idem.py | pypi |
import logging
import os
import os.path
import salt.utils.data
log = logging.getLogger(__name__)
def __virtual__():
"""
Only load if boto is available.
"""
if "boto_cloudtrail.exists" in __salt__:
return "boto_cloudtrail"
return (False, "boto_cloudtrail module could not be loaded")
def... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/boto_cloudtrail.py | 0.499756 | 0.167117 | boto_cloudtrail.py | pypi |
import logging
from ctypes import (
CDLL,
CFUNCTYPE,
POINTER,
Structure,
c_char,
c_char_p,
c_int,
c_uint,
c_void_p,
cast,
pointer,
sizeof,
)
from ctypes.util import find_library
import salt.utils.user
log = logging.getLogger(__name__)
try:
LIBC = CDLL(find_library(... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/auth/pam.py | 0.409575 | 0.159446 | pam.py | pypi |
import getpass
import logging
import random
import time
from collections.abc import Iterable, Mapping
import salt.channel.client
import salt.config
import salt.exceptions
import salt.loader
import salt.payload
import salt.utils.args
import salt.utils.dictupdate
import salt.utils.files
import salt.utils.minions
import... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/auth/__init__.py | 0.55941 | 0.155399 | __init__.py | pypi |
import salt.ext.tornado.httpserver
import salt.ext.tornado.ioloop
import salt.ext.tornado.web
import salt.utils.event
def start(address=None, port=5000, ssl_crt=None, ssl_key=None):
"""
Api to listen for webhooks to send to the reactor.
Implement the webhook behavior in an engine.
:py:class:`rest_che... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/engines/webhook.py | 0.696062 | 0.235817 | webhook.py | pypi |
import fnmatch
import salt.utils.event
import salt.utils.http
import salt.utils.json
_HEADERS = {"Content-Type": "application/json"}
def _logstash(url, data):
"""
Issues HTTP queries to the logstash server.
"""
result = salt.utils.http.query(
url,
"POST",
header_dict=_HEADERS... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/engines/http_logstash.py | 0.568895 | 0.16492 | http_logstash.py | pypi |
import logging
import shlex
import subprocess
import time
import salt.loader
import salt.utils.event
import salt.utils.process
from salt.exceptions import CommandExecutionError
log = logging.getLogger(__name__)
def _read_stdout(proc):
"""
Generator that returns stdout
"""
yield from iter(proc.stdout... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/engines/script.py | 0.607547 | 0.221098 | script.py | pypi |
import logging
import salt.utils.event
log = logging.getLogger(__name__)
def send(tag, data=None):
"""
Send an event with the given tag and data.
This is useful for sending events directly to the master from the shell
with salt-run. It is also quite useful for sending events in orchestration
st... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/runners/event.py | 0.639061 | 0.294545 | event.py | pypi |
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__():... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/runners/mattermost.py | 0.708918 | 0.212702 | mattermost.py | pypi |
import salt.utils.nacl
__virtualname__ = "nacl"
def __virtual__():
if __opts__["fips_mode"] is True:
return False, "nacl runner not available in FIPS mode"
return salt.utils.nacl.check_requirements()
def keygen(sk_file=None, pk_file=None, **kwargs):
"""
Use libnacl to generate a keypair.
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/runners/nacl.py | 0.784649 | 0.206354 | nacl.py | pypi |
import copy
import logging
import salt.client
import salt.loader
import salt.pillar
import salt.utils.args
from salt.exceptions import SaltClientError
log = logging.getLogger(__name__)
def cmd(fun, *args, **kwargs):
"""
.. versionchanged:: 2018.3.0
Added ``with_pillar`` argument
Execute ``fun``... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/runners/salt.py | 0.672977 | 0.205954 | salt.py | pypi |
import logging
import salt.utils.http
log = logging.getLogger(__name__)
def query(url, output=True, **kwargs):
"""
Query a resource, and decode the return data
Passes through all the parameters described in the
:py:func:`utils.http.query function <salt.utils.http.query>`:
CLI Example:
.. ... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/runners/http.py | 0.733452 | 0.174551 | http.py | pypi |
import salt.utils.functools
import salt.utils.json
import salt.utils.pagerduty
import salt.utils.yaml
def __virtual__():
"""
No dependencies outside of what Salt itself requires
"""
return True
def list_services(profile=None, api_key=None):
"""
List services belonging to this account
CL... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/runners/pagerduty.py | 0.740925 | 0.201735 | pagerduty.py | pypi |
import fnmatch
import logging
import os
import salt.cache
import salt.config
import salt.fileserver.gitfs
import salt.payload
import salt.pillar.git_pillar
import salt.runners.winrepo
import salt.utils.args
import salt.utils.gitfs
import salt.utils.master
from salt.exceptions import SaltInvocationError
from salt.files... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/runners/cache.py | 0.711431 | 0.224162 | cache.py | pypi |
import salt.fileserver
def envs(backend=None, sources=False):
"""
Return the available fileserver environments. If no backend is provided,
then the environments for all configured backends will be returned.
backend
Narrow fileserver backends to a subset of the enabled ones.
.. versio... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/runners/fileserver.py | 0.843122 | 0.251349 | fileserver.py | pypi |
import logging
import salt.pillar
import salt.utils.minions
log = logging.getLogger(__name__)
def show_top(minion=None, saltenv="base"):
"""
Returns the compiled top data for pillar for a specific minion. If no
minion is specified, we use the first minion we find.
CLI Example:
.. code-block::... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/runners/pillar.py | 0.78016 | 0.254202 | pillar.py | pypi |
import logging
import salt.loader
import salt.utils.event
import salt.utils.functools
import salt.utils.jid
from salt.exceptions import SaltInvocationError
log = logging.getLogger(__name__)
def pause(jid, state_id=None, duration=None):
"""
Set up a state id pause, this instructs a running state to pause at ... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/runners/state.py | 0.685213 | 0.238107 | state.py | pypi |
import logging
import salt.pillar.git_pillar
import salt.utils.gitfs
from salt.exceptions import SaltRunnerError
log = logging.getLogger(__name__)
def update(branch=None, repo=None):
"""
.. versionadded:: 2014.1.0
.. versionchanged:: 2015.8.4
This runner function now supports the :ref:`git_pill... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/runners/git_pillar.py | 0.681197 | 0.231783 | git_pillar.py | pypi |
import salt.utils.sdb
__func_alias__ = {
"set_": "set",
}
def get(uri):
"""
Get a value from a db, using a uri in the form of sdb://<profile>/<key>. If
the uri provided does not start with sdb://, then it will be returned as-is.
CLI Example:
.. code-block:: bash
salt-run sdb.get sd... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/runners/sdb.py | 0.814828 | 0.269387 | sdb.py | pypi |
import ast
import logging
import re
import salt.loader
import salt.utils.beacons
try:
from pyroute2 import IPDB
IP = IPDB()
HAS_PYROUTE2 = True
except ImportError:
IP = None
HAS_PYROUTE2 = False
log = logging.getLogger(__name__)
__virtualname__ = "network_settings"
ATTRS = [
"family",
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/beacons/network_settings.py | 0.559892 | 0.164819 | network_settings.py | pypi |
import atexit
import logging
import select
import time
import salt.utils.beacons
import salt.utils.stringutils
try:
import pybonjour
HAS_PYBONJOUR = True
except ImportError:
HAS_PYBONJOUR = False
log = logging.getLogger(__name__)
__virtualname__ = "bonjour_announce"
LAST_GRAINS = {}
SD_REF = None
de... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/beacons/bonjour_announce.py | 0.540196 | 0.175291 | bonjour_announce.py | pypi |
import logging
import re
import salt.utils.beacons
log = logging.getLogger(__name__)
__virtualname__ = "sensehat"
def __virtual__():
if "sensehat.get_pressure" in __salt__:
return __virtualname__
else:
err_msg = "sensehat.get_pressure is missing."
log.error("Unable to load %s beacon... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/beacons/sensehat.py | 0.651687 | 0.168532 | sensehat.py | pypi |
import logging
import sys
from collections.abc import Iterable, Mapping, Sequence
log = logging.getLogger(__name__)
def is_non_string_iterable(obj):
"""
Returns True if obj is non-string iterable, False otherwise
Future proof way that is compatible with both Python3 and Python2 to check
for non stri... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/daemons/__init__.py | 0.46952 | 0.400222 | __init__.py | pypi |
import salt.utils.json
__virtualname__ = "redis"
def __virtual__():
"""
Only load if the redis module is in __salt__
"""
if "redis.get_key" in __salt__:
return __virtualname__
return False
def ext_pillar(minion_id, pillar, function, **kwargs):
"""
Grabs external pillar data base... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/pillar/redismod.py | 0.626353 | 0.250534 | redismod.py | pypi |
r"""
Use remote Mercurial repository as a Pillar source.
.. versionadded:: 2015.8.0
The module depends on the ``hglib`` python module being available.
This is the same requirement as for hgfs\_ so should not pose any extra
hurdles.
This external Pillar source can be configured in the master config file as such:
..... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/pillar/hg_pillar.py | 0.776242 | 0.206374 | hg_pillar.py | pypi |
import logging
import re
try:
import pymongo
HAS_PYMONGO = True
except ImportError:
HAS_PYMONGO = False
__opts__ = {
"mongo.db": "salt",
"mongo.host": "salt",
"mongo.password": "",
"mongo.port": 27017,
"mongo.user": "",
}
def __virtual__():
if not HAS_PYMONGO:
return Fa... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/pillar/mongo.py | 0.576065 | 0.219683 | mongo.py | pypi |
import logging
import os
import pickle
import time
from copy import deepcopy
import salt.utils.files
import salt.utils.hashutils
from salt.pillar import Pillar
HAS_LIBS = False
try:
# pylint: disable=no-name-in-module
from azure.storage.blob import BlobServiceClient
# pylint: enable=no-name-in-module
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/pillar/azureblob.py | 0.666497 | 0.178741 | azureblob.py | pypi |
import copy
import logging
import re
import salt.cache
import salt.utils.data
import salt.utils.minions
from salt._compat import ipaddress
log = logging.getLogger(__name__)
def targets(tgt, tgt_type="glob", **kwargs): # pylint: disable=W0613
"""
Return the targets from the Salt Masters' minion cache.
A... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/roster/cache.py | 0.620966 | 0.262065 | cache.py | pypi |
import copy
import fnmatch
import logging
log = logging.getLogger(__name__)
# Try to import range from https://github.com/ytoolshed/range
HAS_RANGE = False
try:
import seco.range
HAS_RANGE = True
except ImportError:
log.error("Unable to load range library")
# pylint: enable=import-error
def __virtual__... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/roster/range.py | 0.479504 | 0.224757 | range.py | pypi |
import copy
import logging
import socket
import salt.utils.network
from salt._compat import ipaddress
log = logging.getLogger(__name__)
def targets(tgt, tgt_type="glob", **kwargs):
"""
Return the targets from the flat yaml file, checks opts for location but
defaults to /etc/salt/roster
"""
rmatc... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/roster/scan.py | 0.587943 | 0.206384 | scan.py | pypi |
import cherrypy
from ws4py.server.cherrypyserver import WebSocketPlugin, WebSocketTool
from ws4py.websocket import WebSocket
# pylint: enable=3rd-party-module-not-gated
cherrypy.tools.websocket = WebSocketTool()
WebSocketPlugin(cherrypy.engine).subscribe()
class SynchronizingWebsocket(WebSocket):
"""
Class ... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/netapi/rest_cherrypy/tools/websockets.py | 0.707405 | 0.173498 | websockets.py | pypi |
import logging
from salt.exceptions import SaltSystemExit
# This must be present or the Salt loader won't load this module.
__proxyenabled__ = ["cisconso"]
try:
from pynso.client import NSOClient
from pynso.datastores import DatastoreType
HAS_PYNSO_LIBS = True
except ImportError:
HAS_PYNSO_LIBS = Fa... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/proxy/cisconso.py | 0.673621 | 0.19031 | cisconso.py | pypi |
import copy
import logging
# Import Salt modules
from salt.exceptions import SaltException
# -----------------------------------------------------------------------------
# proxy properties
# -----------------------------------------------------------------------------
__proxyenabled__ = ["nxos_api"]
# proxy name
#... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/proxy/nxos_api.py | 0.563258 | 0.19095 | nxos_api.py | pypi |
import logging
import os
import warnings
import salt.utils.kinds as kinds
from salt.exceptions import SaltClientError, SaltSystemExit, get_error_message
from salt.utils import migrations
from salt.utils.platform import is_junos
from salt.utils.process import HAS_PSUTIL
# All salt related deprecation warnings should b... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/cli/daemons.py | 0.424173 | 0.163546 | daemons.py | pypi |
try:
import statistics
HAS_STATS = True
except ImportError:
HAS_STATS = False
def __virtual__():
"""
The statistics module must be pip installed
"""
return HAS_STATS
def calc(name, num, oper, minimum=0, maximum=0, ref=None):
"""
Perform a calculation on the ``num`` most recent v... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/thorium/calc.py | 0.87247 | 0.572484 | calc.py | pypi |
import logging
import salt.utils.stringutils
log = logging.getLogger(__file__)
def gt(name, value):
"""
Only succeed if the value in the given register location is greater than
the given value
USAGE:
.. code-block:: yaml
foo:
check.gt:
- value: 42
run_re... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/thorium/check.py | 0.583915 | 0.212457 | check.py | pypi |
import salt.utils.stringutils
__func_alias__ = {
"set_": "set",
"list_": "list",
}
def set_(name, add, match):
"""
Add a value to the named set
USAGE:
.. code-block:: yaml
foo:
reg.set:
- add: bar
- match: my/custom/event
"""
ret = {"name":... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/thorium/reg.py | 0.539469 | 0.185283 | reg.py | pypi |
import logging
import pprint
import urllib.parse
import salt.returners
import salt.utils.slack
import salt.utils.yaml
log = logging.getLogger(__name__)
__virtualname__ = "slack"
def _get_options(ret=None):
"""
Get the slack options from salt.
"""
defaults = {"channel": "#general"}
attrs = {
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/returners/slack_returner.py | 0.563858 | 0.2466 | slack_returner.py | pypi |
import logging
import salt.returners
import salt.utils.json
import salt.utils.mattermost
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_opt... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/returners/mattermost_returner.py | 0.671686 | 0.152537 | mattermost_returner.py | pypi |
import logging
import salt.returners
import salt.utils.jid
try:
import librato
HAS_LIBRATO = True
except ImportError:
HAS_LIBRATO = False
# Define the module's Virtual Name
__virtualname__ = "librato"
log = logging.getLogger(__name__)
def __virtual__():
if not HAS_LIBRATO:
return (
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/returners/librato_return.py | 0.481941 | 0.18101 | librato_return.py | pypi |
import logging
import socket
import time
import requests
import salt.utils.json
_max_content_bytes = 100000
http_event_collector_debug = False
log = logging.getLogger(__name__)
__virtualname__ = "splunk"
def __virtual__():
"""
Return virtual name of the module.
:return: The virtual name of the module.... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/returners/splunk.py | 0.578805 | 0.176175 | splunk.py | pypi |
import json
import logging
import urllib.parse
import salt.returners
import salt.utils.http
import salt.utils.yaml
log = logging.getLogger(__name__)
__virtualname__ = "slack_webhook"
UNCHANGED_KEY = "unchanged"
CHANGED_KEY = "changed"
FAILED_KEY = "failed"
TASKS_KEY = "tasks"
COUNTER_KEY = "counter"
DURATION_KEY = ... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/returners/slack_webhook_return.py | 0.59843 | 0.167593 | slack_webhook_return.py | pypi |
import logging
import salt.returners
import salt.utils.jid
try:
import appoptics_metrics
HAS_APPOPTICS = True
except ImportError:
HAS_APPOPTICS = False
# Define the module's Virtual Name
__virtualname__ = "appoptics"
log = logging.getLogger(__name__)
def __virtual__():
if not HAS_APPOPTICS:
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/returners/appoptics_return.py | 0.516108 | 0.209975 | appoptics_return.py | pypi |
import salt.pillar
import salt.utils.data
import salt.utils.dictupdate
from salt.defaults import DEFAULT_TARGET_DELIM
try:
# Python 3
from collections.abc import Mapping
except ImportError:
# We still allow Py2 import because this could be executed in a machine with Py2.
from collections import Mapping... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/client/ssh/wrapper/pillar.py | 0.768168 | 0.407805 | pillar.py | pypi |
import logging
import time
import salt.config
import salt.loader
import salt.syspaths
from salt.utils.odict import OrderedDict
log = logging.getLogger(__name__)
def factory(opts, **kwargs):
"""
Creates and returns the cache class.
If memory caching is enabled by opts MemCache class will be instantiated.... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/cache/__init__.py | 0.794823 | 0.383959 | __init__.py | pypi |
import os
import salt.utils.path
# Functions that are mapped into an equivalent one in
# transactional_update module
DELEGATION_MAP = {
"state.single": "transactional_update.single",
"state.sls": "transactional_update.sls",
"state.apply": "transactional_update.apply",
"state.highstate": "transactional... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/executors/transactional_update.py | 0.681197 | 0.42316 | transactional_update.py | pypi |
import logging
import time
import salt.utils.stringutils
log = logging.getLogger(__name__)
_DEFAULT_SPLAYTIME = 300
_HASH_SIZE = 8192
_HASH_VAL = None
def __init__(opts):
global _HASH_VAL
_HASH_VAL = _get_hash()
def _get_hash():
"""
Jenkins One-At-A-Time Hash Function
More Info: http://en.wik... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/executors/splay.py | 0.555435 | 0.175114 | splay.py | pypi |
import copy
import datetime
import logging
import yaml
from salt.serializers import DeserializationError, SerializationError
from salt.utils.aggregation import Map, Sequence, aggregate
from salt.utils.odict import OrderedDict
from yaml.constructor import ConstructorError
from yaml.nodes import MappingNode
from yaml.... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/serializers/yamlex.py | 0.687945 | 0.186613 | yamlex.py | pypi |
import datetime
import logging
import yaml
from salt.serializers import DeserializationError, SerializationError
from salt.utils.odict import OrderedDict
from yaml.constructor import ConstructorError
from yaml.scanner import ScannerError
__all__ = ["deserialize", "serialize", "available"]
log = logging.getLogger(__n... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/serializers/yaml.py | 0.672547 | 0.153486 | yaml.py | pypi |
import configparser
import io
from salt.serializers import DeserializationError, SerializationError
__all__ = ["deserialize", "serialize", "available"]
available = True
def deserialize(stream_or_string, **options):
"""
Deserialize any string or stream like object into a Python data structure.
:param s... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/serializers/configparser.py | 0.563378 | 0.169819 | configparser.py | pypi |
r"""
The Linode Cloud Module
=======================
The Linode cloud module is used to interact with the Linode Cloud.
You can target a specific version of the Linode API with the ``api_version`` parameter. The default is ``v3``.
Provider
--------
The following provider parameters are supported:
- **apikey**: (re... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/cloud/clouds/linode.py | 0.83825 | 0.649328 | linode.py | pypi |
import logging
import os
import pprint
import time
import salt.config as config
import salt.utils.cloud
import salt.utils.files
import salt.utils.stringutils
from salt.exceptions import (
SaltCloudConfigError,
SaltCloudExecutionFailure,
SaltCloudExecutionTimeout,
SaltCloudNotFound,
SaltCloudSystemE... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/cloud/clouds/profitbricks.py | 0.523908 | 0.152979 | profitbricks.py | pypi |
import logging
import os
import pprint
import time
import salt.config as config
import salt.utils.cloud
import salt.utils.json
from salt.exceptions import (
SaltCloudConfigError,
SaltCloudExecutionFailure,
SaltCloudExecutionTimeout,
SaltCloudNotFound,
SaltCloudSystemExit,
)
log = logging.getLogger... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/cloud/clouds/scaleway.py | 0.621081 | 0.153359 | scaleway.py | pypi |
import hashlib
import logging
import os
import salt.crypt
import salt.key
import salt.utils.crypt
import salt.utils.files
import salt.utils.platform
from salt.utils.sanitizers import clean
__func_alias__ = {
"list_": "list",
"key_str": "print",
}
log = logging.getLogger(__name__)
def list_(match):
"""
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/wheel/key.py | 0.7324 | 0.230119 | key.py | pypi |
from salt.utils.dictdiffer import recursive_diff
def list_diff(list_a, list_b, key):
return ListDictDiffer(list_a, list_b, key)
class ListDictDiffer:
"""
Calculates the differences between two lists of dictionaries.
It matches the items based on a given key and uses the recursive_diff to
diff t... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/utils/listdiffer.py | 0.818229 | 0.327117 | listdiffer.py | pypi |
import copy
import logging
from salt.utils.odict import OrderedDict
__all__ = ["aggregate", "Aggregate", "Map", "Scalar", "Sequence"]
log = logging.getLogger(__name__)
class Aggregate:
"""
Aggregation base.
"""
class Map(OrderedDict, Aggregate):
"""
Map aggregation.
"""
class Sequence(l... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/utils/aggregation.py | 0.721547 | 0.292861 | aggregation.py | pypi |
r"""
A salt util for modifying the audit policies on the machine. This util is used
by the ``win_auditpol`` and ``win_lgpo`` modules.
Though this utility does not set group policy for auditing, it displays how all
auditing configuration is applied on the machine, either set directly or via
local or domain group policy... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/utils/win_lgpo_auditpol.py | 0.909881 | 0.38318 | win_lgpo_auditpol.py | pypi |
import copy
from collections.abc import Mapping
def diff(current_dict, past_dict):
return DictDiffer(current_dict, past_dict)
class DictDiffer:
"""
Calculate the difference between two dictionaries as:
(1) items added
(2) items removed
(3) keys same in both but changed values
(4) keys sa... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/utils/dictdiffer.py | 0.667256 | 0.364212 | dictdiffer.py | pypi |
import salt.utils.files
import salt.utils.stringutils
from salt.exceptions import SaltException
class InvalidFileMode(SaltException):
"""
An invalid file mode was used to open the file passed to the buffer
"""
class BufferedReader:
"""
This object allows iterating through the contents of a file ... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/utils/filebuffer.py | 0.778439 | 0.433262 | filebuffer.py | pypi |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.