repository_name
stringclasses
316 values
func_path_in_repository
stringlengths
6
223
func_name
stringlengths
1
134
language
stringclasses
1 value
func_code_string
stringlengths
57
65.5k
func_documentation_string
stringlengths
1
46.3k
split_name
stringclasses
1 value
func_code_url
stringlengths
91
315
called_functions
listlengths
1
156
enclosing_scope
stringlengths
2
1.48M
saltstack/salt
salt/states/panos.py
remove_config_lock
python
def remove_config_lock(name): ''' Release config lock previously held. name: The name of the module function to execute. SLS Example: .. code-block:: yaml panos/takelock: panos.remove_config_lock ''' ret = _default_ret(name) ret.update({ 'changes': __sal...
Release config lock previously held. name: The name of the module function to execute. SLS Example: .. code-block:: yaml panos/takelock: panos.remove_config_lock
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/panos.py#L891-L912
[ "def _default_ret(name):\n '''\n Set the default response values.\n\n '''\n ret = {\n 'name': name,\n 'changes': {},\n 'commit': None,\n 'result': False,\n 'comment': ''\n }\n return ret\n" ]
# -*- coding: utf-8 -*- ''' A state module to manage Palo Alto network devices. :codeauthor: ``Spencer Ervin <spencer_ervin@hotmail.com>`` :maturity: new :depends: none :platform: unix About ===== This state module was designed to handle connections to a Palo Alto based firewall. This module relies on the Pal...
saltstack/salt
salt/states/panos.py
security_rule_exists
python
def security_rule_exists(name, rulename=None, vsys='1', action=None, disabled=None, sourcezone=None, destinationzone=None, source=None, ...
Ensures that a security rule exists on the device. Also, ensure that all configurations are set appropriately. This method will create the rule if it does not exist. If the rule does exist, it will ensure that the configurations are set appropriately. If the rule does not exist and is created, any value t...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/panos.py#L970-L1328
[ "def to_dict(xmltree, attr=False):\n '''\n Convert an XML tree into a dict. The tree that is passed in must be an\n ElementTree object.\n Args:\n xmltree: An ElementTree object.\n attr: If true, attributes will be parsed. If false, they will be ignored.\n\n '''\n if attr:\n re...
# -*- coding: utf-8 -*- ''' A state module to manage Palo Alto network devices. :codeauthor: ``Spencer Ervin <spencer_ervin@hotmail.com>`` :maturity: new :depends: none :platform: unix About ===== This state module was designed to handle connections to a Palo Alto based firewall. This module relies on the Pal...
saltstack/salt
salt/states/panos.py
service_exists
python
def service_exists(name, servicename=None, vsys=1, protocol=None, port=None, description=None, commit=False): ''' Ensures that a service object exists in the configured state. If it does not exist or is not configured with the specified attributes, it will be adjusted to match the specified values. nam...
Ensures that a service object exists in the configured state. If it does not exist or is not configured with the specified attributes, it will be adjusted to match the specified values. name: The name of the module function to execute. servicename(str): The name of the security object. The name is case-s...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/panos.py#L1331-L1438
[ "def to_dict(xmltree, attr=False):\n '''\n Convert an XML tree into a dict. The tree that is passed in must be an\n ElementTree object.\n Args:\n xmltree: An ElementTree object.\n attr: If true, attributes will be parsed. If false, they will be ignored.\n\n '''\n if attr:\n re...
# -*- coding: utf-8 -*- ''' A state module to manage Palo Alto network devices. :codeauthor: ``Spencer Ervin <spencer_ervin@hotmail.com>`` :maturity: new :depends: none :platform: unix About ===== This state module was designed to handle connections to a Palo Alto based firewall. This module relies on the Pal...
saltstack/salt
salt/states/panos.py
service_group_exists
python
def service_group_exists(name, groupname=None, vsys=1, members=None, description=None, commit=False): ''' Ensures that a service group object exists in the configured state. If it does no...
Ensures that a service group object exists in the configured state. If it does not exist or is not configured with the specified attributes, it will be adjusted to match the specified values. This module will enforce group membership. If a group exists and contains members this state does not include, thos...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/panos.py#L1441-L1544
[ "def to_dict(xmltree, attr=False):\n '''\n Convert an XML tree into a dict. The tree that is passed in must be an\n ElementTree object.\n Args:\n xmltree: An ElementTree object.\n attr: If true, attributes will be parsed. If false, they will be ignored.\n\n '''\n if attr:\n re...
# -*- coding: utf-8 -*- ''' A state module to manage Palo Alto network devices. :codeauthor: ``Spencer Ervin <spencer_ervin@hotmail.com>`` :maturity: new :depends: none :platform: unix About ===== This state module was designed to handle connections to a Palo Alto based firewall. This module relies on the Pal...
saltstack/salt
salt/states/panos.py
set_config
python
def set_config(name, xpath=None, value=None, commit=False): ''' Sets a Palo Alto XPATH to a specific value. This will always overwrite the existing value, even if it is not changed. You can add or create a new object at a specified location in the configuration hierarchy. Use the xpath parameter to...
Sets a Palo Alto XPATH to a specific value. This will always overwrite the existing value, even if it is not changed. You can add or create a new object at a specified location in the configuration hierarchy. Use the xpath parameter to specify the location of the object in the configuration name: The ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/panos.py#L1547-L1592
[ "def _default_ret(name):\n '''\n Set the default response values.\n\n '''\n ret = {\n 'name': name,\n 'changes': {},\n 'commit': None,\n 'result': False,\n 'comment': ''\n }\n return ret\n", "def _set_config(xpath, element):\n '''\n Sends a set request to...
# -*- coding: utf-8 -*- ''' A state module to manage Palo Alto network devices. :codeauthor: ``Spencer Ervin <spencer_ervin@hotmail.com>`` :maturity: new :depends: none :platform: unix About ===== This state module was designed to handle connections to a Palo Alto based firewall. This module relies on the Pal...
saltstack/salt
salt/modules/cmdmod.py
_check_cb
python
def _check_cb(cb_): ''' If the callback is None or is not callable, return a lambda that returns the value passed. ''' if cb_ is not None: if hasattr(cb_, '__call__'): return cb_ else: log.error('log_callback is not callable, ignoring') return lambda x: x
If the callback is None or is not callable, return a lambda that returns the value passed.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cmdmod.py#L79-L89
null
# -*- coding: utf-8 -*- ''' A module for shelling out. Keep in mind that this module is insecure, in that it can give whomever has access to the master root execution access to all salt minions. ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import functools import g...
saltstack/salt
salt/modules/cmdmod.py
_python_shell_default
python
def _python_shell_default(python_shell, __pub_jid): ''' Set python_shell default based on remote execution and __opts__['cmd_safe'] ''' try: # Default to python_shell=True when run directly from remote execution # system. Cross-module calls won't have a jid. if __pub_jid and pyth...
Set python_shell default based on remote execution and __opts__['cmd_safe']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cmdmod.py#L92-L106
null
# -*- coding: utf-8 -*- ''' A module for shelling out. Keep in mind that this module is insecure, in that it can give whomever has access to the master root execution access to all salt minions. ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import functools import g...
saltstack/salt
salt/modules/cmdmod.py
_render_cmd
python
def _render_cmd(cmd, cwd, template, saltenv='base', pillarenv=None, pillar_override=None): ''' If template is a valid template engine, process the cmd and cwd through that engine. ''' if not template: return (cmd, cwd) # render the path as a template using path_template_engine as the en...
If template is a valid template engine, process the cmd and cwd through that engine.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cmdmod.py#L123-L172
null
# -*- coding: utf-8 -*- ''' A module for shelling out. Keep in mind that this module is insecure, in that it can give whomever has access to the master root execution access to all salt minions. ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import functools import g...
saltstack/salt
salt/modules/cmdmod.py
_check_loglevel
python
def _check_loglevel(level='info'): ''' Retrieve the level code for use in logging.Logger.log(). ''' try: level = level.lower() if level == 'quiet': return None else: return LOG_LEVELS[level] except (AttributeError, KeyError): log.error( ...
Retrieve the level code for use in logging.Logger.log().
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cmdmod.py#L175-L191
null
# -*- coding: utf-8 -*- ''' A module for shelling out. Keep in mind that this module is insecure, in that it can give whomever has access to the master root execution access to all salt minions. ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import functools import g...
saltstack/salt
salt/modules/cmdmod.py
_gather_pillar
python
def _gather_pillar(pillarenv, pillar_override): ''' Whenever a state run starts, gather the pillar data fresh ''' pillar = salt.pillar.get_pillar( __opts__, __grains__, __opts__['id'], __opts__['saltenv'], pillar_override=pillar_override, pillarenv=pillare...
Whenever a state run starts, gather the pillar data fresh
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cmdmod.py#L204-L219
null
# -*- coding: utf-8 -*- ''' A module for shelling out. Keep in mind that this module is insecure, in that it can give whomever has access to the master root execution access to all salt minions. ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import functools import g...
saltstack/salt
salt/modules/cmdmod.py
_check_avail
python
def _check_avail(cmd): ''' Check to see if the given command can be run ''' if isinstance(cmd, list): cmd = ' '.join([six.text_type(x) if not isinstance(x, six.string_types) else x for x in cmd]) bret = True wret = False if __salt__['config.get']('cmd_blacklis...
Check to see if the given command can be run
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cmdmod.py#L222-L247
null
# -*- coding: utf-8 -*- ''' A module for shelling out. Keep in mind that this module is insecure, in that it can give whomever has access to the master root execution access to all salt minions. ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import functools import g...
saltstack/salt
salt/modules/cmdmod.py
_run
python
def _run(cmd, cwd=None, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE, output_encoding=None, output_loglevel='debug', log_callback=None, runas=None, group=None, shell=DEFAULT_SHELL, python_shell=False, ...
Do the DRY thing and only call subprocess.Popen() once
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cmdmod.py#L250-L858
[ "def encode(data, encoding=None, errors='strict', keep=False,\n preserve_dict_class=False, preserve_tuples=False):\n '''\n Generic function which will encode whichever type is passed, if necessary\n\n If `strict` is True, and `keep` is False, and we fail to encode, a\n UnicodeEncodeError will ...
# -*- coding: utf-8 -*- ''' A module for shelling out. Keep in mind that this module is insecure, in that it can give whomever has access to the master root execution access to all salt minions. ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import functools import g...
saltstack/salt
salt/modules/cmdmod.py
_run_quiet
python
def _run_quiet(cmd, cwd=None, stdin=None, output_encoding=None, runas=None, shell=DEFAULT_SHELL, python_shell=False, env=None, template=None, umask=None, timeout=None, ...
Helper for running commands quietly for minion startup
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cmdmod.py#L861-L902
null
# -*- coding: utf-8 -*- ''' A module for shelling out. Keep in mind that this module is insecure, in that it can give whomever has access to the master root execution access to all salt minions. ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import functools import g...
saltstack/salt
salt/modules/zoneadm.py
_is_globalzone
python
def _is_globalzone(): ''' Check if we are running in the globalzone ''' if not __grains__['kernel'] == 'SunOS': return False zonename = __salt__['cmd.run_all']('zonename') if zonename['retcode']: return False if zonename['stdout'] == 'global': return True return...
Check if we are running in the globalzone
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zoneadm.py#L36-L49
null
# -*- coding: utf-8 -*- ''' Module for Solaris 10's zoneadm :maintainer: Jorge Schrauwen <sjorge@blackdot.be> :maturity: new :platform: OmniOS,OpenIndiana,SmartOS,OpenSolaris,Solaris 10 .. versionadded:: 2017.7.0 .. warning:: Oracle Solaris 11's zoneadm is not supported by this module! ''' from __fu...
saltstack/salt
salt/modules/zoneadm.py
list_zones
python
def list_zones(verbose=True, installed=False, configured=False, hide_global=True): ''' List all zones verbose : boolean display additional zone information installed : boolean include installed zones in output configured : boolean include configured zones in output hide_...
List all zones verbose : boolean display additional zone information installed : boolean include installed zones in output configured : boolean include configured zones in output hide_global : boolean do not include global zone CLI Example: .. code-block:: bash...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zoneadm.py#L77-L124
null
# -*- coding: utf-8 -*- ''' Module for Solaris 10's zoneadm :maintainer: Jorge Schrauwen <sjorge@blackdot.be> :maturity: new :platform: OmniOS,OpenIndiana,SmartOS,OpenSolaris,Solaris 10 .. versionadded:: 2017.7.0 .. warning:: Oracle Solaris 11's zoneadm is not supported by this module! ''' from __fu...
saltstack/salt
salt/modules/zoneadm.py
boot
python
def boot(zone, single=False, altinit=None, smf_options=None): ''' Boot (or activate) the specified zone. zone : string name or uuid of the zone single : boolean boots only to milestone svc:/milestone/single-user:default. altinit : string valid path to an alternative executab...
Boot (or activate) the specified zone. zone : string name or uuid of the zone single : boolean boots only to milestone svc:/milestone/single-user:default. altinit : string valid path to an alternative executable to be the primordial process. smf_options : string include ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zoneadm.py#L127-L173
[ "def _is_uuid(zone):\n '''\n Check if zone is actually a UUID\n '''\n return len(zone) == 36 and zone.index('-') == 8\n" ]
# -*- coding: utf-8 -*- ''' Module for Solaris 10's zoneadm :maintainer: Jorge Schrauwen <sjorge@blackdot.be> :maturity: new :platform: OmniOS,OpenIndiana,SmartOS,OpenSolaris,Solaris 10 .. versionadded:: 2017.7.0 .. warning:: Oracle Solaris 11's zoneadm is not supported by this module! ''' from __fu...
saltstack/salt
salt/modules/zoneadm.py
attach
python
def attach(zone, force=False, brand_opts=None): ''' Attach the specified zone. zone : string name of the zone force : boolean force the zone into the "installed" state with no validation brand_opts : string brand specific options to pass CLI Example: .. code-block:...
Attach the specified zone. zone : string name of the zone force : boolean force the zone into the "installed" state with no validation brand_opts : string brand specific options to pass CLI Example: .. code-block:: bash salt '*' zoneadm.attach lawrence sal...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zoneadm.py#L334-L366
null
# -*- coding: utf-8 -*- ''' Module for Solaris 10's zoneadm :maintainer: Jorge Schrauwen <sjorge@blackdot.be> :maturity: new :platform: OmniOS,OpenIndiana,SmartOS,OpenSolaris,Solaris 10 .. versionadded:: 2017.7.0 .. warning:: Oracle Solaris 11's zoneadm is not supported by this module! ''' from __fu...
saltstack/salt
salt/modules/zoneadm.py
ready
python
def ready(zone): ''' Prepares a zone for running applications. zone : string name or uuid of the zone CLI Example: .. code-block:: bash salt '*' zoneadm.ready clementine ''' ret = {'status': True} ## ready zone res = __salt__['cmd.run_all']('zoneadm {zone} ready'...
Prepares a zone for running applications. zone : string name or uuid of the zone CLI Example: .. code-block:: bash salt '*' zoneadm.ready clementine
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zoneadm.py#L369-L394
[ "def _is_uuid(zone):\n '''\n Check if zone is actually a UUID\n '''\n return len(zone) == 36 and zone.index('-') == 8\n" ]
# -*- coding: utf-8 -*- ''' Module for Solaris 10's zoneadm :maintainer: Jorge Schrauwen <sjorge@blackdot.be> :maturity: new :platform: OmniOS,OpenIndiana,SmartOS,OpenSolaris,Solaris 10 .. versionadded:: 2017.7.0 .. warning:: Oracle Solaris 11's zoneadm is not supported by this module! ''' from __fu...
saltstack/salt
salt/modules/zoneadm.py
verify
python
def verify(zone): ''' Check to make sure the configuration of the specified zone can safely be installed on the machine. zone : string name of the zone CLI Example: .. code-block:: bash salt '*' zoneadm.verify dolores ''' ret = {'status': True} ## verify zone ...
Check to make sure the configuration of the specified zone can safely be installed on the machine. zone : string name of the zone CLI Example: .. code-block:: bash salt '*' zoneadm.verify dolores
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zoneadm.py#L397-L423
null
# -*- coding: utf-8 -*- ''' Module for Solaris 10's zoneadm :maintainer: Jorge Schrauwen <sjorge@blackdot.be> :maturity: new :platform: OmniOS,OpenIndiana,SmartOS,OpenSolaris,Solaris 10 .. versionadded:: 2017.7.0 .. warning:: Oracle Solaris 11's zoneadm is not supported by this module! ''' from __fu...
saltstack/salt
salt/modules/zoneadm.py
move
python
def move(zone, zonepath): ''' Move zone to new zonepath. zone : string name or uuid of the zone zonepath : string new zonepath CLI Example: .. code-block:: bash salt '*' zoneadm.move meave /sweetwater/meave ''' ret = {'status': True} ## verify zone re...
Move zone to new zonepath. zone : string name or uuid of the zone zonepath : string new zonepath CLI Example: .. code-block:: bash salt '*' zoneadm.move meave /sweetwater/meave
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zoneadm.py#L426-L454
[ "def _is_uuid(zone):\n '''\n Check if zone is actually a UUID\n '''\n return len(zone) == 36 and zone.index('-') == 8\n" ]
# -*- coding: utf-8 -*- ''' Module for Solaris 10's zoneadm :maintainer: Jorge Schrauwen <sjorge@blackdot.be> :maturity: new :platform: OmniOS,OpenIndiana,SmartOS,OpenSolaris,Solaris 10 .. versionadded:: 2017.7.0 .. warning:: Oracle Solaris 11's zoneadm is not supported by this module! ''' from __fu...
saltstack/salt
salt/modules/zoneadm.py
install
python
def install(zone, nodataset=False, brand_opts=None): ''' Install the specified zone from the system. zone : string name of the zone nodataset : boolean do not create a ZFS file system brand_opts : string brand specific options to pass CLI Example: .. code-block:: b...
Install the specified zone from the system. zone : string name of the zone nodataset : boolean do not create a ZFS file system brand_opts : string brand specific options to pass CLI Example: .. code-block:: bash salt '*' zoneadm.install dolores salt '*' zo...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zoneadm.py#L488-L520
null
# -*- coding: utf-8 -*- ''' Module for Solaris 10's zoneadm :maintainer: Jorge Schrauwen <sjorge@blackdot.be> :maturity: new :platform: OmniOS,OpenIndiana,SmartOS,OpenSolaris,Solaris 10 .. versionadded:: 2017.7.0 .. warning:: Oracle Solaris 11's zoneadm is not supported by this module! ''' from __fu...
saltstack/salt
salt/modules/zoneadm.py
clone
python
def clone(zone, source, snapshot=None): ''' Install a zone by copying an existing installed zone. zone : string name of the zone source : string zone to clone from snapshot : string optional name of snapshot to use as source CLI Example: .. code-block:: bash ...
Install a zone by copying an existing installed zone. zone : string name of the zone source : string zone to clone from snapshot : string optional name of snapshot to use as source CLI Example: .. code-block:: bash salt '*' zoneadm.clone clementine dolores
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zoneadm.py#L523-L554
null
# -*- coding: utf-8 -*- ''' Module for Solaris 10's zoneadm :maintainer: Jorge Schrauwen <sjorge@blackdot.be> :maturity: new :platform: OmniOS,OpenIndiana,SmartOS,OpenSolaris,Solaris 10 .. versionadded:: 2017.7.0 .. warning:: Oracle Solaris 11's zoneadm is not supported by this module! ''' from __fu...
saltstack/salt
salt/fileserver/azurefs.py
find_file
python
def find_file(path, saltenv='base', **kwargs): ''' Search the environment for the relative path ''' fnd = {'path': '', 'rel': ''} for container in __opts__.get('azurefs', []): if container.get('saltenv', 'base') != saltenv: continue full = os.path.join(_get_con...
Search the environment for the relative path
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/azurefs.py#L102-L133
[ "def is_file_ignored(opts, fname):\n '''\n If file_ignore_regex or file_ignore_glob were given in config,\n compare the given file path against all of them and return True\n on the first match.\n '''\n if opts['file_ignore_regex']:\n for regex in opts['file_ignore_regex']:\n if r...
# -*- coding: utf-8 -*- ''' The backend for serving files from the Azure blob storage service. .. versionadded:: 2015.8.0 To enable, add ``azurefs`` to the :conf_master:`fileserver_backend` option in the Master config file. .. code-block:: yaml fileserver_backend: - azurefs Starting in Salt 2018.3.0, thi...
saltstack/salt
salt/fileserver/azurefs.py
envs
python
def envs(): ''' Each container configuration can have an environment setting, or defaults to base ''' saltenvs = [] for container in __opts__.get('azurefs', []): saltenvs.append(container.get('saltenv', 'base')) # Remove duplicates return list(set(saltenvs))
Each container configuration can have an environment setting, or defaults to base
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/azurefs.py#L136-L145
null
# -*- coding: utf-8 -*- ''' The backend for serving files from the Azure blob storage service. .. versionadded:: 2015.8.0 To enable, add ``azurefs`` to the :conf_master:`fileserver_backend` option in the Master config file. .. code-block:: yaml fileserver_backend: - azurefs Starting in Salt 2018.3.0, thi...
saltstack/salt
salt/fileserver/azurefs.py
serve_file
python
def serve_file(load, fnd): ''' Return a chunk from a file based on the data received ''' ret = {'data': '', 'dest': ''} required_load_keys = ('path', 'loc', 'saltenv') if not all(x in load for x in required_load_keys): log.debug( 'Not all of the required keys prese...
Return a chunk from a file based on the data received
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/azurefs.py#L148-L175
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' The backend for serving files from the Azure blob storage service. .. versionadded:: 2015.8.0 To enable, add ``azurefs`` to the :conf_master:`fileserver_backend` option in the Master config file. .. code-block:: yaml fileserver_backend: - azurefs Starting in Salt 2018.3.0, thi...
saltstack/salt
salt/fileserver/azurefs.py
update
python
def update(): ''' Update caches of the storage containers. Compares the md5 of the files on disk to the md5 of the blobs in the container, and only updates if necessary. Also processes deletions by walking the container caches and comparing with the list of blobs in the container ''' f...
Update caches of the storage containers. Compares the md5 of the files on disk to the md5 of the blobs in the container, and only updates if necessary. Also processes deletions by walking the container caches and comparing with the list of blobs in the container
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/azurefs.py#L178-L272
[ "def dump(obj, fp, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.dump, and assumes that ensure_ascii is False (unless explicitly\n passed as True) for unicode compatibility. Note that setting it to True\n will mess up any unicode characters, as they will be dumped as the string\n li...
# -*- coding: utf-8 -*- ''' The backend for serving files from the Azure blob storage service. .. versionadded:: 2015.8.0 To enable, add ``azurefs`` to the :conf_master:`fileserver_backend` option in the Master config file. .. code-block:: yaml fileserver_backend: - azurefs Starting in Salt 2018.3.0, thi...
saltstack/salt
salt/fileserver/azurefs.py
file_hash
python
def file_hash(load, fnd): ''' Return a file hash based on the hash type set in the master config ''' if not all(x in load for x in ('path', 'saltenv')): return '', None ret = {'hash_type': __opts__['hash_type']} relpath = fnd['rel'] path = fnd['path'] hash_cachedir = os.path.join...
Return a file hash based on the hash type set in the master config
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/azurefs.py#L275-L299
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' The backend for serving files from the Azure blob storage service. .. versionadded:: 2015.8.0 To enable, add ``azurefs`` to the :conf_master:`fileserver_backend` option in the Master config file. .. code-block:: yaml fileserver_backend: - azurefs Starting in Salt 2018.3.0, thi...
saltstack/salt
salt/fileserver/azurefs.py
file_list
python
def file_list(load): ''' Return a list of all files in a specified environment ''' ret = set() try: for container in __opts__['azurefs']: if container.get('saltenv', 'base') != load['saltenv']: continue container_list = _get_container_path(container) +...
Return a list of all files in a specified environment
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/azurefs.py#L302-L323
[ "def load(fp, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.load\n\n You can pass an alternate json module (loaded via import_json() above)\n using the _json_module argument)\n '''\n return kwargs.pop('_json_module', json).load(fp, **kwargs)\n", "def fopen(*args, **kwargs):\n ...
# -*- coding: utf-8 -*- ''' The backend for serving files from the Azure blob storage service. .. versionadded:: 2015.8.0 To enable, add ``azurefs`` to the :conf_master:`fileserver_backend` option in the Master config file. .. code-block:: yaml fileserver_backend: - azurefs Starting in Salt 2018.3.0, thi...
saltstack/salt
salt/fileserver/azurefs.py
dir_list
python
def dir_list(load): ''' Return a list of all directories in a specified environment ''' ret = set() files = file_list(load) for f in files: dirname = f while dirname: dirname = os.path.dirname(dirname) if dirname: ret.add(dirname) retur...
Return a list of all directories in a specified environment
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/azurefs.py#L326-L338
[ "def file_list(load):\n '''\n Return a list of all files in a specified environment\n '''\n ret = set()\n try:\n for container in __opts__['azurefs']:\n if container.get('saltenv', 'base') != load['saltenv']:\n continue\n container_list = _get_container_pat...
# -*- coding: utf-8 -*- ''' The backend for serving files from the Azure blob storage service. .. versionadded:: 2015.8.0 To enable, add ``azurefs`` to the :conf_master:`fileserver_backend` option in the Master config file. .. code-block:: yaml fileserver_backend: - azurefs Starting in Salt 2018.3.0, thi...
saltstack/salt
salt/fileserver/azurefs.py
_get_container_path
python
def _get_container_path(container): ''' Get the cache path for the container in question Cache paths are generate by combining the account name, container name, and saltenv, separated by underscores ''' root = os.path.join(__opts__['cachedir'], 'azurefs') container_dir = '{0}_{1}_{2}'.forma...
Get the cache path for the container in question Cache paths are generate by combining the account name, container name, and saltenv, separated by underscores
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/azurefs.py#L341-L352
null
# -*- coding: utf-8 -*- ''' The backend for serving files from the Azure blob storage service. .. versionadded:: 2015.8.0 To enable, add ``azurefs`` to the :conf_master:`fileserver_backend` option in the Master config file. .. code-block:: yaml fileserver_backend: - azurefs Starting in Salt 2018.3.0, thi...
saltstack/salt
salt/fileserver/azurefs.py
_get_container_service
python
def _get_container_service(container): ''' Get the azure block blob service for the container in question Try account_key, sas_token, and no auth in that order ''' if 'account_key' in container: account = azure.storage.CloudStorageAccount(container['account_name'], account_key=container['ac...
Get the azure block blob service for the container in question Try account_key, sas_token, and no auth in that order
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/azurefs.py#L355-L368
null
# -*- coding: utf-8 -*- ''' The backend for serving files from the Azure blob storage service. .. versionadded:: 2015.8.0 To enable, add ``azurefs`` to the :conf_master:`fileserver_backend` option in the Master config file. .. code-block:: yaml fileserver_backend: - azurefs Starting in Salt 2018.3.0, thi...
saltstack/salt
salt/fileserver/azurefs.py
_validate_config
python
def _validate_config(): ''' Validate azurefs config, return False if it doesn't validate ''' if not isinstance(__opts__['azurefs'], list): log.error('azurefs configuration is not formed as a list, skipping azurefs') return False for container in __opts__['azurefs']: if not is...
Validate azurefs config, return False if it doesn't validate
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/azurefs.py#L371-L391
null
# -*- coding: utf-8 -*- ''' The backend for serving files from the Azure blob storage service. .. versionadded:: 2015.8.0 To enable, add ``azurefs`` to the :conf_master:`fileserver_backend` option in the Master config file. .. code-block:: yaml fileserver_backend: - azurefs Starting in Salt 2018.3.0, thi...
saltstack/salt
salt/grains/smartos.py
_smartos_computenode_data
python
def _smartos_computenode_data(): ''' Return useful information from a SmartOS compute node ''' # Provides: # vms_total # vms_running # vms_stopped # vms_type # sdc_version # vm_capable # vm_hw_virt grains = {} # collect vm data vms = {} for vm ...
Return useful information from a SmartOS compute node
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/smartos.py#L49-L99
null
# -*- coding: utf-8 -*- ''' SmartOS grain provider :maintainer: Jorge Schrauwen <sjorge@blackdot.be> :maturity: new :depends: salt.utils, salt.ext.six, salt.module.cmdmod :platform: SmartOS .. versionadded:: nitrogen ''' from __future__ import absolute_import, print_function, unicode_literals # I...
saltstack/salt
salt/grains/smartos.py
_smartos_zone_data
python
def _smartos_zone_data(): ''' Return useful information from a SmartOS zone ''' # Provides: # zoneid # zonename # imageversion grains = { 'zoneid': __salt__['cmd.run']('zoneadm list -p | awk -F: \'{ print $1 }\'', python_shell=True), 'zonename': __salt__['cmd.run']...
Return useful information from a SmartOS zone
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/smartos.py#L102-L126
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' SmartOS grain provider :maintainer: Jorge Schrauwen <sjorge@blackdot.be> :maturity: new :depends: salt.utils, salt.ext.six, salt.module.cmdmod :platform: SmartOS .. versionadded:: nitrogen ''' from __future__ import absolute_import, print_function, unicode_literals # I...
saltstack/salt
salt/grains/smartos.py
_smartos_zone_pkgsrc_data
python
def _smartos_zone_pkgsrc_data(): ''' SmartOS zone pkgsrc information ''' # Provides: # pkgsrcversion # pkgsrcpath grains = { 'pkgsrcversion': 'Unknown', 'pkgsrcpath': 'Unknown', } pkgsrcversion = re.compile('^release:\\s(.+)') if os.path.isfile('/etc/pkgsrc_...
SmartOS zone pkgsrc information
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/smartos.py#L129-L160
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' SmartOS grain provider :maintainer: Jorge Schrauwen <sjorge@blackdot.be> :maturity: new :depends: salt.utils, salt.ext.six, salt.module.cmdmod :platform: SmartOS .. versionadded:: nitrogen ''' from __future__ import absolute_import, print_function, unicode_literals # I...
saltstack/salt
salt/grains/smartos.py
_smartos_zone_pkgin_data
python
def _smartos_zone_pkgin_data(): ''' SmartOS zone pkgsrc information ''' # Provides: # pkgin_repositories grains = { 'pkgin_repositories': [], } pkginrepo = re.compile('^(?:https|http|ftp|file)://.*$') if os.path.isfile('/opt/local/etc/pkgin/repositories.conf'): wi...
SmartOS zone pkgsrc information
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/smartos.py#L163-L182
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' SmartOS grain provider :maintainer: Jorge Schrauwen <sjorge@blackdot.be> :maturity: new :depends: salt.utils, salt.ext.six, salt.module.cmdmod :platform: SmartOS .. versionadded:: nitrogen ''' from __future__ import absolute_import, print_function, unicode_literals # I...
saltstack/salt
salt/grains/smartos.py
smartos
python
def smartos(): ''' Provide grains for SmartOS ''' grains = {} if salt.utils.platform.is_smartos_zone(): grains = salt.utils.dictupdate.update(grains, _smartos_zone_data(), merge_lists=True) grains = salt.utils.dictupdate.update(grains, _smartos_zone_pkgsrc_data(), merge_lists=True) ...
Provide grains for SmartOS
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/smartos.py#L185-L198
[ "def _smartos_zone_data():\n '''\n Return useful information from a SmartOS zone\n '''\n # Provides:\n # zoneid\n # zonename\n # imageversion\n\n grains = {\n 'zoneid': __salt__['cmd.run']('zoneadm list -p | awk -F: \\'{ print $1 }\\'', python_shell=True),\n 'zonename': _...
# -*- coding: utf-8 -*- ''' SmartOS grain provider :maintainer: Jorge Schrauwen <sjorge@blackdot.be> :maturity: new :depends: salt.utils, salt.ext.six, salt.module.cmdmod :platform: SmartOS .. versionadded:: nitrogen ''' from __future__ import absolute_import, print_function, unicode_literals # I...
saltstack/salt
salt/engines/logentries.py
start
python
def start(endpoint='data.logentries.com', port=10000, token=None, tag='salt/engines/logentries'): ''' Listen to salt events and forward them to Logentries ''' if __opts__.get('id').endswith('_master'): event_bus = salt.utils.event.get_master_event( __opt...
Listen to salt events and forward them to Logentries
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/logentries.py#L174-L215
[ "def get_master_event(opts, sock_dir, listen=True, io_loop=None, raise_errors=False, keep_loop=False):\n '''\n Return an event object suitable for the named transport\n '''\n # TODO: AIO core is separate from transport\n if opts['transport'] in ('zeromq', 'tcp', 'detect'):\n return MasterEvent...
# -*- coding: utf-8 -*- ''' An engine that sends events to the Logentries logging service. :maintainer: Jimmy Tang (jimmy_tang@rapid7.com) :maturity: New :depends: ssl, certifi :platform: all .. versionadded: 2016.3.0 To enable this engine the master and/or minion will need the following python libraries ...
saltstack/salt
salt/states/glusterfs.py
peered
python
def peered(name): ''' Check if node is peered. name The remote host with which to peer. .. code-block:: yaml peer-cluster: glusterfs.peered: - name: two peer-clusters: glusterfs.peered: - names: - one - t...
Check if node is peered. name The remote host with which to peer. .. code-block:: yaml peer-cluster: glusterfs.peered: - name: two peer-clusters: glusterfs.peered: - names: - one - two - three ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/glusterfs.py#L40-L108
[ "def check_name(name, safe_chars):\n '''\n Check whether the specified name contains invalid characters\n '''\n regexp = re.compile('[^{0}]'.format(safe_chars))\n if regexp.search(name):\n raise SaltCloudException(\n '{0} contains characters not supported by this cloud provider. '\n...
# -*- coding: utf-8 -*- ''' Manage GlusterFS pool. ''' # Import python libs from __future__ import absolute_import, unicode_literals, \ print_function, generators import logging # Import salt libs import salt.utils.cloud as suc import salt.utils.network from salt.exceptions import SaltCloudException log = loggin...
saltstack/salt
salt/states/glusterfs.py
volume_present
python
def volume_present(name, bricks, stripe=False, replica=False, device_vg=False, transport='tcp', start=False, force=False, arbiter=False): ''' Ensure that the volume exists name name of the volume bricks list of brick paths replica replica count for volum...
Ensure that the volume exists name name of the volume bricks list of brick paths replica replica count for volume arbiter use every third brick as arbiter (metadata only) .. versionadded:: 2019.2.0 start ensure that the volume is also started ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/glusterfs.py#L111-L222
[ "def check_name(name, safe_chars):\n '''\n Check whether the specified name contains invalid characters\n '''\n regexp = re.compile('[^{0}]'.format(safe_chars))\n if regexp.search(name):\n raise SaltCloudException(\n '{0} contains characters not supported by this cloud provider. '\n...
# -*- coding: utf-8 -*- ''' Manage GlusterFS pool. ''' # Import python libs from __future__ import absolute_import, unicode_literals, \ print_function, generators import logging # Import salt libs import salt.utils.cloud as suc import salt.utils.network from salt.exceptions import SaltCloudException log = loggin...
saltstack/salt
salt/states/glusterfs.py
started
python
def started(name): ''' Check if volume has been started name name of the volume .. code-block:: yaml mycluster: glusterfs.started: [] ''' ret = {'name': name, 'changes': {}, 'comment': '', 'result': False} volinfo = __salt__['glu...
Check if volume has been started name name of the volume .. code-block:: yaml mycluster: glusterfs.started: []
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/glusterfs.py#L225-L266
null
# -*- coding: utf-8 -*- ''' Manage GlusterFS pool. ''' # Import python libs from __future__ import absolute_import, unicode_literals, \ print_function, generators import logging # Import salt libs import salt.utils.cloud as suc import salt.utils.network from salt.exceptions import SaltCloudException log = loggin...
saltstack/salt
salt/states/glusterfs.py
add_volume_bricks
python
def add_volume_bricks(name, bricks): ''' Add brick(s) to an existing volume name Volume name bricks List of bricks to add to the volume .. code-block:: yaml myvolume: glusterfs.add_volume_bricks: - bricks: - host1:/srv/gluster/drive1 ...
Add brick(s) to an existing volume name Volume name bricks List of bricks to add to the volume .. code-block:: yaml myvolume: glusterfs.add_volume_bricks: - bricks: - host1:/srv/gluster/drive1 - host2:/srv/gluster/drive2 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/glusterfs.py#L269-L323
null
# -*- coding: utf-8 -*- ''' Manage GlusterFS pool. ''' # Import python libs from __future__ import absolute_import, unicode_literals, \ print_function, generators import logging # Import salt libs import salt.utils.cloud as suc import salt.utils.network from salt.exceptions import SaltCloudException log = loggin...
saltstack/salt
salt/states/glusterfs.py
op_version
python
def op_version(name, version): ''' .. versionadded:: 2019.2.0 Add brick(s) to an existing volume name Volume name version Version to which the cluster.op-version should be set .. code-block:: yaml myvolume: glusterfs.op_version: - name: volume1 ...
.. versionadded:: 2019.2.0 Add brick(s) to an existing volume name Volume name version Version to which the cluster.op-version should be set .. code-block:: yaml myvolume: glusterfs.op_version: - name: volume1 - version: 30707
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/glusterfs.py#L326-L375
null
# -*- coding: utf-8 -*- ''' Manage GlusterFS pool. ''' # Import python libs from __future__ import absolute_import, unicode_literals, \ print_function, generators import logging # Import salt libs import salt.utils.cloud as suc import salt.utils.network from salt.exceptions import SaltCloudException log = loggin...
saltstack/salt
salt/states/glusterfs.py
max_op_version
python
def max_op_version(name): ''' .. versionadded:: 2019.2.0 Add brick(s) to an existing volume name Volume name .. code-block:: yaml myvolume: glusterfs.max_op_version: - name: volume1 - version: 30707 ''' ret = {'name': name, 'ch...
.. versionadded:: 2019.2.0 Add brick(s) to an existing volume name Volume name .. code-block:: yaml myvolume: glusterfs.max_op_version: - name: volume1 - version: 30707
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/glusterfs.py#L378-L431
null
# -*- coding: utf-8 -*- ''' Manage GlusterFS pool. ''' # Import python libs from __future__ import absolute_import, unicode_literals, \ print_function, generators import logging # Import salt libs import salt.utils.cloud as suc import salt.utils.network from salt.exceptions import SaltCloudException log = loggin...
saltstack/salt
salt/returners/nagios_nrdp_return.py
_prepare_xml
python
def _prepare_xml(options=None, state=None): ''' Get the requests options from salt. ''' if state: _state = '0' else: _state = '2' xml = "<?xml version='1.0'?>\n<checkresults>\n" # No service defined then we set the status of the hostname if 'service' in options and opt...
Get the requests options from salt.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/nagios_nrdp_return.py#L108-L138
null
# -*- coding: utf-8 -*- ''' Return salt data to Nagios The following fields can be set in the minion conf file:: nagios.url (required) nagios.token (required) nagios.service (optional) nagios.check_type (optional) Alternative configuration values can be used by prefacing the configuration. Any values...
saltstack/salt
salt/returners/nagios_nrdp_return.py
_getText
python
def _getText(nodelist): ''' Simple function to return value from XML ''' rc = [] for node in nodelist: if node.nodeType == node.TEXT_NODE: rc.append(node.data) return ''.join(rc)
Simple function to return value from XML
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/nagios_nrdp_return.py#L141-L149
null
# -*- coding: utf-8 -*- ''' Return salt data to Nagios The following fields can be set in the minion conf file:: nagios.url (required) nagios.token (required) nagios.service (optional) nagios.check_type (optional) Alternative configuration values can be used by prefacing the configuration. Any values...
saltstack/salt
salt/returners/nagios_nrdp_return.py
_post_data
python
def _post_data(options=None, xml=None): ''' Post data to Nagios NRDP ''' params = {'token': options['token'].strip(), 'cmd': 'submitcheck', 'XMLDATA': xml} res = salt.utils.http.query( url=options['url'], method='POST', params=params, data='', decode=True, ...
Post data to Nagios NRDP
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/nagios_nrdp_return.py#L152-L184
null
# -*- coding: utf-8 -*- ''' Return salt data to Nagios The following fields can be set in the minion conf file:: nagios.url (required) nagios.token (required) nagios.service (optional) nagios.check_type (optional) Alternative configuration values can be used by prefacing the configuration. Any values...
saltstack/salt
salt/returners/nagios_nrdp_return.py
returner
python
def returner(ret): ''' Send a message to Nagios with the data ''' _options = _get_options(ret) log.debug('_options %s', _options) _options['hostname'] = ret.get('id') if 'url' not in _options or _options['url'] == '': log.error('nagios_nrdp.url not defined in salt config') ...
Send a message to Nagios with the data
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/nagios_nrdp_return.py#L187-L207
[ "def _get_options(ret=None):\n '''\n Get the requests options from salt.\n '''\n attrs = {'url': 'url',\n 'token': 'token',\n 'service': 'service',\n 'checktype': 'checktype',\n }\n\n _options = salt.returners.get_returner_options(__virtualname__,\n ...
# -*- coding: utf-8 -*- ''' Return salt data to Nagios The following fields can be set in the minion conf file:: nagios.url (required) nagios.token (required) nagios.service (optional) nagios.check_type (optional) Alternative configuration values can be used by prefacing the configuration. Any values...
saltstack/salt
salt/returners/influxdb_return.py
_get_serv
python
def _get_serv(ret=None): ''' Return an influxdb client object ''' _options = _get_options(ret) host = _options.get('host') port = _options.get('port') database = _options.get('db') user = _options.get('user') password = _options.get('password') version = _get_version(host, port, ...
Return an influxdb client object
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/influxdb_return.py#L122-L147
[ "def _get_options(ret=None):\n '''\n Get the influxdb options from salt.\n '''\n attrs = {'host': 'host',\n 'port': 'port',\n 'db': 'db',\n 'user': 'user',\n 'password': 'password'}\n\n _options = salt.returners.get_returner_options(__virtualname__,\n ...
# -*- coding: utf-8 -*- ''' Return data to an influxdb server. .. versionadded:: 2015.8.0 To enable this returner the minion will need the python client for influxdb installed and the following values configured in the minion or master config, these are the defaults: .. code-block:: yaml influxdb.db: 'salt' ...
saltstack/salt
salt/returners/influxdb_return.py
returner
python
def returner(ret): ''' Return data to a influxdb data store ''' serv = _get_serv(ret) # strip the 'return' key to avoid data duplication in the database json_return = salt.utils.json.dumps(ret['return']) del ret['return'] json_full_ret = salt.utils.json.dumps(ret) # create legacy r...
Return data to a influxdb data store
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/influxdb_return.py#L150-L192
[ "def dumps(obj, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.dumps, and assumes that ensure_ascii is False (unless explicitly\n passed as True) for unicode compatibility. Note that setting it to True\n will mess up any unicode characters, as they will be dumped as the string\n lite...
# -*- coding: utf-8 -*- ''' Return data to an influxdb server. .. versionadded:: 2015.8.0 To enable this returner the minion will need the python client for influxdb installed and the following values configured in the minion or master config, these are the defaults: .. code-block:: yaml influxdb.db: 'salt' ...
saltstack/salt
salt/returners/influxdb_return.py
save_load
python
def save_load(jid, load, minions=None): ''' Save the load to the specified jid ''' serv = _get_serv(ret=None) # create legacy request in case an InfluxDB 0.8.x version is used if "influxdb08" in serv.__module__: req = [ { 'name': 'jids', 'colu...
Save the load to the specified jid
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/influxdb_return.py#L195-L229
[ "def dumps(obj, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.dumps, and assumes that ensure_ascii is False (unless explicitly\n passed as True) for unicode compatibility. Note that setting it to True\n will mess up any unicode characters, as they will be dumped as the string\n lite...
# -*- coding: utf-8 -*- ''' Return data to an influxdb server. .. versionadded:: 2015.8.0 To enable this returner the minion will need the python client for influxdb installed and the following values configured in the minion or master config, these are the defaults: .. code-block:: yaml influxdb.db: 'salt' ...
saltstack/salt
salt/returners/influxdb_return.py
get_load
python
def get_load(jid): ''' Return the load data that marks a specified jid ''' serv = _get_serv(ret=None) sql = "select load from jids where jid = '{0}'".format(jid) log.debug(">> Now in get_load %s", jid) data = serv.query(sql) log.debug(">> Now Data: %s", data) if data: return...
Return the load data that marks a specified jid
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/influxdb_return.py#L239-L251
[ "def _get_serv(ret=None):\n '''\n Return an influxdb client object\n '''\n _options = _get_options(ret)\n host = _options.get('host')\n port = _options.get('port')\n database = _options.get('db')\n user = _options.get('user')\n password = _options.get('password')\n version = _get_versi...
# -*- coding: utf-8 -*- ''' Return data to an influxdb server. .. versionadded:: 2015.8.0 To enable this returner the minion will need the python client for influxdb installed and the following values configured in the minion or master config, these are the defaults: .. code-block:: yaml influxdb.db: 'salt' ...
saltstack/salt
salt/returners/influxdb_return.py
get_jid
python
def get_jid(jid): ''' Return the information returned when the specified job id was executed ''' serv = _get_serv(ret=None) sql = "select id, full_ret from returns where jid = '{0}'".format(jid) data = serv.query(sql) ret = {} if data: points = data[0]['points'] for poi...
Return the information returned when the specified job id was executed
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/influxdb_return.py#L254-L269
[ "def loads(s, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.loads and prevents a traceback in the event that a bytestring is\n passed to the function. (Python < 3.6 cannot load bytestrings)\n\n You can pass an alternate json module (loaded via import_json() above)\n using the _json_...
# -*- coding: utf-8 -*- ''' Return data to an influxdb server. .. versionadded:: 2015.8.0 To enable this returner the minion will need the python client for influxdb installed and the following values configured in the minion or master config, these are the defaults: .. code-block:: yaml influxdb.db: 'salt' ...
saltstack/salt
salt/returners/influxdb_return.py
get_fun
python
def get_fun(fun): ''' Return a dict of the last function called for all minions ''' serv = _get_serv(ret=None) sql = '''select first(id) as fid, first(full_ret) as fret from returns where fun = '{0}' group by fun, id '''.format(fun) data = serv.que...
Return a dict of the last function called for all minions
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/influxdb_return.py#L272-L291
[ "def loads(s, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.loads and prevents a traceback in the event that a bytestring is\n passed to the function. (Python < 3.6 cannot load bytestrings)\n\n You can pass an alternate json module (loaded via import_json() above)\n using the _json_...
# -*- coding: utf-8 -*- ''' Return data to an influxdb server. .. versionadded:: 2015.8.0 To enable this returner the minion will need the python client for influxdb installed and the following values configured in the minion or master config, these are the defaults: .. code-block:: yaml influxdb.db: 'salt' ...
saltstack/salt
salt/returners/influxdb_return.py
get_jids
python
def get_jids(): ''' Return a list of all job ids ''' serv = _get_serv(ret=None) sql = "select distinct(jid) from jids group by load" # [{u'points': [[0, jid, load], # [0, jid, load]], # u'name': u'jids', # u'columns': [u'time', u'distinct', u'load']}] data = se...
Return a list of all job ids
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/influxdb_return.py#L294-L310
[ "def loads(s, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.loads and prevents a traceback in the event that a bytestring is\n passed to the function. (Python < 3.6 cannot load bytestrings)\n\n You can pass an alternate json module (loaded via import_json() above)\n using the _json_...
# -*- coding: utf-8 -*- ''' Return data to an influxdb server. .. versionadded:: 2015.8.0 To enable this returner the minion will need the python client for influxdb installed and the following values configured in the minion or master config, these are the defaults: .. code-block:: yaml influxdb.db: 'salt' ...
saltstack/salt
salt/returners/influxdb_return.py
get_minions
python
def get_minions(): ''' Return a list of minions ''' serv = _get_serv(ret=None) sql = "select distinct(id) from returns" data = serv.query(sql) ret = [] if data: for jid in data[0]['points']: ret.append(jid[1]) return ret
Return a list of minions
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/influxdb_return.py#L313-L326
[ "def _get_serv(ret=None):\n '''\n Return an influxdb client object\n '''\n _options = _get_options(ret)\n host = _options.get('host')\n port = _options.get('port')\n database = _options.get('db')\n user = _options.get('user')\n password = _options.get('password')\n version = _get_versi...
# -*- coding: utf-8 -*- ''' Return data to an influxdb server. .. versionadded:: 2015.8.0 To enable this returner the minion will need the python client for influxdb installed and the following values configured in the minion or master config, these are the defaults: .. code-block:: yaml influxdb.db: 'salt' ...
saltstack/salt
salt/utils/master.py
get_running_jobs
python
def get_running_jobs(opts): ''' Return the running jobs on the master ''' ret = [] proc_dir = os.path.join(opts['cachedir'], 'proc') if not os.path.isdir(proc_dir): return ret for fn_ in os.listdir(proc_dir): path = os.path.join(proc_dir, fn_) data = read_proc_file(p...
Return the running jobs on the master
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/master.py#L48-L65
[ "def read_proc_file(path, opts):\n '''\n Return a dict of JID metadata, or None\n '''\n serial = salt.payload.Serial(opts)\n with salt.utils.files.fopen(path, 'rb') as fp_:\n try:\n data = serial.load(fp_)\n except Exception as err:\n # need to add serial exception...
# -*- coding: utf-8 -*- ''' salt.utils.master ----------------- Utilities that can only be used on a salt master. ''' # Import python libs from __future__ import absolute_import, unicode_literals import os import logging import signal from threading import Thread, Event # Import salt libs import salt.lo...
saltstack/salt
salt/utils/master.py
read_proc_file
python
def read_proc_file(path, opts): ''' Return a dict of JID metadata, or None ''' serial = salt.payload.Serial(opts) with salt.utils.files.fopen(path, 'rb') as fp_: try: data = serial.load(fp_) except Exception as err: # need to add serial exception here ...
Return a dict of JID metadata, or None
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/master.py#L68-L93
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' salt.utils.master ----------------- Utilities that can only be used on a salt master. ''' # Import python libs from __future__ import absolute_import, unicode_literals import os import logging import signal from threading import Thread, Event # Import salt libs import salt.lo...
saltstack/salt
salt/utils/master.py
is_pid_healthy
python
def is_pid_healthy(pid): ''' This is a health check that will confirm the PID is running and executed by salt. If pusutil is available: * all architectures are checked if psutil is not available: * Linux/Solaris/etc: archs with `/proc/cmdline` available are checked * AIX/Wi...
This is a health check that will confirm the PID is running and executed by salt. If pusutil is available: * all architectures are checked if psutil is not available: * Linux/Solaris/etc: archs with `/proc/cmdline` available are checked * AIX/Windows: assume PID is healhty and retu...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/master.py#L96-L129
null
# -*- coding: utf-8 -*- ''' salt.utils.master ----------------- Utilities that can only be used on a salt master. ''' # Import python libs from __future__ import absolute_import, unicode_literals import os import logging import signal from threading import Thread, Event # Import salt libs import salt.lo...
saltstack/salt
salt/utils/master.py
get_values_of_matching_keys
python
def get_values_of_matching_keys(pattern_dict, user_name): ''' Check a whitelist and/or blacklist to see if the value matches it. ''' ret = [] for expr in pattern_dict: if salt.utils.stringutils.expr_match(user_name, expr): ret.extend(pattern_dict[expr]) return ret
Check a whitelist and/or blacklist to see if the value matches it.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/master.py#L806-L814
[ "def expr_match(line, expr):\n '''\n Checks whether or not the passed value matches the specified expression.\n Tries to match expr first as a glob using fnmatch.fnmatch(), and then tries\n to match expr as a regular expression. Originally designed to match minion\n IDs for whitelists/blacklists.\n\n...
# -*- coding: utf-8 -*- ''' salt.utils.master ----------------- Utilities that can only be used on a salt master. ''' # Import python libs from __future__ import absolute_import, unicode_literals import os import logging import signal from threading import Thread, Event # Import salt libs import salt.lo...
saltstack/salt
salt/utils/master.py
MasterPillarUtil.get_minion_pillar
python
def get_minion_pillar(self): ''' Get pillar data for the targeted minions, either by fetching the cached minion data on the master, or by compiling the minion's pillar data on the master. For runner modules that need access minion pillar data, this function should be use...
Get pillar data for the targeted minions, either by fetching the cached minion data on the master, or by compiling the minion's pillar data on the master. For runner modules that need access minion pillar data, this function should be used instead of getting the pillar data by e...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/master.py#L332-L369
[ "def _tgt_to_list(self):\n # Return a list of minion ids that match the target and tgt_type\n minion_ids = []\n ckminions = salt.utils.minions.CkMinions(self.opts)\n _res = ckminions.check_minions(self.tgt, self.tgt_type)\n minion_ids = _res['minions']\n if not minion_ids:\n log.debug('No m...
class MasterPillarUtil(object): ''' Helper utility for easy access to targeted minion grain and pillar data, either from cached data on the master or retrieved on demand, or (by default) both. The minion pillar data returned in get_minion_pillar() is compiled directly from salt.pillar.Pillar on...
saltstack/salt
salt/utils/master.py
MasterPillarUtil.get_minion_grains
python
def get_minion_grains(self): ''' Get grains data for the targeted minions, either by fetching the cached minion data on the master, or by fetching the grains directly on the minion. By default, this function tries hard to get the grains data: - Try to get the cached ...
Get grains data for the targeted minions, either by fetching the cached minion data on the master, or by fetching the grains directly on the minion. By default, this function tries hard to get the grains data: - Try to get the cached minion grains if the master has m...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/master.py#L371-L397
[ "def _tgt_to_list(self):\n # Return a list of minion ids that match the target and tgt_type\n minion_ids = []\n ckminions = salt.utils.minions.CkMinions(self.opts)\n _res = ckminions.check_minions(self.tgt, self.tgt_type)\n minion_ids = _res['minions']\n if not minion_ids:\n log.debug('No m...
class MasterPillarUtil(object): ''' Helper utility for easy access to targeted minion grain and pillar data, either from cached data on the master or retrieved on demand, or (by default) both. The minion pillar data returned in get_minion_pillar() is compiled directly from salt.pillar.Pillar on...
saltstack/salt
salt/utils/master.py
MasterPillarUtil.get_cached_mine_data
python
def get_cached_mine_data(self): ''' Get cached mine data for the targeted minions. ''' mine_data = {} minion_ids = self._tgt_to_list() log.debug('Getting cached mine data for: %s', minion_ids) mine_data = self._get_cached_mine_data(*minion_ids) return mine...
Get cached mine data for the targeted minions.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/master.py#L399-L407
[ "def _get_cached_mine_data(self, *minion_ids):\n # Return one dict with the cached mine data of the targeted minions\n mine_data = dict([(minion_id, {}) for minion_id in minion_ids])\n if (not self.opts.get('minion_data_cache', False)\n and not self.opts.get('enforce_mine_cache', False)):\n ...
class MasterPillarUtil(object): ''' Helper utility for easy access to targeted minion grain and pillar data, either from cached data on the master or retrieved on demand, or (by default) both. The minion pillar data returned in get_minion_pillar() is compiled directly from salt.pillar.Pillar on...
saltstack/salt
salt/utils/master.py
MasterPillarUtil.clear_cached_minion_data
python
def clear_cached_minion_data(self, clear_pillar=False, clear_grains=False, clear_mine=False, clear_mine_func=None): ''' Clear the cached data/files for the targeted minions...
Clear the cached data/files for the targeted minions.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/master.py#L409-L476
[ "def valid_id(opts, id_):\n '''\n Returns if the passed id is valid\n '''\n try:\n if any(x in id_ for x in ('/', '\\\\', str('\\0'))):\n return False\n return bool(clean_path(opts['pki_dir'], id_))\n except (AttributeError, KeyError, TypeError, UnicodeDecodeError):\n ...
class MasterPillarUtil(object): ''' Helper utility for easy access to targeted minion grain and pillar data, either from cached data on the master or retrieved on demand, or (by default) both. The minion pillar data returned in get_minion_pillar() is compiled directly from salt.pillar.Pillar on...
saltstack/salt
salt/utils/master.py
CacheTimer.run
python
def run(self): ''' main loop that fires the event every second ''' context = zmq.Context() # the socket for outgoing timer events socket = context.socket(zmq.PUB) socket.setsockopt(zmq.LINGER, 100) socket.bind('ipc://' + self.timer_sock) count = 0...
main loop that fires the event every second
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/master.py#L492-L509
null
class CacheTimer(Thread): ''' A basic timer class the fires timer-events every second. This is used for cleanup by the ConnectedCache() ''' def __init__(self, opts, event): Thread.__init__(self) self.opts = opts self.stopped = event self.daemon = True self.ser...
saltstack/salt
salt/utils/master.py
CacheWorker.run
python
def run(self): ''' Gather currently connected minions and update the cache ''' new_mins = list(salt.utils.minions.CkMinions(self.opts).connected_ids()) cc = cache_cli(self.opts) cc.get_cached() cc.put_cache([new_mins]) log.debug('ConCache CacheWorker updat...
Gather currently connected minions and update the cache
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/master.py#L544-L552
[ "def put_cache(self, minions):\n '''\n published the given minions to the ConCache\n '''\n self.cupd_out.send(self.serial.dumps(minions))\n", "def get_cached(self):\n '''\n queries the ConCache for a list of currently connected minions\n '''\n msg = self.serial.dumps('minions')\n self.c...
class CacheWorker(MultiprocessingProcess): ''' Worker for ConnectedCache which runs in its own process to prevent blocking of ConnectedCache main-loop when refreshing minion-list ''' def __init__(self, opts, **kwargs): ''' Sets up the zmq-connection to the ConCache ''' ...
saltstack/salt
salt/utils/master.py
ConnectedCache.cleanup
python
def cleanup(self): ''' remove sockets on shutdown ''' log.debug('ConCache cleaning up') if os.path.exists(self.cache_sock): os.remove(self.cache_sock) if os.path.exists(self.update_sock): os.remove(self.update_sock) if os.path.exists(self.u...
remove sockets on shutdown
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/master.py#L613-L623
null
class ConnectedCache(MultiprocessingProcess): ''' Provides access to all minions ids that the master has successfully authenticated. The cache is cleaned up regularly by comparing it to the IPs that have open connections to the master publisher port. ''' def __init__(self, opts, **kwargs): ...
saltstack/salt
salt/utils/master.py
ConnectedCache.secure
python
def secure(self): ''' secure the sockets for root-only access ''' log.debug('ConCache securing sockets') if os.path.exists(self.cache_sock): os.chmod(self.cache_sock, 0o600) if os.path.exists(self.update_sock): os.chmod(self.update_sock, 0o600) ...
secure the sockets for root-only access
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/master.py#L625-L635
null
class ConnectedCache(MultiprocessingProcess): ''' Provides access to all minions ids that the master has successfully authenticated. The cache is cleaned up regularly by comparing it to the IPs that have open connections to the master publisher port. ''' def __init__(self, opts, **kwargs): ...
saltstack/salt
salt/utils/master.py
ConnectedCache.stop
python
def stop(self): ''' shutdown cache process ''' # avoid getting called twice self.cleanup() if self.running: self.running = False self.timer_stop.set() self.timer.join()
shutdown cache process
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/master.py#L637-L646
null
class ConnectedCache(MultiprocessingProcess): ''' Provides access to all minions ids that the master has successfully authenticated. The cache is cleaned up regularly by comparing it to the IPs that have open connections to the master publisher port. ''' def __init__(self, opts, **kwargs): ...
saltstack/salt
salt/utils/master.py
ConnectedCache.run
python
def run(self): ''' Main loop of the ConCache, starts updates in intervals and answers requests from the MWorkers ''' context = zmq.Context() # the socket for incoming cache requests creq_in = context.socket(zmq.REP) creq_in.setsockopt(zmq.LINGER, 100) ...
Main loop of the ConCache, starts updates in intervals and answers requests from the MWorkers
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/master.py#L648-L767
[ "def loads(self, msg, encoding=None, raw=False):\n '''\n Run the correct loads serialization format\n\n :param encoding: Useful for Python 3 support. If the msgpack data\n was encoded using \"use_bin_type=True\", this will\n differentiate between the 'bytes' type and...
class ConnectedCache(MultiprocessingProcess): ''' Provides access to all minions ids that the master has successfully authenticated. The cache is cleaned up regularly by comparing it to the IPs that have open connections to the master publisher port. ''' def __init__(self, opts, **kwargs): ...
saltstack/salt
salt/returners/sms_return.py
returner
python
def returner(ret): ''' Return a response in an SMS message ''' _options = _get_options(ret) sid = _options.get('sid', None) token = _options.get('token', None) sender = _options.get('from', None) receiver = _options.get('to', None) if sid is None or token is None: log.error...
Return a response in an SMS message
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/sms_return.py#L72-L105
[ "def _get_options(ret=None):\n '''\n Get the Twilio options from salt.\n '''\n attrs = {'sid': 'sid',\n 'token': 'token',\n 'to': 'to',\n 'from': 'from'}\n\n _options = salt.returners.get_returner_options(__virtualname__,\n ...
# -*- coding: utf-8 -*- ''' Return data by SMS. .. versionadded:: 2015.5.0 :maintainer: Damian Myerscough :maturity: new :depends: twilio :platform: all To enable this returner the minion will need the python twilio library installed and the following values configured in the minion or master con...
saltstack/salt
salt/states/keystone_group.py
_common
python
def _common(kwargs): ''' Returns: None if group wasn't found, otherwise a group object ''' search_kwargs = {'name': kwargs['name']} if 'domain' in kwargs: domain = __salt__['keystoneng.get_entity']( 'domain', name=kwargs.pop('domain')) domain_id = domain.id ...
Returns: None if group wasn't found, otherwise a group object
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/keystone_group.py#L41-L53
null
# -*- coding: utf-8 -*- ''' Management of OpenStack Keystone Groups ======================================= .. versionadded:: 2018.3.0 :depends: shade :configuration: see :py:mod:`salt.modules.keystoneng` for setup instructions Example States .. code-block:: yaml create group: keystone_group.present: ...
saltstack/salt
salt/states/keystone_group.py
absent
python
def absent(name, auth=None, **kwargs): ''' Ensure group does not exist name Name of the group domain The name or id of the domain ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} kwargs = __utils__['args.clean_kwargs']...
Ensure group does not exist name Name of the group domain The name or id of the domain
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/keystone_group.py#L108-L141
[ "def _common(kwargs):\n '''\n Returns: None if group wasn't found, otherwise a group object\n '''\n search_kwargs = {'name': kwargs['name']}\n if 'domain' in kwargs:\n domain = __salt__['keystoneng.get_entity'](\n 'domain', name=kwargs.pop('domain'))\n domain_id...
# -*- coding: utf-8 -*- ''' Management of OpenStack Keystone Groups ======================================= .. versionadded:: 2018.3.0 :depends: shade :configuration: see :py:mod:`salt.modules.keystoneng` for setup instructions Example States .. code-block:: yaml create group: keystone_group.present: ...
saltstack/salt
salt/wheel/pillar_roots.py
find
python
def find(path, saltenv='base'): ''' Return a dict of the files located with the given path and environment ''' # Return a list of paths + text or bin ret = [] if saltenv not in __opts__['pillar_roots']: return ret for root in __opts__['pillar_roots'][saltenv]: full = os.path....
Return a dict of the files located with the given path and environment
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/wheel/pillar_roots.py#L19-L36
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' The `pillar_roots` wheel module is used to manage files under the pillar roots directories on the master server. ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import os # Import salt libs import salt.utils.files import salt.utils.path # ...
saltstack/salt
salt/wheel/pillar_roots.py
list_env
python
def list_env(saltenv='base'): ''' Return all of the file paths found in an environment ''' ret = {} if saltenv not in __opts__['pillar_roots']: return ret for f_root in __opts__['pillar_roots'][saltenv]: ret[f_root] = {} for root, dirs, files in salt.utils.path.os_walk(f_...
Return all of the file paths found in an environment
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/wheel/pillar_roots.py#L39-L66
[ "def os_walk(top, *args, **kwargs):\n '''\n This is a helper than ensures that all paths returned from os.walk are\n unicode.\n '''\n if six.PY2 and salt.utils.platform.is_windows():\n top_query = top\n else:\n top_query = salt.utils.stringutils.to_str(top)\n for item in os.walk(t...
# -*- coding: utf-8 -*- ''' The `pillar_roots` wheel module is used to manage files under the pillar roots directories on the master server. ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import os # Import salt libs import salt.utils.files import salt.utils.path # ...
saltstack/salt
salt/wheel/pillar_roots.py
list_roots
python
def list_roots(): ''' Return all of the files names in all available environments ''' ret = {} for saltenv in __opts__['pillar_roots']: ret[saltenv] = [] ret[saltenv].append(list_env(saltenv)) return ret
Return all of the files names in all available environments
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/wheel/pillar_roots.py#L69-L77
[ "def list_env(saltenv='base'):\n '''\n Return all of the file paths found in an environment\n '''\n ret = {}\n if saltenv not in __opts__['pillar_roots']:\n return ret\n for f_root in __opts__['pillar_roots'][saltenv]:\n ret[f_root] = {}\n for root, dirs, files in salt.utils.p...
# -*- coding: utf-8 -*- ''' The `pillar_roots` wheel module is used to manage files under the pillar roots directories on the master server. ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import os # Import salt libs import salt.utils.files import salt.utils.path # ...
saltstack/salt
salt/wheel/pillar_roots.py
read
python
def read(path, saltenv='base'): ''' Read the contents of a text file, if the file is binary then ''' # Return a dict of paths + content ret = [] files = find(path, saltenv) for fn_ in files: full = next(six.iterkeys(fn_)) form = fn_[full] if form == 'txt': ...
Read the contents of a text file, if the file is binary then
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/wheel/pillar_roots.py#L80-L95
[ "def find(path, saltenv='base'):\n '''\n Return a dict of the files located with the given path and environment\n '''\n # Return a list of paths + text or bin\n ret = []\n if saltenv not in __opts__['pillar_roots']:\n return ret\n for root in __opts__['pillar_roots'][saltenv]:\n f...
# -*- coding: utf-8 -*- ''' The `pillar_roots` wheel module is used to manage files under the pillar roots directories on the master server. ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import os # Import salt libs import salt.utils.files import salt.utils.path # ...
saltstack/salt
salt/wheel/pillar_roots.py
write
python
def write(data, path, saltenv='base', index=0): ''' Write the named file, by default the first file found is written, but the index of the file can be specified to write to a lower priority file root ''' if saltenv not in __opts__['pillar_roots']: return 'Named environment {0} is not present...
Write the named file, by default the first file found is written, but the index of the file can be specified to write to a lower priority file root
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/wheel/pillar_roots.py#L98-L117
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' The `pillar_roots` wheel module is used to manage files under the pillar roots directories on the master server. ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import os # Import salt libs import salt.utils.files import salt.utils.path # ...
saltstack/salt
salt/states/azurearm_resource.py
resource_group_present
python
def resource_group_present(name, location, managed_by=None, tags=None, connection_auth=None, **kwargs): ''' .. versionadded:: 2019.2.0 Ensure a resource group exists. :param name: Name of the resource group. :param location: The Azure location in which to create the resource group...
.. versionadded:: 2019.2.0 Ensure a resource group exists. :param name: Name of the resource group. :param location: The Azure location in which to create the resource group. This value cannot be updated once the resource group is created. :param managed_by: The ID of...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/azurearm_resource.py#L104-L210
null
# -*- coding: utf-8 -*- ''' Azure (ARM) Resource State Module .. versionadded:: 2019.2.0 :maintainer: <devops@decisionlab.io> :maturity: new :depends: * `azure <https://pypi.python.org/pypi/azure>`_ >= 2.0.0 * `azure-common <https://pypi.python.org/pypi/azure-common>`_ >= 1.1.8 * `azure-mgmt <https://pypi...
saltstack/salt
salt/states/azurearm_resource.py
resource_group_absent
python
def resource_group_absent(name, connection_auth=None): ''' .. versionadded:: 2019.2.0 Ensure a resource group does not exist in the current subscription. :param name: Name of the resource group. :param connection_auth: A dict with subscription and authentication parameters to be u...
.. versionadded:: 2019.2.0 Ensure a resource group does not exist in the current subscription. :param name: Name of the resource group. :param connection_auth: A dict with subscription and authentication parameters to be used in connecting to the Azure Resource Manager API.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/azurearm_resource.py#L213-L275
null
# -*- coding: utf-8 -*- ''' Azure (ARM) Resource State Module .. versionadded:: 2019.2.0 :maintainer: <devops@decisionlab.io> :maturity: new :depends: * `azure <https://pypi.python.org/pypi/azure>`_ >= 2.0.0 * `azure-common <https://pypi.python.org/pypi/azure-common>`_ >= 1.1.8 * `azure-mgmt <https://pypi...
saltstack/salt
salt/states/azurearm_resource.py
policy_definition_present
python
def policy_definition_present(name, policy_rule=None, policy_type=None, mode=None, display_name=None, description=None, metadata=None, parameters=None, policy_rule_json=None, policy_rule_file=None, template='jinja', source_hash=None, source_hash_name=None, ski...
.. versionadded:: 2019.2.0 Ensure a security policy definition exists. :param name: Name of the policy definition. :param policy_rule: A YAML dictionary defining the policy rule. See `Azure Policy Definition documentation <https://docs.microsoft.com/en-us/azure/azure-policy/policy...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/azurearm_resource.py#L278-L544
null
# -*- coding: utf-8 -*- ''' Azure (ARM) Resource State Module .. versionadded:: 2019.2.0 :maintainer: <devops@decisionlab.io> :maturity: new :depends: * `azure <https://pypi.python.org/pypi/azure>`_ >= 2.0.0 * `azure-common <https://pypi.python.org/pypi/azure-common>`_ >= 1.1.8 * `azure-mgmt <https://pypi...
saltstack/salt
salt/states/azurearm_resource.py
policy_definition_absent
python
def policy_definition_absent(name, connection_auth=None): ''' .. versionadded:: 2019.2.0 Ensure a policy definition does not exist in the current subscription. :param name: Name of the policy definition. :param connection_auth: A dict with subscription and authentication parameter...
.. versionadded:: 2019.2.0 Ensure a policy definition does not exist in the current subscription. :param name: Name of the policy definition. :param connection_auth: A dict with subscription and authentication parameters to be used in connecting to the Azure Resource Manager API.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/azurearm_resource.py#L547-L599
null
# -*- coding: utf-8 -*- ''' Azure (ARM) Resource State Module .. versionadded:: 2019.2.0 :maintainer: <devops@decisionlab.io> :maturity: new :depends: * `azure <https://pypi.python.org/pypi/azure>`_ >= 2.0.0 * `azure-common <https://pypi.python.org/pypi/azure-common>`_ >= 1.1.8 * `azure-mgmt <https://pypi...
saltstack/salt
salt/states/azurearm_resource.py
policy_assignment_present
python
def policy_assignment_present(name, scope, definition_name, display_name=None, description=None, assignment_type=None, parameters=None, connection_auth=None, **kwargs): ''' .. versionadded:: 2019.2.0 Ensure a security policy assignment exists. :param name: Name of...
.. versionadded:: 2019.2.0 Ensure a security policy assignment exists. :param name: Name of the policy assignment. :param scope: The scope of the policy assignment. :param definition_name: The name of the policy definition to assign. :param display_name: The disp...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/azurearm_resource.py#L602-L753
null
# -*- coding: utf-8 -*- ''' Azure (ARM) Resource State Module .. versionadded:: 2019.2.0 :maintainer: <devops@decisionlab.io> :maturity: new :depends: * `azure <https://pypi.python.org/pypi/azure>`_ >= 2.0.0 * `azure-common <https://pypi.python.org/pypi/azure-common>`_ >= 1.1.8 * `azure-mgmt <https://pypi...
saltstack/salt
salt/returners/xmpp_return.py
returner
python
def returner(ret): ''' Send an xmpp message with the data ''' _options = _get_options(ret) from_jid = _options.get('from_jid') password = _options.get('password') recipient_jid = _options.get('recipient_jid') if not from_jid: log.error('xmpp.jid not defined in salt config') ...
Send an xmpp message with the data
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/xmpp_return.py#L157-L198
[ "def _get_options(ret=None):\n '''\n Get the xmpp options from salt.\n '''\n attrs = {'xmpp_profile': 'profile',\n 'from_jid': 'jid',\n 'password': 'password',\n 'recipient_jid': 'recipient'}\n\n profile_attr = 'xmpp_profile'\n\n profile_attrs = {'from_jid': 'ji...
# -*- coding: utf-8 -*- ''' Return salt data via xmpp :depends: sleekxmpp >= 1.3.1 The following fields can be set in the minion conf file:: xmpp.jid (required) xmpp.password (required) xmpp.recipient (required) xmpp.profile (optional) Alternative configuration values can be used by prefacing the co...
saltstack/salt
salt/states/win_iis.py
_get_binding_info
python
def _get_binding_info(hostheader='', ipaddress='*', port=80): ''' Combine the host header, IP address, and TCP port into bindingInformation format. ''' ret = r'{0}:{1}:{2}'.format(ipaddress, port, hostheader.replace(' ', '')) return ret
Combine the host header, IP address, and TCP port into bindingInformation format.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_iis.py#L31-L37
null
# -*- coding: utf-8 -*- ''' Microsoft IIS site management This module provides the ability to add/remove websites and application pools from Microsoft IIS. .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import salt libs from salt.ext.s...
saltstack/salt
salt/states/win_iis.py
deployed
python
def deployed(name, sourcepath, apppool='', hostheader='', ipaddress='*', port=80, protocol='http', preload=''): ''' Ensure the website has been deployed. .. note: This function only validates against the site name, and will return True even if the site already exists with a different confi...
Ensure the website has been deployed. .. note: This function only validates against the site name, and will return True even if the site already exists with a different configuration. It will not modify the configuration of an existing site. :param str name: The IIS site name. :pa...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_iis.py#L40-L110
null
# -*- coding: utf-8 -*- ''' Microsoft IIS site management This module provides the ability to add/remove websites and application pools from Microsoft IIS. .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import salt libs from salt.ext.s...
saltstack/salt
salt/states/win_iis.py
remove_site
python
def remove_site(name): ''' Delete a website from IIS. :param str name: The IIS site name. Usage: .. code-block:: yaml defaultwebsite-remove: win_iis.remove_site: - name: Default Web Site ''' ret = {'name': name, 'changes': {}, 'r...
Delete a website from IIS. :param str name: The IIS site name. Usage: .. code-block:: yaml defaultwebsite-remove: win_iis.remove_site: - name: Default Web Site
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_iis.py#L113-L147
null
# -*- coding: utf-8 -*- ''' Microsoft IIS site management This module provides the ability to add/remove websites and application pools from Microsoft IIS. .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import salt libs from salt.ext.s...
saltstack/salt
salt/states/win_iis.py
create_binding
python
def create_binding(name, site, hostheader='', ipaddress='*', port=80, protocol='http', sslflags=0): ''' Create an IIS binding. .. note: This function only validates against the binding ipaddress:port:hostheader combination, and will return True even if the binding already exists with a dif...
Create an IIS binding. .. note: This function only validates against the binding ipaddress:port:hostheader combination, and will return True even if the binding already exists with a different configuration. It will not modify the configuration of an existing binding. :param str site:...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_iis.py#L150-L209
[ "def _get_binding_info(hostheader='', ipaddress='*', port=80):\n '''\n Combine the host header, IP address, and TCP port into bindingInformation format.\n '''\n ret = r'{0}:{1}:{2}'.format(ipaddress, port, hostheader.replace(' ', ''))\n\n return ret\n" ]
# -*- coding: utf-8 -*- ''' Microsoft IIS site management This module provides the ability to add/remove websites and application pools from Microsoft IIS. .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import salt libs from salt.ext.s...
saltstack/salt
salt/states/win_iis.py
remove_binding
python
def remove_binding(name, site, hostheader='', ipaddress='*', port=80): ''' Remove an IIS binding. :param str site: The IIS site name. :param str hostheader: The host header of the binding. :param str ipaddress: The IP address of the binding. :param str port: The TCP port of the binding. Ex...
Remove an IIS binding. :param str site: The IIS site name. :param str hostheader: The host header of the binding. :param str ipaddress: The IP address of the binding. :param str port: The TCP port of the binding. Example of usage with only the required arguments: .. code-block:: yaml ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_iis.py#L212-L261
[ "def _get_binding_info(hostheader='', ipaddress='*', port=80):\n '''\n Combine the host header, IP address, and TCP port into bindingInformation format.\n '''\n ret = r'{0}:{1}:{2}'.format(ipaddress, port, hostheader.replace(' ', ''))\n\n return ret\n" ]
# -*- coding: utf-8 -*- ''' Microsoft IIS site management This module provides the ability to add/remove websites and application pools from Microsoft IIS. .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import salt libs from salt.ext.s...
saltstack/salt
salt/states/win_iis.py
create_cert_binding
python
def create_cert_binding(name, site, hostheader='', ipaddress='*', port=443, sslflags=0): ''' Assign a certificate to an IIS binding. .. note: The web binding that the certificate is being assigned to must already exist. :param str name: The thumbprint of the certificate. :param str site: ...
Assign a certificate to an IIS binding. .. note: The web binding that the certificate is being assigned to must already exist. :param str name: The thumbprint of the certificate. :param str site: The IIS site name. :param str hostheader: The host header of the binding. :param str ipaddres...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_iis.py#L264-L331
[ "def _get_binding_info(hostheader='', ipaddress='*', port=80):\n '''\n Combine the host header, IP address, and TCP port into bindingInformation format.\n '''\n ret = r'{0}:{1}:{2}'.format(ipaddress, port, hostheader.replace(' ', ''))\n\n return ret\n" ]
# -*- coding: utf-8 -*- ''' Microsoft IIS site management This module provides the ability to add/remove websites and application pools from Microsoft IIS. .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import salt libs from salt.ext.s...
saltstack/salt
salt/states/win_iis.py
remove_cert_binding
python
def remove_cert_binding(name, site, hostheader='', ipaddress='*', port=443): ''' Remove a certificate from an IIS binding. .. note: This function only removes the certificate from the web binding. It does not remove the web binding itself. :param str name: The thumbprint of the certif...
Remove a certificate from an IIS binding. .. note: This function only removes the certificate from the web binding. It does not remove the web binding itself. :param str name: The thumbprint of the certificate. :param str site: The IIS site name. :param str hostheader: The host header...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_iis.py#L334-L396
[ "def _get_binding_info(hostheader='', ipaddress='*', port=80):\n '''\n Combine the host header, IP address, and TCP port into bindingInformation format.\n '''\n ret = r'{0}:{1}:{2}'.format(ipaddress, port, hostheader.replace(' ', ''))\n\n return ret\n" ]
# -*- coding: utf-8 -*- ''' Microsoft IIS site management This module provides the ability to add/remove websites and application pools from Microsoft IIS. .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import salt libs from salt.ext.s...
saltstack/salt
salt/states/win_iis.py
create_apppool
python
def create_apppool(name): ''' Create an IIS application pool. .. note: This function only validates against the application pool name, and will return True even if the application pool already exists with a different configuration. It will not modify the configuration of an existin...
Create an IIS application pool. .. note: This function only validates against the application pool name, and will return True even if the application pool already exists with a different configuration. It will not modify the configuration of an existing application pool. :param str na...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_iis.py#L399-L439
null
# -*- coding: utf-8 -*- ''' Microsoft IIS site management This module provides the ability to add/remove websites and application pools from Microsoft IIS. .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import salt libs from salt.ext.s...
saltstack/salt
salt/states/win_iis.py
remove_apppool
python
def remove_apppool(name): # Remove IIS AppPool ''' Remove an IIS application pool. :param str name: The name of the IIS application pool. Usage: .. code-block:: yaml defaultapppool-remove: win_iis.remove_apppool: - name: DefaultAppPool ''' ret = {...
Remove an IIS application pool. :param str name: The name of the IIS application pool. Usage: .. code-block:: yaml defaultapppool-remove: win_iis.remove_apppool: - name: DefaultAppPool
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_iis.py#L442-L477
null
# -*- coding: utf-8 -*- ''' Microsoft IIS site management This module provides the ability to add/remove websites and application pools from Microsoft IIS. .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import salt libs from salt.ext.s...
saltstack/salt
salt/states/win_iis.py
container_setting
python
def container_setting(name, container, settings=None): ''' Set the value of the setting for an IIS container. :param str name: The name of the IIS container. :param str container: The type of IIS container. The container types are: AppPools, Sites, SslBindings :param str settings: A diction...
Set the value of the setting for an IIS container. :param str name: The name of the IIS container. :param str container: The type of IIS container. The container types are: AppPools, Sites, SslBindings :param str settings: A dictionary of the setting names and their values. Example of usage...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_iis.py#L480-L573
null
# -*- coding: utf-8 -*- ''' Microsoft IIS site management This module provides the ability to add/remove websites and application pools from Microsoft IIS. .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import salt libs from salt.ext.s...
saltstack/salt
salt/states/win_iis.py
create_app
python
def create_app(name, site, sourcepath, apppool=None): ''' Create an IIS application. .. note: This function only validates against the application name, and will return True even if the application already exists with a different configuration. It will not modify the configuration ...
Create an IIS application. .. note: This function only validates against the application name, and will return True even if the application already exists with a different configuration. It will not modify the configuration of an existing application. :param str name: The IIS applicat...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_iis.py#L576-L632
null
# -*- coding: utf-8 -*- ''' Microsoft IIS site management This module provides the ability to add/remove websites and application pools from Microsoft IIS. .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import salt libs from salt.ext.s...
saltstack/salt
salt/states/win_iis.py
remove_app
python
def remove_app(name, site): ''' Remove an IIS application. :param str name: The application name. :param str site: The IIS site name. Usage: .. code-block:: yaml site0-v1-app-remove: win_iis.remove_app: - name: v1 - site: site0 ''' ...
Remove an IIS application. :param str name: The application name. :param str site: The IIS site name. Usage: .. code-block:: yaml site0-v1-app-remove: win_iis.remove_app: - name: v1 - site: site0
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_iis.py#L635-L670
null
# -*- coding: utf-8 -*- ''' Microsoft IIS site management This module provides the ability to add/remove websites and application pools from Microsoft IIS. .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import salt libs from salt.ext.s...
saltstack/salt
salt/states/win_iis.py
create_vdir
python
def create_vdir(name, site, sourcepath, app='/'): ''' Create an IIS virtual directory. .. note: This function only validates against the virtual directory name, and will return True even if the virtual directory already exists with a different configuration. It will not modify the ...
Create an IIS virtual directory. .. note: This function only validates against the virtual directory name, and will return True even if the virtual directory already exists with a different configuration. It will not modify the configuration of an existing virtual directory. :param st...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_iis.py#L673-L730
null
# -*- coding: utf-8 -*- ''' Microsoft IIS site management This module provides the ability to add/remove websites and application pools from Microsoft IIS. .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import salt libs from salt.ext.s...
saltstack/salt
salt/states/win_iis.py
remove_vdir
python
def remove_vdir(name, site, app='/'): ''' Remove an IIS virtual directory. :param str name: The virtual directory name. :param str site: The IIS site name. :param str app: The IIS application. Example of usage with only the required arguments: .. code-block:: yaml site0-foo-vdir-...
Remove an IIS virtual directory. :param str name: The virtual directory name. :param str site: The IIS site name. :param str app: The IIS application. Example of usage with only the required arguments: .. code-block:: yaml site0-foo-vdir-remove: win_iis.remove_vdir: ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_iis.py#L733-L780
null
# -*- coding: utf-8 -*- ''' Microsoft IIS site management This module provides the ability to add/remove websites and application pools from Microsoft IIS. .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import salt libs from salt.ext.s...
saltstack/salt
salt/states/win_iis.py
set_app
python
def set_app(name, site, settings=None): # pylint: disable=anomalous-backslash-in-string ''' .. versionadded:: 2017.7.0 Set the value of the setting for an IIS web application. .. note:: This function only configures existing app. Params are case sensitive. :param str name: The IIS app...
.. versionadded:: 2017.7.0 Set the value of the setting for an IIS web application. .. note:: This function only configures existing app. Params are case sensitive. :param str name: The IIS application. :param str site: The IIS site name. :param str settings: A dictionary of the setting n...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_iis.py#L783-L871
null
# -*- coding: utf-8 -*- ''' Microsoft IIS site management This module provides the ability to add/remove websites and application pools from Microsoft IIS. .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import salt libs from salt.ext.s...
saltstack/salt
salt/states/win_iis.py
webconfiguration_settings
python
def webconfiguration_settings(name, location='', settings=None): r''' Set the value of webconfiguration settings. :param str name: The name of the IIS PSPath containing the settings. Possible PSPaths are : MACHINE, MACHINE/WEBROOT, IIS:\, IIS:\Sites\sitename, ... :param str location: Th...
r''' Set the value of webconfiguration settings. :param str name: The name of the IIS PSPath containing the settings. Possible PSPaths are : MACHINE, MACHINE/WEBROOT, IIS:\, IIS:\Sites\sitename, ... :param str location: The location of the settings. :param dict settings: Dictionaries of...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_iis.py#L874-L1006
null
# -*- coding: utf-8 -*- ''' Microsoft IIS site management This module provides the ability to add/remove websites and application pools from Microsoft IIS. .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import salt libs from salt.ext.s...