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/runners/fileserver.py | dir_list | python | def dir_list(saltenv='base', backend=None):
'''
Return a list of directories in the given environment
saltenv : base
The salt fileserver environment to be listed
backend
Narrow fileserver backends to a subset of the enabled ones. If all
passed backends start with a minus sign (... | Return a list of directories in the given environment
saltenv : base
The salt fileserver environment to be listed
backend
Narrow fileserver backends to a subset of the enabled ones. If all
passed backends start with a minus sign (``-``), then these backends
will be excluded fro... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/fileserver.py#L242-L285 | null | # -*- coding: utf-8 -*-
'''
Directly manage the Salt fileserver plugins
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt libs
import salt.fileserver
def envs(backend=None, sources=False):
'''
Return the available fileserver environments. If no backend is provided,
... |
saltstack/salt | salt/runners/fileserver.py | empty_dir_list | python | def empty_dir_list(saltenv='base', backend=None):
'''
.. versionadded:: 2015.5.0
Return a list of empty directories in the given environment
saltenv : base
The salt fileserver environment to be listed
backend
Narrow fileserver backends to a subset of the enabled ones. If all
... | .. versionadded:: 2015.5.0
Return a list of empty directories in the given environment
saltenv : base
The salt fileserver environment to be listed
backend
Narrow fileserver backends to a subset of the enabled ones. If all
passed backends start with a minus sign (``-``), then these... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/fileserver.py#L288-L322 | null | # -*- coding: utf-8 -*-
'''
Directly manage the Salt fileserver plugins
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt libs
import salt.fileserver
def envs(backend=None, sources=False):
'''
Return the available fileserver environments. If no backend is provided,
... |
saltstack/salt | salt/runners/fileserver.py | update | python | def update(backend=None):
'''
Update the fileserver cache. If no backend is provided, then the cache for
all configured backends will be updated.
backend
Narrow fileserver backends to a subset of the enabled ones.
.. versionchanged:: 2015.5.0
If all passed backends start wi... | Update the fileserver cache. If no backend is provided, then the cache for
all configured backends will be updated.
backend
Narrow fileserver backends to a subset of the enabled ones.
.. versionchanged:: 2015.5.0
If all passed backends start with a minus sign (``-``), then these
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/fileserver.py#L325-L353 | [
"def update(self, back=None):\n '''\n Update all of the enabled fileserver backends which support the update\n function, or\n '''\n back = self.backends(back)\n for fsb in back:\n fstr = '{0}.update'.format(fsb)\n if fstr in self.servers:\n log.debug('Updating %s fileserve... | # -*- coding: utf-8 -*-
'''
Directly manage the Salt fileserver plugins
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt libs
import salt.fileserver
def envs(backend=None, sources=False):
'''
Return the available fileserver environments. If no backend is provided,
... |
saltstack/salt | salt/runners/fileserver.py | clear_cache | python | def clear_cache(backend=None):
'''
.. versionadded:: 2015.5.0
Clear the fileserver cache from VCS fileserver backends (:mod:`git
<salt.fileserver.gitfs>`, :mod:`hg <salt.fileserver.hgfs>`, :mod:`svn
<salt.fileserver.svnfs>`). Executing this runner with no arguments will
clear the cache for all ... | .. versionadded:: 2015.5.0
Clear the fileserver cache from VCS fileserver backends (:mod:`git
<salt.fileserver.gitfs>`, :mod:`hg <salt.fileserver.hgfs>`, :mod:`svn
<salt.fileserver.svnfs>`). Executing this runner with no arguments will
clear the cache for all enabled VCS fileserver backends, but this
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/fileserver.py#L356-L391 | [
"def clear_cache(self, back=None):\n '''\n Clear the cache of all of the fileserver backends that support the\n clear_cache function or the named backend(s) only.\n '''\n back = self.backends(back)\n cleared = []\n errors = []\n for fsb in back:\n fstr = '{0}.clear_cache'.format(fsb)\... | # -*- coding: utf-8 -*-
'''
Directly manage the Salt fileserver plugins
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt libs
import salt.fileserver
def envs(backend=None, sources=False):
'''
Return the available fileserver environments. If no backend is provided,
... |
saltstack/salt | salt/runners/fileserver.py | clear_lock | python | def clear_lock(backend=None, remote=None):
'''
.. versionadded:: 2015.5.0
Clear the fileserver update lock from VCS fileserver backends (:mod:`git
<salt.fileserver.gitfs>`, :mod:`hg <salt.fileserver.hgfs>`, :mod:`svn
<salt.fileserver.svnfs>`). This should only need to be done if a fileserver
up... | .. versionadded:: 2015.5.0
Clear the fileserver update lock from VCS fileserver backends (:mod:`git
<salt.fileserver.gitfs>`, :mod:`hg <salt.fileserver.hgfs>`, :mod:`svn
<salt.fileserver.svnfs>`). This should only need to be done if a fileserver
update was interrupted and a remote is not updating (gene... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/fileserver.py#L394-L432 | [
"def clear_lock(self, back=None, remote=None):\n '''\n Clear the update lock for the enabled fileserver backends\n\n back\n Only clear the update lock for the specified backend(s). The\n default is to clear the lock for all enabled backends\n\n remote\n If specified, then any remote... | # -*- coding: utf-8 -*-
'''
Directly manage the Salt fileserver plugins
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt libs
import salt.fileserver
def envs(backend=None, sources=False):
'''
Return the available fileserver environments. If no backend is provided,
... |
saltstack/salt | salt/runners/fileserver.py | lock | python | def lock(backend=None, remote=None):
'''
.. versionadded:: 2015.5.0
Set a fileserver update lock for VCS fileserver backends (:mod:`git
<salt.fileserver.gitfs>`, :mod:`hg <salt.fileserver.hgfs>`, :mod:`svn
<salt.fileserver.svnfs>`).
.. note::
This will only operate on enabled backends... | .. versionadded:: 2015.5.0
Set a fileserver update lock for VCS fileserver backends (:mod:`git
<salt.fileserver.gitfs>`, :mod:`hg <salt.fileserver.hgfs>`, :mod:`svn
<salt.fileserver.svnfs>`).
.. note::
This will only operate on enabled backends (those configured in
:conf_master:`files... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/fileserver.py#L435-L474 | [
"def lock(self, back=None, remote=None):\n '''\n ``remote`` can either be a dictionary containing repo configuration\n information, or a pattern. If the latter, then remotes for which the URL\n matches the pattern will be locked.\n '''\n back = self.backends(back)\n locked = []\n errors = []... | # -*- coding: utf-8 -*-
'''
Directly manage the Salt fileserver plugins
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt libs
import salt.fileserver
def envs(backend=None, sources=False):
'''
Return the available fileserver environments. If no backend is provided,
... |
saltstack/salt | salt/key.py | KeyCLI.run | python | def run(self):
'''
Run the logic for saltkey
'''
self._update_opts()
cmd = self.opts['fun']
veri = None
ret = None
try:
if cmd in ('accept', 'reject', 'delete'):
ret = self._run_cmd('name_match')
if not isinstan... | Run the logic for saltkey | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L228-L284 | [
"def display_output(data, out=None, opts=None, **kwargs):\n '''\n Print the passed data using the desired output\n '''\n if opts is None:\n opts = {}\n display_data = try_printout(data, out, opts, **kwargs)\n\n output_filename = opts.get('output_file', None)\n log.trace('data = %s', data... | class KeyCLI(object):
'''
Manage key CLI operations
'''
CLI_KEY_MAP = {'list': 'list_status',
'delete': 'delete_key',
'gen_signature': 'gen_keys_signature',
'print': 'key_str',
}
def __init__(self, opts):
self.opts ... |
saltstack/salt | salt/key.py | Key._check_minions_directories | python | def _check_minions_directories(self):
'''
Return the minion keys directory paths
'''
minions_accepted = os.path.join(self.opts['pki_dir'], self.ACC)
minions_pre = os.path.join(self.opts['pki_dir'], self.PEND)
minions_rejected = os.path.join(self.opts['pki_dir'],
... | Return the minion keys directory paths | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L314-L325 | null | class Key(object):
'''
The object that encapsulates saltkey actions
'''
ACC = 'minions'
PEND = 'minions_pre'
REJ = 'minions_rejected'
DEN = 'minions_denied'
def __init__(self, opts, io_loop=None):
self.opts = opts
kind = self.opts.get('__role', '') # application kind
... |
saltstack/salt | salt/key.py | Key.gen_keys | python | def gen_keys(self, keydir=None, keyname=None, keysize=None, user=None):
'''
Generate minion RSA public keypair
'''
keydir, keyname, keysize, user = self._get_key_attrs(keydir, keyname,
keysize, user)
salt.crypt.gen_keys... | Generate minion RSA public keypair | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L343-L350 | [
"def gen_keys(keydir, keyname, keysize, user=None, passphrase=None):\n '''\n Generate a RSA public keypair for use with salt\n\n :param str keydir: The directory to write the keypair to\n :param str keyname: The type of salt server for whom this key should be written. (i.e. 'master' or 'minion')\n :p... | class Key(object):
'''
The object that encapsulates saltkey actions
'''
ACC = 'minions'
PEND = 'minions_pre'
REJ = 'minions_rejected'
DEN = 'minions_denied'
def __init__(self, opts, io_loop=None):
self.opts = opts
kind = self.opts.get('__role', '') # application kind
... |
saltstack/salt | salt/key.py | Key.gen_signature | python | def gen_signature(self, privkey, pubkey, sig_path):
'''
Generate master public-key-signature
'''
return salt.crypt.gen_signature(privkey,
pubkey,
sig_path,
self.passphr... | Generate master public-key-signature | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L352-L359 | [
"def gen_signature(priv_path, pub_path, sign_path, passphrase=None):\n '''\n creates a signature for the given public-key with\n the given private key and writes it to sign_path\n '''\n\n with salt.utils.files.fopen(pub_path) as fp_:\n mpub_64 = fp_.read()\n\n mpub_sig = sign_message(priv_p... | class Key(object):
'''
The object that encapsulates saltkey actions
'''
ACC = 'minions'
PEND = 'minions_pre'
REJ = 'minions_rejected'
DEN = 'minions_denied'
def __init__(self, opts, io_loop=None):
self.opts = opts
kind = self.opts.get('__role', '') # application kind
... |
saltstack/salt | salt/key.py | Key.gen_keys_signature | python | def gen_keys_signature(self, priv, pub, signature_path, auto_create=False, keysize=None):
'''
Generate master public-key-signature
'''
# check given pub-key
if pub:
if not os.path.isfile(pub):
return 'Public-key {0} does not exist'.format(pub)
... | Generate master public-key-signature | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L361-L416 | null | class Key(object):
'''
The object that encapsulates saltkey actions
'''
ACC = 'minions'
PEND = 'minions_pre'
REJ = 'minions_rejected'
DEN = 'minions_denied'
def __init__(self, opts, io_loop=None):
self.opts = opts
kind = self.opts.get('__role', '') # application kind
... |
saltstack/salt | salt/key.py | Key.check_minion_cache | python | def check_minion_cache(self, preserve_minions=None):
'''
Check the minion cache to make sure that old minion data is cleared
Optionally, pass in a list of minions which should have their caches
preserved. To preserve all caches, set __opts__['preserve_minion_cache']
'''
... | Check the minion cache to make sure that old minion data is cleared
Optionally, pass in a list of minions which should have their caches
preserved. To preserve all caches, set __opts__['preserve_minion_cache'] | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L418-L448 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def factory(opts, **kwargs):\n '''\n Creates and returns the cache class.\n If memory caching is enabled by opts MemCache class will be instantiated.\n If not Cache class will be returned.\n '''\n if opts.get('memcache_expire_seconds', ... | class Key(object):
'''
The object that encapsulates saltkey actions
'''
ACC = 'minions'
PEND = 'minions_pre'
REJ = 'minions_rejected'
DEN = 'minions_denied'
def __init__(self, opts, io_loop=None):
self.opts = opts
kind = self.opts.get('__role', '') # application kind
... |
saltstack/salt | salt/key.py | Key.check_master | python | def check_master(self):
'''
Log if the master is not running
:rtype: bool
:return: Whether or not the master is running
'''
if not os.path.exists(
os.path.join(
self.opts['sock_dir'],
'publish_pull.ipc'
... | Log if the master is not running
:rtype: bool
:return: Whether or not the master is running | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L450-L464 | null | class Key(object):
'''
The object that encapsulates saltkey actions
'''
ACC = 'minions'
PEND = 'minions_pre'
REJ = 'minions_rejected'
DEN = 'minions_denied'
def __init__(self, opts, io_loop=None):
self.opts = opts
kind = self.opts.get('__role', '') # application kind
... |
saltstack/salt | salt/key.py | Key.name_match | python | def name_match(self, match, full=False):
'''
Accept a glob which to match the of a key and return the key's location
'''
if full:
matches = self.all_keys()
else:
matches = self.list_keys()
ret = {}
if ',' in match and isinstance(match, six.... | Accept a glob which to match the of a key and return the key's location | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L466-L490 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def list_keys(self):\n '''\n Return a dict of managed keys and what the key status are\n '''\n key_dirs = self._check_minions_directories()\n\n ret = {}\n\n for dir_ in key_dirs:\n if dir_ is None:\n continue\n ... | class Key(object):
'''
The object that encapsulates saltkey actions
'''
ACC = 'minions'
PEND = 'minions_pre'
REJ = 'minions_rejected'
DEN = 'minions_denied'
def __init__(self, opts, io_loop=None):
self.opts = opts
kind = self.opts.get('__role', '') # application kind
... |
saltstack/salt | salt/key.py | Key.dict_match | python | def dict_match(self, match_dict):
'''
Accept a dictionary of keys and return the current state of the
specified keys
'''
ret = {}
cur_keys = self.list_keys()
for status, keys in six.iteritems(match_dict):
for key in salt.utils.data.sorted_ignorecase(ke... | Accept a dictionary of keys and return the current state of the
specified keys | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L492-L504 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def list_keys(self):\n '''\n Return a dict of managed keys and what the key status are\n '''\n key_dirs = self._check_minions_directories()\n\n ret = {}\n\n for dir_ in key_dirs:\n if dir_ is None:\n continue\n ... | class Key(object):
'''
The object that encapsulates saltkey actions
'''
ACC = 'minions'
PEND = 'minions_pre'
REJ = 'minions_rejected'
DEN = 'minions_denied'
def __init__(self, opts, io_loop=None):
self.opts = opts
kind = self.opts.get('__role', '') # application kind
... |
saltstack/salt | salt/key.py | Key.local_keys | python | def local_keys(self):
'''
Return a dict of local keys
'''
ret = {'local': []}
for fn_ in salt.utils.data.sorted_ignorecase(os.listdir(self.opts['pki_dir'])):
if fn_.endswith('.pub') or fn_.endswith('.pem'):
path = os.path.join(self.opts['pki_dir'], fn_... | Return a dict of local keys | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L506-L516 | null | class Key(object):
'''
The object that encapsulates saltkey actions
'''
ACC = 'minions'
PEND = 'minions_pre'
REJ = 'minions_rejected'
DEN = 'minions_denied'
def __init__(self, opts, io_loop=None):
self.opts = opts
kind = self.opts.get('__role', '') # application kind
... |
saltstack/salt | salt/key.py | Key.list_keys | python | def list_keys(self):
'''
Return a dict of managed keys and what the key status are
'''
key_dirs = self._check_minions_directories()
ret = {}
for dir_ in key_dirs:
if dir_ is None:
continue
ret[os.path.basename(dir_)] = []
... | Return a dict of managed keys and what the key status are | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L518-L540 | [
"def to_unicode(s, encoding=None, errors='strict', normalize=False):\n '''\n Given str or unicode, return unicode (str for python 3)\n '''\n def _normalize(s):\n return unicodedata.normalize('NFC', s) if normalize else s\n\n if encoding is None:\n # Try utf-8 first, and fall back to det... | class Key(object):
'''
The object that encapsulates saltkey actions
'''
ACC = 'minions'
PEND = 'minions_pre'
REJ = 'minions_rejected'
DEN = 'minions_denied'
def __init__(self, opts, io_loop=None):
self.opts = opts
kind = self.opts.get('__role', '') # application kind
... |
saltstack/salt | salt/key.py | Key.all_keys | python | def all_keys(self):
'''
Merge managed keys with local keys
'''
keys = self.list_keys()
keys.update(self.local_keys())
return keys | Merge managed keys with local keys | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L542-L548 | [
"def local_keys(self):\n '''\n Return a dict of local keys\n '''\n ret = {'local': []}\n for fn_ in salt.utils.data.sorted_ignorecase(os.listdir(self.opts['pki_dir'])):\n if fn_.endswith('.pub') or fn_.endswith('.pem'):\n path = os.path.join(self.opts['pki_dir'], fn_)\n i... | class Key(object):
'''
The object that encapsulates saltkey actions
'''
ACC = 'minions'
PEND = 'minions_pre'
REJ = 'minions_rejected'
DEN = 'minions_denied'
def __init__(self, opts, io_loop=None):
self.opts = opts
kind = self.opts.get('__role', '') # application kind
... |
saltstack/salt | salt/key.py | Key.list_status | python | def list_status(self, match):
'''
Return a dict of managed keys under a named status
'''
acc, pre, rej, den = self._check_minions_directories()
ret = {}
if match.startswith('acc'):
ret[os.path.basename(acc)] = []
for fn_ in salt.utils.data.sorted_i... | Return a dict of managed keys under a named status | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L550-L582 | [
"def _check_minions_directories(self):\n '''\n Return the minion keys directory paths\n '''\n minions_accepted = os.path.join(self.opts['pki_dir'], self.ACC)\n minions_pre = os.path.join(self.opts['pki_dir'], self.PEND)\n minions_rejected = os.path.join(self.opts['pki_dir'],\n ... | class Key(object):
'''
The object that encapsulates saltkey actions
'''
ACC = 'minions'
PEND = 'minions_pre'
REJ = 'minions_rejected'
DEN = 'minions_denied'
def __init__(self, opts, io_loop=None):
self.opts = opts
kind = self.opts.get('__role', '') # application kind
... |
saltstack/salt | salt/key.py | Key.key_str | python | def key_str(self, match):
'''
Return the specified public key or keys based on a glob
'''
ret = {}
for status, keys in six.iteritems(self.name_match(match)):
ret[status] = {}
for key in salt.utils.data.sorted_ignorecase(keys):
path = os.pat... | Return the specified public key or keys based on a glob | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L584-L596 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"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 ... | class Key(object):
'''
The object that encapsulates saltkey actions
'''
ACC = 'minions'
PEND = 'minions_pre'
REJ = 'minions_rejected'
DEN = 'minions_denied'
def __init__(self, opts, io_loop=None):
self.opts = opts
kind = self.opts.get('__role', '') # application kind
... |
saltstack/salt | salt/key.py | Key.accept | python | def accept(self, match=None, match_dict=None, include_rejected=False, include_denied=False):
'''
Accept public keys. If "match" is passed, it is evaluated as a glob.
Pre-gathered matches can also be passed via "match_dict".
'''
if match is not None:
matches = self.nam... | Accept public keys. If "match" is passed, it is evaluated as a glob.
Pre-gathered matches can also be passed via "match_dict". | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L612-L651 | [
"def tagify(suffix='', prefix='', base=SALT):\n '''\n convenience function to build a namespaced event tag string\n from joining with the TABPART character the base, prefix and suffix\n\n If string prefix is a valid key in TAGS Then use the value of key prefix\n Else use prefix string\n\n If suffi... | class Key(object):
'''
The object that encapsulates saltkey actions
'''
ACC = 'minions'
PEND = 'minions_pre'
REJ = 'minions_rejected'
DEN = 'minions_denied'
def __init__(self, opts, io_loop=None):
self.opts = opts
kind = self.opts.get('__role', '') # application kind
... |
saltstack/salt | salt/key.py | Key.accept_all | python | def accept_all(self):
'''
Accept all keys in pre
'''
keys = self.list_keys()
for key in keys[self.PEND]:
try:
shutil.move(
os.path.join(
self.opts['pki_dir'],
self.PEND,
... | Accept all keys in pre | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L653-L677 | [
"def tagify(suffix='', prefix='', base=SALT):\n '''\n convenience function to build a namespaced event tag string\n from joining with the TABPART character the base, prefix and suffix\n\n If string prefix is a valid key in TAGS Then use the value of key prefix\n Else use prefix string\n\n If suffi... | class Key(object):
'''
The object that encapsulates saltkey actions
'''
ACC = 'minions'
PEND = 'minions_pre'
REJ = 'minions_rejected'
DEN = 'minions_denied'
def __init__(self, opts, io_loop=None):
self.opts = opts
kind = self.opts.get('__role', '') # application kind
... |
saltstack/salt | salt/key.py | Key.delete_key | python | def delete_key(self,
match=None,
match_dict=None,
preserve_minions=None,
revoke_auth=False):
'''
Delete public keys. If "match" is passed, it is evaluated as a glob.
Pre-gathered matches can also be passed via "match... | Delete public keys. If "match" is passed, it is evaluated as a glob.
Pre-gathered matches can also be passed via "match_dict".
To preserve the master caches of minions who are matched, set preserve_minions | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L679-L729 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def get_local_client(\n c_path=os.path.join(syspaths.CONFIG_DIR, 'master'),\n mopts=None,\n skip_perm_errors=False,\n io_loop=None,\n auto_reconnect=False):\n '''\n .. versionadded:: 2014.7.0\n\n Read in the co... | class Key(object):
'''
The object that encapsulates saltkey actions
'''
ACC = 'minions'
PEND = 'minions_pre'
REJ = 'minions_rejected'
DEN = 'minions_denied'
def __init__(self, opts, io_loop=None):
self.opts = opts
kind = self.opts.get('__role', '') # application kind
... |
saltstack/salt | salt/key.py | Key.delete_den | python | def delete_den(self):
'''
Delete all denied keys
'''
keys = self.list_keys()
for status, keys in six.iteritems(self.list_keys()):
for key in keys[self.DEN]:
try:
os.remove(os.path.join(self.opts['pki_dir'], status, key))
... | Delete all denied keys | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L731-L748 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def tagify(suffix='', prefix='', base=SALT):\n '''\n convenience function to build a namespaced event tag string\n from joining with the TABPART character the base, prefix and suffix\n\n If string prefix is a valid key in TAGS Then use the va... | class Key(object):
'''
The object that encapsulates saltkey actions
'''
ACC = 'minions'
PEND = 'minions_pre'
REJ = 'minions_rejected'
DEN = 'minions_denied'
def __init__(self, opts, io_loop=None):
self.opts = opts
kind = self.opts.get('__role', '') # application kind
... |
saltstack/salt | salt/key.py | Key.delete_all | python | def delete_all(self):
'''
Delete all keys
'''
for status, keys in six.iteritems(self.list_keys()):
for key in keys:
try:
os.remove(os.path.join(self.opts['pki_dir'], status, key))
eload = {'result': True,
... | Delete all keys | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L750-L768 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def tagify(suffix='', prefix='', base=SALT):\n '''\n convenience function to build a namespaced event tag string\n from joining with the TABPART character the base, prefix and suffix\n\n If string prefix is a valid key in TAGS Then use the va... | class Key(object):
'''
The object that encapsulates saltkey actions
'''
ACC = 'minions'
PEND = 'minions_pre'
REJ = 'minions_rejected'
DEN = 'minions_denied'
def __init__(self, opts, io_loop=None):
self.opts = opts
kind = self.opts.get('__role', '') # application kind
... |
saltstack/salt | salt/key.py | Key.reject_all | python | def reject_all(self):
'''
Reject all keys in pre
'''
keys = self.list_keys()
for key in keys[self.PEND]:
try:
shutil.move(
os.path.join(
self.opts['pki_dir'],
self.PEND,
... | Reject all keys in pre | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L814-L841 | [
"def tagify(suffix='', prefix='', base=SALT):\n '''\n convenience function to build a namespaced event tag string\n from joining with the TABPART character the base, prefix and suffix\n\n If string prefix is a valid key in TAGS Then use the value of key prefix\n Else use prefix string\n\n If suffi... | class Key(object):
'''
The object that encapsulates saltkey actions
'''
ACC = 'minions'
PEND = 'minions_pre'
REJ = 'minions_rejected'
DEN = 'minions_denied'
def __init__(self, opts, io_loop=None):
self.opts = opts
kind = self.opts.get('__role', '') # application kind
... |
saltstack/salt | salt/key.py | Key.finger | python | def finger(self, match, hash_type=None):
'''
Return the fingerprint for a specified key
'''
if hash_type is None:
hash_type = __opts__['hash_type']
matches = self.name_match(match, True)
ret = {}
for status, keys in six.iteritems(matches):
... | Return the fingerprint for a specified key | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L843-L860 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def pem_finger(path=None, key=None, sum_type='sha256'):\n '''\n Pass in either a raw pem string, or the path on disk to the location of a\n pem file, and the type of cryptographic hash to use. The default is SHA256.\n The fingerprint of the p... | class Key(object):
'''
The object that encapsulates saltkey actions
'''
ACC = 'minions'
PEND = 'minions_pre'
REJ = 'minions_rejected'
DEN = 'minions_denied'
def __init__(self, opts, io_loop=None):
self.opts = opts
kind = self.opts.get('__role', '') # application kind
... |
saltstack/salt | salt/key.py | Key.finger_all | python | def finger_all(self, hash_type=None):
'''
Return fingerprints for all keys
'''
if hash_type is None:
hash_type = __opts__['hash_type']
ret = {}
for status, keys in six.iteritems(self.all_keys()):
ret[status] = {}
for key in keys:
... | Return fingerprints for all keys | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L862-L878 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def pem_finger(path=None, key=None, sum_type='sha256'):\n '''\n Pass in either a raw pem string, or the path on disk to the location of a\n pem file, and the type of cryptographic hash to use. The default is SHA256.\n The fingerprint of the p... | class Key(object):
'''
The object that encapsulates saltkey actions
'''
ACC = 'minions'
PEND = 'minions_pre'
REJ = 'minions_rejected'
DEN = 'minions_denied'
def __init__(self, opts, io_loop=None):
self.opts = opts
kind = self.opts.get('__role', '') # application kind
... |
saltstack/salt | salt/modules/tomcat.py | __catalina_home | python | def __catalina_home():
'''
Tomcat paths differ depending on packaging
'''
locations = ['/usr/share/tomcat*', '/opt/tomcat']
for location in locations:
folders = glob.glob(location)
if folders:
for catalina_home in folders:
if os.path.isdir(catalina_home + ... | Tomcat paths differ depending on packaging | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tomcat.py#L119-L130 | null | # -*- coding: utf-8 -*-
'''
Support for Tomcat
This module uses the manager webapp to manage Apache tomcat webapps.
If the manager webapp is not configured some of the functions won't work.
:configuration:
- Java bin path should be in default path
- If ipv6 is enabled make sure you permit manager access to ip... |
saltstack/salt | salt/modules/tomcat.py | _get_credentials | python | def _get_credentials():
'''
Get the username and password from opts, grains, or pillar
'''
ret = {
'user': False,
'passwd': False
}
# Loop through opts, grains, and pillar
# Return the first acceptable configuration found
for item in ret:
for struct in [__opts__,... | Get the username and password from opts, grains, or pillar | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tomcat.py#L133-L156 | null | # -*- coding: utf-8 -*-
'''
Support for Tomcat
This module uses the manager webapp to manage Apache tomcat webapps.
If the manager webapp is not configured some of the functions won't work.
:configuration:
- Java bin path should be in default path
- If ipv6 is enabled make sure you permit manager access to ip... |
saltstack/salt | salt/modules/tomcat.py | _auth | python | def _auth(uri):
'''
returns a authentication handler.
Get user & password from grains, if are not set default to
modules.config.option
If user & pass are missing return False
'''
user, password = _get_credentials()
if user is False or password is False:
return False
basic ... | returns a authentication handler.
Get user & password from grains, if are not set default to
modules.config.option
If user & pass are missing return False | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tomcat.py#L159-L178 | null | # -*- coding: utf-8 -*-
'''
Support for Tomcat
This module uses the manager webapp to manage Apache tomcat webapps.
If the manager webapp is not configured some of the functions won't work.
:configuration:
- Java bin path should be in default path
- If ipv6 is enabled make sure you permit manager access to ip... |
saltstack/salt | salt/modules/tomcat.py | extract_war_version | python | def extract_war_version(war):
'''
Extract the version from the war file name. There does not seem to be a
standard for encoding the version into the `war file name`_
.. _`war file name`: https://tomcat.apache.org/tomcat-6.0-doc/deployer-howto.html
Examples:
.. code-block:: bash
/path... | Extract the version from the war file name. There does not seem to be a
standard for encoding the version into the `war file name`_
.. _`war file name`: https://tomcat.apache.org/tomcat-6.0-doc/deployer-howto.html
Examples:
.. code-block:: bash
/path/salt-2015.8.6.war -> 2015.8.6
/pa... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tomcat.py#L181-L198 | null | # -*- coding: utf-8 -*-
'''
Support for Tomcat
This module uses the manager webapp to manage Apache tomcat webapps.
If the manager webapp is not configured some of the functions won't work.
:configuration:
- Java bin path should be in default path
- If ipv6 is enabled make sure you permit manager access to ip... |
saltstack/salt | salt/modules/tomcat.py | _wget | python | def _wget(cmd, opts=None, url='http://localhost:8080/manager', timeout=180):
'''
A private function used to issue the command to tomcat via the manager
webapp
cmd
the command to execute
url
The URL of the server manager webapp (example:
http://localhost:8080/manager)
o... | A private function used to issue the command to tomcat via the manager
webapp
cmd
the command to execute
url
The URL of the server manager webapp (example:
http://localhost:8080/manager)
opts
a dict of arguments
timeout
timeout for HTTP request
Return... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tomcat.py#L201-L265 | [
"def _auth(uri):\n '''\n returns a authentication handler.\n Get user & password from grains, if are not set default to\n modules.config.option\n\n If user & pass are missing return False\n '''\n\n user, password = _get_credentials()\n if user is False or password is False:\n return F... | # -*- coding: utf-8 -*-
'''
Support for Tomcat
This module uses the manager webapp to manage Apache tomcat webapps.
If the manager webapp is not configured some of the functions won't work.
:configuration:
- Java bin path should be in default path
- If ipv6 is enabled make sure you permit manager access to ip... |
saltstack/salt | salt/modules/tomcat.py | _simple_cmd | python | def _simple_cmd(cmd, app, url='http://localhost:8080/manager', timeout=180):
'''
Simple command wrapper to commands that need only a path option
'''
try:
opts = {
'path': app,
'version': ls(url)[app]['version']
}
return '\n'.join(_wget(cmd, opts, url, tim... | Simple command wrapper to commands that need only a path option | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tomcat.py#L268-L280 | [
"def ls(url='http://localhost:8080/manager', timeout=180):\n '''\n list all the deployed webapps\n\n url : http://localhost:8080/manager\n the URL of the server manager webapp\n timeout : 180\n timeout for HTTP request\n\n CLI Examples:\n\n .. code-block:: bash\n\n salt '*' to... | # -*- coding: utf-8 -*-
'''
Support for Tomcat
This module uses the manager webapp to manage Apache tomcat webapps.
If the manager webapp is not configured some of the functions won't work.
:configuration:
- Java bin path should be in default path
- If ipv6 is enabled make sure you permit manager access to ip... |
saltstack/salt | salt/modules/tomcat.py | ls | python | def ls(url='http://localhost:8080/manager', timeout=180):
'''
list all the deployed webapps
url : http://localhost:8080/manager
the URL of the server manager webapp
timeout : 180
timeout for HTTP request
CLI Examples:
.. code-block:: bash
salt '*' tomcat.ls
sa... | list all the deployed webapps
url : http://localhost:8080/manager
the URL of the server manager webapp
timeout : 180
timeout for HTTP request
CLI Examples:
.. code-block:: bash
salt '*' tomcat.ls
salt '*' tomcat.ls http://localhost:8080/manager | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tomcat.py#L324-L358 | [
"def _wget(cmd, opts=None, url='http://localhost:8080/manager', timeout=180):\n '''\n A private function used to issue the command to tomcat via the manager\n webapp\n\n cmd\n the command to execute\n\n url\n The URL of the server manager webapp (example:\n http://localhost:8080/... | # -*- coding: utf-8 -*-
'''
Support for Tomcat
This module uses the manager webapp to manage Apache tomcat webapps.
If the manager webapp is not configured some of the functions won't work.
:configuration:
- Java bin path should be in default path
- If ipv6 is enabled make sure you permit manager access to ip... |
saltstack/salt | salt/modules/tomcat.py | status_webapp | python | def status_webapp(app, url='http://localhost:8080/manager', timeout=180):
'''
return the status of the webapp (stopped | running | missing)
app
the webapp context path
url : http://localhost:8080/manager
the URL of the server manager webapp
timeout : 180
timeout for HTTP req... | return the status of the webapp (stopped | running | missing)
app
the webapp context path
url : http://localhost:8080/manager
the URL of the server manager webapp
timeout : 180
timeout for HTTP request
CLI Examples:
.. code-block:: bash
salt '*' tomcat.status_weba... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tomcat.py#L449-L473 | [
"def ls(url='http://localhost:8080/manager', timeout=180):\n '''\n list all the deployed webapps\n\n url : http://localhost:8080/manager\n the URL of the server manager webapp\n timeout : 180\n timeout for HTTP request\n\n CLI Examples:\n\n .. code-block:: bash\n\n salt '*' to... | # -*- coding: utf-8 -*-
'''
Support for Tomcat
This module uses the manager webapp to manage Apache tomcat webapps.
If the manager webapp is not configured some of the functions won't work.
:configuration:
- Java bin path should be in default path
- If ipv6 is enabled make sure you permit manager access to ip... |
saltstack/salt | salt/modules/tomcat.py | serverinfo | python | def serverinfo(url='http://localhost:8080/manager', timeout=180):
'''
return details about the server
url : http://localhost:8080/manager
the URL of the server manager webapp
timeout : 180
timeout for HTTP request
CLI Examples:
.. code-block:: bash
salt '*' tomcat.ser... | return details about the server
url : http://localhost:8080/manager
the URL of the server manager webapp
timeout : 180
timeout for HTTP request
CLI Examples:
.. code-block:: bash
salt '*' tomcat.serverinfo
salt '*' tomcat.serverinfo http://localhost:8080/manager | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tomcat.py#L476-L503 | [
"def _wget(cmd, opts=None, url='http://localhost:8080/manager', timeout=180):\n '''\n A private function used to issue the command to tomcat via the manager\n webapp\n\n cmd\n the command to execute\n\n url\n The URL of the server manager webapp (example:\n http://localhost:8080/... | # -*- coding: utf-8 -*-
'''
Support for Tomcat
This module uses the manager webapp to manage Apache tomcat webapps.
If the manager webapp is not configured some of the functions won't work.
:configuration:
- Java bin path should be in default path
- If ipv6 is enabled make sure you permit manager access to ip... |
saltstack/salt | salt/modules/tomcat.py | deploy_war | python | def deploy_war(war,
context,
force='no',
url='http://localhost:8080/manager',
saltenv='base',
timeout=180,
temp_war_location=None,
version=True):
'''
Deploy a WAR file
war
absolute path to WAR f... | Deploy a WAR file
war
absolute path to WAR file (should be accessible by the user running
tomcat) or a path supported by the salt.modules.cp.get_file function
context
the context path to deploy
force : False
set True to deploy the webapp even one is deployed in the context
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tomcat.py#L528-L635 | [
"def extract_war_version(war):\n '''\n Extract the version from the war file name. There does not seem to be a\n standard for encoding the version into the `war file name`_\n\n .. _`war file name`: https://tomcat.apache.org/tomcat-6.0-doc/deployer-howto.html\n\n Examples:\n\n .. code-block:: bash\... | # -*- coding: utf-8 -*-
'''
Support for Tomcat
This module uses the manager webapp to manage Apache tomcat webapps.
If the manager webapp is not configured some of the functions won't work.
:configuration:
- Java bin path should be in default path
- If ipv6 is enabled make sure you permit manager access to ip... |
saltstack/salt | salt/modules/tomcat.py | passwd | python | def passwd(passwd,
user='',
alg='sha1',
realm=None):
'''
This function replaces the $CATALINA_HOME/bin/digest.sh script
convert a clear-text password to the $CATALINA_BASE/conf/tomcat-users.xml
format
CLI Examples:
.. code-block:: bash
salt '*' tomcat.... | This function replaces the $CATALINA_HOME/bin/digest.sh script
convert a clear-text password to the $CATALINA_BASE/conf/tomcat-users.xml
format
CLI Examples:
.. code-block:: bash
salt '*' tomcat.passwd secret
salt '*' tomcat.passwd secret tomcat sha1
salt '*' tomcat.passwd sec... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tomcat.py#L638-L663 | null | # -*- coding: utf-8 -*-
'''
Support for Tomcat
This module uses the manager webapp to manage Apache tomcat webapps.
If the manager webapp is not configured some of the functions won't work.
:configuration:
- Java bin path should be in default path
- If ipv6 is enabled make sure you permit manager access to ip... |
saltstack/salt | salt/modules/tomcat.py | version | python | def version():
'''
Return server version from catalina.sh version
CLI Example:
.. code-block:: bash
salt '*' tomcat.version
'''
cmd = __catalina_home() + '/bin/catalina.sh version'
out = __salt__['cmd.run'](cmd).splitlines()
for line in out:
if not line:
co... | Return server version from catalina.sh version
CLI Example:
.. code-block:: bash
salt '*' tomcat.version | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tomcat.py#L667-L684 | [
"def __catalina_home():\n '''\n Tomcat paths differ depending on packaging\n '''\n locations = ['/usr/share/tomcat*', '/opt/tomcat']\n for location in locations:\n folders = glob.glob(location)\n if folders:\n for catalina_home in folders:\n if os.path.isdir(ca... | # -*- coding: utf-8 -*-
'''
Support for Tomcat
This module uses the manager webapp to manage Apache tomcat webapps.
If the manager webapp is not configured some of the functions won't work.
:configuration:
- Java bin path should be in default path
- If ipv6 is enabled make sure you permit manager access to ip... |
saltstack/salt | salt/modules/tomcat.py | fullversion | python | def fullversion():
'''
Return all server information from catalina.sh version
CLI Example:
.. code-block:: bash
salt '*' tomcat.fullversion
'''
cmd = __catalina_home() + '/bin/catalina.sh version'
ret = {}
out = __salt__['cmd.run'](cmd).splitlines()
for line in out:
... | Return all server information from catalina.sh version
CLI Example:
.. code-block:: bash
salt '*' tomcat.fullversion | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tomcat.py#L687-L706 | [
"def __catalina_home():\n '''\n Tomcat paths differ depending on packaging\n '''\n locations = ['/usr/share/tomcat*', '/opt/tomcat']\n for location in locations:\n folders = glob.glob(location)\n if folders:\n for catalina_home in folders:\n if os.path.isdir(ca... | # -*- coding: utf-8 -*-
'''
Support for Tomcat
This module uses the manager webapp to manage Apache tomcat webapps.
If the manager webapp is not configured some of the functions won't work.
:configuration:
- Java bin path should be in default path
- If ipv6 is enabled make sure you permit manager access to ip... |
saltstack/salt | salt/modules/tomcat.py | signal | python | def signal(signal=None):
'''
Signals catalina to start, stop, securestart, forcestop.
CLI Example:
.. code-block:: bash
salt '*' tomcat.signal start
'''
valid_signals = {'forcestop': 'stop -force',
'securestart': 'start -security',
'start': 's... | Signals catalina to start, stop, securestart, forcestop.
CLI Example:
.. code-block:: bash
salt '*' tomcat.signal start | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tomcat.py#L709-L730 | [
"def __catalina_home():\n '''\n Tomcat paths differ depending on packaging\n '''\n locations = ['/usr/share/tomcat*', '/opt/tomcat']\n for location in locations:\n folders = glob.glob(location)\n if folders:\n for catalina_home in folders:\n if os.path.isdir(ca... | # -*- coding: utf-8 -*-
'''
Support for Tomcat
This module uses the manager webapp to manage Apache tomcat webapps.
If the manager webapp is not configured some of the functions won't work.
:configuration:
- Java bin path should be in default path
- If ipv6 is enabled make sure you permit manager access to ip... |
saltstack/salt | salt/returners/appoptics_return.py | _get_options | python | def _get_options(ret=None):
'''
Get the appoptics options from salt.
'''
attrs = {
'api_token': 'api_token',
'api_url': 'api_url',
'tags': 'tags',
'sls_states': 'sls_states'
}
_options = salt.returners.get_returner_options(
__virtualname__,
ret,
... | Get the appoptics options from salt. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/appoptics_return.py#L98-L123 | [
"def get_returner_options(virtualname=None,\n ret=None,\n attrs=None,\n **kwargs):\n '''\n Get the returner options from salt.\n\n :param str virtualname: The returner virtualname (as returned\n by __virtual__()\n :param ret:... | # -*- coding: utf-8 -*-
'''Salt returner to return highstate stats to AppOptics Metrics
To enable this returner the minion will need the AppOptics Metrics
client importable on the Python path and the following
values configured in the minion or master config.
The AppOptics python client can be found at:
https://gith... |
saltstack/salt | salt/returners/appoptics_return.py | _get_appoptics | python | def _get_appoptics(options):
'''
Return an appoptics connection object.
'''
conn = appoptics_metrics.connect(
options.get('api_token'),
sanitizer=appoptics_metrics.sanitize_metric_name,
hostname=options.get('api_url'))
log.info("Connected to appoptics.")
return conn | Return an appoptics connection object. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/appoptics_return.py#L126-L135 | null | # -*- coding: utf-8 -*-
'''Salt returner to return highstate stats to AppOptics Metrics
To enable this returner the minion will need the AppOptics Metrics
client importable on the Python path and the following
values configured in the minion or master config.
The AppOptics python client can be found at:
https://gith... |
saltstack/salt | salt/returners/appoptics_return.py | returner | python | def returner(ret):
'''
Parse the return data and return metrics to AppOptics.
For each state that's provided in the configuration, return tagged metrics for
the result of that state if it's present.
'''
options = _get_options(ret)
states_to_report = ['state.highstate']
if options.get('... | Parse the return data and return metrics to AppOptics.
For each state that's provided in the configuration, return tagged metrics for
the result of that state if it's present. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/appoptics_return.py#L186-L209 | [
"def _get_options(ret=None):\n '''\n Get the appoptics options from salt.\n '''\n attrs = {\n 'api_token': 'api_token',\n 'api_url': 'api_url',\n 'tags': 'tags',\n 'sls_states': 'sls_states'\n }\n\n _options = salt.returners.get_returner_options(\n __virtualname_... | # -*- coding: utf-8 -*-
'''Salt returner to return highstate stats to AppOptics Metrics
To enable this returner the minion will need the AppOptics Metrics
client importable on the Python path and the following
values configured in the minion or master config.
The AppOptics python client can be found at:
https://gith... |
saltstack/salt | salt/states/zabbix_service.py | present | python | def present(host, service_root, trigger_desc, service_name=None, **kwargs):
'''
.. versionadded:: Fluorine
Ensure service exists under service root.
:param host: Technical name of the host
:param service_root: Path of service (path is split by /)
:param service_name: Name of service
:param... | .. versionadded:: Fluorine
Ensure service exists under service root.
:param host: Technical name of the host
:param service_root: Path of service (path is split by /)
:param service_name: Name of service
:param trigger_desc: Description of trigger in zabbix
:param _connection_user: Optional - ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_service.py#L17-L128 | null | # -*- coding: utf-8 -*-
'''
Management of Zabbix services.
'''
from __future__ import absolute_import, print_function, unicode_literals
def __virtual__():
'''
Only make these states available if Zabbix module is available.
'''
return 'zabbix.service_add' in __salt__
def absent(host, service_root,... |
saltstack/salt | salt/states/zabbix_service.py | absent | python | def absent(host, service_root, service_name=None, **kwargs):
'''
.. versionadded:: Fluorine
Ensure service does not exists under service root.
:param host: Technical name of the host
:param service_root: Path of service (path is split /)
:param service_name: Name of service
:param _connecti... | .. versionadded:: Fluorine
Ensure service does not exists under service root.
:param host: Technical name of the host
:param service_root: Path of service (path is split /)
:param service_name: Name of service
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see m... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_service.py#L131-L225 | null | # -*- coding: utf-8 -*-
'''
Management of Zabbix services.
'''
from __future__ import absolute_import, print_function, unicode_literals
def __virtual__():
'''
Only make these states available if Zabbix module is available.
'''
return 'zabbix.service_add' in __salt__
def present(host, service_root,... |
saltstack/salt | salt/cli/support/intfunc.py | filetree | python | def filetree(collector, *paths):
'''
Add all files in the tree. If the "path" is a file,
only that file will be added.
:param path: File or directory
:return:
'''
_paths = []
# Unglob
for path in paths:
_paths += glob.glob(path)
for path in set(_paths):
if not pa... | Add all files in the tree. If the "path" is a file,
only that file will be added.
:param path: File or directory
:return: | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/intfunc.py#L17-L53 | [
"def warning(self, message, ident=0):\n '''\n Write a warning message to the CLI.\n\n :param message:\n :param ident:\n :return:\n '''\n self.__colored_output('Warning', message, 'YELLOW', 'LIGHT_YELLOW', ident=ident)\n",
"def error(self, message, ident=0):\n '''\n Write an error messag... | # coding=utf-8
'''
Internal functions.
'''
# Maybe this needs to be a modules in a future?
from __future__ import absolute_import, print_function, unicode_literals
import os
import glob
from salt.cli.support.console import MessagesOutput
import salt.utils.files
out = MessagesOutput()
|
saltstack/salt | salt/modules/win_powercfg.py | _get_powercfg_minute_values | python | def _get_powercfg_minute_values(scheme, guid, subguid, safe_name):
'''
Returns the AC/DC values in an dict for a guid and subguid for a the given
scheme
'''
if scheme is None:
scheme = _get_current_scheme()
if __grains__['osrelease'] == '7':
cmd = 'powercfg /q {0} {1}'.format(sc... | Returns the AC/DC values in an dict for a guid and subguid for a the given
scheme | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_powercfg.py#L44-L69 | [
"def _get_current_scheme():\n cmd = 'powercfg /getactivescheme'\n out = __salt__['cmd.run'](cmd, python_shell=False)\n matches = re.search(r'GUID: (.*) \\(', out)\n return matches.groups()[0].strip()\n"
] | # -*- coding: utf-8 -*-
'''
This module allows you to control the power settings of a windows minion via
powercfg.
.. versionadded:: 2015.8.0
.. code-block:: bash
# Set monitor to never turn off on Battery power
salt '*' powercfg.set_monitor_timeout 0 power=dc
# Set disk timeout to 120 minutes on AC powe... |
saltstack/salt | salt/modules/win_powercfg.py | _set_powercfg_value | python | def _set_powercfg_value(scheme, sub_group, setting_guid, power, value):
'''
Sets the AC/DC values of a setting with the given power for the given scheme
'''
if scheme is None:
scheme = _get_current_scheme()
cmd = 'powercfg /set{0}valueindex {1} {2} {3} {4}' \
''.format(power, sche... | Sets the AC/DC values of a setting with the given power for the given scheme | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_powercfg.py#L72-L81 | [
"def _get_current_scheme():\n cmd = 'powercfg /getactivescheme'\n out = __salt__['cmd.run'](cmd, python_shell=False)\n matches = re.search(r'GUID: (.*) \\(', out)\n return matches.groups()[0].strip()\n"
] | # -*- coding: utf-8 -*-
'''
This module allows you to control the power settings of a windows minion via
powercfg.
.. versionadded:: 2015.8.0
.. code-block:: bash
# Set monitor to never turn off on Battery power
salt '*' powercfg.set_monitor_timeout 0 power=dc
# Set disk timeout to 120 minutes on AC powe... |
saltstack/salt | salt/modules/win_powercfg.py | set_monitor_timeout | python | def set_monitor_timeout(timeout, power='ac', scheme=None):
'''
Set the monitor timeout in minutes for the given power scheme
Args:
timeout (int):
The amount of time in minutes before the monitor will timeout
power (str):
Set the value for AC or DC power. Default is ... | Set the monitor timeout in minutes for the given power scheme
Args:
timeout (int):
The amount of time in minutes before the monitor will timeout
power (str):
Set the value for AC or DC power. Default is ``ac``. Valid options
are:
- ``ac`` (AC Po... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_powercfg.py#L84-L123 | [
"def _set_powercfg_value(scheme, sub_group, setting_guid, power, value):\n '''\n Sets the AC/DC values of a setting with the given power for the given scheme\n '''\n if scheme is None:\n scheme = _get_current_scheme()\n\n cmd = 'powercfg /set{0}valueindex {1} {2} {3} {4}' \\\n ''.form... | # -*- coding: utf-8 -*-
'''
This module allows you to control the power settings of a windows minion via
powercfg.
.. versionadded:: 2015.8.0
.. code-block:: bash
# Set monitor to never turn off on Battery power
salt '*' powercfg.set_monitor_timeout 0 power=dc
# Set disk timeout to 120 minutes on AC powe... |
saltstack/salt | salt/modules/win_powercfg.py | set_disk_timeout | python | def set_disk_timeout(timeout, power='ac', scheme=None):
'''
Set the disk timeout in minutes for the given power scheme
Args:
timeout (int):
The amount of time in minutes before the disk will timeout
power (str):
Set the value for AC or DC power. Default is ``ac``. V... | Set the disk timeout in minutes for the given power scheme
Args:
timeout (int):
The amount of time in minutes before the disk will timeout
power (str):
Set the value for AC or DC power. Default is ``ac``. Valid options
are:
- ``ac`` (AC Power)
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_powercfg.py#L156-L195 | [
"def _set_powercfg_value(scheme, sub_group, setting_guid, power, value):\n '''\n Sets the AC/DC values of a setting with the given power for the given scheme\n '''\n if scheme is None:\n scheme = _get_current_scheme()\n\n cmd = 'powercfg /set{0}valueindex {1} {2} {3} {4}' \\\n ''.form... | # -*- coding: utf-8 -*-
'''
This module allows you to control the power settings of a windows minion via
powercfg.
.. versionadded:: 2015.8.0
.. code-block:: bash
# Set monitor to never turn off on Battery power
salt '*' powercfg.set_monitor_timeout 0 power=dc
# Set disk timeout to 120 minutes on AC powe... |
saltstack/salt | salt/modules/win_powercfg.py | set_standby_timeout | python | def set_standby_timeout(timeout, power='ac', scheme=None):
'''
Set the standby timeout in minutes for the given power scheme
Args:
timeout (int):
The amount of time in minutes before the computer sleeps
power (str):
Set the value for AC or DC power. Default is ``ac`... | Set the standby timeout in minutes for the given power scheme
Args:
timeout (int):
The amount of time in minutes before the computer sleeps
power (str):
Set the value for AC or DC power. Default is ``ac``. Valid options
are:
- ``ac`` (AC Power)
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_powercfg.py#L228-L267 | [
"def _set_powercfg_value(scheme, sub_group, setting_guid, power, value):\n '''\n Sets the AC/DC values of a setting with the given power for the given scheme\n '''\n if scheme is None:\n scheme = _get_current_scheme()\n\n cmd = 'powercfg /set{0}valueindex {1} {2} {3} {4}' \\\n ''.form... | # -*- coding: utf-8 -*-
'''
This module allows you to control the power settings of a windows minion via
powercfg.
.. versionadded:: 2015.8.0
.. code-block:: bash
# Set monitor to never turn off on Battery power
salt '*' powercfg.set_monitor_timeout 0 power=dc
# Set disk timeout to 120 minutes on AC powe... |
saltstack/salt | salt/modules/win_powercfg.py | set_hibernate_timeout | python | def set_hibernate_timeout(timeout, power='ac', scheme=None):
'''
Set the hibernate timeout in minutes for the given power scheme
Args:
timeout (int):
The amount of time in minutes before the computer hibernates
power (str):
Set the value for AC or DC power. Default ... | Set the hibernate timeout in minutes for the given power scheme
Args:
timeout (int):
The amount of time in minutes before the computer hibernates
power (str):
Set the value for AC or DC power. Default is ``ac``. Valid options
are:
- ``ac`` (AC P... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_powercfg.py#L299-L338 | [
"def _set_powercfg_value(scheme, sub_group, setting_guid, power, value):\n '''\n Sets the AC/DC values of a setting with the given power for the given scheme\n '''\n if scheme is None:\n scheme = _get_current_scheme()\n\n cmd = 'powercfg /set{0}valueindex {1} {2} {3} {4}' \\\n ''.form... | # -*- coding: utf-8 -*-
'''
This module allows you to control the power settings of a windows minion via
powercfg.
.. versionadded:: 2015.8.0
.. code-block:: bash
# Set monitor to never turn off on Battery power
salt '*' powercfg.set_monitor_timeout 0 power=dc
# Set disk timeout to 120 minutes on AC powe... |
saltstack/salt | salt/states/pagerduty_schedule.py | present | python | def present(profile='pagerduty', subdomain=None, api_key=None, **kwargs):
'''
Ensure that a pagerduty schedule exists.
This method accepts as args everything defined in
https://developer.pagerduty.com/documentation/rest/schedules/create.
This means that most arguments are in a dict called "schedule.... | Ensure that a pagerduty schedule exists.
This method accepts as args everything defined in
https://developer.pagerduty.com/documentation/rest/schedules/create.
This means that most arguments are in a dict called "schedule."
User id's can be pagerduty id, or name, or email address. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pagerduty_schedule.py#L48-L77 | null | # -*- coding: utf-8 -*-
'''
Manage PagerDuty schedules.
Example:
.. code-block:: yaml
ensure test schedule:
pagerduty_schedule.present:
- name: 'bruce test schedule level1'
- schedule:
name: 'bruce test schedule level1'
time_zone: 'Pacific Time (US ... |
saltstack/salt | salt/states/pagerduty_schedule.py | _diff | python | def _diff(state_data, resource_object):
'''helper method to compare salt state info with the PagerDuty API json structure,
and determine if we need to update.
returns the dict to pass to the PD API to perform the update, or empty dict if no update.
'''
state_data['id'] = resource_object['schedule'... | helper method to compare salt state info with the PagerDuty API json structure,
and determine if we need to update.
returns the dict to pass to the PD API to perform the update, or empty dict if no update. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pagerduty_schedule.py#L94-L163 | null | # -*- coding: utf-8 -*-
'''
Manage PagerDuty schedules.
Example:
.. code-block:: yaml
ensure test schedule:
pagerduty_schedule.present:
- name: 'bruce test schedule level1'
- schedule:
name: 'bruce test schedule level1'
time_zone: 'Pacific Time (US ... |
saltstack/salt | salt/modules/cron.py | _cron_id | python | def _cron_id(cron):
'''SAFETYBELT, Only set if we really have an identifier'''
cid = None
if cron['identifier']:
cid = cron['identifier']
else:
cid = SALT_CRON_NO_IDENTIFIER
if cid:
return _ensure_string(cid) | SAFETYBELT, Only set if we really have an identifier | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cron.py#L52-L60 | [
"def _ensure_string(val):\n # Account for cases where the identifier is not a string\n # which would cause to_unicode to fail.\n if not isinstance(val, six.string_types):\n val = str(val) # future lint: enable=blacklisted-function\n try:\n return salt.utils.stringutils.to_unicode(val)\n ... | # -*- coding: utf-8 -*-
'''
Work with cron
.. note::
Salt does not escape cron metacharacters automatically. You should
backslash-escape percent characters and any other metacharacters that might
be interpreted incorrectly by the shell.
'''
from __future__ import absolute_import, unicode_literals, print_fu... |
saltstack/salt | salt/modules/cron.py | _cron_matched | python | def _cron_matched(cron, cmd, identifier=None):
'''Check if:
- we find a cron with same cmd, old state behavior
- but also be smart enough to remove states changed crons where we do
not removed priorly by a cron.absent by matching on the provided
identifier.
We assure retrocompati... | Check if:
- we find a cron with same cmd, old state behavior
- but also be smart enough to remove states changed crons where we do
not removed priorly by a cron.absent by matching on the provided
identifier.
We assure retrocompatibility by only checking on identifier if
and o... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cron.py#L63-L105 | [
"def _ensure_string(val):\n # Account for cases where the identifier is not a string\n # which would cause to_unicode to fail.\n if not isinstance(val, six.string_types):\n val = str(val) # future lint: enable=blacklisted-function\n try:\n return salt.utils.stringutils.to_unicode(val)\n ... | # -*- coding: utf-8 -*-
'''
Work with cron
.. note::
Salt does not escape cron metacharacters automatically. You should
backslash-escape percent characters and any other metacharacters that might
be interpreted incorrectly by the shell.
'''
from __future__ import absolute_import, unicode_literals, print_fu... |
saltstack/salt | salt/modules/cron.py | _render_tab | python | def _render_tab(lst):
'''
Takes a tab list structure and renders it to a list for applying it to
a file
'''
ret = []
for pre in lst['pre']:
ret.append('{0}\n'.format(pre))
if ret:
if ret[-1] != TAG:
ret.append(TAG)
else:
ret.append(TAG)
for env in ... | Takes a tab list structure and renders it to a list for applying it to
a file | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cron.py#L119-L177 | null | # -*- coding: utf-8 -*-
'''
Work with cron
.. note::
Salt does not escape cron metacharacters automatically. You should
backslash-escape percent characters and any other metacharacters that might
be interpreted incorrectly by the shell.
'''
from __future__ import absolute_import, unicode_literals, print_fu... |
saltstack/salt | salt/modules/cron.py | _get_cron_cmdstr | python | def _get_cron_cmdstr(path, user=None):
'''
Returns a format string, to be used to build a crontab command.
'''
if user:
cmd = 'crontab -u {0}'.format(user)
else:
cmd = 'crontab'
return '{0} {1}'.format(cmd, path) | Returns a format string, to be used to build a crontab command. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cron.py#L180-L188 | null | # -*- coding: utf-8 -*-
'''
Work with cron
.. note::
Salt does not escape cron metacharacters automatically. You should
backslash-escape percent characters and any other metacharacters that might
be interpreted incorrectly by the shell.
'''
from __future__ import absolute_import, unicode_literals, print_fu... |
saltstack/salt | salt/modules/cron.py | write_cron_file | python | def write_cron_file(user, path):
'''
Writes the contents of a file to a user's crontab
CLI Example:
.. code-block:: bash
salt '*' cron.write_cron_file root /tmp/new_cron
.. versionchanged:: 2015.8.9
.. note::
Some OS' do not support specifying user via the `crontab` command... | Writes the contents of a file to a user's crontab
CLI Example:
.. code-block:: bash
salt '*' cron.write_cron_file root /tmp/new_cron
.. versionchanged:: 2015.8.9
.. note::
Some OS' do not support specifying user via the `crontab` command i.e. (Solaris, AIX) | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cron.py#L198-L220 | [
"def _get_cron_cmdstr(path, user=None):\n '''\n Returns a format string, to be used to build a crontab command.\n '''\n if user:\n cmd = 'crontab -u {0}'.format(user)\n else:\n cmd = 'crontab'\n return '{0} {1}'.format(cmd, path)\n",
"def _check_instance_uid_match(user):\n '''\n... | # -*- coding: utf-8 -*-
'''
Work with cron
.. note::
Salt does not escape cron metacharacters automatically. You should
backslash-escape percent characters and any other metacharacters that might
be interpreted incorrectly by the shell.
'''
from __future__ import absolute_import, unicode_literals, print_fu... |
saltstack/salt | salt/modules/cron.py | _write_cron_lines | python | def _write_cron_lines(user, lines):
'''
Takes a list of lines to be committed to a user's crontab and writes it
'''
lines = [salt.utils.stringutils.to_str(_l) for _l in lines]
path = salt.utils.files.mkstemp()
if _check_instance_uid_match(user) or __grains__.get('os_family') in ('Solaris', 'AIX'... | Takes a list of lines to be committed to a user's crontab and writes it | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cron.py#L248-L267 | [
"def mkstemp(*args, **kwargs):\n '''\n Helper function which does exactly what ``tempfile.mkstemp()`` does but\n accepts another argument, ``close_fd``, which, by default, is true and closes\n the fd before returning the file path. Something commonly done throughout\n Salt's code.\n '''\n if 'p... | # -*- coding: utf-8 -*-
'''
Work with cron
.. note::
Salt does not escape cron metacharacters automatically. You should
backslash-escape percent characters and any other metacharacters that might
be interpreted incorrectly by the shell.
'''
from __future__ import absolute_import, unicode_literals, print_fu... |
saltstack/salt | salt/modules/cron.py | _date_time_match | python | def _date_time_match(cron, **kwargs):
'''
Returns true if the minute, hour, etc. params match their counterparts from
the dict returned from list_tab().
'''
return all([kwargs.get(x) is None or cron[x] == six.text_type(kwargs[x])
or (six.text_type(kwargs[x]).lower() == 'random' and c... | Returns true if the minute, hour, etc. params match their counterparts from
the dict returned from list_tab(). | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cron.py#L270-L277 | null | # -*- coding: utf-8 -*-
'''
Work with cron
.. note::
Salt does not escape cron metacharacters automatically. You should
backslash-escape percent characters and any other metacharacters that might
be interpreted incorrectly by the shell.
'''
from __future__ import absolute_import, unicode_literals, print_fu... |
saltstack/salt | salt/modules/cron.py | raw_cron | python | def raw_cron(user):
'''
Return the contents of the user's crontab
CLI Example:
.. code-block:: bash
salt '*' cron.raw_cron root
'''
if _check_instance_uid_match(user) or __grains__.get('os_family') in ('Solaris', 'AIX'):
cmd = 'crontab -l'
# Preserve line endings
... | Return the contents of the user's crontab
CLI Example:
.. code-block:: bash
salt '*' cron.raw_cron root | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cron.py#L280-L312 | [
"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 -*-
'''
Work with cron
.. note::
Salt does not escape cron metacharacters automatically. You should
backslash-escape percent characters and any other metacharacters that might
be interpreted incorrectly by the shell.
'''
from __future__ import absolute_import, unicode_literals, print_fu... |
saltstack/salt | salt/modules/cron.py | list_tab | python | def list_tab(user):
'''
Return the contents of the specified user's crontab
CLI Example:
.. code-block:: bash
salt '*' cron.list_tab root
'''
data = raw_cron(user)
ret = {'pre': [],
'crons': [],
'special': [],
'env': []}
flag = False
commen... | Return the contents of the specified user's crontab
CLI Example:
.. code-block:: bash
salt '*' cron.list_tab root | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cron.py#L315-L404 | [
"def raw_cron(user):\n '''\n Return the contents of the user's crontab\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' cron.raw_cron root\n '''\n if _check_instance_uid_match(user) or __grains__.get('os_family') in ('Solaris', 'AIX'):\n cmd = 'crontab -l'\n # Preserve l... | # -*- coding: utf-8 -*-
'''
Work with cron
.. note::
Salt does not escape cron metacharacters automatically. You should
backslash-escape percent characters and any other metacharacters that might
be interpreted incorrectly by the shell.
'''
from __future__ import absolute_import, unicode_literals, print_fu... |
saltstack/salt | salt/modules/cron.py | get_entry | python | def get_entry(user, identifier=None, cmd=None):
'''
Return the specified entry from user's crontab.
identifier will be used if specified, otherwise will lookup cmd
Either identifier or cmd should be specified.
user:
User's crontab to query
identifier:
Search for line with ident... | Return the specified entry from user's crontab.
identifier will be used if specified, otherwise will lookup cmd
Either identifier or cmd should be specified.
user:
User's crontab to query
identifier:
Search for line with identifier
cmd:
Search for cron line with cmd
C... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cron.py#L411-L438 | [
"def list_tab(user):\n '''\n Return the contents of the specified user's crontab\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' cron.list_tab root\n '''\n data = raw_cron(user)\n ret = {'pre': [],\n 'crons': [],\n 'special': [],\n 'env': []}\n fla... | # -*- coding: utf-8 -*-
'''
Work with cron
.. note::
Salt does not escape cron metacharacters automatically. You should
backslash-escape percent characters and any other metacharacters that might
be interpreted incorrectly by the shell.
'''
from __future__ import absolute_import, unicode_literals, print_fu... |
saltstack/salt | salt/modules/cron.py | set_special | python | def set_special(user,
special,
cmd,
commented=False,
comment=None,
identifier=None):
'''
Set up a special command in the crontab.
CLI Example:
.. code-block:: bash
salt '*' cron.set_special root @hourly 'echo foob... | Set up a special command in the crontab.
CLI Example:
.. code-block:: bash
salt '*' cron.set_special root @hourly 'echo foobar' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cron.py#L441-L516 | [
"def _needs_change(old, new):\n if old != new:\n if new == 'random':\n # Allow switch from '*' or not present to 'random'\n if old == '*':\n return True\n elif new is not None:\n return True\n return False\n",
"def _cron_matched(cron, cmd, identi... | # -*- coding: utf-8 -*-
'''
Work with cron
.. note::
Salt does not escape cron metacharacters automatically. You should
backslash-escape percent characters and any other metacharacters that might
be interpreted incorrectly by the shell.
'''
from __future__ import absolute_import, unicode_literals, print_fu... |
saltstack/salt | salt/modules/cron.py | _get_cron_date_time | python | def _get_cron_date_time(**kwargs):
'''
Returns a dict of date/time values to be used in a cron entry
'''
# Define ranges (except daymonth, as it depends on the month)
range_max = {
'minute': list(list(range(60))),
'hour': list(list(range(24))),
'month': list(list(range(1, 13)... | Returns a dict of date/time values to be used in a cron entry | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cron.py#L519-L558 | null | # -*- coding: utf-8 -*-
'''
Work with cron
.. note::
Salt does not escape cron metacharacters automatically. You should
backslash-escape percent characters and any other metacharacters that might
be interpreted incorrectly by the shell.
'''
from __future__ import absolute_import, unicode_literals, print_fu... |
saltstack/salt | salt/modules/cron.py | set_job | python | def set_job(user,
minute,
hour,
daymonth,
month,
dayweek,
cmd,
commented=False,
comment=None,
identifier=None):
'''
Sets a cron job up for a specified user.
CLI Example:
.. code-block:: bash
... | Sets a cron job up for a specified user.
CLI Example:
.. code-block:: bash
salt '*' cron.set_job root '*' '*' '*' '*' 1 /usr/local/weekly | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cron.py#L561-L661 | [
"def rm_job(user,\n cmd,\n minute=None,\n hour=None,\n daymonth=None,\n month=None,\n dayweek=None,\n identifier=None):\n '''\n Remove a cron job for a specified user. If any of the day/time params are\n specified, the job will only be r... | # -*- coding: utf-8 -*-
'''
Work with cron
.. note::
Salt does not escape cron metacharacters automatically. You should
backslash-escape percent characters and any other metacharacters that might
be interpreted incorrectly by the shell.
'''
from __future__ import absolute_import, unicode_literals, print_fu... |
saltstack/salt | salt/modules/cron.py | rm_special | python | def rm_special(user, cmd, special=None, identifier=None):
'''
Remove a special cron job for a specified user.
CLI Example:
.. code-block:: bash
salt '*' cron.rm_special root /usr/bin/foo
'''
lst = list_tab(user)
ret = 'absent'
rm_ = None
for ind in range(len(lst['special']... | Remove a special cron job for a specified user.
CLI Example:
.. code-block:: bash
salt '*' cron.rm_special root /usr/bin/foo | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cron.py#L664-L694 | [
"def _cron_matched(cron, cmd, identifier=None):\n '''Check if:\n - we find a cron with same cmd, old state behavior\n - but also be smart enough to remove states changed crons where we do\n not removed priorly by a cron.absent by matching on the provided\n identifier.\n We assure r... | # -*- coding: utf-8 -*-
'''
Work with cron
.. note::
Salt does not escape cron metacharacters automatically. You should
backslash-escape percent characters and any other metacharacters that might
be interpreted incorrectly by the shell.
'''
from __future__ import absolute_import, unicode_literals, print_fu... |
saltstack/salt | salt/modules/cron.py | rm_job | python | def rm_job(user,
cmd,
minute=None,
hour=None,
daymonth=None,
month=None,
dayweek=None,
identifier=None):
'''
Remove a cron job for a specified user. If any of the day/time params are
specified, the job will only be removed if the s... | Remove a cron job for a specified user. If any of the day/time params are
specified, the job will only be removed if the specified params match.
CLI Example:
.. code-block:: bash
salt '*' cron.rm_job root /usr/local/weekly
salt '*' cron.rm_job root /usr/bin/foo dayweek=1 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cron.py#L697-L742 | [
"def _cron_matched(cron, cmd, identifier=None):\n '''Check if:\n - we find a cron with same cmd, old state behavior\n - but also be smart enough to remove states changed crons where we do\n not removed priorly by a cron.absent by matching on the provided\n identifier.\n We assure r... | # -*- coding: utf-8 -*-
'''
Work with cron
.. note::
Salt does not escape cron metacharacters automatically. You should
backslash-escape percent characters and any other metacharacters that might
be interpreted incorrectly by the shell.
'''
from __future__ import absolute_import, unicode_literals, print_fu... |
saltstack/salt | salt/modules/cron.py | set_env | python | def set_env(user, name, value=None):
'''
Set up an environment variable in the crontab.
CLI Example:
.. code-block:: bash
salt '*' cron.set_env root MAILTO user@example.com
'''
lst = list_tab(user)
for env in lst['env']:
if name == env['name']:
if value != env[... | Set up an environment variable in the crontab.
CLI Example:
.. code-block:: bash
salt '*' cron.set_env root MAILTO user@example.com | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cron.py#L748-L775 | [
"def _render_tab(lst):\n '''\n Takes a tab list structure and renders it to a list for applying it to\n a file\n '''\n ret = []\n for pre in lst['pre']:\n ret.append('{0}\\n'.format(pre))\n if ret:\n if ret[-1] != TAG:\n ret.append(TAG)\n else:\n ret.append(TA... | # -*- coding: utf-8 -*-
'''
Work with cron
.. note::
Salt does not escape cron metacharacters automatically. You should
backslash-escape percent characters and any other metacharacters that might
be interpreted incorrectly by the shell.
'''
from __future__ import absolute_import, unicode_literals, print_fu... |
saltstack/salt | salt/modules/cron.py | rm_env | python | def rm_env(user, name):
'''
Remove cron environment variable for a specified user.
CLI Example:
.. code-block:: bash
salt '*' cron.rm_env root MAILTO
'''
lst = list_tab(user)
ret = 'absent'
rm_ = None
for ind in range(len(lst['env'])):
if name == lst['env'][ind]['n... | Remove cron environment variable for a specified user.
CLI Example:
.. code-block:: bash
salt '*' cron.rm_env root MAILTO | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cron.py#L778-L801 | [
"def _render_tab(lst):\n '''\n Takes a tab list structure and renders it to a list for applying it to\n a file\n '''\n ret = []\n for pre in lst['pre']:\n ret.append('{0}\\n'.format(pre))\n if ret:\n if ret[-1] != TAG:\n ret.append(TAG)\n else:\n ret.append(TA... | # -*- coding: utf-8 -*-
'''
Work with cron
.. note::
Salt does not escape cron metacharacters automatically. You should
backslash-escape percent characters and any other metacharacters that might
be interpreted incorrectly by the shell.
'''
from __future__ import absolute_import, unicode_literals, print_fu... |
saltstack/salt | salt/modules/boto_s3_bucket.py | exists | python | def exists(Bucket,
region=None, key=None, keyid=None, profile=None):
'''
Given a bucket name, check to see if the given bucket exists.
Returns True if the given bucket exists and returns False if the given
bucket does not exist.
CLI Example:
.. code-block:: bash
salt mymin... | Given a bucket name, check to see if the given bucket exists.
Returns True if the given bucket exists and returns False if the given
bucket does not exist.
CLI Example:
.. code-block:: bash
salt myminion boto_s3_bucket.exists mybucket | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3_bucket.py#L103-L127 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon S3 Buckets
.. versionadded:: 2016.3.0
:depends:
- boto
- boto3
The dependencies listed above can be installed via package or pip.
:configuration: This module accepts explicit Lambda credentials but can also
utilize IAM roles assigned to the instan... |
saltstack/salt | salt/modules/boto_s3_bucket.py | create | python | def create(Bucket,
ACL=None, LocationConstraint=None,
GrantFullControl=None,
GrantRead=None,
GrantReadACP=None,
GrantWrite=None,
GrantWriteACP=None,
region=None, key=None, keyid=None, profile=None):
'''
Given a valid config, create an ... | Given a valid config, create an S3 Bucket.
Returns {created: true} if the bucket was created and returns
{created: False} if the bucket was not created.
CLI Example:
.. code-block:: bash
salt myminion boto_s3_bucket.create my_bucket \\
GrantFullControl='emailaddress=... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3_bucket.py#L130-L177 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon S3 Buckets
.. versionadded:: 2016.3.0
:depends:
- boto
- boto3
The dependencies listed above can be installed via package or pip.
:configuration: This module accepts explicit Lambda credentials but can also
utilize IAM roles assigned to the instan... |
saltstack/salt | salt/modules/boto_s3_bucket.py | delete | python | def delete(Bucket, MFA=None, RequestPayer=None, Force=False,
region=None, key=None, keyid=None, profile=None):
'''
Given a bucket name, delete it, optionally emptying it first.
Returns {deleted: true} if the bucket was deleted and returns
{deleted: false} if the bucket was not deleted.
... | Given a bucket name, delete it, optionally emptying it first.
Returns {deleted: true} if the bucket was deleted and returns
{deleted: false} if the bucket was not deleted.
CLI Example:
.. code-block:: bash
salt myminion boto_s3_bucket.delete mybucket | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3_bucket.py#L180-L204 | [
"def empty(Bucket, MFA=None, RequestPayer=None, region=None, key=None,\n keyid=None, profile=None):\n '''\n Delete all objects in a given S3 bucket.\n\n Returns {deleted: true} if all objects were deleted\n and {deleted: false, failed: [key, ...]} otherwise\n\n CLI Example:\n\n .. code-bl... | # -*- coding: utf-8 -*-
'''
Connection module for Amazon S3 Buckets
.. versionadded:: 2016.3.0
:depends:
- boto
- boto3
The dependencies listed above can be installed via package or pip.
:configuration: This module accepts explicit Lambda credentials but can also
utilize IAM roles assigned to the instan... |
saltstack/salt | salt/modules/boto_s3_bucket.py | delete_objects | python | def delete_objects(Bucket, Delete, MFA=None, RequestPayer=None,
region=None, key=None, keyid=None, profile=None):
'''
Delete objects in a given S3 bucket.
Returns {deleted: true} if all objects were deleted
and {deleted: false, failed: [key, ...]} otherwise
CLI Example:
.. ... | Delete objects in a given S3 bucket.
Returns {deleted: true} if all objects were deleted
and {deleted: false, failed: [key, ...]} otherwise
CLI Example:
.. code-block:: bash
salt myminion boto_s3_bucket.delete_objects mybucket '{Objects: [Key: myobject]}' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3_bucket.py#L207-L249 | [
"def loads(s, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.loads and prevents a traceback in the event that a bytestring is\n passed to the function. (Python < 3.6 cannot load bytestrings)\n\n You can pass an alternate json module (loaded via import_json() above)\n using the _json_... | # -*- coding: utf-8 -*-
'''
Connection module for Amazon S3 Buckets
.. versionadded:: 2016.3.0
:depends:
- boto
- boto3
The dependencies listed above can be installed via package or pip.
:configuration: This module accepts explicit Lambda credentials but can also
utilize IAM roles assigned to the instan... |
saltstack/salt | salt/modules/boto_s3_bucket.py | describe | python | def describe(Bucket,
region=None, key=None, keyid=None, profile=None):
'''
Given a bucket name describe its properties.
Returns a dictionary of interesting properties.
CLI Example:
.. code-block:: bash
salt myminion boto_s3_bucket.describe mybucket
'''
try:
... | Given a bucket name describe its properties.
Returns a dictionary of interesting properties.
CLI Example:
.. code-block:: bash
salt myminion boto_s3_bucket.describe mybucket | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3_bucket.py#L252-L315 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n"
] | # -*- coding: utf-8 -*-
'''
Connection module for Amazon S3 Buckets
.. versionadded:: 2016.3.0
:depends:
- boto
- boto3
The dependencies listed above can be installed via package or pip.
:configuration: This module accepts explicit Lambda credentials but can also
utilize IAM roles assigned to the instan... |
saltstack/salt | salt/modules/boto_s3_bucket.py | empty | python | def empty(Bucket, MFA=None, RequestPayer=None, region=None, key=None,
keyid=None, profile=None):
'''
Delete all objects in a given S3 bucket.
Returns {deleted: true} if all objects were deleted
and {deleted: false, failed: [key, ...]} otherwise
CLI Example:
.. code-block:: bash
... | Delete all objects in a given S3 bucket.
Returns {deleted: true} if all objects were deleted
and {deleted: false, failed: [key, ...]} otherwise
CLI Example:
.. code-block:: bash
salt myminion boto_s3_bucket.empty mybucket | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3_bucket.py#L318-L345 | [
"def delete_objects(Bucket, Delete, MFA=None, RequestPayer=None,\n region=None, key=None, keyid=None, profile=None):\n '''\n Delete objects in a given S3 bucket.\n\n Returns {deleted: true} if all objects were deleted\n and {deleted: false, failed: [key, ...]} otherwise\n\n CLI Exam... | # -*- coding: utf-8 -*-
'''
Connection module for Amazon S3 Buckets
.. versionadded:: 2016.3.0
:depends:
- boto
- boto3
The dependencies listed above can be installed via package or pip.
:configuration: This module accepts explicit Lambda credentials but can also
utilize IAM roles assigned to the instan... |
saltstack/salt | salt/modules/boto_s3_bucket.py | list | python | def list(region=None, key=None, keyid=None, profile=None):
'''
List all buckets owned by the authenticated sender of the request.
Returns list of buckets
CLI Example:
.. code-block:: yaml
Owner: {...}
Buckets:
- {...}
- {...}
'''
try:
conn = _... | List all buckets owned by the authenticated sender of the request.
Returns list of buckets
CLI Example:
.. code-block:: yaml
Owner: {...}
Buckets:
- {...}
- {...} | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3_bucket.py#L348-L373 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon S3 Buckets
.. versionadded:: 2016.3.0
:depends:
- boto
- boto3
The dependencies listed above can be installed via package or pip.
:configuration: This module accepts explicit Lambda credentials but can also
utilize IAM roles assigned to the instan... |
saltstack/salt | salt/modules/boto_s3_bucket.py | list_object_versions | python | def list_object_versions(Bucket, Delimiter=None, EncodingType=None, Prefix=None,
region=None, key=None, keyid=None, profile=None):
'''
List objects in a given S3 bucket.
Returns a list of objects.
CLI Example:
.. code-block:: bash
salt myminion boto_s3_bucket.list_object... | List objects in a given S3 bucket.
Returns a list of objects.
CLI Example:
.. code-block:: bash
salt myminion boto_s3_bucket.list_object_versions mybucket | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3_bucket.py#L376-L410 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon S3 Buckets
.. versionadded:: 2016.3.0
:depends:
- boto
- boto3
The dependencies listed above can be installed via package or pip.
:configuration: This module accepts explicit Lambda credentials but can also
utilize IAM roles assigned to the instan... |
saltstack/salt | salt/modules/boto_s3_bucket.py | list_objects | python | def list_objects(Bucket, Delimiter=None, EncodingType=None, Prefix=None,
FetchOwner=False, StartAfter=None, region=None, key=None,
keyid=None, profile=None):
'''
List objects in a given S3 bucket.
Returns a list of objects.
CLI Example:
.. code-block:: bash
... | List objects in a given S3 bucket.
Returns a list of objects.
CLI Example:
.. code-block:: bash
salt myminion boto_s3_bucket.list_objects mybucket | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3_bucket.py#L413-L446 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon S3 Buckets
.. versionadded:: 2016.3.0
:depends:
- boto
- boto3
The dependencies listed above can be installed via package or pip.
:configuration: This module accepts explicit Lambda credentials but can also
utilize IAM roles assigned to the instan... |
saltstack/salt | salt/modules/boto_s3_bucket.py | put_acl | python | def put_acl(Bucket,
ACL=None,
AccessControlPolicy=None,
GrantFullControl=None,
GrantRead=None,
GrantReadACP=None,
GrantWrite=None,
GrantWriteACP=None,
region=None, key=None, keyid=None, profile=None):
'''
Given a valid confi... | Given a valid config, update the ACL for a bucket.
Returns {updated: true} if the ACL was updated and returns
{updated: False} if the ACL was not updated.
CLI Example:
.. code-block:: bash
salt myminion boto_s3_bucket.put_acl my_bucket 'public' \\
GrantFullControl='e... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3_bucket.py#L449-L491 | [
"def loads(s, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.loads and prevents a traceback in the event that a bytestring is\n passed to the function. (Python < 3.6 cannot load bytestrings)\n\n You can pass an alternate json module (loaded via import_json() above)\n using the _json_... | # -*- coding: utf-8 -*-
'''
Connection module for Amazon S3 Buckets
.. versionadded:: 2016.3.0
:depends:
- boto
- boto3
The dependencies listed above can be installed via package or pip.
:configuration: This module accepts explicit Lambda credentials but can also
utilize IAM roles assigned to the instan... |
saltstack/salt | salt/modules/boto_s3_bucket.py | put_cors | python | def put_cors(Bucket,
CORSRules,
region=None, key=None, keyid=None, profile=None):
'''
Given a valid config, update the CORS rules for a bucket.
Returns {updated: true} if CORS was updated and returns
{updated: False} if CORS was not updated.
CLI Example:
.. code-block:: ... | Given a valid config, update the CORS rules for a bucket.
Returns {updated: true} if CORS was updated and returns
{updated: False} if CORS was not updated.
CLI Example:
.. code-block:: bash
salt myminion boto_s3_bucket.put_cors my_bucket '[{\\
"AllowedHeaders":[],\\
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3_bucket.py#L494-L524 | [
"def loads(s, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.loads and prevents a traceback in the event that a bytestring is\n passed to the function. (Python < 3.6 cannot load bytestrings)\n\n You can pass an alternate json module (loaded via import_json() above)\n using the _json_... | # -*- coding: utf-8 -*-
'''
Connection module for Amazon S3 Buckets
.. versionadded:: 2016.3.0
:depends:
- boto
- boto3
The dependencies listed above can be installed via package or pip.
:configuration: This module accepts explicit Lambda credentials but can also
utilize IAM roles assigned to the instan... |
saltstack/salt | salt/modules/boto_s3_bucket.py | put_lifecycle_configuration | python | def put_lifecycle_configuration(Bucket,
Rules,
region=None, key=None, keyid=None, profile=None):
'''
Given a valid config, update the Lifecycle rules for a bucket.
Returns {updated: true} if Lifecycle was updated and returns
{updated: False} if Lifecycle was not updated.
CLI ... | Given a valid config, update the Lifecycle rules for a bucket.
Returns {updated: true} if Lifecycle was updated and returns
{updated: False} if Lifecycle was not updated.
CLI Example:
.. code-block:: bash
salt myminion boto_s3_bucket.put_lifecycle_configuration my_bucket '[{\\
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3_bucket.py#L527-L559 | [
"def loads(s, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.loads and prevents a traceback in the event that a bytestring is\n passed to the function. (Python < 3.6 cannot load bytestrings)\n\n You can pass an alternate json module (loaded via import_json() above)\n using the _json_... | # -*- coding: utf-8 -*-
'''
Connection module for Amazon S3 Buckets
.. versionadded:: 2016.3.0
:depends:
- boto
- boto3
The dependencies listed above can be installed via package or pip.
:configuration: This module accepts explicit Lambda credentials but can also
utilize IAM roles assigned to the instan... |
saltstack/salt | salt/modules/boto_s3_bucket.py | put_logging | python | def put_logging(Bucket,
TargetBucket=None, TargetPrefix=None, TargetGrants=None,
region=None, key=None, keyid=None, profile=None):
'''
Given a valid config, update the logging parameters for a bucket.
Returns {updated: true} if parameters were updated and returns
{updated: False} ... | Given a valid config, update the logging parameters for a bucket.
Returns {updated: true} if parameters were updated and returns
{updated: False} if parameters were not updated.
CLI Example:
.. code-block:: bash
salt myminion boto_s3_bucket.put_logging my_bucket log_bucket '[{...}]' prefix | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3_bucket.py#L562-L597 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def loads(s, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.loads and prevents a traceback in the event that a bytestring is\n passed to the function. (Python < 3.6 cannot load bytestrings)\n\n You can pass an alternate json ... | # -*- coding: utf-8 -*-
'''
Connection module for Amazon S3 Buckets
.. versionadded:: 2016.3.0
:depends:
- boto
- boto3
The dependencies listed above can be installed via package or pip.
:configuration: This module accepts explicit Lambda credentials but can also
utilize IAM roles assigned to the instan... |
saltstack/salt | salt/modules/boto_s3_bucket.py | put_notification_configuration | python | def put_notification_configuration(Bucket,
TopicConfigurations=None, QueueConfigurations=None,
LambdaFunctionConfigurations=None,
region=None, key=None, keyid=None, profile=None):
'''
Given a valid config, update the notification parameters for a bucket.
Returns {updated: t... | Given a valid config, update the notification parameters for a bucket.
Returns {updated: true} if parameters were updated and returns
{updated: False} if parameters were not updated.
CLI Example:
.. code-block:: bash
salt myminion boto_s3_bucket.put_notification_configuration my_bucket
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3_bucket.py#L600-L643 | [
"def loads(s, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.loads and prevents a traceback in the event that a bytestring is\n passed to the function. (Python < 3.6 cannot load bytestrings)\n\n You can pass an alternate json module (loaded via import_json() above)\n using the _json_... | # -*- coding: utf-8 -*-
'''
Connection module for Amazon S3 Buckets
.. versionadded:: 2016.3.0
:depends:
- boto
- boto3
The dependencies listed above can be installed via package or pip.
:configuration: This module accepts explicit Lambda credentials but can also
utilize IAM roles assigned to the instan... |
saltstack/salt | salt/modules/boto_s3_bucket.py | put_policy | python | def put_policy(Bucket, Policy,
region=None, key=None, keyid=None, profile=None):
'''
Given a valid config, update the policy for a bucket.
Returns {updated: true} if policy was updated and returns
{updated: False} if policy was not updated.
CLI Example:
.. code-block:: bash
... | Given a valid config, update the policy for a bucket.
Returns {updated: true} if policy was updated and returns
{updated: False} if policy was not updated.
CLI Example:
.. code-block:: bash
salt myminion boto_s3_bucket.put_policy my_bucket {...} | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3_bucket.py#L646-L671 | [
"def dumps(obj, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.dumps, and assumes that ensure_ascii is False (unless explicitly\n passed as True) for unicode compatibility. Note that setting it to True\n will mess up any unicode characters, as they will be dumped as the string\n lite... | # -*- coding: utf-8 -*-
'''
Connection module for Amazon S3 Buckets
.. versionadded:: 2016.3.0
:depends:
- boto
- boto3
The dependencies listed above can be installed via package or pip.
:configuration: This module accepts explicit Lambda credentials but can also
utilize IAM roles assigned to the instan... |
saltstack/salt | salt/modules/boto_s3_bucket.py | put_replication | python | def put_replication(Bucket, Role, Rules,
region=None, key=None, keyid=None, profile=None):
'''
Given a valid config, update the replication configuration for a bucket.
Returns {updated: true} if replication configuration was updated and returns
{updated: False} if replication configuration w... | Given a valid config, update the replication configuration for a bucket.
Returns {updated: true} if replication configuration was updated and returns
{updated: False} if replication configuration was not updated.
CLI Example:
.. code-block:: bash
salt myminion boto_s3_bucket.put_replication ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3_bucket.py#L688-L718 | [
"def loads(s, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.loads and prevents a traceback in the event that a bytestring is\n passed to the function. (Python < 3.6 cannot load bytestrings)\n\n You can pass an alternate json module (loaded via import_json() above)\n using the _json_... | # -*- coding: utf-8 -*-
'''
Connection module for Amazon S3 Buckets
.. versionadded:: 2016.3.0
:depends:
- boto
- boto3
The dependencies listed above can be installed via package or pip.
:configuration: This module accepts explicit Lambda credentials but can also
utilize IAM roles assigned to the instan... |
saltstack/salt | salt/modules/boto_s3_bucket.py | put_request_payment | python | def put_request_payment(Bucket, Payer,
region=None, key=None, keyid=None, profile=None):
'''
Given a valid config, update the request payment configuration for a bucket.
Returns {updated: true} if request payment configuration was updated and returns
{updated: False} if request payment confi... | Given a valid config, update the request payment configuration for a bucket.
Returns {updated: true} if request payment configuration was updated and returns
{updated: False} if request payment configuration was not updated.
CLI Example:
.. code-block:: bash
salt myminion boto_s3_bucket.put_... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3_bucket.py#L721-L744 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon S3 Buckets
.. versionadded:: 2016.3.0
:depends:
- boto
- boto3
The dependencies listed above can be installed via package or pip.
:configuration: This module accepts explicit Lambda credentials but can also
utilize IAM roles assigned to the instan... |
saltstack/salt | salt/modules/boto_s3_bucket.py | put_tagging | python | def put_tagging(Bucket,
region=None, key=None, keyid=None, profile=None, **kwargs):
'''
Given a valid config, update the tags for a bucket.
Returns {updated: true} if tags were updated and returns
{updated: False} if tags were not updated.
CLI Example:
.. code-block:: bash
... | Given a valid config, update the tags for a bucket.
Returns {updated: true} if tags were updated and returns
{updated: False} if tags were not updated.
CLI Example:
.. code-block:: bash
salt myminion boto_s3_bucket.put_tagging my_bucket my_role [...] | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3_bucket.py#L747-L775 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n"
] | # -*- coding: utf-8 -*-
'''
Connection module for Amazon S3 Buckets
.. versionadded:: 2016.3.0
:depends:
- boto
- boto3
The dependencies listed above can be installed via package or pip.
:configuration: This module accepts explicit Lambda credentials but can also
utilize IAM roles assigned to the instan... |
saltstack/salt | salt/modules/boto_s3_bucket.py | put_versioning | python | def put_versioning(Bucket, Status, MFADelete=None, MFA=None,
region=None, key=None, keyid=None, profile=None):
'''
Given a valid config, update the versioning configuration for a bucket.
Returns {updated: true} if versioning configuration was updated and returns
{updated: False} if versionin... | Given a valid config, update the versioning configuration for a bucket.
Returns {updated: true} if versioning configuration was updated and returns
{updated: False} if versioning configuration was not updated.
CLI Example:
.. code-block:: bash
salt myminion boto_s3_bucket.put_versioning my_b... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3_bucket.py#L778-L807 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon S3 Buckets
.. versionadded:: 2016.3.0
:depends:
- boto
- boto3
The dependencies listed above can be installed via package or pip.
:configuration: This module accepts explicit Lambda credentials but can also
utilize IAM roles assigned to the instan... |
saltstack/salt | salt/modules/boto_s3_bucket.py | put_website | python | def put_website(Bucket, ErrorDocument=None, IndexDocument=None,
RedirectAllRequestsTo=None, RoutingRules=None,
region=None, key=None, keyid=None, profile=None):
'''
Given a valid config, update the website configuration for a bucket.
Returns {updated: true} if website configuration wa... | Given a valid config, update the website configuration for a bucket.
Returns {updated: true} if website configuration was updated and returns
{updated: False} if website configuration was not updated.
CLI Example:
.. code-block:: bash
salt myminion boto_s3_bucket.put_website my_bucket IndexD... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3_bucket.py#L810-L842 | [
"def loads(s, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.loads and prevents a traceback in the event that a bytestring is\n passed to the function. (Python < 3.6 cannot load bytestrings)\n\n You can pass an alternate json module (loaded via import_json() above)\n using the _json_... | # -*- coding: utf-8 -*-
'''
Connection module for Amazon S3 Buckets
.. versionadded:: 2016.3.0
:depends:
- boto
- boto3
The dependencies listed above can be installed via package or pip.
:configuration: This module accepts explicit Lambda credentials but can also
utilize IAM roles assigned to the instan... |
saltstack/salt | salt/modules/boto_s3_bucket.py | delete_cors | python | def delete_cors(Bucket,
region=None, key=None, keyid=None, profile=None):
'''
Delete the CORS configuration for the given bucket
Returns {deleted: true} if CORS was deleted and returns
{deleted: False} if CORS was not deleted.
CLI Example:
.. code-block:: bash
salt myminio... | Delete the CORS configuration for the given bucket
Returns {deleted: true} if CORS was deleted and returns
{deleted: False} if CORS was not deleted.
CLI Example:
.. code-block:: bash
salt myminion boto_s3_bucket.delete_cors my_bucket | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3_bucket.py#L845-L866 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon S3 Buckets
.. versionadded:: 2016.3.0
:depends:
- boto
- boto3
The dependencies listed above can be installed via package or pip.
:configuration: This module accepts explicit Lambda credentials but can also
utilize IAM roles assigned to the instan... |
saltstack/salt | salt/modules/boto_s3_bucket.py | delete_lifecycle_configuration | python | def delete_lifecycle_configuration(Bucket,
region=None, key=None, keyid=None, profile=None):
'''
Delete the lifecycle configuration for the given bucket
Returns {deleted: true} if Lifecycle was deleted and returns
{deleted: False} if Lifecycle was not deleted.
CLI Example:
.. code-... | Delete the lifecycle configuration for the given bucket
Returns {deleted: true} if Lifecycle was deleted and returns
{deleted: False} if Lifecycle was not deleted.
CLI Example:
.. code-block:: bash
salt myminion boto_s3_bucket.delete_lifecycle_configuration my_bucket | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3_bucket.py#L869-L890 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon S3 Buckets
.. versionadded:: 2016.3.0
:depends:
- boto
- boto3
The dependencies listed above can be installed via package or pip.
:configuration: This module accepts explicit Lambda credentials but can also
utilize IAM roles assigned to the instan... |
saltstack/salt | salt/modules/boto_s3_bucket.py | delete_replication | python | def delete_replication(Bucket,
region=None, key=None, keyid=None, profile=None):
'''
Delete the replication config from the given bucket
Returns {deleted: true} if replication configuration was deleted and returns
{deleted: False} if replication configuration was not deleted.
CLI Exampl... | Delete the replication config from the given bucket
Returns {deleted: true} if replication configuration was deleted and returns
{deleted: False} if replication configuration was not deleted.
CLI Example:
.. code-block:: bash
salt myminion boto_s3_bucket.delete_replication my_bucket | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3_bucket.py#L917-L938 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon S3 Buckets
.. versionadded:: 2016.3.0
:depends:
- boto
- boto3
The dependencies listed above can be installed via package or pip.
:configuration: This module accepts explicit Lambda credentials but can also
utilize IAM roles assigned to the instan... |
saltstack/salt | salt/modules/boto_s3_bucket.py | delete_tagging | python | def delete_tagging(Bucket,
region=None, key=None, keyid=None, profile=None):
'''
Delete the tags from the given bucket
Returns {deleted: true} if tags were deleted and returns
{deleted: False} if tags were not deleted.
CLI Example:
.. code-block:: bash
salt myminion boto_s... | Delete the tags from the given bucket
Returns {deleted: true} if tags were deleted and returns
{deleted: False} if tags were not deleted.
CLI Example:
.. code-block:: bash
salt myminion boto_s3_bucket.delete_tagging my_bucket | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3_bucket.py#L941-L962 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon S3 Buckets
.. versionadded:: 2016.3.0
:depends:
- boto
- boto3
The dependencies listed above can be installed via package or pip.
:configuration: This module accepts explicit Lambda credentials but can also
utilize IAM roles assigned to the instan... |
saltstack/salt | salt/modules/boto_s3_bucket.py | delete_website | python | def delete_website(Bucket,
region=None, key=None, keyid=None, profile=None):
'''
Remove the website configuration from the given bucket
Returns {deleted: true} if website configuration was deleted and returns
{deleted: False} if website configuration was not deleted.
CLI Example:
.... | Remove the website configuration from the given bucket
Returns {deleted: true} if website configuration was deleted and returns
{deleted: False} if website configuration was not deleted.
CLI Example:
.. code-block:: bash
salt myminion boto_s3_bucket.delete_website my_bucket | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3_bucket.py#L965-L986 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon S3 Buckets
.. versionadded:: 2016.3.0
:depends:
- boto
- boto3
The dependencies listed above can be installed via package or pip.
:configuration: This module accepts explicit Lambda credentials but can also
utilize IAM roles assigned to the instan... |
saltstack/salt | salt/acl/__init__.py | PublisherACL.user_is_blacklisted | python | def user_is_blacklisted(self, user):
'''
Takes a username as a string and returns a boolean. True indicates that
the provided user has been blacklisted
'''
return not salt.utils.stringutils.check_whitelist_blacklist(user, blacklist=self.blacklist.get('users', [])) | Takes a username as a string and returns a boolean. True indicates that
the provided user has been blacklisted | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/acl/__init__.py#L29-L34 | null | class PublisherACL(object):
'''
Represents the publisher ACL and provides methods
to query the ACL for given operations
'''
def __init__(self, blacklist):
self.blacklist = blacklist
def cmd_is_blacklisted(self, cmd):
# If this is a regular command, it is a single function
... |
saltstack/salt | salt/states/pagerduty_escalation_policy.py | present | python | def present(profile='pagerduty', subdomain=None, api_key=None, **kwargs):
'''
Ensure that a pagerduty escalation policy exists. Will create or update as needed.
This method accepts as args everything defined in
https://developer.pagerduty.com/documentation/rest/escalation_policies/create.
In addit... | Ensure that a pagerduty escalation policy exists. Will create or update as needed.
This method accepts as args everything defined in
https://developer.pagerduty.com/documentation/rest/escalation_policies/create.
In addition, user and schedule id's will be translated from name (or email address)
into P... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pagerduty_escalation_policy.py#L49-L107 | null | # -*- coding: utf-8 -*-
'''
Manage PagerDuty escalation policies.
Schedules and users can be referenced by pagerduty ID, or by name, or by email address.
For example:
.. code-block:: yaml
ensure test escalation policy:
pagerduty_escalation_policy.present:
- name: bruce test escalation polic... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.