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 logging
import salt.utils.napalm
from salt.utils.napalm import proxy_napalm_wrap
log = logging.getLogger(__file__)
# ----------------------------------------------------------------------------------------------------------------------
# module properties
# ---------------------------------------------------... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/napalm_probes.py | 0.78609 | 0.179351 | napalm_probes.py | pypi |
import logging
import salt.utils.path
from salt.exceptions import CommandExecutionError
logger = logging.getLogger(__name__)
# Function alias to make sure not to shadow built-in's
__func_alias__ = {"list_": "list"}
def __virtual__():
"""
Only work when cabal-install is installed.
"""
return (salt.... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/cabal.py | 0.691081 | 0.187616 | cabal.py | pypi |
import logging
import os
import jinja2
import jinja2.exceptions
import salt.utils.files
import salt.utils.json
import salt.utils.stringutils
import salt.utils.templates
import salt.utils.validate.net
from salt.exceptions import CommandExecutionError
# Set up logging
log = logging.getLogger(__name__)
# Set up templat... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/rh_ip.py | 0.448426 | 0.238545 | rh_ip.py | pypi |
import logging
import salt.utils.platform
from salt.exceptions import CommandExecutionError
from salt.utils.args import clean_kwargs
try:
from netmiko import ConnectHandler
from netmiko import BaseConnection
HAS_NETMIKO = True
except ImportError:
HAS_NETMIKO = False
# -------------------------------... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/netmiko_mod.py | 0.772273 | 0.179243 | netmiko_mod.py | pypi |
import logging
import os
import re
import time
import salt.utils.data
import salt.utils.files
import salt.utils.path
import salt.utils.platform
from salt.exceptions import CommandExecutionError
log = logging.getLogger(__name__)
def __virtual__():
"""
Only work on POSIX-like systems
"""
return not sa... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/xfs.py | 0.529263 | 0.154217 | xfs.py | pypi |
import logging
import os
import socket
import urllib.error
import salt.utils.data
import salt.utils.files
import salt.utils.http
import salt.utils.json
from salt.exceptions import SaltException
from salt.utils.versions import LooseVersion as _LooseVersion
log = logging.getLogger(__name__)
INTERFACE_DEFAULT_PORTS = [... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/zabbix.py | 0.427277 | 0.154504 | zabbix.py | pypi |
import salt.exceptions
import salt.utils.path
def __virtual__():
"""
Only work on Gentoo systems with layman installed
"""
if __grains__["os"] == "Gentoo" and salt.utils.path.which("layman"):
return "layman"
return (
False,
"layman execution module cannot be loaded: only av... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/layman.py | 0.669421 | 0.238434 | layman.py | pypi |
import logging
import salt.utils.data
import salt.utils.path
from salt.exceptions import CommandExecutionError
log = logging.getLogger(__name__)
def __virtual__():
"""
Only load if hg is installed
"""
if salt.utils.path.which("hg") is None:
return (False, "The hg execution module cannot be l... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/hg.py | 0.644784 | 0.23965 | hg.py | pypi |
HAS_SHADE = False
try:
import shade
HAS_SHADE = True
except ImportError:
pass
__virtualname__ = "glanceng"
def __virtual__():
"""
Only load this module if shade python module is installed
"""
if HAS_SHADE:
return __virtualname__
return (
False,
"The glanceng e... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/glanceng.py | 0.692642 | 0.184143 | glanceng.py | pypi |
import logging
import salt.utils.json
import salt.utils.path
import salt.utils.platform
log = logging.getLogger(__name__)
# Function aliases
__func_alias__ = {
"list_installed": "list",
"update_installed": "update",
"import_image": "import",
}
# Define the module's virtual name
__virtualname__ = "imgadm... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/smartos_imgadm.py | 0.508788 | 0.164148 | smartos_imgadm.py | pypi |
import salt.utils.path
import salt.utils.platform
# Define the module's virtual name
__virtualname__ = "system"
def __virtual__():
"""
Only supported on Solaris-like systems
"""
if not salt.utils.platform.is_sunos() or not salt.utils.path.which("shutdown"):
return (
False,
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/solaris_system.py | 0.534612 | 0.408513 | solaris_system.py | pypi |
import logging
import salt.utils.versions
import salt.version
log = logging.getLogger(__name__)
__virtualname__ = "salt_version"
def __virtual__():
"""
Only work on POSIX-like systems
"""
return __virtualname__
def get_release_number(name):
"""
Returns the release number of a given releas... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/salt_version.py | 0.823612 | 0.184859 | salt_version.py | pypi |
import shlex
import salt.exceptions
import salt.utils.decorators.path
try:
import pipes
HAS_DEPS = True
except ImportError:
HAS_DEPS = False
if hasattr(shlex, "quote"):
_quote = shlex.quote
elif HAS_DEPS and hasattr(pipes, "quote"):
_quote = pipes.quote
else:
_quote = None
# Don't shadow b... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/openstack_config.py | 0.534127 | 0.193547 | openstack_config.py | pypi |
import logging
import os
import jinja2
import jinja2.exceptions
import salt.utils.files
import salt.utils.stringutils
import salt.utils.templates
import salt.utils.validate.net
from salt.exceptions import CommandExecutionError
# Set up logging
log = logging.getLogger(__name__)
# Set up template environment
JINJA = j... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/suse_ip.py | 0.449634 | 0.212579 | suse_ip.py | pypi |
import logging
import re
import salt.utils.network
import salt.utils.path
log = logging.getLogger(__name__)
__virtualname__ = "dig"
def __virtual__():
"""
Only load module if dig binary is present
"""
if salt.utils.path.which("dig"):
return __virtualname__
return (
False,
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/dig.py | 0.64131 | 0.228081 | dig.py | pypi |
import logging
import re
import shlex
import salt.utils.platform
try:
import pipes
HAS_DEPS = True
except ImportError:
HAS_DEPS = False
if hasattr(shlex, "quote"):
_quote = shlex.quote
elif HAS_DEPS and hasattr(pipes, "quote"):
_quote = pipes.quote
else:
_quote = None
log = logging.getLogge... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/mac_keychain.py | 0.58439 | 0.206454 | mac_keychain.py | pypi |
import salt.utils.data
import salt.utils.files
def __virtual__():
"""
Only work on Gentoo
"""
if __grains__["os"] == "Gentoo":
return "makeconf"
return (
False,
"The makeconf execution module cannot be loaded: only available on Gentoo"
" systems.",
)
def _get_... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/makeconf.py | 0.479016 | 0.182626 | makeconf.py | pypi |
import os
HAS_GENTOOLKIT = False
try:
from gentoolkit.eclean import search, clean, cli, exclude as excludemod
HAS_GENTOOLKIT = True
except ImportError:
pass
# Define the module's virtual name
__virtualname__ = "gentoolkit"
def __virtual__():
"""
Only work on Gentoo systems with gentoolkit inst... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/gentoolkitmod.py | 0.535341 | 0.232484 | gentoolkitmod.py | pypi |
import difflib
import logging
import os
import salt.utils.event
import salt.utils.files
import salt.utils.yaml
log = logging.getLogger(__name__)
default_event_wait = 60
__func_alias__ = {"list_": "list", "reload_": "reload"}
def list_(return_yaml=True, include_pillar=True, include_opts=True, **kwargs):
"""
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/beacons.py | 0.585694 | 0.15428 | beacons.py | pypi |
import logging
from salt.exceptions import CommandExecutionError
try:
import requests
ENABLED = True
except ImportError:
ENABLED = False
log = logging.getLogger(__name__)
def __virtual__():
"""
Only load this module if the requests python module is available
"""
if ENABLED:
ret... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/uptime.py | 0.600071 | 0.162314 | uptime.py | pypi |
import logging
import os
import re
import salt.utils.platform
import salt.utils.versions
log = logging.getLogger(__name__)
__virtualname__ = "dism"
# We always want to use the version of dism that matches the architecture of the
# host machine. On 32bit boxes that will always be System32. On 64bit boxes that
# are r... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/win_dism.py | 0.695545 | 0.1692 | win_dism.py | pypi |
try:
import sqlite3
HAS_SQLITE3 = True
except ImportError:
HAS_SQLITE3 = False
# pylint: disable=C0103
def __virtual__():
if not HAS_SQLITE3:
return (
False,
"The sqlite3 execution module failed to load: the sqlite3 python library is"
" not available.",
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/sqlite3.py | 0.634883 | 0.211967 | sqlite3.py | pypi |
import logging
import os
import salt.utils.platform
log = logging.getLogger(__name__)
def __virtual__():
"""
No dependency checks, and not renaming, just return True
"""
return True
def setval(key, val, false_unsets=False, permanent=False):
"""
Set a single salt process environment variabl... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/environ.py | 0.631822 | 0.184694 | environ.py | pypi |
import logging
import time
import salt.utils.compat
import salt.utils.odict as odict
import salt.utils.versions
from salt.exceptions import SaltInvocationError
log = logging.getLogger(__name__)
# pylint: disable=import-error
try:
# pylint: disable=unused-import
import boto
import boto3
# pylint: ... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/boto_rds.py | 0.457379 | 0.171165 | boto_rds.py | pypi |
import logging
import salt.utils.platform
log = logging.getLogger(__name__)
def __virtual__():
"""
Only work on POSIX-like systems
"""
if salt.utils.platform.is_windows():
return (
False,
"The extfs execution module cannot be loaded: only available on "
"n... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/extfs.py | 0.715026 | 0.339718 | extfs.py | pypi |
import logging
import time
from datetime import datetime
import salt.utils.platform
import salt.utils.winapi
from salt.exceptions import ArgumentValueError, CommandExecutionError
try:
import pythoncom
import win32com.client
HAS_DEPENDENCIES = True
except ImportError:
HAS_DEPENDENCIES = False
log = l... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/win_task.py | 0.409693 | 0.15704 | win_task.py | pypi |
import re
import salt.utils.path
from salt.exceptions import CommandExecutionError, SaltInvocationError
def __virtual__():
"""
Only load if csf exists on the system
"""
if salt.utils.path.which("csf") is None:
return (False, "The csf execution module cannot be loaded: csf unavailable.")
e... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/csf.py | 0.520496 | 0.154376 | csf.py | pypi |
import logging
import salt.utils.platform
log = logging.getLogger(__name__)
__func_alias__ = {"list_": "list"}
# Define the module's virtual name
__virtualname__ = "service"
def __virtual__():
"""
Only work on systems that are a proxy minion
"""
try:
if salt.utils.platform.is_proxy() and ... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/dummyproxy_service.py | 0.700485 | 0.182207 | dummyproxy_service.py | pypi |
import datetime
import logging
import salt.utils.compat
import salt.utils.json
import salt.utils.versions
log = logging.getLogger(__name__)
# pylint: disable=import-error
try:
# pylint: disable=unused-import
import boto
import boto3
# pylint: enable=unused-import
from botocore.exceptions impo... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/boto_iot.py | 0.559651 | 0.178741 | boto_iot.py | pypi |
from salt.exceptions import SaltException
# Import Salt modules
try:
import ciscoconfparse
HAS_CISCOCONFPARSE = True
except ImportError:
HAS_CISCOCONFPARSE = False
# ------------------------------------------------------------------------------
# module properties
# -------------------------------------... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/ciscoconfparse_mod.py | 0.796807 | 0.196865 | ciscoconfparse_mod.py | pypi |
import logging
import re
import uuid
# Solve the Chicken and egg problem where grains need to run before any
# of the modules are loaded and are generally available for any usage.
import salt.modules.cmdmod
import salt.utils.path
log = logging.getLogger(__name__)
def __virtual__():
"""
Only work when dmidec... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/smbios.py | 0.593374 | 0.175344 | smbios.py | pypi |
import logging
import salt.utils.path
log = logging.getLogger(__name__)
def __virtual__():
"""
Only load if pcs package is installed
"""
if salt.utils.path.which("pcs"):
return "pcs"
return (False, "Missing dependency: pcs")
def __use_new_commands():
"""
The command line argume... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/pcs.py | 0.454714 | 0.16975 | pcs.py | pypi |
import logging
import salt.utils.path
import salt.utils.platform
from salt.exceptions import CommandExecutionError
log = logging.getLogger(__name__)
# Define the module's virtual name
__virtualname__ = "virt"
def __virtual__():
"""
Provides virt on SmartOS
"""
if salt.utils.platform.is_smartos_glob... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/smartos_virt.py | 0.715623 | 0.216798 | smartos_virt.py | pypi |
import logging
import salt.utils.files
import salt.utils.path
log = logging.getLogger(__name__)
# Define the module's virtual name
__virtualname__ = "rbac"
def __virtual__():
"""
Provides rbac if we are running on a solaris like system
"""
if __grains__["kernel"] == "SunOS" and salt.utils.path.whic... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/rbac_solaris.py | 0.555435 | 0.157234 | rbac_solaris.py | pypi |
import hashlib
import logging
import os.path
import random
import signal
import salt.utils.path
log = logging.getLogger(__name__)
def __virtual__():
"""
Only load the module if znc is installed
"""
if salt.utils.path.which("znc"):
return "znc"
return (False, "Module znc: znc binary not f... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/znc.py | 0.541894 | 0.199756 | znc.py | pypi |
import copy
import logging
import os
import salt.utils.data
from salt.exceptions import SaltCloudConfigError
try:
import salt.cloud
HAS_SALTCLOUD = True
except ImportError:
HAS_SALTCLOUD = False
log = logging.getLogger(__name__)
__func_alias__ = {"profile_": "profile"}
def __virtual__():
"""
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/cloud.py | 0.63307 | 0.179908 | cloud.py | pypi |
import copy
import logging
import os
from collections.abc import Mapping
import salt.pillar
import salt.utils.crypt
import salt.utils.data
import salt.utils.dictupdate
import salt.utils.functools
import salt.utils.odict
import salt.utils.yaml
from salt.defaults import DEFAULT_TARGET_DELIM, NOT_SET
from salt.exceptions... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/pillar.py | 0.718496 | 0.285752 | pillar.py | pypi |
import logging
import salt.utils.platform
log = logging.getLogger(__name__)
def __virtual__():
"""
Only work on POSIX-like systems
"""
if salt.utils.platform.is_windows():
return (
False,
"The locate execution module cannot be loaded: only available on "
"... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/locate.py | 0.629205 | 0.21162 | locate.py | pypi |
import logging
import os
import salt.utils.files
import salt.utils.platform
import salt.utils.stringutils
from salt.exceptions import SaltInvocationError
_LOG = logging.getLogger(__name__)
_DEFAULT_CONF = "/etc/logrotate.conf"
# Define a function alias in order not to shadow built-in's
__func_alias__ = {"set_": "se... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/logrotate.py | 0.592902 | 0.209126 | logrotate.py | pypi |
import salt.utils.platform
__proxyenabled__ = ["cisconso"]
__virtualname__ = "cisconso"
def __virtual__():
if salt.utils.platform.is_proxy():
return __virtualname__
return (
False,
"The cisconso execution module failed to load: "
"only available on proxy minions.",
)
def... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/cisconso.py | 0.734215 | 0.378459 | cisconso.py | pypi |
import logging
import salt.utils.platform
import salt.utils.win_functions
import salt.utils.winapi
try:
import win32api
import win32com.client
import pywintypes
HAS_DEPENDENCIES = True
except ImportError:
HAS_DEPENDENCIES = False
log = logging.getLogger(__name__)
# Define the module's virtual n... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/win_groupadd.py | 0.678753 | 0.159708 | win_groupadd.py | pypi |
import fnmatch
import os
import re
__func_alias__ = {"reload_": "reload"}
_GRAINMAP = {"Arch": "/etc/rc.d", "Arch ARM": "/etc/rc.d"}
def __virtual__():
"""
Only work on systems which exclusively use sysvinit
"""
# Disable on these platforms, specific service modules exist:
disable = {
"R... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/linux_service.py | 0.546496 | 0.164416 | linux_service.py | pypi |
import logging
import salt.utils.args
import salt.utils.mac_utils
from salt.exceptions import CommandExecutionError
log = logging.getLogger(__name__)
__virtualname__ = "xattr"
__func_alias__ = {
"list_": "list",
}
def __virtual__():
"""
Only work on Mac OS
"""
if __grains__["os"] in ["MacOS", "... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/mac_xattr.py | 0.708515 | 0.187411 | mac_xattr.py | pypi |
import logging
import xml.etree.ElementTree as ET
import salt.utils.http
import salt.utils.yaml
log = logging.getLogger(__name__)
def __virtual__():
"""
Only load the module if apache is installed
"""
if _apikey():
return True
return (
False,
'The API key was not specifie... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/bamboohr.py | 0.52342 | 0.19112 | bamboohr.py | pypi |
import logging
import os.path
import salt.utils.path
# Set up logger
log = logging.getLogger(__name__)
# Define the module's virtual name
__virtualname__ = "lvm"
def __virtual__():
"""
Only load the module if lvm is installed
"""
if salt.utils.path.which("lvm"):
return __virtualname__
r... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/linux_lvm.py | 0.618089 | 0.213152 | linux_lvm.py | pypi |
import os
import re
import salt.utils.files
# Define the module's virtual name
__virtualname__ = "kmod"
_LOAD_MODULE = '{0}_load="YES"'
_LOADER_CONF = "/boot/loader.conf"
_MODULE_RE = '^{0}_load="YES"'
_MODULES_RE = r'^(\w+)_load="YES"'
def __virtual__():
"""
Only runs on FreeBSD systems
"""
if __... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/freebsdkmod.py | 0.493897 | 0.153074 | freebsdkmod.py | pypi |
import salt.utils.platform
from salt.exceptions import CommandExecutionError
# Define the module's virtual name
__virtualname__ = "desktop"
def __virtual__():
"""
Only load on Mac systems
"""
if salt.utils.platform.is_darwin():
return __virtualname__
return False, "Cannot load macOS deskt... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/mac_desktop.py | 0.577019 | 0.155495 | mac_desktop.py | pypi |
import logging
import salt.utils.path
log = logging.getLogger(__name__)
def __virtual__():
"""
Only load the module if Open vSwitch is installed
"""
if salt.utils.path.which("ovs-vsctl"):
return "openvswitch"
return (False, "Missing dependency: ovs-vsctl")
def _param_may_exist(may_exis... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/openvswitch.py | 0.788705 | 0.207215 | openvswitch.py | pypi |
import logging
import re
import salt.utils.path
from salt.exceptions import CommandExecutionError, SaltInvocationError
log = logging.getLogger(__name__)
def __virtual__():
"""
Only works on OpenBSD and FreeBSD for now; other systems with pf (macOS,
FreeBSD, etc) need to be tested before enabling them.
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/pf.py | 0.591605 | 0.231875 | pf.py | pypi |
import logging
import salt.utils.path
from salt.utils.versions import warn_until_date
log = logging.getLogger(__name__)
HAS_PYCASSA = False
try:
from pycassa.system_manager import SystemManager
HAS_PYCASSA = True
except ImportError:
pass
def __virtual__():
"""
Only load if pycassa is availabl... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/cassandra_mod.py | 0.615897 | 0.157752 | cassandra_mod.py | pypi |
import fnmatch
import glob
import os
import re
__func_alias__ = {"reload_": "reload"}
# Define the module's virtual name
__virtualname__ = "service"
def __virtual__():
"""
Only work on NetBSD
"""
if __grains__["os"] == "NetBSD" and os.path.exists("/etc/rc.subr"):
return __virtualname__
r... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/netbsdservice.py | 0.676192 | 0.178705 | netbsdservice.py | pypi |
import datetime
import hashlib
import re
import socket
import salt.utils.network
import salt.utils.platform
import salt.utils.validate.net
from salt._compat import ipaddress
from salt.modules.network import (
calc_net,
convert_cidr,
get_fqdn,
get_hostname,
ifacestartswith,
interface,
interf... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/win_network.py | 0.477554 | 0.182826 | win_network.py | pypi |
import logging
log = logging.getLogger(__name__)
__func_alias__ = {
"filter_": "filter",
}
def _udev(udev_info, key):
"""
Return the value for a udev key.
The `key` parameter is a lower case text joined by dots. For
example, 'e.id_bus' will represent the key for
`udev_info['E']['ID_BUS']`.
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/devinfo.py | 0.729905 | 0.26877 | devinfo.py | pypi |
import fnmatch
import logging
import re
import salt.utils.platform
log = logging.getLogger(__name__)
__func_alias__ = {"list_": "list"}
# Define the module's virtual name
__virtualname__ = "service"
def __virtual__():
"""
Only work on systems that are a proxy minion
"""
try:
if (
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/rest_service.py | 0.713032 | 0.173253 | rest_service.py | pypi |
import base64
import random
import salt.utils.data
import salt.utils.pycrypto
from salt.exceptions import SaltInvocationError
# Define the module's virtual name
__virtualname__ = "random"
def __virtual__():
return __virtualname__
def hash(value, algorithm="sha512"):
"""
.. versionadded:: 2014.7.0
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/mod_random.py | 0.820829 | 0.296737 | mod_random.py | pypi |
import getpass
import shlex
import salt.utils.platform
from salt.exceptions import CommandExecutionError, SaltInvocationError
__virtualname__ = "system"
def __virtual__():
"""
Only for MacOS with atrun enabled
"""
if not salt.utils.platform.is_darwin():
return (
False,
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/mac_system.py | 0.637595 | 0.240775 | mac_system.py | pypi |
import logging
import time
import salt.utils.compat
import salt.utils.data
import salt.utils.json
import salt.utils.versions
from salt.exceptions import CommandExecutionError, SaltInvocationError
try:
# pylint: disable=unused-import
import boto
import boto.ec2
# pylint: enable=unused-import
fro... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/boto_ec2.py | 0.725357 | 0.162048 | boto_ec2.py | pypi |
import base64
import hashlib
import hmac
import io
import salt.exceptions
import salt.utils.files
import salt.utils.hashutils
import salt.utils.stringutils
def digest(instr, checksum="md5"):
"""
Return a checksum digest for a string
instr
A string
checksum : ``md5``
The hashing algor... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/hashutil.py | 0.861626 | 0.354461 | hashutil.py | pypi |
import re
import salt.utils.path
def __virtual__():
"""
loads the module, if only sysbench is installed
"""
# finding the path of the binary
if salt.utils.path.which("sysbench"):
return "sysbench"
return (
False,
"The sysbench execution module failed to load: the sysbe... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/sysbench.py | 0.525612 | 0.393968 | sysbench.py | pypi |
import salt.utils.mac_utils
import salt.utils.platform
from salt.exceptions import SaltInvocationError
__virtualname__ = "power"
def __virtual__():
"""
Only for macOS
"""
if not salt.utils.platform.is_darwin():
return (
False,
"The mac_power module could not be loaded:... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/mac_power.py | 0.728459 | 0.297763 | mac_power.py | pypi |
import logging
from functools import wraps
import salt.utils.azurearm
# Azure libs
HAS_LIBS = False
try:
import azure.mgmt.dns.models # pylint: disable=unused-import
from msrest.exceptions import SerializationError
from msrestazure.azure_exceptions import CloudError
HAS_LIBS = True
except ImportErr... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/azurearm_dns.py | 0.759225 | 0.153486 | azurearm_dns.py | pypi |
import logging
import os
import re
import salt.utils.json
import salt.utils.path
import salt.utils.stringutils
from salt.exceptions import SaltInvocationError
_DEFAULT_CONFIG_PATH = "/etc/aptly.conf"
log = logging.getLogger(__name__)
# Define the module's virtual name
__virtualname__ = "aptly"
def __virtual__():
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/aptly.py | 0.591723 | 0.151875 | aptly.py | pypi |
import logging
import os
from salt.utils.files import fopen
try:
import textfsm
HAS_TEXTFSM = True
except ImportError:
HAS_TEXTFSM = False
try:
from textfsm import clitable
HAS_CLITABLE = True
except ImportError:
HAS_CLITABLE = False
log = logging.getLogger(__name__)
__virtualname__ = "te... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/textfsm_mod.py | 0.554953 | 0.264762 | textfsm_mod.py | pypi |
import copy
import inspect
import logging
import sys
from collections.abc import Mapping
import salt.loader
from salt.defaults import DEFAULT_TARGET_DELIM
from salt.exceptions import SaltException
__func_alias__ = {"list_": "list"}
log = logging.getLogger(__name__)
def compound(tgt, minion_id=None):
"""
Re... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/match.py | 0.586286 | 0.254984 | match.py | pypi |
import datetime
import logging
import time
import salt.utils.http
import salt.utils.json
from salt.exceptions import SaltInvocationError
log = logging.getLogger(__name__)
_api_key_missing_error = "No VictorOps api key found."
def __virtual__():
"""
Only load the module if apache is installed
"""
if... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/victorops.py | 0.631026 | 0.200519 | victorops.py | pypi |
import logging
import os
import salt.utils.path
log = logging.getLogger(__name__)
__virtualname__ = "webutil"
def __virtual__():
"""
Only load the module if htpasswd is installed
"""
if salt.utils.path.which("htpasswd"):
return __virtualname__
return (
False,
"The htpass... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/webutil.py | 0.650245 | 0.152284 | webutil.py | pypi |
import logging
import os
import shlex
import salt.utils.platform
try:
import pipes
HAS_DEPS = True
except ImportError:
HAS_DEPS = False
log = logging.getLogger(__name__)
__virtualname__ = "macpackage"
if hasattr(shlex, "quote"):
_quote = shlex.quote
elif HAS_DEPS and hasattr(pipes, "quote"):
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/macpackage.py | 0.589598 | 0.180974 | macpackage.py | pypi |
import logging
import salt.utils.json
import salt.utils.path
log = logging.getLogger(__name__)
_OUTPUT = "--output json"
def __virtual__():
if salt.utils.path.which("aws"):
# awscli is installed, load the module
return True
return (False, "The module aws_sqs could not be loaded: aws command... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/aws_sqs.py | 0.641085 | 0.206514 | aws_sqs.py | pypi |
import logging
import salt.utils.http
import salt.utils.json
from salt.exceptions import SaltInvocationError
log = logging.getLogger(__name__)
def __virtual__():
"""
Only load the module if apache is installed
"""
if not __opts__.get("rallydev", {}).get("username", None):
return (
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/rallydev.py | 0.575946 | 0.197058 | rallydev.py | pypi |
import os
import re
POLICY_MAP_DICT = {
"Adaptive": "ad",
"CLAROpt": "co",
"LeastBlocks": "lb",
"LeastIos": "li",
"REquest": "re",
"RoundRobin": "rr",
"StreamIo": "si",
"SymmOpt": "so",
}
POLICY_RE = re.compile(".*policy=([^;]+)")
def has_powerpath():
if os.path.exists("/sbin/emc... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/powerpath.py | 0.47098 | 0.1933 | powerpath.py | pypi |
import logging
import salt.utils.platform
try:
import wmi
import salt.utils.winapi
HAS_LIBS = True
except ImportError:
HAS_LIBS = False
log = logging.getLogger(__name__)
def __virtual__():
"""
Only works on Windows systems
"""
if not salt.utils.platform.is_windows():
return... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/win_dns_client.py | 0.714329 | 0.159152 | win_dns_client.py | pypi |
import logging
try:
from sense_hat import SenseHat
has_sense_hat = True
except (ImportError, NameError):
_sensehat = None
has_sense_hat = False
log = logging.getLogger(__name__)
def __virtual__():
"""
Only load the module if SenseHat is available
"""
if has_sense_hat:
try:
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/sensehat.py | 0.792103 | 0.52902 | sensehat.py | pypi |
import logging
import os
import re
import salt.utils.files
import salt.utils.path
import salt.utils.stringutils
import salt.utils.versions
log = logging.getLogger(__name__)
__func_alias__ = {"set_": "set"}
# Define the module's virtual name
__virtualname__ = "debconf"
def __virtual__():
"""
Confirm this m... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/debconfmod.py | 0.432303 | 0.151467 | debconfmod.py | pypi |
r"""
Manage the Windows registry
Hives
-----
Hives are the main sections of the registry and all begin with the word HKEY.
- HKEY_LOCAL_MACHINE
- HKEY_CURRENT_USER
- HKEY_USER
Keys
----
Keys are the folders in the registry. Keys can have many nested subkeys. Keys
can have a value assigned to them under the (Default... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/reg.py | 0.8398 | 0.406862 | reg.py | pypi |
import collections
# Import Salt Modules
import salt.utils.path
Plugin = collections.namedtuple("Plugin", "name status update versino")
def __virtual__():
if salt.utils.path.which("wp"):
return True
return (False, "Missing dependency: wp")
def _get_plugins(stuff):
return Plugin(stuff)
def l... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/wordpress.py | 0.563378 | 0.176299 | wordpress.py | pypi |
import logging
import salt.modules.cmdmod
import salt.utils.args
import salt.utils.path
import salt.utils.platform
import salt.utils.versions
from salt.utils.odict import OrderedDict
__virtualname__ = "zfs"
log = logging.getLogger(__name__)
# Function alias to set mapping.
__func_alias__ = {
"list_": "list",
}
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/zfs.py | 0.657978 | 0.216425 | zfs.py | pypi |
import logging
import salt.utils.data
import salt.utils.platform
log = logging.getLogger(__name__)
# Define the module's virtual name
__virtualname__ = "pkg"
def __virtual__():
"""
Only work on systems that are a proxy minion
"""
try:
if salt.utils.platform.is_proxy() and __opts__["proxy"][... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/dummyproxy_pkg.py | 0.574753 | 0.158435 | dummyproxy_pkg.py | pypi |
import salt.utils.sdb
__func_alias__ = {
"set_": "set",
}
def get(uri, strict=False):
"""
Get a value from a db, using a uri in the form of ``sdb://<profile>/<key>``. If
the uri provided is not valid, then it will be returned as-is, unless ``strict=True`` was passed.
CLI Example:
.. code-bl... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/sdb.py | 0.767864 | 0.256256 | sdb.py | pypi |
import salt.utils.platform
# Define the module's virtual name
__virtualname__ = "auditpol"
def __virtual__():
"""
Only works on Windows systems
"""
if not salt.utils.platform.is_windows():
return False, "Module win_auditpol: module only available on Windows"
return __virtualname__
def ... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/win_auditpol.py | 0.857589 | 0.245944 | win_auditpol.py | pypi |
import logging
import re
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 __virtualname__
def... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/win_powercfg.py | 0.839372 | 0.184694 | win_powercfg.py | pypi |
import difflib
import logging
from salt.exceptions import CommandExecutionError
from salt.utils.args import clean_kwargs
try:
import pyeapi
HAS_PYEAPI = True
except ImportError:
HAS_PYEAPI = False
# -----------------------------------------------------------------------------
# execution module properti... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/arista_pyeapi.py | 0.75985 | 0.199211 | arista_pyeapi.py | pypi |
import logging
import re
import salt.utils.args
import salt.utils.data
import salt.utils.decorators
import salt.utils.files
import salt.utils.path
from salt.utils.odict import OrderedDict
log = logging.getLogger(__name__)
# Define the module's virtual name
__virtualname__ = "zonecfg"
# Function aliases
__func_alias... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/zonecfg.py | 0.4917 | 0.166947 | zonecfg.py | pypi |
import glob
import logging
import os
import tempfile
import time
import salt.crypt
import salt.utils.path
# Set up logging
log = logging.getLogger(__name__)
def __virtual__():
"""
Only load if qemu-img and qemu-nbd are installed
"""
if salt.utils.path.which("qemu-nbd"):
return "qemu_nbd"
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/qemu_nbd.py | 0.418578 | 0.201794 | qemu_nbd.py | pypi |
import logging
import salt.utils.decorators
import salt.utils.path
log = logging.getLogger(__name__)
# Define the module's virtual name
__virtualname__ = "zoneadm"
# Function aliases
__func_alias__ = {"list_zones": "list"}
@salt.utils.decorators.memoize
def _is_globalzone():
"""
Check if we are running in... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/zoneadm.py | 0.636692 | 0.17515 | zoneadm.py | pypi |
import logging
import salt.utils.compat
import salt.utils.versions
log = logging.getLogger(__name__)
# pylint: disable=import-error
try:
# pylint: disable=unused-import
import boto
import boto3
# pylint: enable=unused-import
from botocore.exceptions import ClientError
logging.getLogger("... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/modules/boto_cloudtrail.py | 0.578448 | 0.164097 | boto_cloudtrail.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/tops/mongo.py | 0.591015 | 0.308385 | mongo.py | pypi |
from salt.utils.schema import (
ArrayItem,
BooleanItem,
ComplexSchemaItem,
DefinitionsSchema,
IntegerItem,
OneOfItem,
Schema,
StringItem,
)
class VMwareScsiAddressItem(StringItem):
pattern = r"vmhba\d+:C\d+:T\d+:L\d+"
class DiskGroupDiskScsiAddressItem(ComplexSchemaItem):
"""... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/config/schemas/esxi.py | 0.600071 | 0.223462 | esxi.py | pypi |
from salt.utils.schema import (
AnyOfItem,
ArrayItem,
BooleanItem,
ComplexSchemaItem,
DefinitionsSchema,
DictItem,
IntegerItem,
Schema,
StringItem,
)
class OptionValueItem(ComplexSchemaItem):
"""Sechma item of the OptionValue"""
title = "OptionValue"
key = StringItem(t... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/config/schemas/esxcluster.py | 0.73782 | 0.204005 | esxcluster.py | pypi |
from salt.utils.schema import (
AnyOfItem,
ArrayItem,
BooleanItem,
ComplexSchemaItem,
DefinitionsSchema,
IntegerItem,
IPv4Item,
NullItem,
NumberItem,
StringItem,
)
class ESXVirtualMachineSerialBackingItem(ComplexSchemaItem):
"""
Configuration Schema Item for ESX Virtual... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/config/schemas/esxvm.py | 0.810816 | 0.232147 | esxvm.py | pypi |
from salt.config.schemas.minion import MinionConfiguration
from salt.utils.schema import (
AnyOfItem,
BooleanItem,
DictItem,
IntegerItem,
PortItem,
RequirementsItem,
Schema,
SecretItem,
StringItem,
)
class RosterEntryConfig(Schema):
"""
Schema definition of a Salt SSH Roste... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/config/schemas/ssh.py | 0.57821 | 0.1811 | ssh.py | pypi |
import os
def __virtual__():
"""
Only load if the snapper module is available in __salt__
"""
if "snapper.diff" in __salt__:
return "snapper"
return (False, "snapper module could not be loaded")
def _get_baseline_from_tag(config, tag):
"""
Returns the last created baseline snapsh... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/snapper.py | 0.695441 | 0.210442 | snapper.py | pypi |
import logging
import salt.utils.platform
log = logging.getLogger(__name__)
__virtualname__ = "certutil"
def __virtual__():
"""
Only work on Windows
"""
if salt.utils.platform.is_windows():
return __virtualname__
return (False, "Only Windows supported")
def add_store(name, store, salte... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/win_certutil.py | 0.763043 | 0.221319 | win_certutil.py | pypi |
import salt.utils.json
def alias(name, collections, **kwargs):
"""
Create alias and enforce collection list.
Use the solrcloud module to get alias members and set them.
You can pass additional arguments that will be forwarded to http.query
name
The collection name
collections
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/solrcloud.py | 0.661595 | 0.288106 | solrcloud.py | pypi |
import logging
log = logging.getLogger(__name__)
def __virtual__():
"""
Only load if cyg module is available in __salt__.
"""
if "cyg.list" in __salt__:
return True
return (False, "cyg module could not be loaded")
def installed(name, cyg_arch="x86_64", mirrors=None):
"""
Make su... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/cyg.py | 0.75037 | 0.17266 | cyg.py | pypi |
def present(name=None, ipv4addr=None, data=None, ensure_data=True, **api_opts):
"""
Ensure infoblox A record.
When you wish to update a hostname ensure `name` is set to the hostname
of the current record. You can give a new name in the `data.name`.
State example:
.. code-block:: yaml
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/infoblox_a.py | 0.600774 | 0.343012 | infoblox_a.py | pypi |
import logging
import salt.utils.dictdiffer
log = logging.getLogger(__name__)
def __virtual__():
"""
Only work when the ACME module agrees
"""
if "acme.cert" in __salt__:
return True
return (False, "acme module could not be loaded")
def cert(
name,
aliases=None,
email=None,... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/acme.py | 0.619126 | 0.173009 | acme.py | pypi |
__virtualname__ = "zookeeper"
def __virtual__():
if "zookeeper.create" in __salt__:
return __virtualname__
return (False, "zookeeper module could not be loaded")
def _check_acls(left, right):
first = not bool(set(left) - set(right))
second = not bool(set(right) - set(left))
return first ... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/zookeeper.py | 0.688887 | 0.256681 | zookeeper.py | pypi |
import os.path
import salt.utils.files
import salt.utils.stringutils
from salt.utils.icinga2 import get_certs_path
def __virtual__():
"""
Only load if the icinga2 module is available in __salt__
"""
if "icinga2.generate_ticket" in __salt__:
return True
return (False, "icinga2 module could... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/icinga2.py | 0.4917 | 0.229255 | icinga2.py | pypi |
from salt.exceptions import CommandExecutionError, SaltInvocationError
def __virtual__():
"""
Load if the module firewall is loaded
"""
if "firewall.get_config" in __salt__:
return "win_firewall"
return (False, "firewall module could not be loaded")
def disabled(name="allprofiles"):
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/win_firewall.py | 0.822332 | 0.165559 | win_firewall.py | pypi |
import salt.utils.data
def __virtual__():
"""
Only load if boto is available.
"""
if "boto_cloudwatch.get_alarm" in __salt__:
return "boto_cloudwatch_alarm"
return (False, "boto_cloudwatch module could not be loaded")
def present(name, attributes, region=None, key=None, keyid=None, profi... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/boto_cloudwatch_alarm.py | 0.537284 | 0.184694 | boto_cloudwatch_alarm.py | pypi |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.