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/modules/service.py
status
python
def status(name, sig=None): ''' Return the status for a service. If the name contains globbing, a dict mapping service name to PID or empty string is returned. .. versionchanged:: 2018.3.0 The service name can now be a glob (e.g. ``salt*``) Args: name (str): The name of the ser...
Return the status for a service. If the name contains globbing, a dict mapping service name to PID or empty string is returned. .. versionchanged:: 2018.3.0 The service name can now be a glob (e.g. ``salt*``) Args: name (str): The name of the service to check sig (str): Signatu...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/service.py#L125-L161
[ "def get_all():\n '''\n Return a list of all available services\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' service.get_all\n '''\n if not os.path.isdir(_GRAINMAP.get(__grains__.get('os'), '/etc/init.d')):\n return []\n return sorted(os.listdir(_GRAINMAP.get(__grains__....
# -*- coding: utf-8 -*- ''' If Salt's OS detection does not identify a different virtual service module, the minion will fall back to using this basic module, which simply wraps sysvinit scripts. ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import os import fnmatch ...
saltstack/salt
salt/modules/service.py
get_all
python
def get_all(): ''' Return a list of all available services CLI Example: .. code-block:: bash salt '*' service.get_all ''' if not os.path.isdir(_GRAINMAP.get(__grains__.get('os'), '/etc/init.d')): return [] return sorted(os.listdir(_GRAINMAP.get(__grains__.get('os'), '/etc/...
Return a list of all available services CLI Example: .. code-block:: bash salt '*' service.get_all
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/service.py#L207-L219
null
# -*- coding: utf-8 -*- ''' If Salt's OS detection does not identify a different virtual service module, the minion will fall back to using this basic module, which simply wraps sysvinit scripts. ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import os import fnmatch ...
saltstack/salt
salt/pillar/neutron.py
_auth
python
def _auth(profile=None): ''' Set up neutron credentials ''' credentials = __salt__['config.option'](profile) kwargs = { 'username': credentials['keystone.user'], 'password': credentials['keystone.password'], 'tenant_name': credentials['keystone.tenant'], 'auth_url': c...
Set up neutron credentials
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/neutron.py#L68-L82
null
# -*- coding: utf-8 -*- ''' Use Openstack Neutron data as a Pillar source. Will list all networks listed inside of Neutron, to all minions. .. versionadded:: 2015.5.1 :depends: - python-neutronclient A keystone profile must be used for the pillar to work (no generic keystone configuration here). For example: .. co...
saltstack/salt
salt/pillar/neutron.py
ext_pillar
python
def ext_pillar(minion_id, pillar, # pylint: disable=W0613 conf): ''' Check neutron for all data ''' comps = conf.split() profile = None if comps[0]: profile = comps[0] conn = _auth(profile) ret = {} networks = conn.list_networks() for netw...
Check neutron for all data
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/neutron.py#L85-L105
[ "def _auth(profile=None):\n '''\n Set up neutron credentials\n '''\n credentials = __salt__['config.option'](profile)\n kwargs = {\n 'username': credentials['keystone.user'],\n 'password': credentials['keystone.password'],\n 'tenant_name': credentials['keystone.tenant'],\n ...
# -*- coding: utf-8 -*- ''' Use Openstack Neutron data as a Pillar source. Will list all networks listed inside of Neutron, to all minions. .. versionadded:: 2015.5.1 :depends: - python-neutronclient A keystone profile must be used for the pillar to work (no generic keystone configuration here). For example: .. co...
saltstack/salt
salt/states/mssql_database.py
present
python
def present(name, containment='NONE', options=None, **kwargs): ''' Ensure that the named database is present with the specified options name The name of the database to manage containment Defaults to NONE options Can be a list of strings, a dictionary, or a list of dictionar...
Ensure that the named database is present with the specified options name The name of the database to manage containment Defaults to NONE options Can be a list of strings, a dictionary, or a list of dictionaries
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mssql_database.py#L36-L67
[ "def _normalize_options(options):\n if type(options) in [dict, collections.OrderedDict]:\n return ['{0}={1}'.format(k, v) for k, v in options.items()]\n if type(options) is list and (not options or type(options[0]) is str):\n return options\n # Invalid options\n if type(options) is not lis...
# -*- coding: utf-8 -*- ''' Management of Microsoft SQLServer Databases =========================================== The mssql_database module is used to create and manage SQL Server Databases .. code-block:: yaml yolo: mssql_database.present ''' from __future__ import absolute_import, print_function, unico...
saltstack/salt
salt/fileclient.py
get_file_client
python
def get_file_client(opts, pillar=False): ''' Read in the ``file_client`` option and return the correct type of file server ''' client = opts.get('file_client', 'remote') if pillar and client == 'local': client = 'pillar' return { 'remote': RemoteClient, 'local': FSCli...
Read in the ``file_client`` option and return the correct type of file server
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L52-L64
null
# -*- coding: utf-8 -*- ''' Classes that manage file clients ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import contextlib import errno import logging import os import string import shutil import ftplib from tornado.httputil import parse_response_start_line, HTTPHe...
saltstack/salt
salt/fileclient.py
decode_dict_keys_to_str
python
def decode_dict_keys_to_str(src): ''' Convert top level keys from bytes to strings if possible. This is necessary because Python 3 makes a distinction between these types. ''' if not six.PY3 or not isinstance(src, dict): return src output = {} for key, val in six.iteritems(src):...
Convert top level keys from bytes to strings if possible. This is necessary because Python 3 makes a distinction between these types.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L67-L84
null
# -*- coding: utf-8 -*- ''' Classes that manage file clients ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import contextlib import errno import logging import os import string import shutil import ftplib from tornado.httputil import parse_response_start_line, HTTPHe...
saltstack/salt
salt/fileclient.py
Client._check_proto
python
def _check_proto(self, path): ''' Make sure that this path is intended for the salt master and trim it ''' if not path.startswith('salt://'): raise MinionError('Unsupported path: {0}'.format(path)) file_path, saltenv = salt.utils.url.parse(path) return file_pa...
Make sure that this path is intended for the salt master and trim it
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L109-L116
[ "def parse(url):\n '''\n Parse a salt:// URL; return the path and a possible saltenv query.\n '''\n if not url.startswith('salt://'):\n return url, None\n\n # urlparse will split on valid filename chars such as '?' and '&'\n resource = url.split('salt://', 1)[-1]\n\n if '?env=' in resour...
class Client(object): ''' Base class for Salt file interactions ''' def __init__(self, opts): self.opts = opts self.utils = salt.loader.utils(self.opts) self.serial = salt.payload.Serial(self.opts) # Add __setstate__ and __getstate__ so that the object may be # deep copi...
saltstack/salt
salt/fileclient.py
Client._file_local_list
python
def _file_local_list(self, dest): ''' Helper util to return a list of files in a directory ''' if os.path.isdir(dest): destdir = dest else: destdir = os.path.dirname(dest) filelist = set() for root, dirs, files in salt.utils.path.os_walk(...
Helper util to return a list of files in a directory
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L118-L134
[ "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...
class Client(object): ''' Base class for Salt file interactions ''' def __init__(self, opts): self.opts = opts self.utils = salt.loader.utils(self.opts) self.serial = salt.payload.Serial(self.opts) # Add __setstate__ and __getstate__ so that the object may be # deep copi...
saltstack/salt
salt/fileclient.py
Client._cache_loc
python
def _cache_loc(self, path, saltenv='base', cachedir=None): ''' Return the local location to cache the file, cache dirs will be made ''' cachedir = self.get_cachedir(cachedir) dest = salt.utils.path.join(cachedir, 'files', ...
Return the local location to cache the file, cache dirs will be made
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L137-L160
null
class Client(object): ''' Base class for Salt file interactions ''' def __init__(self, opts): self.opts = opts self.utils = salt.loader.utils(self.opts) self.serial = salt.payload.Serial(self.opts) # Add __setstate__ and __getstate__ so that the object may be # deep copi...
saltstack/salt
salt/fileclient.py
Client.get_file
python
def get_file(self, path, dest='', makedirs=False, saltenv='base', gzip=None, cachedir=None): ''' Copies a file from the local files or master depending on implementation ''' rais...
Copies a file from the local files or master depending on implementation
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L169-L180
null
class Client(object): ''' Base class for Salt file interactions ''' def __init__(self, opts): self.opts = opts self.utils = salt.loader.utils(self.opts) self.serial = salt.payload.Serial(self.opts) # Add __setstate__ and __getstate__ so that the object may be # deep copi...
saltstack/salt
salt/fileclient.py
Client.cache_file
python
def cache_file(self, path, saltenv='base', cachedir=None, source_hash=None): ''' Pull a file down from the file server and store it in the minion file cache ''' return self.get_url( path, '', True, saltenv, cachedir=cachedir, source_hash=source_hash)
Pull a file down from the file server and store it in the minion file cache
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L188-L194
[ "def get_url(self, url, dest, makedirs=False, saltenv='base',\n no_cache=False, cachedir=None, source_hash=None):\n '''\n Get a single file from a URL.\n '''\n url_data = urlparse(url)\n url_scheme = url_data.scheme\n url_path = os.path.join(\n url_data.netloc, url_data.path)...
class Client(object): ''' Base class for Salt file interactions ''' def __init__(self, opts): self.opts = opts self.utils = salt.loader.utils(self.opts) self.serial = salt.payload.Serial(self.opts) # Add __setstate__ and __getstate__ so that the object may be # deep copi...
saltstack/salt
salt/fileclient.py
Client.cache_files
python
def cache_files(self, paths, saltenv='base', cachedir=None): ''' Download a list of files stored on the master and put them in the minion file cache ''' ret = [] if isinstance(paths, six.string_types): paths = paths.split(',') for path in paths: ...
Download a list of files stored on the master and put them in the minion file cache
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L196-L206
[ "def cache_file(self, path, saltenv='base', cachedir=None, source_hash=None):\n '''\n Pull a file down from the file server and store it in the minion\n file cache\n '''\n return self.get_url(\n path, '', True, saltenv, cachedir=cachedir, source_hash=source_hash)\n" ]
class Client(object): ''' Base class for Salt file interactions ''' def __init__(self, opts): self.opts = opts self.utils = salt.loader.utils(self.opts) self.serial = salt.payload.Serial(self.opts) # Add __setstate__ and __getstate__ so that the object may be # deep copi...
saltstack/salt
salt/fileclient.py
Client.cache_master
python
def cache_master(self, saltenv='base', cachedir=None): ''' Download and cache all files on a master in a specified environment ''' ret = [] for path in self.file_list(saltenv): ret.append( self.cache_file( salt.utils.url.create(path...
Download and cache all files on a master in a specified environment
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L208-L218
[ "def create(path, saltenv=None):\n '''\n join `path` and `saltenv` into a 'salt://' URL.\n '''\n if salt.utils.platform.is_windows():\n path = salt.utils.path.sanitize_win_path(path)\n path = salt.utils.data.decode(path)\n\n query = 'saltenv={0}'.format(saltenv) if saltenv else ''\n url ...
class Client(object): ''' Base class for Salt file interactions ''' def __init__(self, opts): self.opts = opts self.utils = salt.loader.utils(self.opts) self.serial = salt.payload.Serial(self.opts) # Add __setstate__ and __getstate__ so that the object may be # deep copi...
saltstack/salt
salt/fileclient.py
Client.cache_dir
python
def cache_dir(self, path, saltenv='base', include_empty=False, include_pat=None, exclude_pat=None, cachedir=None): ''' Download all of the files in a subdir of the master ''' ret = [] path = self._check_proto(salt.utils.data.decode(path)) # We want to m...
Download all of the files in a subdir of the master
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L220-L269
[ "def decode(data, encoding=None, errors='strict', keep=False,\n normalize=False, preserve_dict_class=False, preserve_tuples=False,\n to_str=False):\n '''\n Generic function which will decode whichever type is passed, if necessary.\n Optionally use to_str=True to ensure strings are str t...
class Client(object): ''' Base class for Salt file interactions ''' def __init__(self, opts): self.opts = opts self.utils = salt.loader.utils(self.opts) self.serial = salt.payload.Serial(self.opts) # Add __setstate__ and __getstate__ so that the object may be # deep copi...
saltstack/salt
salt/fileclient.py
Client.cache_local_file
python
def cache_local_file(self, path, **kwargs): ''' Cache a local file on the minion in the localfiles cache ''' dest = os.path.join(self.opts['cachedir'], 'localfiles', path.lstrip('/')) destdir = os.path.dirname(dest) if not os.path.isdir(destdi...
Cache a local file on the minion in the localfiles cache
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L271-L283
null
class Client(object): ''' Base class for Salt file interactions ''' def __init__(self, opts): self.opts = opts self.utils = salt.loader.utils(self.opts) self.serial = salt.payload.Serial(self.opts) # Add __setstate__ and __getstate__ so that the object may be # deep copi...
saltstack/salt
salt/fileclient.py
Client.file_local_list
python
def file_local_list(self, saltenv='base'): ''' List files in the local minion files and localfiles caches ''' filesdest = os.path.join(self.opts['cachedir'], 'files', saltenv) localfilesdest = os.path.join(self.opts['cachedir'], 'localfiles') fdest = self._file_local_lis...
List files in the local minion files and localfiles caches
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L285-L294
[ "def _file_local_list(self, dest):\n '''\n Helper util to return a list of files in a directory\n '''\n if os.path.isdir(dest):\n destdir = dest\n else:\n destdir = os.path.dirname(dest)\n\n filelist = set()\n\n for root, dirs, files in salt.utils.path.os_walk(destdir, followlinks...
class Client(object): ''' Base class for Salt file interactions ''' def __init__(self, opts): self.opts = opts self.utils = salt.loader.utils(self.opts) self.serial = salt.payload.Serial(self.opts) # Add __setstate__ and __getstate__ so that the object may be # deep copi...
saltstack/salt
salt/fileclient.py
Client.is_cached
python
def is_cached(self, path, saltenv='base', cachedir=None): ''' Returns the full path to a file if it is cached locally on the minion otherwise returns a blank string ''' if path.startswith('salt://'): path, senv = salt.utils.url.parse(path) if senv: ...
Returns the full path to a file if it is cached locally on the minion otherwise returns a blank string
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L314-L342
[ "def parse(url):\n '''\n Parse a salt:// URL; return the path and a possible saltenv query.\n '''\n if not url.startswith('salt://'):\n return url, None\n\n # urlparse will split on valid filename chars such as '?' and '&'\n resource = url.split('salt://', 1)[-1]\n\n if '?env=' in resour...
class Client(object): ''' Base class for Salt file interactions ''' def __init__(self, opts): self.opts = opts self.utils = salt.loader.utils(self.opts) self.serial = salt.payload.Serial(self.opts) # Add __setstate__ and __getstate__ so that the object may be # deep copi...
saltstack/salt
salt/fileclient.py
Client.cache_dest
python
def cache_dest(self, url, saltenv='base', cachedir=None): ''' Return the expected cache location for the specified URL and environment. ''' proto = urlparse(url).scheme if proto == '': # Local file path return url if proto == 'salt': ...
Return the expected cache location for the specified URL and environment.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L344-L365
[ "def parse(url):\n '''\n Parse a salt:// URL; return the path and a possible saltenv query.\n '''\n if not url.startswith('salt://'):\n return url, None\n\n # urlparse will split on valid filename chars such as '?' and '&'\n resource = url.split('salt://', 1)[-1]\n\n if '?env=' in resour...
class Client(object): ''' Base class for Salt file interactions ''' def __init__(self, opts): self.opts = opts self.utils = salt.loader.utils(self.opts) self.serial = salt.payload.Serial(self.opts) # Add __setstate__ and __getstate__ so that the object may be # deep copi...
saltstack/salt
salt/fileclient.py
Client.list_states
python
def list_states(self, saltenv): ''' Return a list of all available sls modules on the master for a given environment ''' states = set() for path in self.file_list(saltenv): if salt.utils.platform.is_windows(): path = path.replace('\\', '/') ...
Return a list of all available sls modules on the master for a given environment
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L367-L382
[ "def file_list(self, saltenv='base', prefix=''):\n '''\n This function must be overwritten\n '''\n return []\n" ]
class Client(object): ''' Base class for Salt file interactions ''' def __init__(self, opts): self.opts = opts self.utils = salt.loader.utils(self.opts) self.serial = salt.payload.Serial(self.opts) # Add __setstate__ and __getstate__ so that the object may be # deep copi...
saltstack/salt
salt/fileclient.py
Client.get_state
python
def get_state(self, sls, saltenv, cachedir=None): ''' Get a state file from the master and store it in the local minion cache; return the location of the file ''' if '.' in sls: sls = sls.replace('.', '/') sls_url = salt.utils.url.create(sls + '.sls') ...
Get a state file from the master and store it in the local minion cache; return the location of the file
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L384-L397
[ "def create(path, saltenv=None):\n '''\n join `path` and `saltenv` into a 'salt://' URL.\n '''\n if salt.utils.platform.is_windows():\n path = salt.utils.path.sanitize_win_path(path)\n path = salt.utils.data.decode(path)\n\n query = 'saltenv={0}'.format(saltenv) if saltenv else ''\n url ...
class Client(object): ''' Base class for Salt file interactions ''' def __init__(self, opts): self.opts = opts self.utils = salt.loader.utils(self.opts) self.serial = salt.payload.Serial(self.opts) # Add __setstate__ and __getstate__ so that the object may be # deep copi...
saltstack/salt
salt/fileclient.py
Client.get_dir
python
def get_dir(self, path, dest='', saltenv='base', gzip=None, cachedir=None): ''' Get a directory recursively from the salt-master ''' ret = [] # Strip trailing slash path = self._check_proto(path).rstrip('/') # Break up the path into a list containi...
Get a directory recursively from the salt-master
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L399-L456
[ "def create(path, saltenv=None):\n '''\n join `path` and `saltenv` into a 'salt://' URL.\n '''\n if salt.utils.platform.is_windows():\n path = salt.utils.path.sanitize_win_path(path)\n path = salt.utils.data.decode(path)\n\n query = 'saltenv={0}'.format(saltenv) if saltenv else ''\n url ...
class Client(object): ''' Base class for Salt file interactions ''' def __init__(self, opts): self.opts = opts self.utils = salt.loader.utils(self.opts) self.serial = salt.payload.Serial(self.opts) # Add __setstate__ and __getstate__ so that the object may be # deep copi...
saltstack/salt
salt/fileclient.py
Client.get_url
python
def get_url(self, url, dest, makedirs=False, saltenv='base', no_cache=False, cachedir=None, source_hash=None): ''' Get a single file from a URL. ''' url_data = urlparse(url) url_scheme = url_data.scheme url_path = os.path.join( url_data.net...
Get a single file from a URL.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L458-L740
[ "def rename(src, dst):\n '''\n On Windows, os.rename() will fail with a WindowsError exception if a file\n exists at the destination path. This function checks for this error and if\n found, it deletes the destination path first.\n '''\n try:\n os.rename(src, dst)\n except OSError as exc...
class Client(object): ''' Base class for Salt file interactions ''' def __init__(self, opts): self.opts = opts self.utils = salt.loader.utils(self.opts) self.serial = salt.payload.Serial(self.opts) # Add __setstate__ and __getstate__ so that the object may be # deep copi...
saltstack/salt
salt/fileclient.py
Client.get_template
python
def get_template( self, url, dest, template='jinja', makedirs=False, saltenv='base', cachedir=None, **kwargs): ''' Cache a file then process it as a template ''' if 'env' in kwargs: ...
Cache a file then process it as a template
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L742-L792
[ "def cache_file(self, path, saltenv='base', cachedir=None, source_hash=None):\n '''\n Pull a file down from the file server and store it in the minion\n file cache\n '''\n return self.get_url(\n path, '', True, saltenv, cachedir=cachedir, source_hash=source_hash)\n", "def _extrn_path(self, u...
class Client(object): ''' Base class for Salt file interactions ''' def __init__(self, opts): self.opts = opts self.utils = salt.loader.utils(self.opts) self.serial = salt.payload.Serial(self.opts) # Add __setstate__ and __getstate__ so that the object may be # deep copi...
saltstack/salt
salt/fileclient.py
Client._extrn_path
python
def _extrn_path(self, url, saltenv, cachedir=None): ''' Return the extrn_filepath for a given url ''' url_data = urlparse(url) if salt.utils.platform.is_windows(): netloc = salt.utils.path.sanitize_win_path(url_data.netloc) else: netloc = url_data....
Return the extrn_filepath for a given url
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L794-L826
null
class Client(object): ''' Base class for Salt file interactions ''' def __init__(self, opts): self.opts = opts self.utils = salt.loader.utils(self.opts) self.serial = salt.payload.Serial(self.opts) # Add __setstate__ and __getstate__ so that the object may be # deep copi...
saltstack/salt
salt/fileclient.py
PillarClient._find_file
python
def _find_file(self, path, saltenv='base'): ''' Locate the file path ''' fnd = {'path': '', 'rel': ''} if salt.utils.url.is_escaped(path): # The path arguments are escaped path = salt.utils.url.unescape(path) for root in self.opts['...
Locate the file path
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L833-L849
[ "def is_escaped(url):\n '''\n test whether `url` is escaped with `|`\n '''\n scheme = urlparse(url).scheme\n if not scheme:\n return url.startswith('|')\n elif scheme == 'salt':\n path, saltenv = parse(url)\n if salt.utils.platform.is_windows() and '|' in url:\n ret...
class PillarClient(Client): ''' Used by pillar to handle fileclient requests ''' def get_file(self, path, dest='', makedirs=False, saltenv='base', gzip=None, cachedir=None): ''' Copies...
saltstack/salt
salt/fileclient.py
PillarClient.get_file
python
def get_file(self, path, dest='', makedirs=False, saltenv='base', gzip=None, cachedir=None): ''' Copies a file from the local files directory into :param:`dest` gzip compression settings are ign...
Copies a file from the local files directory into :param:`dest` gzip compression settings are ignored for local files
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L851-L868
[ "def _check_proto(self, path):\n '''\n Make sure that this path is intended for the salt master and trim it\n '''\n if not path.startswith('salt://'):\n raise MinionError('Unsupported path: {0}'.format(path))\n file_path, saltenv = salt.utils.url.parse(path)\n return file_path\n", "def _f...
class PillarClient(Client): ''' Used by pillar to handle fileclient requests ''' def _find_file(self, path, saltenv='base'): ''' Locate the file path ''' fnd = {'path': '', 'rel': ''} if salt.utils.url.is_escaped(path): # The path argum...
saltstack/salt
salt/fileclient.py
PillarClient.file_list
python
def file_list(self, saltenv='base', prefix=''): ''' Return a list of files in the given environment with optional relative prefix path to limit directory traversal ''' ret = [] prefix = prefix.strip('/') for path in self.opts['pillar_roots'].get(saltenv, []): ...
Return a list of files in the given environment with optional relative prefix path to limit directory traversal
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L870-L886
[ "def decode(data, encoding=None, errors='strict', keep=False,\n normalize=False, preserve_dict_class=False, preserve_tuples=False,\n to_str=False):\n '''\n Generic function which will decode whichever type is passed, if necessary.\n Optionally use to_str=True to ensure strings are str t...
class PillarClient(Client): ''' Used by pillar to handle fileclient requests ''' def _find_file(self, path, saltenv='base'): ''' Locate the file path ''' fnd = {'path': '', 'rel': ''} if salt.utils.url.is_escaped(path): # The path argum...
saltstack/salt
salt/fileclient.py
PillarClient.__get_file_path
python
def __get_file_path(self, path, saltenv='base'): ''' Return either a file path or the result of a remote find_file call. ''' try: path = self._check_proto(path) except MinionError as err: # Local file path if not os.path.isfile(path): ...
Return either a file path or the result of a remote find_file call.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L919-L935
[ "def _check_proto(self, path):\n '''\n Make sure that this path is intended for the salt master and trim it\n '''\n if not path.startswith('salt://'):\n raise MinionError('Unsupported path: {0}'.format(path))\n file_path, saltenv = salt.utils.url.parse(path)\n return file_path\n", "def _f...
class PillarClient(Client): ''' Used by pillar to handle fileclient requests ''' def _find_file(self, path, saltenv='base'): ''' Locate the file path ''' fnd = {'path': '', 'rel': ''} if salt.utils.url.is_escaped(path): # The path argum...
saltstack/salt
salt/fileclient.py
PillarClient.hash_file
python
def hash_file(self, path, saltenv='base'): ''' Return the hash of a file, to get the hash of a file in the pillar_roots prepend the path with salt://<file on server> otherwise, prepend the file with / for a local file. ''' ret = {} fnd = self.__get_file_path(path,...
Return the hash of a file, to get the hash of a file in the pillar_roots prepend the path with salt://<file on server> otherwise, prepend the file with / for a local file.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L937-L958
[ "def __get_file_path(self, path, saltenv='base'):\n '''\n Return either a file path or the result of a remote find_file call.\n '''\n try:\n path = self._check_proto(path)\n except MinionError as err:\n # Local file path\n if not os.path.isfile(path):\n log.warning(\n ...
class PillarClient(Client): ''' Used by pillar to handle fileclient requests ''' def _find_file(self, path, saltenv='base'): ''' Locate the file path ''' fnd = {'path': '', 'rel': ''} if salt.utils.url.is_escaped(path): # The path argum...
saltstack/salt
salt/fileclient.py
PillarClient.hash_and_stat_file
python
def hash_and_stat_file(self, path, saltenv='base'): ''' Return the hash of a file, to get the hash of a file in the pillar_roots prepend the path with salt://<file on server> otherwise, prepend the file with / for a local file. Additionally, return the stat result of the file, o...
Return the hash of a file, to get the hash of a file in the pillar_roots prepend the path with salt://<file on server> otherwise, prepend the file with / for a local file. Additionally, return the stat result of the file, or None if no stat results were found.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L960-L989
[ "def __get_file_path(self, path, saltenv='base'):\n '''\n Return either a file path or the result of a remote find_file call.\n '''\n try:\n path = self._check_proto(path)\n except MinionError as err:\n # Local file path\n if not os.path.isfile(path):\n log.warning(\n ...
class PillarClient(Client): ''' Used by pillar to handle fileclient requests ''' def _find_file(self, path, saltenv='base'): ''' Locate the file path ''' fnd = {'path': '', 'rel': ''} if salt.utils.url.is_escaped(path): # The path argum...
saltstack/salt
salt/fileclient.py
PillarClient.envs
python
def envs(self): ''' Return the available environments ''' ret = [] for saltenv in self.opts['pillar_roots']: ret.append(saltenv) return ret
Return the available environments
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L1003-L1010
null
class PillarClient(Client): ''' Used by pillar to handle fileclient requests ''' def _find_file(self, path, saltenv='base'): ''' Locate the file path ''' fnd = {'path': '', 'rel': ''} if salt.utils.url.is_escaped(path): # The path argum...
saltstack/salt
salt/fileclient.py
RemoteClient._refresh_channel
python
def _refresh_channel(self): ''' Reset the channel, in the event of an interruption ''' self.channel = salt.transport.client.ReqChannel.factory(self.opts) return self.channel
Reset the channel, in the event of an interruption
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L1041-L1046
null
class RemoteClient(Client): ''' Interact with the salt master file server. ''' def __init__(self, opts): Client.__init__(self, opts) self._closing = False self.channel = salt.transport.client.ReqChannel.factory(self.opts) if hasattr(self.channel, 'auth'): self...
saltstack/salt
salt/fileclient.py
RemoteClient.get_file
python
def get_file(self, path, dest='', makedirs=False, saltenv='base', gzip=None, cachedir=None): ''' Get a single file from the salt-master path must be a salt server location, aka, salt://path/to/f...
Get a single file from the salt-master path must be a salt server location, aka, salt://path/to/file, if dest is omitted, then the downloaded file will be placed in the minion cache
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L1064-L1262
[ "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 ...
class RemoteClient(Client): ''' Interact with the salt master file server. ''' def __init__(self, opts): Client.__init__(self, opts) self._closing = False self.channel = salt.transport.client.ReqChannel.factory(self.opts) if hasattr(self.channel, 'auth'): self...
saltstack/salt
salt/fileclient.py
RemoteClient.dir_list
python
def dir_list(self, saltenv='base', prefix=''): ''' List the dirs on the master ''' load = {'saltenv': saltenv, 'prefix': prefix, 'cmd': '_dir_list'} return salt.utils.data.decode(self.channel.send(load)) if six.PY2 \ else self.channel.s...
List the dirs on the master
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L1284-L1292
[ "def decode(data, encoding=None, errors='strict', keep=False,\n normalize=False, preserve_dict_class=False, preserve_tuples=False,\n to_str=False):\n '''\n Generic function which will decode whichever type is passed, if necessary.\n Optionally use to_str=True to ensure strings are str t...
class RemoteClient(Client): ''' Interact with the salt master file server. ''' def __init__(self, opts): Client.__init__(self, opts) self._closing = False self.channel = salt.transport.client.ReqChannel.factory(self.opts) if hasattr(self.channel, 'auth'): self...
saltstack/salt
salt/fileclient.py
RemoteClient.__hash_and_stat_file
python
def __hash_and_stat_file(self, path, saltenv='base'): ''' Common code for hashing and stating files ''' try: path = self._check_proto(path) except MinionError as err: if not os.path.isfile(path): log.warning( 'specified ...
Common code for hashing and stating files
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L1304-L1326
[ "def _check_proto(self, path):\n '''\n Make sure that this path is intended for the salt master and trim it\n '''\n if not path.startswith('salt://'):\n raise MinionError('Unsupported path: {0}'.format(path))\n file_path, saltenv = salt.utils.url.parse(path)\n return file_path\n" ]
class RemoteClient(Client): ''' Interact with the salt master file server. ''' def __init__(self, opts): Client.__init__(self, opts) self._closing = False self.channel = salt.transport.client.ReqChannel.factory(self.opts) if hasattr(self.channel, 'auth'): self...
saltstack/salt
salt/fileclient.py
RemoteClient.hash_and_stat_file
python
def hash_and_stat_file(self, path, saltenv='base'): ''' The same as hash_file, but also return the file's mode, or None if no mode data is present. ''' hash_result = self.hash_file(path, saltenv) try: path = self._check_proto(path) except MinionError a...
The same as hash_file, but also return the file's mode, or None if no mode data is present.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L1336-L1360
[ "def _check_proto(self, path):\n '''\n Make sure that this path is intended for the salt master and trim it\n '''\n if not path.startswith('salt://'):\n raise MinionError('Unsupported path: {0}'.format(path))\n file_path, saltenv = salt.utils.url.parse(path)\n return file_path\n", "def ha...
class RemoteClient(Client): ''' Interact with the salt master file server. ''' def __init__(self, opts): Client.__init__(self, opts) self._closing = False self.channel = salt.transport.client.ReqChannel.factory(self.opts) if hasattr(self.channel, 'auth'): self...
saltstack/salt
salt/fileclient.py
RemoteClient.list_env
python
def list_env(self, saltenv='base'): ''' Return a list of the files in the file server's specified environment ''' load = {'saltenv': saltenv, 'cmd': '_file_list'} return salt.utils.data.decode(self.channel.send(load)) if six.PY2 \ else self.channel.sen...
Return a list of the files in the file server's specified environment
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L1362-L1369
[ "def decode(data, encoding=None, errors='strict', keep=False,\n normalize=False, preserve_dict_class=False, preserve_tuples=False,\n to_str=False):\n '''\n Generic function which will decode whichever type is passed, if necessary.\n Optionally use to_str=True to ensure strings are str t...
class RemoteClient(Client): ''' Interact with the salt master file server. ''' def __init__(self, opts): Client.__init__(self, opts) self._closing = False self.channel = salt.transport.client.ReqChannel.factory(self.opts) if hasattr(self.channel, 'auth'): self...
saltstack/salt
salt/fileclient.py
RemoteClient.envs
python
def envs(self): ''' Return a list of available environments ''' load = {'cmd': '_file_envs'} return salt.utils.data.decode(self.channel.send(load)) if six.PY2 \ else self.channel.send(load)
Return a list of available environments
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L1371-L1377
[ "def decode(data, encoding=None, errors='strict', keep=False,\n normalize=False, preserve_dict_class=False, preserve_tuples=False,\n to_str=False):\n '''\n Generic function which will decode whichever type is passed, if necessary.\n Optionally use to_str=True to ensure strings are str t...
class RemoteClient(Client): ''' Interact with the salt master file server. ''' def __init__(self, opts): Client.__init__(self, opts) self._closing = False self.channel = salt.transport.client.ReqChannel.factory(self.opts) if hasattr(self.channel, 'auth'): self...
saltstack/salt
salt/fileclient.py
RemoteClient.master_tops
python
def master_tops(self): ''' Return the metadata derived from the master_tops system ''' log.debug( 'The _ext_nodes master function has been renamed to _master_tops. ' 'To ensure compatibility when using older Salt masters we will ' 'continue to invoke t...
Return the metadata derived from the master_tops system
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L1387-L1405
[ "def decode(data, encoding=None, errors='strict', keep=False,\n normalize=False, preserve_dict_class=False, preserve_tuples=False,\n to_str=False):\n '''\n Generic function which will decode whichever type is passed, if necessary.\n Optionally use to_str=True to ensure strings are str t...
class RemoteClient(Client): ''' Interact with the salt master file server. ''' def __init__(self, opts): Client.__init__(self, opts) self._closing = False self.channel = salt.transport.client.ReqChannel.factory(self.opts) if hasattr(self.channel, 'auth'): self...
saltstack/salt
salt/states/saltsupport.py
SaltSupportState.check_destination
python
def check_destination(self, location, group): ''' Check destination for the archives. :return: ''' # Pre-create destination, since rsync will # put one file named as group try: destination = os.path.join(location, group) if os.path.exists(d...
Check destination for the archives. :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/saltsupport.py#L96-L113
null
class SaltSupportState(object): ''' Salt-support. ''' EXPORTED = ['collected', 'taken'] def get_kwargs(self, data): kwargs = {} for keyset in data: kwargs.update(keyset) return kwargs def __call__(self, state): ''' Call support. :pa...
saltstack/salt
salt/states/saltsupport.py
SaltSupportState.collected
python
def collected(self, group, filename=None, host=None, location=None, move=True, all=True): ''' Sync archives to a central place. :param name: :param group: :param filename: :param host: :param location: :param move: :param all: :return: ...
Sync archives to a central place. :param name: :param group: :param filename: :param host: :param location: :param move: :param all: :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/saltsupport.py#L115-L139
[ "def check_destination(self, location, group):\n '''\n Check destination for the archives.\n :return:\n '''\n # Pre-create destination, since rsync will\n # put one file named as group\n try:\n destination = os.path.join(location, group)\n if os.path.exists(destination) and not os...
class SaltSupportState(object): ''' Salt-support. ''' EXPORTED = ['collected', 'taken'] def get_kwargs(self, data): kwargs = {} for keyset in data: kwargs.update(keyset) return kwargs def __call__(self, state): ''' Call support. :pa...
saltstack/salt
salt/states/saltsupport.py
SaltSupportState.taken
python
def taken(self, profile='default', pillar=None, archive=None, output='nested'): ''' Takes minion support config data. :param profile: :param pillar: :param archive: :param output: :return: ''' ret = { 'name': 'support.taken', ...
Takes minion support config data. :param profile: :param pillar: :param archive: :param output: :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/saltsupport.py#L141-L168
null
class SaltSupportState(object): ''' Salt-support. ''' EXPORTED = ['collected', 'taken'] def get_kwargs(self, data): kwargs = {} for keyset in data: kwargs.update(keyset) return kwargs def __call__(self, state): ''' Call support. :pa...
saltstack/salt
salt/modules/vmctl.py
create_disk
python
def create_disk(name, size): ''' Create a VMM disk with the specified `name` and `size`. size: Size in megabytes, or use a specifier such as M, G, T. CLI Example: .. code-block:: bash salt '*' vmctl.create_disk /path/to/disk.img size=10G ''' ret = False cmd = 'vmctl c...
Create a VMM disk with the specified `name` and `size`. size: Size in megabytes, or use a specifier such as M, G, T. CLI Example: .. code-block:: bash salt '*' vmctl.create_disk /path/to/disk.img size=10G
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vmctl.py#L50-L78
null
# -*- coding: utf-8 -*- ''' Manage vms running on the OpenBSD VMM hypervisor using vmctl(8). .. versionadded:: 2019.2.0 :codeauthor: ``Jasper Lievisse Adriaanse <jasper@openbsd.org>`` .. note:: This module requires the `vmd` service to be running on the OpenBSD target machine. ''' from __future__ import ab...
saltstack/salt
salt/modules/vmctl.py
load
python
def load(path): ''' Load additional configuration from the specified file. path Path to the configuration file. CLI Example: .. code-block:: bash salt '*' vmctl.load path=/etc/vm.switches.conf ''' ret = False cmd = 'vmctl load {0}'.format(path) result = __salt__['...
Load additional configuration from the specified file. path Path to the configuration file. CLI Example: .. code-block:: bash salt '*' vmctl.load path=/etc/vm.switches.conf
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vmctl.py#L81-L107
null
# -*- coding: utf-8 -*- ''' Manage vms running on the OpenBSD VMM hypervisor using vmctl(8). .. versionadded:: 2019.2.0 :codeauthor: ``Jasper Lievisse Adriaanse <jasper@openbsd.org>`` .. note:: This module requires the `vmd` service to be running on the OpenBSD target machine. ''' from __future__ import ab...
saltstack/salt
salt/modules/vmctl.py
reload
python
def reload(): ''' Remove all stopped VMs and reload configuration from the default configuration file. CLI Example: .. code-block:: bash salt '*' vmctl.reload ''' ret = False cmd = 'vmctl reload' result = __salt__['cmd.run_all'](cmd, output...
Remove all stopped VMs and reload configuration from the default configuration file. CLI Example: .. code-block:: bash salt '*' vmctl.reload
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vmctl.py#L110-L133
null
# -*- coding: utf-8 -*- ''' Manage vms running on the OpenBSD VMM hypervisor using vmctl(8). .. versionadded:: 2019.2.0 :codeauthor: ``Jasper Lievisse Adriaanse <jasper@openbsd.org>`` .. note:: This module requires the `vmd` service to be running on the OpenBSD target machine. ''' from __future__ import ab...
saltstack/salt
salt/modules/vmctl.py
reset
python
def reset(all=False, vms=False, switches=False): ''' Reset the running state of VMM or a subsystem. all: Reset the running state. switches: Reset the configured switches. vms: Reset and terminate all VMs. CLI Example: .. code-block:: bash salt '*' vmctl...
Reset the running state of VMM or a subsystem. all: Reset the running state. switches: Reset the configured switches. vms: Reset and terminate all VMs. CLI Example: .. code-block:: bash salt '*' vmctl.reset all=True
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vmctl.py#L136-L177
null
# -*- coding: utf-8 -*- ''' Manage vms running on the OpenBSD VMM hypervisor using vmctl(8). .. versionadded:: 2019.2.0 :codeauthor: ``Jasper Lievisse Adriaanse <jasper@openbsd.org>`` .. note:: This module requires the `vmd` service to be running on the OpenBSD target machine. ''' from __future__ import ab...
saltstack/salt
salt/modules/vmctl.py
start
python
def start(name=None, id=None, bootpath=None, disk=None, disks=None, local_iface=False, memory=None, nics=0, switch=None): ''' Starts a VM defined by the specified parameters. When both a name and id are provided, the id is ignored. name: Name of the defined VM. id: VM id....
Starts a VM defined by the specified parameters. When both a name and id are provided, the id is ignored. name: Name of the defined VM. id: VM id. bootpath: Path to a kernel or BIOS image to load. disk: Path to a single disk to use. disks: List of mul...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vmctl.py#L180-L283
[ "def status(name=None, id=None):\n '''\n List VMs running on the host, or only the VM specified by ``id``. When\n both a name and id are provided, the id is ignored.\n\n name:\n Name of the defined VM.\n\n id:\n VM id.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*'...
# -*- coding: utf-8 -*- ''' Manage vms running on the OpenBSD VMM hypervisor using vmctl(8). .. versionadded:: 2019.2.0 :codeauthor: ``Jasper Lievisse Adriaanse <jasper@openbsd.org>`` .. note:: This module requires the `vmd` service to be running on the OpenBSD target machine. ''' from __future__ import ab...
saltstack/salt
salt/modules/vmctl.py
status
python
def status(name=None, id=None): ''' List VMs running on the host, or only the VM specified by ``id``. When both a name and id are provided, the id is ignored. name: Name of the defined VM. id: VM id. CLI Example: .. code-block:: bash salt '*' vmctl.status ...
List VMs running on the host, or only the VM specified by ``id``. When both a name and id are provided, the id is ignored. name: Name of the defined VM. id: VM id. CLI Example: .. code-block:: bash salt '*' vmctl.status # to list all VMs salt '*' vmctl...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vmctl.py#L286-L358
null
# -*- coding: utf-8 -*- ''' Manage vms running on the OpenBSD VMM hypervisor using vmctl(8). .. versionadded:: 2019.2.0 :codeauthor: ``Jasper Lievisse Adriaanse <jasper@openbsd.org>`` .. note:: This module requires the `vmd` service to be running on the OpenBSD target machine. ''' from __future__ import ab...
saltstack/salt
salt/modules/vmctl.py
stop
python
def stop(name=None, id=None): ''' Stop (terminate) the VM identified by the given id or name. When both a name and id are provided, the id is ignored. name: Name of the defined VM. id: VM id. CLI Example: .. code-block:: bash salt '*' vmctl.stop name=alpine '...
Stop (terminate) the VM identified by the given id or name. When both a name and id are provided, the id is ignored. name: Name of the defined VM. id: VM id. CLI Example: .. code-block:: bash salt '*' vmctl.stop name=alpine
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vmctl.py#L361-L403
null
# -*- coding: utf-8 -*- ''' Manage vms running on the OpenBSD VMM hypervisor using vmctl(8). .. versionadded:: 2019.2.0 :codeauthor: ``Jasper Lievisse Adriaanse <jasper@openbsd.org>`` .. note:: This module requires the `vmd` service to be running on the OpenBSD target machine. ''' from __future__ import ab...
saltstack/salt
salt/modules/munin.py
run
python
def run(plugins): ''' Run one or more named munin plugins CLI Example: .. code-block:: bash salt '*' munin.run uptime salt '*' munin.run uptime,cpu,load,memory ''' all_plugins = list_plugins() if isinstance(plugins, six.string_types): plugins = plugins.split(',') ...
Run one or more named munin plugins CLI Example: .. code-block:: bash salt '*' munin.run uptime salt '*' munin.run uptime,cpu,load,memory
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/munin.py#L33-L70
[ "def list_plugins():\n '''\n List all the munin plugins\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' munin.list_plugins\n '''\n pluginlist = os.listdir(PLUGINDIR)\n ret = []\n for plugin in pluginlist:\n # Check if execute bit\n statf = os.path.join(PLUGINDIR, ...
# -*- coding: utf-8 -*- ''' Run munin plugins/checks from salt and format the output as data. ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import os import stat # Import salt libs from salt.ext import six import salt.utils.files import salt.utils.stringutils PLUGI...
saltstack/salt
salt/modules/munin.py
run_all
python
def run_all(): ''' Run all the munin plugins CLI Example: .. code-block:: bash salt '*' munin.run_all ''' plugins = list_plugins() ret = {} for plugin in plugins: ret.update(run(plugin)) return ret
Run all the munin plugins CLI Example: .. code-block:: bash salt '*' munin.run_all
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/munin.py#L73-L87
[ "def run(plugins):\n '''\n Run one or more named munin plugins\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' munin.run uptime\n salt '*' munin.run uptime,cpu,load,memory\n '''\n all_plugins = list_plugins()\n\n if isinstance(plugins, six.string_types):\n plugins = ...
# -*- coding: utf-8 -*- ''' Run munin plugins/checks from salt and format the output as data. ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import os import stat # Import salt libs from salt.ext import six import salt.utils.files import salt.utils.stringutils PLUGI...
saltstack/salt
salt/modules/munin.py
list_plugins
python
def list_plugins(): ''' List all the munin plugins CLI Example: .. code-block:: bash salt '*' munin.list_plugins ''' pluginlist = os.listdir(PLUGINDIR) ret = [] for plugin in pluginlist: # Check if execute bit statf = os.path.join(PLUGINDIR, plugin) try...
List all the munin plugins CLI Example: .. code-block:: bash salt '*' munin.list_plugins
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/munin.py#L90-L111
null
# -*- coding: utf-8 -*- ''' Run munin plugins/checks from salt and format the output as data. ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import os import stat # Import salt libs from salt.ext import six import salt.utils.files import salt.utils.stringutils PLUGI...
saltstack/salt
salt/modules/kernelpkg_linux_yum.py
list_installed
python
def list_installed(): ''' Return a list of all installed kernels. CLI Example: .. code-block:: bash salt '*' kernelpkg.list_installed ''' result = __salt__['pkg.version'](_package_name(), versions_as_list=True) if result is None: return [] if six.PY2: return s...
Return a list of all installed kernels. CLI Example: .. code-block:: bash salt '*' kernelpkg.list_installed
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kernelpkg_linux_yum.py#L64-L81
[ "def _package_name():\n '''\n Return static string for the package name\n '''\n return 'kernel'\n" ]
# -*- coding: utf-8 -*- ''' Manage Linux kernel packages on YUM-based systems ''' from __future__ import absolute_import, print_function, unicode_literals import functools import logging try: # Import Salt libs from salt.ext import six from salt.utils.versions import LooseVersion as _LooseVersion from ...
saltstack/salt
salt/modules/kernelpkg_linux_yum.py
upgrade
python
def upgrade(reboot=False, at_time=None): ''' Upgrade the kernel and optionally reboot the system. reboot : False Request a reboot if a new kernel is available. at_time : immediate Schedule the reboot at some point in the future. This argument is ignored if ``reboot=False``. See...
Upgrade the kernel and optionally reboot the system. reboot : False Request a reboot if a new kernel is available. at_time : immediate Schedule the reboot at some point in the future. This argument is ignored if ``reboot=False``. See :py:func:`~salt.modules.system.reboot` for m...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kernelpkg_linux_yum.py#L138-L178
[ "def active():\n '''\n Return the version of the running kernel.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' kernelpkg.active\n '''\n if 'pkg.normalize_name' in __salt__:\n return __salt__['pkg.normalize_name'](__grains__['kernelrelease'])\n\n return __grains__['kernelr...
# -*- coding: utf-8 -*- ''' Manage Linux kernel packages on YUM-based systems ''' from __future__ import absolute_import, print_function, unicode_literals import functools import logging try: # Import Salt libs from salt.ext import six from salt.utils.versions import LooseVersion as _LooseVersion from ...
saltstack/salt
salt/modules/kernelpkg_linux_yum.py
remove
python
def remove(release): ''' Remove a specific version of the kernel. release The release number of an installed kernel. This must be the entire release number as returned by :py:func:`~salt.modules.kernelpkg_linux_yum.list_installed`, not the package name. CLI Example: .. cod...
Remove a specific version of the kernel. release The release number of an installed kernel. This must be the entire release number as returned by :py:func:`~salt.modules.kernelpkg_linux_yum.list_installed`, not the package name. CLI Example: .. code-block:: bash salt '*' ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kernelpkg_linux_yum.py#L195-L246
[ "def active():\n '''\n Return the version of the running kernel.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' kernelpkg.active\n '''\n if 'pkg.normalize_name' in __salt__:\n return __salt__['pkg.normalize_name'](__grains__['kernelrelease'])\n\n return __grains__['kernelr...
# -*- coding: utf-8 -*- ''' Manage Linux kernel packages on YUM-based systems ''' from __future__ import absolute_import, print_function, unicode_literals import functools import logging try: # Import Salt libs from salt.ext import six from salt.utils.versions import LooseVersion as _LooseVersion from ...
saltstack/salt
salt/utils/cache.py
context_cache
python
def context_cache(func): ''' A decorator to be used module functions which need to cache their context. To evaluate a __context__ and re-hydrate it if a given key is empty or contains no items, pass a list of keys to evaulate. ''' def context_cache_wrap(*args, **kwargs): func_contex...
A decorator to be used module functions which need to cache their context. To evaluate a __context__ and re-hydrate it if a given key is empty or contains no items, pass a list of keys to evaulate.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cache.py#L344-L363
null
# -*- coding: utf-8 -*- ''' In-memory caching used by Salt ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import os import re import time import logging try: import salt.utils.msgpack as msgpack except ImportError: msgpack = None # Import salt libs import salt...
saltstack/salt
salt/utils/cache.py
CacheDict._enforce_ttl_key
python
def _enforce_ttl_key(self, key): ''' Enforce the TTL to a specific key, delete if its past TTL ''' if key not in self._key_cache_time or self._ttl == 0: return if time.time() - self._key_cache_time[key] > self._ttl: del self._key_cache_time[key] ...
Enforce the TTL to a specific key, delete if its past TTL
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cache.py#L65-L73
null
class CacheDict(CacheAPI): ''' Subclass of dict that will lazily delete items past ttl ''' def __init__(self, ttl, *args, **kwargs): # pylint: disable=W0231 dict.__init__(self, *args, **kwargs) # pylint: disable=W0233 self._ttl = ttl self._key_cache_time = {} def __getit...
saltstack/salt
salt/utils/cache.py
CacheDisk._enforce_ttl_key
python
def _enforce_ttl_key(self, key): ''' Enforce the TTL to a specific key, delete if its past TTL ''' if key not in self._key_cache_time or self._ttl == 0: return if time.time() - self._key_cache_time[key] > self._ttl: del self._key_cache_time[key] ...
Enforce the TTL to a specific key, delete if its past TTL
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cache.py#L106-L114
null
class CacheDisk(CacheDict): ''' Class that represents itself as a dictionary to a consumer but uses a disk-based backend. Serialization and de-serialization is done with msgpack ''' def __init__(self, ttl, path, *args, **kwargs): super(CacheDisk, self).__init__(ttl, *args, **kwargs) ...
saltstack/salt
salt/utils/cache.py
CacheDisk._read
python
def _read(self): ''' Read in from disk ''' if msgpack is None: log.error('Cache cannot be read from the disk: msgpack is missing') elif not os.path.exists(self._path): log.debug('Cache path does not exist for reading: %s', self._path) else: ...
Read in from disk
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cache.py#L172-L195
[ "def decode(data, encoding=None, errors='strict', keep=False,\n normalize=False, preserve_dict_class=False, preserve_tuples=False,\n to_str=False):\n '''\n Generic function which will decode whichever type is passed, if necessary.\n Optionally use to_str=True to ensure strings are str t...
class CacheDisk(CacheDict): ''' Class that represents itself as a dictionary to a consumer but uses a disk-based backend. Serialization and de-serialization is done with msgpack ''' def __init__(self, ttl, path, *args, **kwargs): super(CacheDisk, self).__init__(ttl, *args, **kwargs) ...
saltstack/salt
salt/utils/cache.py
CacheDisk.store
python
def store(self): ''' Write content of the entire cache to disk ''' if msgpack is None: log.error('Cache cannot be stored on disk: msgpack is missing') else: # TODO Dir hashing? try: with salt.utils.files.fopen(self._path, 'wb+')...
Write content of the entire cache to disk
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cache.py#L197-L213
[ "def pack(o, stream, **kwargs):\n '''\n .. versionadded:: 2018.3.4\n\n Wraps msgpack.pack and ensures that the passed object is unwrapped if it is\n a proxy.\n\n By default, this function uses the msgpack module and falls back to\n msgpack_pure, if the msgpack is not available. You can pass an alt...
class CacheDisk(CacheDict): ''' Class that represents itself as a dictionary to a consumer but uses a disk-based backend. Serialization and de-serialization is done with msgpack ''' def __init__(self, ttl, path, *args, **kwargs): super(CacheDisk, self).__init__(ttl, *args, **kwargs) ...
saltstack/salt
salt/utils/cache.py
CacheCli.put_cache
python
def put_cache(self, minions): ''' published the given minions to the ConCache ''' self.cupd_out.send(self.serial.dumps(minions))
published the given minions to the ConCache
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cache.py#L244-L248
[ "def dumps(self, msg, use_bin_type=False):\n '''\n Run the correct dumps serialization format\n\n :param use_bin_type: Useful for Python 3 support. Tells msgpack to\n differentiate between 'str' and 'bytes' types\n by encoding them differently.\n ...
class CacheCli(object): ''' Connection client for the ConCache. Should be used by all components that need the list of currently connected minions ''' def __init__(self, opts): ''' Sets up the zmq-connection to the ConCache ''' self.opts = opts self.serial = ...
saltstack/salt
salt/utils/cache.py
CacheCli.get_cached
python
def get_cached(self): ''' queries the ConCache for a list of currently connected minions ''' msg = self.serial.dumps('minions') self.creq_out.send(msg) min_list = self.serial.loads(self.creq_out.recv()) return min_list
queries the ConCache for a list of currently connected minions
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cache.py#L250-L257
[ "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 CacheCli(object): ''' Connection client for the ConCache. Should be used by all components that need the list of currently connected minions ''' def __init__(self, opts): ''' Sets up the zmq-connection to the ConCache ''' self.opts = opts self.serial = ...
saltstack/salt
salt/utils/cache.py
CacheRegex.sweep
python
def sweep(self): ''' Sweep the cache and remove the outdated or least frequently used entries ''' if self.max_age < time.time() - self.timestamp: self.clear() self.timestamp = time.time() else: paterns = list(self.cache.values()) ...
Sweep the cache and remove the outdated or least frequently used entries
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cache.py#L286-L298
[ "def clear(self):\n '''\n Clear the cache\n '''\n self.cache.clear()\n" ]
class CacheRegex(object): ''' Create a regular expression object cache for the most frequently used patterns to minimize compilation of the same patterns over and over again ''' def __init__(self, prepend='', append='', size=1000, keep_fraction=0.8, max_age=3600): self.p...
saltstack/salt
salt/utils/cache.py
CacheRegex.get
python
def get(self, pattern): ''' Get a compiled regular expression object based on pattern and cache it when it is not in the cache already ''' try: self.cache[pattern][0] += 1 return self.cache[pattern][1] except KeyError: pass if l...
Get a compiled regular expression object based on pattern and cache it when it is not in the cache already
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cache.py#L300-L315
[ "def sweep(self):\n '''\n Sweep the cache and remove the outdated or least frequently\n used entries\n '''\n if self.max_age < time.time() - self.timestamp:\n self.clear()\n self.timestamp = time.time()\n else:\n paterns = list(self.cache.values())\n paterns.sort()\n ...
class CacheRegex(object): ''' Create a regular expression object cache for the most frequently used patterns to minimize compilation of the same patterns over and over again ''' def __init__(self, prepend='', append='', size=1000, keep_fraction=0.8, max_age=3600): self.p...
saltstack/salt
salt/utils/cache.py
ContextCache.cache_context
python
def cache_context(self, context): ''' Cache the given context to disk ''' if not os.path.isdir(os.path.dirname(self.cache_path)): os.mkdir(os.path.dirname(self.cache_path)) with salt.utils.files.fopen(self.cache_path, 'w+b') as cache: self.serial.dump(cont...
Cache the given context to disk
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cache.py#L327-L334
[ "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 ...
class ContextCache(object): def __init__(self, opts, name): ''' Create a context cache ''' self.opts = opts self.cache_path = os.path.join(opts['cachedir'], 'context', '{0}.p'.format(name)) self.serial = salt.payload.Serial(self.opts) def get_cache_context(self)...
saltstack/salt
salt/utils/cache.py
ContextCache.get_cache_context
python
def get_cache_context(self): ''' Retrieve a context cache from disk ''' with salt.utils.files.fopen(self.cache_path, 'rb') as cache: return salt.utils.data.decode(self.serial.load(cache))
Retrieve a context cache from disk
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cache.py#L336-L341
[ "def decode(data, encoding=None, errors='strict', keep=False,\n normalize=False, preserve_dict_class=False, preserve_tuples=False,\n to_str=False):\n '''\n Generic function which will decode whichever type is passed, if necessary.\n Optionally use to_str=True to ensure strings are str t...
class ContextCache(object): def __init__(self, opts, name): ''' Create a context cache ''' self.opts = opts self.cache_path = os.path.join(opts['cachedir'], 'context', '{0}.p'.format(name)) self.serial = salt.payload.Serial(self.opts) def cache_context(self, cont...
saltstack/salt
salt/utils/doc.py
strip_rst
python
def strip_rst(docs): ''' Strip/replace reStructuredText directives in docstrings ''' for func, docstring in six.iteritems(docs): log.debug('Stripping docstring for %s', func) if not docstring: continue docstring_new = docstring if six.PY3 else salt.utils.data.encode(d...
Strip/replace reStructuredText directives in docstrings
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/doc.py#L16-L46
[ "def decode(data, encoding=None, errors='strict', keep=False,\n normalize=False, preserve_dict_class=False, preserve_tuples=False,\n to_str=False):\n '''\n Generic function which will decode whichever type is passed, if necessary.\n Optionally use to_str=True to ensure strings are str t...
# -*- coding: utf-8 -*- ''' Functions for analyzing/parsing docstrings ''' from __future__ import absolute_import, print_function, unicode_literals import logging import re import salt.utils.data from salt.ext import six log = logging.getLogger(__name__) def parse_docstring(docstring): ''' Parse a docstri...
saltstack/salt
salt/utils/doc.py
parse_docstring
python
def parse_docstring(docstring): ''' Parse a docstring into its parts. Currently only parses dependencies, can be extended to parse whatever is needed. Parses into a dictionary: { 'full': full docstring, 'deps': list of dependencies (empty list if none) } ...
Parse a docstring into its parts. Currently only parses dependencies, can be extended to parse whatever is needed. Parses into a dictionary: { 'full': full docstring, 'deps': list of dependencies (empty list if none) }
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/doc.py#L49-L83
null
# -*- coding: utf-8 -*- ''' Functions for analyzing/parsing docstrings ''' from __future__ import absolute_import, print_function, unicode_literals import logging import re import salt.utils.data from salt.ext import six log = logging.getLogger(__name__) def strip_rst(docs): ''' Strip/replace reStructuredT...
saltstack/salt
salt/states/boto_elasticache.py
present
python
def present( name, engine=None, cache_node_type=None, num_cache_nodes=None, preferred_availability_zone=None, port=None, cache_parameter_group_name=None, cache_security_group_names=None, replication_group_id=None, auto_minor_version_upgrade...
Ensure the cache cluster exists. name Name of the cache cluster (cache cluster id). engine The name of the cache engine to be used for this cache cluster. Valid values are memcached or redis. cache_node_type The compute and memory capacity of the nodes in the cache cluster...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_elasticache.py#L100-L263
null
# -*- coding: utf-8 -*- ''' Manage Elasticache ================== .. versionadded:: 2014.7.0 Create, destroy and update Elasticache clusters. Be aware that this interacts with Amazon's services, and so may incur charges. Note: This module currently only supports creation and deletion of elasticache resources and wil...
saltstack/salt
salt/states/boto_elasticache.py
subnet_group_present
python
def subnet_group_present(name, subnet_ids=None, subnet_names=None, description=None, tags=None, region=None, key=None, keyid=None, profile=None): ''' Ensure ElastiCache subnet group exists. .. versionadded:: 2015.8.0 name The name for the Elast...
Ensure ElastiCache subnet group exists. .. versionadded:: 2015.8.0 name The name for the ElastiCache subnet group. This value is stored as a lowercase string. subnet_ids A list of VPC subnet IDs for the cache subnet group. Exclusive with subnet_names. subnet_names A list of ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_elasticache.py#L266-L329
null
# -*- coding: utf-8 -*- ''' Manage Elasticache ================== .. versionadded:: 2014.7.0 Create, destroy and update Elasticache clusters. Be aware that this interacts with Amazon's services, and so may incur charges. Note: This module currently only supports creation and deletion of elasticache resources and wil...
saltstack/salt
salt/states/boto_elasticache.py
creategroup
python
def creategroup(name, primary_cluster_id, replication_group_description, wait=None, region=None, key=None, keyid=None, profile=None): ''' Ensure the a replication group is create. name Name of replication group wait Waits for the group to be available primary_clust...
Ensure the a replication group is create. name Name of replication group wait Waits for the group to be available primary_cluster_id Name of the master cache node replication_group_description Description for the group region Region to connect to. ke...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_elasticache.py#L386-L438
null
# -*- coding: utf-8 -*- ''' Manage Elasticache ================== .. versionadded:: 2014.7.0 Create, destroy and update Elasticache clusters. Be aware that this interacts with Amazon's services, and so may incur charges. Note: This module currently only supports creation and deletion of elasticache resources and wil...
saltstack/salt
salt/states/statuspage.py
_clear_dict
python
def _clear_dict(endpoint_props): ''' Eliminates None entries from the features of the endpoint dict. ''' return dict( (prop_name, prop_val) for prop_name, prop_val in six.iteritems(endpoint_props) if prop_val is not None )
Eliminates None entries from the features of the endpoint dict.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/statuspage.py#L85-L93
null
# -*- coding: utf-8 -*- ''' StatusPage ========== Manage the StatusPage_ configuration. .. _StatusPage: https://www.statuspage.io/ In the minion configuration file, the following block is required: .. code-block:: yaml statuspage: api_key: <API_KEY> page_id: <PAGE_ID> .. versionadded:: 2017.7.0 ''' fro...
saltstack/salt
salt/states/statuspage.py
_ignore_keys
python
def _ignore_keys(endpoint_props): ''' Ignores some keys that might be different without any important info. These keys are defined under _DO_NOT_COMPARE_FIELDS. ''' return dict( (prop_name, prop_val) for prop_name, prop_val in six.iteritems(endpoint_props) if prop_name not in...
Ignores some keys that might be different without any important info. These keys are defined under _DO_NOT_COMPARE_FIELDS.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/statuspage.py#L96-L105
null
# -*- coding: utf-8 -*- ''' StatusPage ========== Manage the StatusPage_ configuration. .. _StatusPage: https://www.statuspage.io/ In the minion configuration file, the following block is required: .. code-block:: yaml statuspage: api_key: <API_KEY> page_id: <PAGE_ID> .. versionadded:: 2017.7.0 ''' fro...
saltstack/salt
salt/states/statuspage.py
_unique
python
def _unique(list_of_dicts): ''' Returns an unique list of dictionaries given a list that may contain duplicates. ''' unique_list = [] for ele in list_of_dicts: if ele not in unique_list: unique_list.append(ele) return unique_list
Returns an unique list of dictionaries given a list that may contain duplicates.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/statuspage.py#L108-L116
null
# -*- coding: utf-8 -*- ''' StatusPage ========== Manage the StatusPage_ configuration. .. _StatusPage: https://www.statuspage.io/ In the minion configuration file, the following block is required: .. code-block:: yaml statuspage: api_key: <API_KEY> page_id: <PAGE_ID> .. versionadded:: 2017.7.0 ''' fro...
saltstack/salt
salt/states/statuspage.py
_clear_ignore
python
def _clear_ignore(endpoint_props): ''' Both _clear_dict and _ignore_keys in a single iteration. ''' return dict( (prop_name, prop_val) for prop_name, prop_val in six.iteritems(endpoint_props) if prop_name not in _DO_NOT_COMPARE_FIELDS and prop_val is not None )
Both _clear_dict and _ignore_keys in a single iteration.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/statuspage.py#L119-L127
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n" ]
# -*- coding: utf-8 -*- ''' StatusPage ========== Manage the StatusPage_ configuration. .. _StatusPage: https://www.statuspage.io/ In the minion configuration file, the following block is required: .. code-block:: yaml statuspage: api_key: <API_KEY> page_id: <PAGE_ID> .. versionadded:: 2017.7.0 ''' fro...
saltstack/salt
salt/states/statuspage.py
_find_match
python
def _find_match(ele, lst): ''' Find a matching element in a list. ''' for _ele in lst: for match_key in _MATCH_KEYS: if _ele.get(match_key) == ele.get(match_key): return ele
Find a matching element in a list.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/statuspage.py#L140-L147
null
# -*- coding: utf-8 -*- ''' StatusPage ========== Manage the StatusPage_ configuration. .. _StatusPage: https://www.statuspage.io/ In the minion configuration file, the following block is required: .. code-block:: yaml statuspage: api_key: <API_KEY> page_id: <PAGE_ID> .. versionadded:: 2017.7.0 ''' fro...
saltstack/salt
salt/states/statuspage.py
_update_on_fields
python
def _update_on_fields(prev_ele, new_ele): ''' Return a dict with fields that differ between two dicts. ''' fields_update = dict( (prop_name, prop_val) for prop_name, prop_val in six.iteritems(new_ele) if new_ele.get(prop_name) != prev_ele.get(prop_name) or prop_name in _MATCH_KEY...
Return a dict with fields that differ between two dicts.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/statuspage.py#L150-L165
null
# -*- coding: utf-8 -*- ''' StatusPage ========== Manage the StatusPage_ configuration. .. _StatusPage: https://www.statuspage.io/ In the minion configuration file, the following block is required: .. code-block:: yaml statuspage: api_key: <API_KEY> page_id: <PAGE_ID> .. versionadded:: 2017.7.0 ''' fro...
saltstack/salt
salt/states/statuspage.py
_compute_diff
python
def _compute_diff(expected_endpoints, configured_endpoints): ''' Compares configured endpoints with the expected configuration and returns the differences. ''' new_endpoints = [] update_endpoints = [] remove_endpoints = [] ret = _compute_diff_ret() # noth configured => configure with e...
Compares configured endpoints with the expected configuration and returns the differences.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/statuspage.py#L168-L218
null
# -*- coding: utf-8 -*- ''' StatusPage ========== Manage the StatusPage_ configuration. .. _StatusPage: https://www.statuspage.io/ In the minion configuration file, the following block is required: .. code-block:: yaml statuspage: api_key: <API_KEY> page_id: <PAGE_ID> .. versionadded:: 2017.7.0 ''' fro...
saltstack/salt
salt/states/statuspage.py
create
python
def create(name, endpoint='incidents', api_url=None, page_id=None, api_key=None, api_version=None, **kwargs): ''' Insert a new entry under a specific endpoint. endpoint: incidents Insert under this specific endpoint. page_id ...
Insert a new entry under a specific endpoint. endpoint: incidents Insert under this specific endpoint. page_id Page ID. Can also be specified in the config file. api_key API key. Can also be specified in the config file. api_version: 1 API version. Can also be specifi...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/statuspage.py#L225-L286
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def _default_ret(name):\n '''\n Default dictionary returned.\n '''\n return {\n 'name': name,\n 'result': False,\n 'comment': '',\n 'changes': {}\n }\n" ]
# -*- coding: utf-8 -*- ''' StatusPage ========== Manage the StatusPage_ configuration. .. _StatusPage: https://www.statuspage.io/ In the minion configuration file, the following block is required: .. code-block:: yaml statuspage: api_key: <API_KEY> page_id: <PAGE_ID> .. versionadded:: 2017.7.0 ''' fro...
saltstack/salt
salt/states/statuspage.py
update
python
def update(name, endpoint='incidents', id=None, api_url=None, page_id=None, api_key=None, api_version=None, **kwargs): ''' Update attribute(s) of a specific endpoint. id The unique ID of the enpoint entry. endpoint: i...
Update attribute(s) of a specific endpoint. id The unique ID of the enpoint entry. endpoint: incidents Endpoint name. page_id Page ID. Can also be specified in the config file. api_key API key. Can also be specified in the config file. api_version: 1 API ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/statuspage.py#L289-L356
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def _default_ret(name):\n '''\n Default dictionary returned.\n '''\n return {\n 'name': name,\n 'result': False,\n 'comment': '',\n 'changes': {}\n }\n" ]
# -*- coding: utf-8 -*- ''' StatusPage ========== Manage the StatusPage_ configuration. .. _StatusPage: https://www.statuspage.io/ In the minion configuration file, the following block is required: .. code-block:: yaml statuspage: api_key: <API_KEY> page_id: <PAGE_ID> .. versionadded:: 2017.7.0 ''' fro...
saltstack/salt
salt/states/statuspage.py
delete
python
def delete(name, endpoint='incidents', id=None, api_url=None, page_id=None, api_key=None, api_version=None): ''' Remove an entry from an endpoint. endpoint: incidents Request a specific endpoint. page_id Page ID. Can als...
Remove an entry from an endpoint. endpoint: incidents Request a specific endpoint. page_id Page ID. Can also be specified in the config file. api_key API key. Can also be specified in the config file. api_version: 1 API version. Can also be specified in the config fil...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/statuspage.py#L359-L414
[ "def _default_ret(name):\n '''\n Default dictionary returned.\n '''\n return {\n 'name': name,\n 'result': False,\n 'comment': '',\n 'changes': {}\n }\n" ]
# -*- coding: utf-8 -*- ''' StatusPage ========== Manage the StatusPage_ configuration. .. _StatusPage: https://www.statuspage.io/ In the minion configuration file, the following block is required: .. code-block:: yaml statuspage: api_key: <API_KEY> page_id: <PAGE_ID> .. versionadded:: 2017.7.0 ''' fro...
saltstack/salt
salt/states/statuspage.py
managed
python
def managed(name, config, api_url=None, page_id=None, api_key=None, api_version=None, pace=_PACE, allow_empty=False): ''' Manage the StatusPage configuration. config Dictionary with the expected configuration of the...
Manage the StatusPage configuration. config Dictionary with the expected configuration of the StatusPage. The main level keys of this dictionary represent the endpoint name. If a certain endpoint does not exist in this structure, it will be ignored / not configured. page_id Pag...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/statuspage.py#L417-L590
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def _default_ret(name):\n '''\n Default dictionary returned.\n '''\n return {\n 'name': name,\n 'result': False,\n 'comment': '',\n 'changes': {}\n }\n", "def _compute_diff(expected_endpoints, configured_endpo...
# -*- coding: utf-8 -*- ''' StatusPage ========== Manage the StatusPage_ configuration. .. _StatusPage: https://www.statuspage.io/ In the minion configuration file, the following block is required: .. code-block:: yaml statuspage: api_key: <API_KEY> page_id: <PAGE_ID> .. versionadded:: 2017.7.0 ''' fro...
saltstack/salt
salt/states/splunk.py
present
python
def present(email, profile="splunk", **kwargs): ''' Ensure a user is present .. code-block:: yaml ensure example test user 1: splunk.user_present: - realname: 'Example TestUser1' - name: 'exampleuser' - email: 'example@domain.com' ...
Ensure a user is present .. code-block:: yaml ensure example test user 1: splunk.user_present: - realname: 'Example TestUser1' - name: 'exampleuser' - email: 'example@domain.com' - roles: ['user'] The following parameters are...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/splunk.py#L26-L103
null
# -*- coding: utf-8 -*- ''' Splunk User State Module .. versionadded:: 2016.3.0. This state is used to ensure presence of users in splunk. .. code-block:: yaml ensure example test user 1: splunk.present: - name: 'Example TestUser1' - email: example@domain.com ''' from __future__ ...
saltstack/salt
salt/states/splunk.py
absent
python
def absent(email, profile="splunk", **kwargs): ''' Ensure a splunk user is absent .. code-block:: yaml ensure example test user 1: splunk.absent: - email: 'example@domain.com' - name: 'exampleuser' The following parameters are required: email ...
Ensure a splunk user is absent .. code-block:: yaml ensure example test user 1: splunk.absent: - email: 'example@domain.com' - name: 'exampleuser' The following parameters are required: email This is the email of the user in splunk name ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/splunk.py#L106-L158
null
# -*- coding: utf-8 -*- ''' Splunk User State Module .. versionadded:: 2016.3.0. This state is used to ensure presence of users in splunk. .. code-block:: yaml ensure example test user 1: splunk.present: - name: 'Example TestUser1' - email: example@domain.com ''' from __future__ ...
saltstack/salt
salt/states/keyboard.py
system
python
def system(name): ''' Set the keyboard layout for the system name The keyboard layout to use ''' ret = {'name': name, 'changes': {}, 'result': None, 'comment': ''} if __salt__['keyboard.get_sys']() == name: ret['result'] = True ret['comme...
Set the keyboard layout for the system name The keyboard layout to use
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/keyboard.py#L32-L58
null
# -*- coding: utf-8 -*- ''' Management of keyboard layouts ============================== The keyboard layout can be managed for the system: .. code-block:: yaml us: keyboard.system Or it can be managed for XOrg: .. code-block:: yaml us: keyboard.xorg ''' # Import Python libs from __future__ ...
saltstack/salt
salt/states/keyboard.py
xorg
python
def xorg(name): ''' Set the keyboard layout for XOrg layout The keyboard layout to use ''' ret = {'name': name, 'changes': {}, 'result': None, 'comment': ''} if __salt__['keyboard.get_x']() == name: ret['result'] = True ret['comment'] = '...
Set the keyboard layout for XOrg layout The keyboard layout to use
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/keyboard.py#L61-L87
null
# -*- coding: utf-8 -*- ''' Management of keyboard layouts ============================== The keyboard layout can be managed for the system: .. code-block:: yaml us: keyboard.system Or it can be managed for XOrg: .. code-block:: yaml us: keyboard.xorg ''' # Import Python libs from __future__ ...
saltstack/salt
salt/modules/win_service.py
_status_wait
python
def _status_wait(service_name, end_time, service_states): ''' Helper function that will wait for the status of the service to match the provided status before an end time expires. Used for service stop and start .. versionadded:: 2017.7.9,2018.3.4 Args: service_name (str): The ...
Helper function that will wait for the status of the service to match the provided status before an end time expires. Used for service stop and start .. versionadded:: 2017.7.9,2018.3.4 Args: service_name (str): The name of the service end_time (float): A future ti...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L251-L293
null
# -*- coding: utf-8 -*- ''' Windows Service module. .. versionchanged:: 2016.11.0 - Rewritten to use PyWin32 ''' # Import Python libs from __future__ import absolute_import, unicode_literals, print_function import fnmatch import logging import re import time # Import Salt libs import salt.utils.platform from salt.ex...
saltstack/salt
salt/modules/win_service.py
_cmd_quote
python
def _cmd_quote(cmd): r''' Helper function to properly format the path to the binary for the service Must be wrapped in double quotes to account for paths that have spaces. For example: ``"C:\Program Files\Path\to\bin.exe"`` Args: cmd (str): Full path to the binary Returns: ...
r''' Helper function to properly format the path to the binary for the service Must be wrapped in double quotes to account for paths that have spaces. For example: ``"C:\Program Files\Path\to\bin.exe"`` Args: cmd (str): Full path to the binary Returns: str: Properly quoted pat...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L296-L317
null
# -*- coding: utf-8 -*- ''' Windows Service module. .. versionchanged:: 2016.11.0 - Rewritten to use PyWin32 ''' # Import Python libs from __future__ import absolute_import, unicode_literals, print_function import fnmatch import logging import re import time # Import Salt libs import salt.utils.platform from salt.ex...
saltstack/salt
salt/modules/win_service.py
get_enabled
python
def get_enabled(): ''' Return a list of enabled services. Enabled is defined as a service that is marked to Auto Start. Returns: list: A list of enabled services CLI Example: .. code-block:: bash salt '*' service.get_enabled ''' raw_services = _get_services() serv...
Return a list of enabled services. Enabled is defined as a service that is marked to Auto Start. Returns: list: A list of enabled services CLI Example: .. code-block:: bash salt '*' service.get_enabled
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L320-L340
[ "def info(name):\n '''\n Get information about a service on the system\n\n Args:\n name (str): The name of the service. This is not the display name. Use\n ``get_service_name`` to find the service name.\n\n Returns:\n dict: A dictionary containing information about the service.\...
# -*- coding: utf-8 -*- ''' Windows Service module. .. versionchanged:: 2016.11.0 - Rewritten to use PyWin32 ''' # Import Python libs from __future__ import absolute_import, unicode_literals, print_function import fnmatch import logging import re import time # Import Salt libs import salt.utils.platform from salt.ex...
saltstack/salt
salt/modules/win_service.py
available
python
def available(name): ''' Check if a service is available on the system. Args: name (str): The name of the service to check Returns: bool: ``True`` if the service is available, ``False`` otherwise CLI Example: .. code-block:: bash salt '*' service.available <service n...
Check if a service is available on the system. Args: name (str): The name of the service to check Returns: bool: ``True`` if the service is available, ``False`` otherwise CLI Example: .. code-block:: bash salt '*' service.available <service name>
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L366-L386
[ "def get_all():\n '''\n Return all installed services\n\n Returns:\n list: Returns a list of all services on the system.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' service.get_all\n '''\n services = _get_services()\n\n ret = set()\n for service in services:\n ...
# -*- coding: utf-8 -*- ''' Windows Service module. .. versionchanged:: 2016.11.0 - Rewritten to use PyWin32 ''' # Import Python libs from __future__ import absolute_import, unicode_literals, print_function import fnmatch import logging import re import time # Import Salt libs import salt.utils.platform from salt.ex...
saltstack/salt
salt/modules/win_service.py
_get_services
python
def _get_services(): ''' Returns a list of all services on the system. ''' handle_scm = win32service.OpenSCManager( None, None, win32service.SC_MANAGER_ENUMERATE_SERVICE) try: services = win32service.EnumServicesStatusEx(handle_scm) except AttributeError: services = win3...
Returns a list of all services on the system.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L408-L422
null
# -*- coding: utf-8 -*- ''' Windows Service module. .. versionchanged:: 2016.11.0 - Rewritten to use PyWin32 ''' # Import Python libs from __future__ import absolute_import, unicode_literals, print_function import fnmatch import logging import re import time # Import Salt libs import salt.utils.platform from salt.ex...
saltstack/salt
salt/modules/win_service.py
get_all
python
def get_all(): ''' Return all installed services Returns: list: Returns a list of all services on the system. CLI Example: .. code-block:: bash salt '*' service.get_all ''' services = _get_services() ret = set() for service in services: ret.add(service['S...
Return all installed services Returns: list: Returns a list of all services on the system. CLI Example: .. code-block:: bash salt '*' service.get_all
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L425-L444
[ "def _get_services():\n '''\n Returns a list of all services on the system.\n '''\n handle_scm = win32service.OpenSCManager(\n None, None, win32service.SC_MANAGER_ENUMERATE_SERVICE)\n\n try:\n services = win32service.EnumServicesStatusEx(handle_scm)\n except AttributeError:\n ...
# -*- coding: utf-8 -*- ''' Windows Service module. .. versionchanged:: 2016.11.0 - Rewritten to use PyWin32 ''' # Import Python libs from __future__ import absolute_import, unicode_literals, print_function import fnmatch import logging import re import time # Import Salt libs import salt.utils.platform from salt.ex...
saltstack/salt
salt/modules/win_service.py
get_service_name
python
def get_service_name(*args): ''' The Display Name is what is displayed in Windows when services.msc is executed. Each Display Name has an associated Service Name which is the actual name of the service. This function allows you to discover the Service Name by returning a dictionary of Display Name...
The Display Name is what is displayed in Windows when services.msc is executed. Each Display Name has an associated Service Name which is the actual name of the service. This function allows you to discover the Service Name by returning a dictionary of Display Names and Service Names, or filter by add...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L447-L482
[ "def _get_services():\n '''\n Returns a list of all services on the system.\n '''\n handle_scm = win32service.OpenSCManager(\n None, None, win32service.SC_MANAGER_ENUMERATE_SERVICE)\n\n try:\n services = win32service.EnumServicesStatusEx(handle_scm)\n except AttributeError:\n ...
# -*- coding: utf-8 -*- ''' Windows Service module. .. versionchanged:: 2016.11.0 - Rewritten to use PyWin32 ''' # Import Python libs from __future__ import absolute_import, unicode_literals, print_function import fnmatch import logging import re import time # Import Salt libs import salt.utils.platform from salt.ex...
saltstack/salt
salt/modules/win_service.py
info
python
def info(name): ''' Get information about a service on the system Args: name (str): The name of the service. This is not the display name. Use ``get_service_name`` to find the service name. Returns: dict: A dictionary containing information about the service. CLI Examp...
Get information about a service on the system Args: name (str): The name of the service. This is not the display name. Use ``get_service_name`` to find the service name. Returns: dict: A dictionary containing information about the service. CLI Example: .. code-block:: bas...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L485-L591
null
# -*- coding: utf-8 -*- ''' Windows Service module. .. versionchanged:: 2016.11.0 - Rewritten to use PyWin32 ''' # Import Python libs from __future__ import absolute_import, unicode_literals, print_function import fnmatch import logging import re import time # Import Salt libs import salt.utils.platform from salt.ex...
saltstack/salt
salt/modules/win_service.py
start
python
def start(name, timeout=90, with_deps=False, with_parents=False): ''' Start the specified service. .. warning:: You cannot start a disabled service in Windows. If the service is disabled, it will be changed to ``Manual`` start. Args: name (str): The name of the service to start...
Start the specified service. .. warning:: You cannot start a disabled service in Windows. If the service is disabled, it will be changed to ``Manual`` start. Args: name (str): The name of the service to start timeout (int): The time in seconds to wait for the servi...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L594-L653
[ "def disabled(name):\n '''\n Check to see if the named service is disabled to start on boot\n\n Args:\n name (str): The name of the service to check\n\n Returns:\n bool: True if the service is disabled\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' service.disabled <se...
# -*- coding: utf-8 -*- ''' Windows Service module. .. versionchanged:: 2016.11.0 - Rewritten to use PyWin32 ''' # Import Python libs from __future__ import absolute_import, unicode_literals, print_function import fnmatch import logging import re import time # Import Salt libs import salt.utils.platform from salt.ex...
saltstack/salt
salt/modules/win_service.py
stop
python
def stop(name, timeout=90, with_deps=False, with_parents=False): ''' Stop the specified service Args: name (str): The name of the service to stop timeout (int): The time in seconds to wait for the service to stop before returning. Default is 90 seconds ...
Stop the specified service Args: name (str): The name of the service to stop timeout (int): The time in seconds to wait for the service to stop before returning. Default is 90 seconds .. versionadded:: 2017.7.9,2018.3.4 with_deps (bool): If...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L656-L708
[ "def _status_wait(service_name, end_time, service_states):\n '''\n Helper function that will wait for the status of the service to match the\n provided status before an end time expires. Used for service stop and start\n\n .. versionadded:: 2017.7.9,2018.3.4\n\n Args:\n service_name (str):\n ...
# -*- coding: utf-8 -*- ''' Windows Service module. .. versionchanged:: 2016.11.0 - Rewritten to use PyWin32 ''' # Import Python libs from __future__ import absolute_import, unicode_literals, print_function import fnmatch import logging import re import time # Import Salt libs import salt.utils.platform from salt.ex...
saltstack/salt
salt/modules/win_service.py
restart
python
def restart(name, timeout=90, with_deps=False, with_parents=False): ''' Restart the named service. This issues a stop command followed by a start. Args: name: The name of the service to restart. .. note:: If the name passed is ``salt-minion`` a scheduled task is ...
Restart the named service. This issues a stop command followed by a start. Args: name: The name of the service to restart. .. note:: If the name passed is ``salt-minion`` a scheduled task is created and executed to restart the salt-minion service. timeo...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L711-L760
[ "def start(name, timeout=90, with_deps=False, with_parents=False):\n '''\n Start the specified service.\n\n .. warning::\n You cannot start a disabled service in Windows. If the service is\n disabled, it will be changed to ``Manual`` start.\n\n Args:\n name (str): The name of the se...
# -*- coding: utf-8 -*- ''' Windows Service module. .. versionchanged:: 2016.11.0 - Rewritten to use PyWin32 ''' # Import Python libs from __future__ import absolute_import, unicode_literals, print_function import fnmatch import logging import re import time # Import Salt libs import salt.utils.platform from salt.ex...
saltstack/salt
salt/modules/win_service.py
create_win_salt_restart_task
python
def create_win_salt_restart_task(): ''' Create a task in Windows task scheduler to enable restarting the salt-minion Returns: bool: ``True`` if successful, otherwise ``False`` CLI Example: .. code-block:: bash salt '*' service.create_win_salt_restart_task() ''' cmd = 'cmd...
Create a task in Windows task scheduler to enable restarting the salt-minion Returns: bool: ``True`` if successful, otherwise ``False`` CLI Example: .. code-block:: bash salt '*' service.create_win_salt_restart_task()
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L763-L787
null
# -*- coding: utf-8 -*- ''' Windows Service module. .. versionchanged:: 2016.11.0 - Rewritten to use PyWin32 ''' # Import Python libs from __future__ import absolute_import, unicode_literals, print_function import fnmatch import logging import re import time # Import Salt libs import salt.utils.platform from salt.ex...
saltstack/salt
salt/modules/win_service.py
status
python
def status(name, *args, **kwargs): ''' Return the status for a service. If the name contains globbing, a dict mapping service name to True/False values is returned. .. versionchanged:: 2018.3.0 The service name can now be a glob (e.g. ``salt*``) Args: name (str): The name of th...
Return the status for a service. If the name contains globbing, a dict mapping service name to True/False values is returned. .. versionchanged:: 2018.3.0 The service name can now be a glob (e.g. ``salt*``) Args: name (str): The name of the service to check Returns: bool: ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L806-L840
[ "def info(name):\n '''\n Get information about a service on the system\n\n Args:\n name (str): The name of the service. This is not the display name. Use\n ``get_service_name`` to find the service name.\n\n Returns:\n dict: A dictionary containing information about the service.\...
# -*- coding: utf-8 -*- ''' Windows Service module. .. versionchanged:: 2016.11.0 - Rewritten to use PyWin32 ''' # Import Python libs from __future__ import absolute_import, unicode_literals, print_function import fnmatch import logging import re import time # Import Salt libs import salt.utils.platform from salt.ex...