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 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_database.py | 0.502197 | 0.212722 | mssql_database.py | pypi |
def __virtual__():
"""
Only load if the influxdb08 module is available
"""
if "influxdb08.db_exists" in __salt__:
return "influxdb08_database"
return (False, "influxdb08 module could not be loaded")
def present(name, user=None, password=None, host=None, port=None):
"""
Ensure that ... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/influxdb08_database.py | 0.518059 | 0.15241 | influxdb08_database.py | pypi |
from salt.exceptions import CommandExecutionError, SaltInvocationError
__docformat__ = "restructuredtext en"
__virtualname__ = "lxd_container"
# Keep in sync with: https://github.com/lxc/lxd/blob/master/shared/status.go
CONTAINER_STATUS_RUNNING = 103
CONTAINER_STATUS_FROZEN = 110
CONTAINER_STATUS_STOPPED = 102
def... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/lxd_container.py | 0.706798 | 0.187783 | lxd_container.py | pypi |
def present(name, **kwargs):
"""
Ensure a job is present in the schedule
name
The unique name that is given to the scheduled job.
seconds
The scheduled job will be executed after the specified
number of seconds have passed.
minutes
The scheduled job will be execute... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/schedule.py | 0.762114 | 0.620708 | schedule.py | pypi |
import logging
import xml.etree.ElementTree as ET
import salt.utils.xmlutil as xml
log = logging.getLogger(__name__)
def __virtual__():
if "panos.commit" in __salt__:
return True
return (False, "panos module could not be loaded")
def _build_members(members, anycheck=False):
"""
Builds a me... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/panos.py | 0.658527 | 0.203787 | panos.py | pypi |
def present(name=None, data=None, ensure_data=True, **api_opts):
"""
Ensure the CNAME with the given data is present.
name
CNAME of record
data
raw CNAME api data see: https://INFOBLOX/wapidoc
State example:
.. code-block:: yaml
infoblox_cname.present:
- n... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/infoblox_cname.py | 0.689619 | 0.475423 | infoblox_cname.py | pypi |
import salt.utils.functools
def send(
name,
data=None,
preload=None,
with_env=False,
with_grains=False,
with_pillar=False,
show_changed=True,
**kwargs
):
"""
Send an event to the Salt Master
.. versionadded:: 2014.7.0
Accepts the same arguments as the :py:func:`event.... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/event.py | 0.698329 | 0.350227 | event.py | pypi |
import logging
log = logging.getLogger(__name__)
def __virtual__():
"""
Only make these states available if a kernelpkg provider has been detected or
assigned for this minion
"""
if "kernelpkg.upgrade" in __salt__:
return True
return (False, "kernelpkg module could not be loaded")
d... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/kernelpkg.py | 0.721253 | 0.271726 | kernelpkg.py | pypi |
__virtualname__ = "keystone_endpoint"
def __virtual__():
if "keystoneng.endpoint_get" in __salt__:
return __virtualname__
return (
False,
"The keystoneng execution module failed to load: shade python module is not"
" available",
)
def _common(ret, name, service_name, kwar... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/keystone_endpoint.py | 0.735262 | 0.155816 | keystone_endpoint.py | pypi |
from os import path
__monitor__ = [
"status",
]
def _validate_int(name, value, limits=(), strip="%"):
"""
Validate the named integer within the supplied limits inclusive and
strip supplied unit characters
"""
comment = ""
# Must be integral
try:
if isinstance(value, str):
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/disk.py | 0.710628 | 0.211376 | disk.py | pypi |
def __virtual__():
"""
Only load if the lvs module is available in __salt__
"""
if "lvs.get_rules" in __salt__:
return "lvs_service"
return (False, "lvs module could not be loaded")
def present(
name,
protocol=None,
service_address=None,
scheduler="wlc",
):
"""
Ensu... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/lvs_service.py | 0.645567 | 0.202325 | lvs_service.py | pypi |
import salt.utils.data
def __virtual__():
"""
Load only if win_servermanager is loaded
"""
if "win_servermanager.install" in __salt__:
return "win_servermanager"
return (False, "win_servermanager module could not be loaded")
def installed(
name,
features=None,
recurse=False,
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/win_servermanager.py | 0.75274 | 0.340485 | win_servermanager.py | pypi |
import logging
import salt.utils.data
log = logging.getLogger(__name__)
# Define the state's virtual name
__virtualname__ = "pdbedit"
def __virtual__():
"""
Provides pdbedit when available
"""
if "pdbedit.create" in __salt__:
return True
else:
return (
False,
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/pdbedit.py | 0.46563 | 0.202167 | pdbedit.py | pypi |
import logging
from salt.exceptions import CommandExecutionError
log = logging.getLogger(__name__)
def repo_managed(
name,
present=None,
absent=None,
prune=False,
repo_update=False,
namespace=None,
flags=None,
kvflags=None,
):
"""
Make sure the repository is updated.
nam... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/helm.py | 0.543833 | 0.160102 | helm.py | pypi |
import copy
__virtualname__ = "redis"
def __virtual__():
"""
Only load if the redis module is in __salt__
"""
if "redis.set_key" in __salt__:
return __virtualname__
return (False, "redis module could not be loaded")
def string(name, value, expire=None, expireat=None, **connection_args):... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/redismod.py | 0.710929 | 0.246709 | redismod.py | pypi |
__func_alias__ = {"set_": "set"}
def __virtual__():
"""
Only load if the eselect module is available in __salt__
"""
if "eselect.exec_action" in __salt__:
return "eselect"
return (False, "eselect module could not be loaded")
def set_(name, target, module_parameter=None, action_parameter=... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/eselect.py | 0.616936 | 0.160299 | eselect.py | pypi |
r"""
Manage Windows Local Group Policy
=================================
.. versionadded:: 2016.11.0
This state module allows you to configure local Group Policy on Windows. You
can ensure the setting of a single policy or multiple policies in one pass.
Single policies must specify the policy name, the setting, and ... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/win_lgpo.py | 0.916596 | 0.445771 | win_lgpo.py | pypi |
import logging
import salt.utils.validate.net
log = logging.getLogger(__name__)
def present(name, ip, comment="", clean=False): # pylint: disable=C0103
"""
Ensures that the named host is present with the given ip
name
The host to assign an ip to
ip
The ip addr(s) to apply to the h... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/host.py | 0.537284 | 0.21262 | host.py | pypi |
def __virtual__():
"""
Only load if the lvs module is available in __salt__
"""
if "lvs.get_rules" in __salt__:
return "lvs_server"
return (False, "lvs module could not be loaded")
def present(
name,
protocol=None,
service_address=None,
server_address=None,
packet_forwa... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/lvs_server.py | 0.672439 | 0.220563 | lvs_server.py | pypi |
import salt.utils.json
from salt.exceptions import CommandExecutionError
try:
import requests
HAS_LIBS = True
except ImportError:
HAS_LIBS = False
def __virtual__():
"""
Only load if glassfish module is available
"""
if "glassfish.enum_connector_c_pool" in __salt__ and HAS_LIBS:
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/glassfish.py | 0.531209 | 0.195268 | glassfish.py | pypi |
import hashlib
import logging
import re
import salt.utils.data
import salt.utils.dictupdate
import salt.utils.stringutils
from salt.exceptions import SaltInvocationError
log = logging.getLogger(__name__)
def __virtual__():
"""
Only load if boto is available.
"""
if "boto_elb.exists" in __salt__:
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/boto_elb.py | 0.646125 | 0.187133 | boto_elb.py | pypi |
def __virtual__():
"""
Only make this state available if the monit module is available.
"""
if "monit.summary" in __salt__:
return "monit"
return (False, "monit module could not be loaded")
def monitor(name):
"""
Get the summary from module monit and try to see if service is
be... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/monit.py | 0.465387 | 0.219599 | monit.py | pypi |
import logging
import salt.utils.json
from salt.utils.versions import LooseVersion
log = logging.getLogger(__name__)
__virtualname__ = "boto3_elasticsearch"
def __virtual__():
"""
Only load if boto3 and the required module functions are available.
"""
requirements = {
"salt": [
"... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/boto3_elasticsearch.py | 0.721645 | 0.283031 | boto3_elasticsearch.py | pypi |
def __virtual__():
"""
Only load if the pushover module is available in __salt__
"""
if "pushover.post_message" in __salt__:
return "pushover"
return (False, "pushover module could not be loaded")
def post_message(
name,
user=None,
device=None,
message=None,
title=None,... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/pushover.py | 0.658747 | 0.162314 | pushover.py | pypi |
import json
import logging
from salt.exceptions import SaltException
log = logging.getLogger(__name__)
def __virtual__():
"""
Only make these states available if Zabbix module and run_query function is available
and all 3rd party modules imported.
"""
if "zabbix.run_query" in __salt__:
r... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/zabbix_valuemap.py | 0.671471 | 0.256273 | zabbix_valuemap.py | pypi |
def __virtual__():
"""
Only load if the postgres module is present
"""
if "postgres.language_create" not in __salt__:
return (
False,
"Unable to load postgres module. Make sure `postgres.bins_dir` is set.",
)
return True
def present(
name,
maintenan... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/postgres_language.py | 0.662687 | 0.163345 | postgres_language.py | pypi |
def __virtual__():
"""
Only load if boto is available.
"""
if "boto3_elasticache.cache_cluster_exists" in __salt__:
return "boto3_elasticache"
return (False, "boto3_elasticcache module could not be loaded")
def _diff_cache_cluster(current, desired):
"""
If you need to enhance what ... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/boto3_elasticache.py | 0.695441 | 0.303093 | boto3_elasticache.py | pypi |
def __virtual__():
"""
Only load if the Traffic Server module is available in __salt__
"""
if "trafficserver.set_config" in __salt__:
return "trafficserver"
return (False, "trafficserver module could not be loaded")
def bounce_cluster(name):
"""
Bounce all Traffic Server nodes in t... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/trafficserver.py | 0.725843 | 0.327561 | trafficserver.py | pypi |
import logging
log = logging.getLogger(__name__)
def __virtual__():
"""
Only load if boto is available.
"""
if "boto_elasticache.exists" in __salt__:
return "boto_elasticache"
return (False, "boto_elasticache module could not be loaded")
def cache_cluster_present(*args, **kwargs):
r... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/boto_elasticache.py | 0.63023 | 0.269872 | boto_elasticache.py | pypi |
import logging
log = logging.getLogger(__name__)
def additions_installed(name, reboot=False, upgrade_os=False):
"""
Ensure that the VirtualBox Guest Additions are installed. Uses the CD,
connected by VirtualBox.
name
The name has no functional value and is only used as a tracking
ref... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/vbox_guest.py | 0.639398 | 0.225172 | vbox_guest.py | pypi |
import difflib
import logging
import os.path
import re
import salt.utils.args
import salt.utils.files
import salt.utils.stringutils
from salt.modules.augeas_cfg import METHOD_MAP
log = logging.getLogger(__name__)
def __virtual__():
if "augeas.execute" in __salt__:
return "augeas"
return (False, "aug... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/augeas.py | 0.53777 | 0.166066 | augeas.py | pypi |
import logging
log = logging.getLogger(__name__)
def mapped(
name,
device,
keyfile=None,
opts=None,
config="/etc/crypttab",
persist=True,
immediate=False,
match_on="name",
):
"""
Verify that a device is mapped
name
The name under which the device is to be mapped
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/cryptdev.py | 0.700178 | 0.261198 | cryptdev.py | pypi |
__virtualname__ = "keystone_service"
def __virtual__():
if "keystoneng.service_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_service.py | 0.745398 | 0.158012 | keystone_service.py | pypi |
import copy
import difflib
import logging
import salt.utils.hashutils
log = logging.getLogger(__name__)
def __virtual__():
"""
Only load if boto is available.
"""
if "boto_s3.get_object_metadata" not in __salt__:
return (False, "boto_s3 module could not be loaded")
return "boto_s3"
# K... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/boto_s3.py | 0.586878 | 0.160759 | boto_s3.py | pypi |
__virtualname__ = "sysrc"
def __virtual__():
"""
Only load if sysrc executable exists
"""
if __salt__["cmd.has_exec"]("sysrc"):
return True
return (False, "Command not found: sysrc")
def managed(name, value, **kwargs):
"""
Ensure a sysrc variable is set to a specific value.
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/sysrc.py | 0.509276 | 0.278453 | sysrc.py | pypi |
def present(name=None, start_addr=None, end_addr=None, data=None, **api_opts):
"""
Ensure range record is present.
infoblox_range.present:
start_addr: '129.97.150.160',
end_addr: '129.97.150.170',
Verbose state example:
.. code-block:: yaml
infoblox_range.present:
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/infoblox_range.py | 0.529263 | 0.157622 | infoblox_range.py | pypi |
import logging
log = logging.getLogger(__name__)
def present(name, save=False, **kwargs):
"""
Ensure beacon is configured with the included beacon data.
name
The name of the beacon to ensure is configured.
save
True/False, if True the beacons.conf file be updated too. Default is Fals... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/beacon.py | 0.631822 | 0.169612 | beacon.py | pypi |
import logging
import re
import time
__monitor__ = [
"query",
]
log = logging.getLogger(__name__)
def query(
name,
match=None,
match_type="string",
status=None,
status_type="string",
wait_for=None,
**kwargs
):
"""
Perform an HTTP query and statefully return the result
Pa... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/http.py | 0.667581 | 0.427755 | http.py | pypi |
def __virtual__():
"""
Load only on minions that have the win_snmp module.
"""
if "win_snmp.get_agent_settings" in __salt__:
return True
return (False, "win_snmp module could not be loaded")
def agent_settings(name, contact, location, services=None):
"""
Manage the SNMP sysContact,... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/win_snmp.py | 0.527803 | 0.189727 | win_snmp.py | pypi |
import logging
import os
import salt.utils.json
log = logging.getLogger(__name__)
def __virtual__():
"""
Only load if boto is available.
"""
if "boto_elasticsearch_domain.exists" in __salt__:
return "boto_elasticsearch_domain"
return (False, "boto_elasticsearch_domain module could not be... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/boto_elasticsearch_domain.py | 0.525612 | 0.239149 | boto_elasticsearch_domain.py | pypi |
import logging
import salt.utils.args
import salt.utils.dockermod
from salt.exceptions import CommandExecutionError
# Enable proper logging
log = logging.getLogger(__name__)
# Define the module's virtual name
__virtualname__ = "docker_image"
__virtual_aliases__ = ("moby_image",)
def __virtual__():
"""
Only... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/docker_image.py | 0.743634 | 0.166879 | docker_image.py | pypi |
import logging
import os
import salt.utils.path
from salt.exceptions import CommandExecutionError
log = logging.getLogger(__name__)
__virtualname__ = "acl"
def __virtual__():
"""
Ensure getfacl & setfacl exist
"""
if salt.utils.path.which("getfacl") and salt.utils.path.which("setfacl"):
ret... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/linux_acl.py | 0.496338 | 0.200401 | linux_acl.py | pypi |
import logging
# Set up logging
log = logging.getLogger(__name__)
def __virtual__():
"""
Provide ethtool state
"""
if "ethtool.show_driver" in __salt__:
return "ethtool"
return (False, "ethtool module could not be loaded")
def coalesce(name, **kwargs):
"""
Manage coalescing sett... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/ethtool.py | 0.569374 | 0.161949 | ethtool.py | pypi |
import logging
import salt.utils.dictdiffer
import salt.utils.dictupdate as dictupdate
from salt.utils.odict import OrderedDict
log = logging.getLogger(__name__)
def __virtual__():
"""
Only load if boto is available.
"""
if "boto_iam.role_exists" in __salt__:
return "boto_iam_role"
retur... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/boto_iam_role.py | 0.531696 | 0.155078 | boto_iam_role.py | pypi |
def __virtual__():
if "libcloud_dns.list_zones" in __salt__:
return True
return (False, "libcloud_dns module could not be loaded")
def state_result(result, message, name, changes=None):
if changes is None:
changes = {}
return {"result": result, "comment": message, "name": name, "change... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/libcloud_dns.py | 0.631935 | 0.3492 | libcloud_dns.py | pypi |
def __virtual__():
"""
Only load if the influxdb module is available
"""
if "influxdb.db_exists" in __salt__:
return "influxdb_database"
return (False, "influxdb module could not be loaded")
def present(name, **client_args):
"""
Ensure that given database is present.
name
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/influxdb_database.py | 0.563978 | 0.164684 | influxdb_database.py | pypi |
import salt.utils.path
from salt.exceptions import CommandExecutionError, CommandNotFoundError
def __virtual__():
"""
Only work when cabal-install is installed.
"""
if (salt.utils.path.which("cabal") is not None) and (
salt.utils.path.which("ghc-pkg") is not None
):
return True
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/cabal.py | 0.530236 | 0.161485 | cabal.py | pypi |
import logging
from functools import wraps
log = logging.getLogger()
def resultdecorator(function):
@wraps(function)
def wrapper(*args, **kwargs):
ret = function(*args, **kwargs)
ret["result"] = ret["changes"]["out"]
return ret
return wrapper
@resultdecorator
def rpc(name, dest... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/junos.py | 0.769384 | 0.237443 | junos.py | pypi |
import copy
import logging
log = logging.getLogger(__name__)
def __virtual__():
"""
Only load if boto is available.
"""
if "boto_elbv2.target_group_exists" in __salt__:
return "boto_elbv2"
return (False, "The boto_elbv2 module cannot be loaded: boto3 library not found")
def create_targe... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/boto_elbv2.py | 0.688049 | 0.208058 | boto_elbv2.py | pypi |
import copy
import salt.utils.json
from salt.utils.dictdiffer import DictDiffer
def __virtual__():
"""Only load if grafana4 module is available"""
if "grafana4.get_dashboard" in __salt__:
return True
return (False, "grafana4 module could not be loaded")
_DEFAULT_DASHBOARD_PILLAR = "grafana_dash... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/grafana4_dashboard.py | 0.60778 | 0.191422 | grafana4_dashboard.py | pypi |
def __virtual__():
"""
Only make this state available if the selinux module is available.
"""
if "selinux.getenforce" in __salt__:
return "selinux"
return (False, "selinux module could not be loaded")
def _refine_mode(mode):
"""
Return a mode value that is predictable
"""
m... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/selinux.py | 0.609873 | 0.234056 | selinux.py | pypi |
def __virtual__():
"""
Only load if the layman module is available in __salt__
"""
if "layman.add" in __salt__:
return "layman"
return (False, "layman module could not be loaded")
def present(name):
"""
Verify that the overlay is present
name
The name of the overlay to... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/layman.py | 0.524882 | 0.188343 | layman.py | pypi |
import os.path
import sys
import salt.utils.files
import salt.utils.stringutils
def __virtual__():
"""
Only load if the mysql module is available in __salt__
"""
if "mysql.query" in __salt__:
return True
return (False, "mysql module could not be loaded")
def _get_mysql_error():
"""
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/mysql_query.py | 0.431105 | 0.173393 | mysql_query.py | pypi |
import logging
import salt.utils.json
log = logging.getLogger(__name__)
def index_absent(name):
"""
Ensure that the named index is absent.
name
Name of the index to remove
"""
ret = {"name": name, "changes": {}, "result": True, "comment": ""}
try:
index = __salt__["elastic... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/elasticsearch.py | 0.491212 | 0.190611 | elasticsearch.py | pypi |
def __virtual__():
"""
Only load if a2ensite is available.
"""
if "apache.a2ensite" in __salt__:
return "apache_site"
return (False, "apache module could not be loaded")
def enabled(name):
"""
Ensure an Apache site is enabled.
name
Name of the Apache site
"""
r... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/apache_site.py | 0.557725 | 0.160957 | apache_site.py | pypi |
def __virtual__():
"""
Only load if the splunk_search module is available in __salt__
"""
if "splunk_search.get" in __salt__:
return "splunk_search"
return (False, "splunk module could not be loaded")
def present(name, profile="splunk", **kwargs):
"""
Ensure a search is present
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/splunk_search.py | 0.678647 | 0.23814 | splunk_search.py | pypi |
from salt.exceptions import SaltInvocationError
def __virtual__():
"""
Only load if the slack module is available in __salt__
"""
if "slack.post_message" in __salt__:
return "slack"
return (False, "slack module could not be loaded")
def post_message(name, **kwargs):
"""
Send a me... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/slack.py | 0.76176 | 0.199659 | slack.py | pypi |
def __virtual__():
"""
Only load if a2enmod is available.
"""
if "apache.a2enmod" in __salt__:
return "apache_module"
return (False, "apache module could not be loaded")
def enabled(name):
"""
Ensure an Apache module is enabled.
.. versionadded:: 2016.3.0
name
Nam... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/apache_module.py | 0.592431 | 0.158467 | apache_module.py | pypi |
from salt.exceptions import SaltInvocationError
def __virtual__():
"""
Only load if boto is available.
"""
if "boto_asg.exists" in __salt__:
return "boto_lc"
return (False, "boto_asg module could not be loaded")
def present(
name,
image_id,
key_name=None,
vpc_id=None,
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/boto_lc.py | 0.663451 | 0.270546 | boto_lc.py | pypi |
def __virtual__():
"""
Only make these states available if Zabbix module is available.
"""
if "zabbix.mediatype_create" in __salt__:
return True
return (False, "zabbix module could not be loaded")
def present(name, mediatype, **kwargs):
"""
Creates new mediatype.
NOTE: This fun... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/zabbix_mediatype.py | 0.58166 | 0.185947 | zabbix_mediatype.py | pypi |
__virtualname__ = "neutron_network"
def __virtual__():
if "neutronng.list_networks" 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):
"""
Ens... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/neutron_network.py | 0.719581 | 0.198744 | neutron_network.py | pypi |
from salt.exceptions import CommandExecutionError
def __virtual__():
"""
Only load if the openstack_config module is in __salt__
"""
if "openstack_config.get" not in __salt__:
return (False, "openstack_config module could not be loaded")
if "openstack_config.set" not in __salt__:
r... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/openstack_config.py | 0.622689 | 0.20264 | openstack_config.py | pypi |
import copy
import salt.utils.json
from salt.exceptions import SaltInvocationError
from salt.utils.dictdiffer import DictDiffer
def __virtual__():
"""
Only load if grafana is available.
"""
if "elasticsearch.exists" in __salt__:
return "grafana"
return (False, "elasticsearch module could ... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/grafana.py | 0.549157 | 0.201892 | grafana.py | pypi |
def __virtual__():
"""
Only load if the influxdb module is available
"""
if "influxdb.db_exists" in __salt__:
return "influxdb_retention_policy"
return (False, "influxdb module could not be loaded")
def convert_duration(duration):
"""
Convert the a duration string into XXhYYmZZs fo... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/influxdb_retention_policy.py | 0.798619 | 0.189934 | influxdb_retention_policy.py | pypi |
import logging
import os
import salt.utils.platform
log = logging.getLogger(__name__)
__virtualname__ = "keychain"
def __virtual__():
"""
Only work on Mac OS
"""
if salt.utils.platform.is_darwin():
return __virtualname__
return (False, "Only supported on Mac OS")
def installed(name, p... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/mac_keychain.py | 0.644113 | 0.160529 | mac_keychain.py | pypi |
__virtualname__ = "win_iis"
def __virtual__():
"""
Load only on minions that have the win_iis module.
"""
if "win_iis.create_site" in __salt__:
return __virtualname__
return (False, "win_iis module could not be loaded")
def _get_binding_info(hostheader="", ipaddress="*", port=80):
""... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/win_iis.py | 0.747892 | 0.270054 | win_iis.py | pypi |
import logging
log = logging.getLogger(__name__)
def absent(name):
"""
Ensure that the named index is absent.
name
Name of the index to remove
"""
ret = {"name": name, "changes": {}, "result": True, "comment": ""}
try:
index = __salt__["elasticsearch.index_get"](index=name)... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/elasticsearch_index.py | 0.511717 | 0.176246 | elasticsearch_index.py | pypi |
def __virtual__():
"""
Only load if the postgres module is present
"""
if "postgres.datadir_init" not in __salt__:
return (
False,
"Unable to load postgres module. Make sure `postgres.bins_dir` is set.",
)
return True
def present(
name,
user=None,
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/postgres_initdb.py | 0.719679 | 0.202345 | postgres_initdb.py | pypi |
import copy
import logging
log = logging.getLogger(__name__)
def __virtual__():
"""
Only load if the kubernetes module is available in __salt__
"""
if "kubernetes.ping" in __salt__:
return True
return (False, "kubernetes module could not be loaded")
def _error(ret, err_msg):
"""
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/kubernetes.py | 0.476336 | 0.191895 | kubernetes.py | pypi |
_DEFAULT_CONTEXT = "LocalMachine"
_DEFAULT_FORMAT = "cer"
_DEFAULT_STORE = "My"
def __virtual__():
"""
Load only on minions that have the win_pki module.
"""
if "win_pki.get_stores" in __salt__:
return True
return (False, "win_pki module could not be loaded")
def import_cert(
name,
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/win_pki.py | 0.745584 | 0.221961 | win_pki.py | pypi |
import logging
import os
import salt.utils.data
import salt.utils.platform
log = logging.getLogger(__name__)
__virtualname__ = "dism"
def __virtual__():
"""
Only work on Windows where the DISM module is available
"""
if not salt.utils.platform.is_windows():
return False, "Module only availab... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/win_dism.py | 0.777215 | 0.201538 | win_dism.py | pypi |
def __virtual__():
"""
Only load if the deb_postgres module is present
"""
if "postgres.cluster_exists" not in __salt__:
return (
False,
"Unable to load postgres module. Make sure `postgres.bins_dir` is set.",
)
return True
def present(
version,
nam... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/postgres_cluster.py | 0.540439 | 0.221098 | postgres_cluster.py | pypi |
import copy
import datetime
import difflib
import salt.utils.data
import salt.utils.json
def __virtual__():
"""
Only load if boto is available.
"""
if "boto_datapipeline.create_pipeline" in __salt__:
return "boto_datapipeline"
return (False, "boto_datapipeline module could not be loaded")... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/boto_datapipeline.py | 0.492676 | 0.352341 | boto_datapipeline.py | pypi |
try:
import sqlite3
HAS_SQLITE3 = True
except ImportError:
HAS_SQLITE3 = False
def __virtual__():
"""
Only load if the sqlite3 module is available
"""
if HAS_SQLITE3:
return True
return (False, "Unable to import sqlite3")
def row_absent(name, db, table, where_sql, where_args... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/sqlite3.py | 0.436862 | 0.261048 | sqlite3.py | pypi |
import os
import salt.utils.platform
def __virtual__():
"""
No dependency checks, and not renaming, just return True
"""
return True
def _norm_key(key):
"""
Normalize windows environment keys
"""
if salt.utils.platform.is_windows():
return key.upper()
return key
def se... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/environ.py | 0.542136 | 0.218305 | environ.py | pypi |
def __virtual__():
"""
Only load if the kmod module is available in __salt__
"""
if "kmod.available" in __salt__:
return True
return (False, "kmod module could not be loaded")
def _append_comment(ret, comment):
"""
append ``comment`` to ``ret['comment']``
"""
if ret["commen... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/kmod.py | 0.523908 | 0.204114 | kmod.py | pypi |
import logging
import os
import salt.utils.data
from salt.exceptions import SaltInvocationError
log = logging.getLogger(__name__)
def __virtual__():
"""
Only load if boto is available.
"""
if "boto_rds.exists" in __salt__:
return "boto_rds"
return (False, __salt__.missing_fun_string("bot... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/boto_rds.py | 0.672547 | 0.175009 | boto_rds.py | pypi |
import logging
import salt.utils.platform
log = logging.getLogger(__name__)
__virtualname__ = "proxy"
def __virtual__():
"""
Only work on Mac OS and Windows
"""
if salt.utils.platform.is_darwin() or salt.utils.platform.is_windows():
return True
return (False, "Only Mac OS and Windows sup... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/proxy.py | 0.525856 | 0.16099 | proxy.py | pypi |
import os
import salt.utils.path
def __virtual__():
"""
Only load the module if lvm is installed
"""
if salt.utils.path.which("lvm"):
return "lvm"
return (False, "lvm command not found")
def _convert_to_mb(size):
str_size = str(size).lower()
unit = str_size[-1:]
if unit.isd... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/lvm.py | 0.642432 | 0.237278 | lvm.py | pypi |
import logging
log = logging.getLogger(__name__)
def absent(name):
"""
Ensure that the named index template is absent.
name
Name of the index to remove
"""
ret = {"name": name, "changes": {}, "result": True, "comment": ""}
try:
index_template = __salt__["elasticsearch.index... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/elasticsearch_index_template.py | 0.499268 | 0.173638 | elasticsearch_index_template.py | pypi |
import errno
import logging
import os
log = logging.getLogger(__name__)
def _get_missing_results(results, dest_dir):
"""
Return a list of the filenames specified in the ``results`` argument, which
are not present in the dest_dir.
"""
try:
present = set(os.listdir(dest_dir))
except OSE... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/pkgbuild.py | 0.572006 | 0.21767 | pkgbuild.py | pypi |
import logging
log = logging.getLogger(__name__)
def __virtual__():
if "libcloud_storage.list_containers" in __salt__:
return True
return (False, "libcloud_storage module could not be loaded")
def state_result(result, message, name, changes):
return {"result": result, "comment": message, "name"... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/libcloud_storage.py | 0.77675 | 0.219296 | libcloud_storage.py | pypi |
import salt.utils.data
import salt.utils.path
import salt.utils.platform
from salt.exceptions import CommandExecutionError
# Define the module's virtual name
__virtualname__ = "shortcut"
def __virtual__():
"""
Only works on Windows systems
"""
if not salt.utils.platform.is_windows():
return F... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/win_shortcut.py | 0.764628 | 0.245673 | win_shortcut.py | pypi |
import json
import logging
from salt.exceptions import SaltException
log = logging.getLogger(__name__)
def __virtual__():
"""
Only make these states available if Zabbix module and run_query function is available
and all 3rd party modules imported.
"""
if "zabbix.run_query" in __salt__:
r... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/zabbix_action.py | 0.761272 | 0.237388 | zabbix_action.py | pypi |
import logging
log = logging.getLogger(__name__)
def __virtual__():
if "csf.exists" in __salt__:
return "csf"
return (False, "csf module could not be loaded")
def rule_present(
name,
method,
port=None,
proto="tcp",
direction="in",
port_origin="d",
ip_origin="s",
ttl... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/csf.py | 0.691497 | 0.209814 | csf.py | pypi |
import logging
import operator
import sys
import time
# Initialize logging
log = logging.getLogger(__name__)
# Define the module's virtual name
__virtualname__ = "loop"
def __virtual__():
return True
def until(name, m_args=None, m_kwargs=None, condition=None, period=1, timeout=60):
"""
Loop over an ex... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/loop.py | 0.494385 | 0.284228 | loop.py | pypi |
import os
import salt.utils.platform
from salt.exceptions import CommandNotFoundError
# Define the state's virtual name
__virtualname__ = "ssh_known_hosts"
def __virtual__():
"""
Does not work on Windows, requires ssh module functions
"""
if salt.utils.platform.is_windows():
return False, "s... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/ssh_known_hosts.py | 0.603114 | 0.181481 | ssh_known_hosts.py | pypi |
import logging
import salt.utils.data
# Enable proper logging
log = logging.getLogger(__name__) # pylint: disable=invalid-name
# Define the module's virtual name
__virtualname__ = "docker_volume"
__virtual_aliases__ = ("moby_volume",)
def __virtual__():
"""
Only load if the docker execution module is avai... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/docker_volume.py | 0.595022 | 0.165155 | docker_volume.py | pypi |
def __virtual__():
"""
Only make these states available if Open vSwitch module is available.
"""
if "openvswitch.port_add" in __salt__:
return True
return (False, "openvswitch module could not be loaded")
def present(
name, bridge, tunnel_type=None, id=None, remote=None, dst_port=None,... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/openvswitch_port.py | 0.746786 | 0.166574 | openvswitch_port.py | pypi |
import salt.utils.openstack.pyrax as suop
def __virtual__():
"""
Only load if pyrax is available.
"""
return suop.HAS_PYRAX
def present(name, provider):
"""
Ensure the RackSpace queue exists.
name
Name of the Rackspace queue.
provider
Salt Cloud Provider
"""
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/pyrax_queues.py | 0.556761 | 0.28758 | pyrax_queues.py | pypi |
__virtualname__ = "neutron_secgroup_rule"
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 _rule_compare(rule1, rule2):
"""
Compa... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/neutron_secgroup_rule.py | 0.641422 | 0.177632 | neutron_secgroup_rule.py | pypi |
_DEFAULT_CONF = "/etc/logrotate.conf"
# Define the module's virtual name
__virtualname__ = "logrotate"
# Define a function alias in order not to shadow built-in's
__func_alias__ = {"set_": "set"}
def __virtual__():
"""
Load only on minions that have the logrotate module.
"""
if "logrotate.show_conf"... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/logrotate.py | 0.586523 | 0.247773 | logrotate.py | pypi |
r"""
Execution of Ansible modules from within states
===============================================
With `ansible.call` these states allow individual Ansible module calls to be
made via states. To call an Ansible module function use a :mod:`module.run <salt.states.ansible.call>`
state:
.. code-block:: yaml
som... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/ansiblegate.py | 0.558568 | 0.356503 | ansiblegate.py | pypi |
import salt.utils.compat
def __virtual__():
if "cisconso.set_data_value" in __salt__:
return True
return (False, "cisconso module could not be loaded")
def value_present(name, datastore, path, config):
"""
Ensure a specific value exists at a given path
:param name: The name for this rul... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/cisconso.py | 0.765944 | 0.336781 | cisconso.py | pypi |
import logging
import os.path
import re
log = logging.getLogger(__name__)
def _size_convert(_re_size):
converted_size = int(_re_size.group("size_value"))
if _re_size.group("size_unit") == "m":
converted_size = int(converted_size) * 1024
if _re_size.group("size_unit") == "g":
converted_siz... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/mount.py | 0.546012 | 0.166574 | mount.py | pypi |
__func_alias__ = {"set_": "set"}
def __virtual__():
"""
Only load if alternatives execution module is available.
"""
if "alternatives.auto" in __salt__:
return True
return (False, "alernatives module could not be loaded")
def install(name, link, path, priority):
"""
Install new a... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/alternatives.py | 0.541409 | 0.2205 | alternatives.py | pypi |
def __virtual__():
"""
Only load if the splunk module is available in __salt__
"""
if "splunk.list_users" in __salt__:
return "splunk"
return (False, "splunk module could not be loaded")
def present(email, profile="splunk", **kwargs):
"""
Ensure a user is present
.. code-block... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/splunk.py | 0.707101 | 0.236836 | splunk.py | pypi |
import salt.utils.dictupdate as dictupdate
from requests.exceptions import HTTPError
from salt.utils.dictdiffer import deep_diff
def __virtual__():
"""Only load if grafana4 module is available"""
if "grafana4.get_org" in __salt__:
return True
return (False, "grafana4 module could not be loaded")
... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/grafana4_org.py | 0.566139 | 0.192729 | grafana4_org.py | pypi |
import salt.utils.args
_DEFAULT_SERVER = "SmtpSvc/1"
def __virtual__():
"""
Load only on minions that have the win_smtp_server module.
"""
if "win_smtp_server.get_server_setting" in __salt__:
return True
return (False, "win_smtp_server module could not be loaded")
def _merge_dicts(*args... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/win_smtp_server.py | 0.656768 | 0.172642 | win_smtp_server.py | pypi |
__virtualname__ = "neutron_secgroup"
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):
"""
Ens... | /salt-ssh-9000.tar.gz/salt-ssh-9000/salt/states/neutron_secgroup.py | 0.731155 | 0.189802 | neutron_secgroup.py | pypi |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.