partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | deployed | Ensures that the given application is deployed on server.
jboss_config:
Dict with connection properties (see state description)
salt_source:
How to find the artifact to be deployed.
target_file:
Where to look in the minion's file system for the artifact to be deploye... | salt/states/jboss7.py | def deployed(name, jboss_config, salt_source=None):
'''Ensures that the given application is deployed on server.
jboss_config:
Dict with connection properties (see state description)
salt_source:
How to find the artifact to be deployed.
target_file:
Where to look... | def deployed(name, jboss_config, salt_source=None):
'''Ensures that the given application is deployed on server.
jboss_config:
Dict with connection properties (see state description)
salt_source:
How to find the artifact to be deployed.
target_file:
Where to look... | [
"Ensures",
"that",
"the",
"given",
"application",
"is",
"deployed",
"on",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/jboss7.py#L273-L380 | [
"def",
"deployed",
"(",
"name",
",",
"jboss_config",
",",
"salt_source",
"=",
"None",
")",
":",
"log",
".",
"debug",
"(",
"\" ======================== STATE: jboss7.deployed (name: %s) \"",
",",
"name",
")",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | reloaded | Reloads configuration of jboss server.
jboss_config:
Dict with connection properties (see state description)
timeout:
Time to wait until jboss is back in running state. Default timeout is 60s.
interval:
Interval between state checks. Default interval is 5s. Decreasing the interval m... | salt/states/jboss7.py | def reloaded(name, jboss_config, timeout=60, interval=5):
'''
Reloads configuration of jboss server.
jboss_config:
Dict with connection properties (see state description)
timeout:
Time to wait until jboss is back in running state. Default timeout is 60s.
interval:
Interval b... | def reloaded(name, jboss_config, timeout=60, interval=5):
'''
Reloads configuration of jboss server.
jboss_config:
Dict with connection properties (see state description)
timeout:
Time to wait until jboss is back in running state. Default timeout is 60s.
interval:
Interval b... | [
"Reloads",
"configuration",
"of",
"jboss",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/jboss7.py#L484-L549 | [
"def",
"reloaded",
"(",
"name",
",",
"jboss_config",
",",
"timeout",
"=",
"60",
",",
"interval",
"=",
"5",
")",
":",
"log",
".",
"debug",
"(",
"\" ======================== STATE: jboss7.reloaded (name: %s) \"",
",",
"name",
")",
"ret",
"=",
"{",
"'name'",
":",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | valid_username | Validates a username based on the guidelines in `useradd(8)` | salt/utils/validate/user.py | def valid_username(user):
'''
Validates a username based on the guidelines in `useradd(8)`
'''
if not isinstance(user, six.string_types):
return False
if len(user) > 32:
return False
return VALID_USERNAME.match(user) is not None | def valid_username(user):
'''
Validates a username based on the guidelines in `useradd(8)`
'''
if not isinstance(user, six.string_types):
return False
if len(user) > 32:
return False
return VALID_USERNAME.match(user) is not None | [
"Validates",
"a",
"username",
"based",
"on",
"the",
"guidelines",
"in",
"useradd",
"(",
"8",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/validate/user.py#L17-L27 | [
"def",
"valid_username",
"(",
"user",
")",
":",
"if",
"not",
"isinstance",
"(",
"user",
",",
"six",
".",
"string_types",
")",
":",
"return",
"False",
"if",
"len",
"(",
"user",
")",
">",
"32",
":",
"return",
"False",
"return",
"VALID_USERNAME",
".",
"ma... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | load_states | This loads our states into the salt __context__ | salt/renderers/pyobjects.py | def load_states():
'''
This loads our states into the salt __context__
'''
states = {}
# the loader expects to find pillar & grain data
__opts__['grains'] = salt.loader.grains(__opts__)
__opts__['pillar'] = __pillar__
lazy_utils = salt.loader.utils(__opts__)
lazy_funcs = salt.loader... | def load_states():
'''
This loads our states into the salt __context__
'''
states = {}
# the loader expects to find pillar & grain data
__opts__['grains'] = salt.loader.grains(__opts__)
__opts__['pillar'] = __pillar__
lazy_utils = salt.loader.utils(__opts__)
lazy_funcs = salt.loader... | [
"This",
"loads",
"our",
"states",
"into",
"the",
"salt",
"__context__"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/renderers/pyobjects.py#L339-L365 | [
"def",
"load_states",
"(",
")",
":",
"states",
"=",
"{",
"}",
"# the loader expects to find pillar & grain data",
"__opts__",
"[",
"'grains'",
"]",
"=",
"salt",
".",
"loader",
".",
"grains",
"(",
"__opts__",
")",
"__opts__",
"[",
"'pillar'",
"]",
"=",
"__pilla... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | send_message | Send a message to the google chat room specified in the webhook url.
.. code-block:: bash
salt '*' google_chat.send_message "https://chat.googleapis.com/v1/spaces/example_space/messages?key=example_key" "This is a test message" | salt/modules/google_chat.py | def send_message(url, message):
'''
Send a message to the google chat room specified in the webhook url.
.. code-block:: bash
salt '*' google_chat.send_message "https://chat.googleapis.com/v1/spaces/example_space/messages?key=example_key" "This is a test message"
'''
headers = {'Content-Ty... | def send_message(url, message):
'''
Send a message to the google chat room specified in the webhook url.
.. code-block:: bash
salt '*' google_chat.send_message "https://chat.googleapis.com/v1/spaces/example_space/messages?key=example_key" "This is a test message"
'''
headers = {'Content-Ty... | [
"Send",
"a",
"message",
"to",
"the",
"google",
"chat",
"room",
"specified",
"in",
"the",
"webhook",
"url",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/google_chat.py#L36-L56 | [
"def",
"send_message",
"(",
"url",
",",
"message",
")",
":",
"headers",
"=",
"{",
"'Content-Type'",
":",
"'application/json'",
"}",
"data",
"=",
"{",
"'text'",
":",
"message",
"}",
"result",
"=",
"__utils__",
"[",
"'http.query'",
"]",
"(",
"url",
",",
"'... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | raise_error | Raise an exception with __name__ from name, args from args
If args is None Otherwise message from message\
If name is empty then use "Exception" | salt/utils/error.py | def raise_error(name=None, args=None, message=''):
'''
Raise an exception with __name__ from name, args from args
If args is None Otherwise message from message\
If name is empty then use "Exception"
'''
name = name or 'Exception'
if hasattr(salt.exceptions, name):
ex = getattr(salt.... | def raise_error(name=None, args=None, message=''):
'''
Raise an exception with __name__ from name, args from args
If args is None Otherwise message from message\
If name is empty then use "Exception"
'''
name = name or 'Exception'
if hasattr(salt.exceptions, name):
ex = getattr(salt.... | [
"Raise",
"an",
"exception",
"with",
"__name__",
"from",
"name",
"args",
"from",
"args",
"If",
"args",
"is",
"None",
"Otherwise",
"message",
"from",
"message",
"\\",
"If",
"name",
"is",
"empty",
"then",
"use",
"Exception"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/error.py#L16-L33 | [
"def",
"raise_error",
"(",
"name",
"=",
"None",
",",
"args",
"=",
"None",
",",
"message",
"=",
"''",
")",
":",
"name",
"=",
"name",
"or",
"'Exception'",
"if",
"hasattr",
"(",
"salt",
".",
"exceptions",
",",
"name",
")",
":",
"ex",
"=",
"getattr",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | fire_exception | Fire raw exception across the event bus | salt/utils/error.py | def fire_exception(exc, opts, job=None, node='minion'):
'''
Fire raw exception across the event bus
'''
if job is None:
job = {}
event = salt.utils.event.SaltEvent(node, opts=opts, listen=False)
event.fire_event(pack_exception(exc), '_salt_error') | def fire_exception(exc, opts, job=None, node='minion'):
'''
Fire raw exception across the event bus
'''
if job is None:
job = {}
event = salt.utils.event.SaltEvent(node, opts=opts, listen=False)
event.fire_event(pack_exception(exc), '_salt_error') | [
"Fire",
"raw",
"exception",
"across",
"the",
"event",
"bus"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/error.py#L44-L51 | [
"def",
"fire_exception",
"(",
"exc",
",",
"opts",
",",
"job",
"=",
"None",
",",
"node",
"=",
"'minion'",
")",
":",
"if",
"job",
"is",
"None",
":",
"job",
"=",
"{",
"}",
"event",
"=",
"salt",
".",
"utils",
".",
"event",
".",
"SaltEvent",
"(",
"nod... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | render | Accepts a message pack string or a file object, renders said data back to
a python dict.
.. note:
This renderer is NOT intended for use in creating sls files by hand,
but exists to allow for data backends to serialize the highdata
structure in an easily transportable way. This is to all... | salt/renderers/msgpack.py | def render(msgpack_data, saltenv='base', sls='', **kws):
'''
Accepts a message pack string or a file object, renders said data back to
a python dict.
.. note:
This renderer is NOT intended for use in creating sls files by hand,
but exists to allow for data backends to serialize the high... | def render(msgpack_data, saltenv='base', sls='', **kws):
'''
Accepts a message pack string or a file object, renders said data back to
a python dict.
.. note:
This renderer is NOT intended for use in creating sls files by hand,
but exists to allow for data backends to serialize the high... | [
"Accepts",
"a",
"message",
"pack",
"string",
"or",
"a",
"file",
"object",
"renders",
"said",
"data",
"back",
"to",
"a",
"python",
"dict",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/renderers/msgpack.py#L9-L29 | [
"def",
"render",
"(",
"msgpack_data",
",",
"saltenv",
"=",
"'base'",
",",
"sls",
"=",
"''",
",",
"*",
"*",
"kws",
")",
":",
"if",
"not",
"isinstance",
"(",
"msgpack_data",
",",
"six",
".",
"string_types",
")",
":",
"msgpack_data",
"=",
"msgpack_data",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | init_git_pillar | Clear out the ext pillar caches, used when the master starts | salt/daemons/masterapi.py | def init_git_pillar(opts):
'''
Clear out the ext pillar caches, used when the master starts
'''
ret = []
for opts_dict in [x for x in opts.get('ext_pillar', [])]:
if 'git' in opts_dict:
try:
pillar = salt.utils.gitfs.GitPillar(
opts,
... | def init_git_pillar(opts):
'''
Clear out the ext pillar caches, used when the master starts
'''
ret = []
for opts_dict in [x for x in opts.get('ext_pillar', [])]:
if 'git' in opts_dict:
try:
pillar = salt.utils.gitfs.GitPillar(
opts,
... | [
"Clear",
"out",
"the",
"ext",
"pillar",
"caches",
"used",
"when",
"the",
"master",
"starts"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L68-L88 | [
"def",
"init_git_pillar",
"(",
"opts",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"opts_dict",
"in",
"[",
"x",
"for",
"x",
"in",
"opts",
".",
"get",
"(",
"'ext_pillar'",
",",
"[",
"]",
")",
"]",
":",
"if",
"'git'",
"in",
"opts_dict",
":",
"try",
":",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | clean_fsbackend | Clean out the old fileserver backends | salt/daemons/masterapi.py | def clean_fsbackend(opts):
'''
Clean out the old fileserver backends
'''
# Clear remote fileserver backend caches so they get recreated
for backend in ('git', 'hg', 'svn'):
if backend in opts['fileserver_backend']:
env_cache = os.path.join(
opts['cachedir'],
... | def clean_fsbackend(opts):
'''
Clean out the old fileserver backends
'''
# Clear remote fileserver backend caches so they get recreated
for backend in ('git', 'hg', 'svn'):
if backend in opts['fileserver_backend']:
env_cache = os.path.join(
opts['cachedir'],
... | [
"Clean",
"out",
"the",
"old",
"fileserver",
"backends"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L91-L130 | [
"def",
"clean_fsbackend",
"(",
"opts",
")",
":",
"# Clear remote fileserver backend caches so they get recreated",
"for",
"backend",
"in",
"(",
"'git'",
",",
"'hg'",
",",
"'svn'",
")",
":",
"if",
"backend",
"in",
"opts",
"[",
"'fileserver_backend'",
"]",
":",
"env... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | clean_expired_tokens | Clean expired tokens from the master | salt/daemons/masterapi.py | def clean_expired_tokens(opts):
'''
Clean expired tokens from the master
'''
loadauth = salt.auth.LoadAuth(opts)
for tok in loadauth.list_tokens():
token_data = loadauth.get_tok(tok)
if 'expire' not in token_data or token_data.get('expire', 0) < time.time():
loadauth.rm_t... | def clean_expired_tokens(opts):
'''
Clean expired tokens from the master
'''
loadauth = salt.auth.LoadAuth(opts)
for tok in loadauth.list_tokens():
token_data = loadauth.get_tok(tok)
if 'expire' not in token_data or token_data.get('expire', 0) < time.time():
loadauth.rm_t... | [
"Clean",
"expired",
"tokens",
"from",
"the",
"master"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L133-L141 | [
"def",
"clean_expired_tokens",
"(",
"opts",
")",
":",
"loadauth",
"=",
"salt",
".",
"auth",
".",
"LoadAuth",
"(",
"opts",
")",
"for",
"tok",
"in",
"loadauth",
".",
"list_tokens",
"(",
")",
":",
"token_data",
"=",
"loadauth",
".",
"get_tok",
"(",
"tok",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | clean_old_jobs | Clean out the old jobs from the job cache | salt/daemons/masterapi.py | def clean_old_jobs(opts):
'''
Clean out the old jobs from the job cache
'''
# TODO: better way to not require creating the masterminion every time?
mminion = salt.minion.MasterMinion(
opts,
states=False,
rend=False,
)
# If the maste... | def clean_old_jobs(opts):
'''
Clean out the old jobs from the job cache
'''
# TODO: better way to not require creating the masterminion every time?
mminion = salt.minion.MasterMinion(
opts,
states=False,
rend=False,
)
# If the maste... | [
"Clean",
"out",
"the",
"old",
"jobs",
"from",
"the",
"job",
"cache"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L162-L175 | [
"def",
"clean_old_jobs",
"(",
"opts",
")",
":",
"# TODO: better way to not require creating the masterminion every time?",
"mminion",
"=",
"salt",
".",
"minion",
".",
"MasterMinion",
"(",
"opts",
",",
"states",
"=",
"False",
",",
"rend",
"=",
"False",
",",
")",
"#... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | clean_proc_dir | Clean out old tracked jobs running on the master
Generally, anything tracking a job should remove the job
once the job has finished. However, this will remove any
jobs that for some reason were not properly removed
when finished or errored. | salt/daemons/masterapi.py | def clean_proc_dir(opts):
'''
Clean out old tracked jobs running on the master
Generally, anything tracking a job should remove the job
once the job has finished. However, this will remove any
jobs that for some reason were not properly removed
when finished or errored.
'''
serial = sal... | def clean_proc_dir(opts):
'''
Clean out old tracked jobs running on the master
Generally, anything tracking a job should remove the job
once the job has finished. However, this will remove any
jobs that for some reason were not properly removed
when finished or errored.
'''
serial = sal... | [
"Clean",
"out",
"old",
"tracked",
"jobs",
"running",
"on",
"the",
"master"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L178-L211 | [
"def",
"clean_proc_dir",
"(",
"opts",
")",
":",
"serial",
"=",
"salt",
".",
"payload",
".",
"Serial",
"(",
"opts",
")",
"proc_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"opts",
"[",
"'cachedir'",
"]",
",",
"'proc'",
")",
"for",
"fn_",
"in",
"o... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | access_keys | A key needs to be placed in the filesystem with permissions 0400 so
clients are required to run as root. | salt/daemons/masterapi.py | def access_keys(opts):
'''
A key needs to be placed in the filesystem with permissions 0400 so
clients are required to run as root.
'''
# TODO: Need a way to get all available users for systems not supported by pwd module.
# For now users pattern matching will not work for publisher_acl.
... | def access_keys(opts):
'''
A key needs to be placed in the filesystem with permissions 0400 so
clients are required to run as root.
'''
# TODO: Need a way to get all available users for systems not supported by pwd module.
# For now users pattern matching will not work for publisher_acl.
... | [
"A",
"key",
"needs",
"to",
"be",
"placed",
"in",
"the",
"filesystem",
"with",
"permissions",
"0400",
"so",
"clients",
"are",
"required",
"to",
"run",
"as",
"root",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L259-L287 | [
"def",
"access_keys",
"(",
"opts",
")",
":",
"# TODO: Need a way to get all available users for systems not supported by pwd module.",
"# For now users pattern matching will not work for publisher_acl.",
"keys",
"=",
"{",
"}",
"publisher_acl",
"=",
"opts",
"[",
"'publisher_acl'... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | fileserver_update | Update the fileserver backends, requires that a salt.fileserver.Fileserver
object be passed in | salt/daemons/masterapi.py | def fileserver_update(fileserver):
'''
Update the fileserver backends, requires that a salt.fileserver.Fileserver
object be passed in
'''
try:
if not fileserver.servers:
log.error(
'No fileservers loaded, the master will not be able to '
'serve fil... | def fileserver_update(fileserver):
'''
Update the fileserver backends, requires that a salt.fileserver.Fileserver
object be passed in
'''
try:
if not fileserver.servers:
log.error(
'No fileservers loaded, the master will not be able to '
'serve fil... | [
"Update",
"the",
"fileserver",
"backends",
"requires",
"that",
"a",
"salt",
".",
"fileserver",
".",
"Fileserver",
"object",
"be",
"passed",
"in"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L290-L307 | [
"def",
"fileserver_update",
"(",
"fileserver",
")",
":",
"try",
":",
"if",
"not",
"fileserver",
".",
"servers",
":",
"log",
".",
"error",
"(",
"'No fileservers loaded, the master will not be able to '",
"'serve files to minions'",
")",
"raise",
"salt",
".",
"exception... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AutoKey.check_permissions | Check if the specified filename has correct permissions | salt/daemons/masterapi.py | def check_permissions(self, filename):
'''
Check if the specified filename has correct permissions
'''
if salt.utils.platform.is_windows():
return True
# After we've ascertained we're not on windows
groups = salt.utils.user.get_gid_list(self.opts['user'], inc... | def check_permissions(self, filename):
'''
Check if the specified filename has correct permissions
'''
if salt.utils.platform.is_windows():
return True
# After we've ascertained we're not on windows
groups = salt.utils.user.get_gid_list(self.opts['user'], inc... | [
"Check",
"if",
"the",
"specified",
"filename",
"has",
"correct",
"permissions"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L318-L342 | [
"def",
"check_permissions",
"(",
"self",
",",
"filename",
")",
":",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"return",
"True",
"# After we've ascertained we're not on windows",
"groups",
"=",
"salt",
".",
"utils",
".",
"us... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AutoKey.check_signing_file | Check a keyid for membership in a signing file | salt/daemons/masterapi.py | def check_signing_file(self, keyid, signing_file):
'''
Check a keyid for membership in a signing file
'''
if not signing_file or not os.path.exists(signing_file):
return False
if not self.check_permissions(signing_file):
log.warning('Wrong permissions for... | def check_signing_file(self, keyid, signing_file):
'''
Check a keyid for membership in a signing file
'''
if not signing_file or not os.path.exists(signing_file):
return False
if not self.check_permissions(signing_file):
log.warning('Wrong permissions for... | [
"Check",
"a",
"keyid",
"for",
"membership",
"in",
"a",
"signing",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L344-L363 | [
"def",
"check_signing_file",
"(",
"self",
",",
"keyid",
",",
"signing_file",
")",
":",
"if",
"not",
"signing_file",
"or",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"signing_file",
")",
":",
"return",
"False",
"if",
"not",
"self",
".",
"check_permission... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AutoKey.check_autosign_dir | Check a keyid for membership in a autosign directory. | salt/daemons/masterapi.py | def check_autosign_dir(self, keyid):
'''
Check a keyid for membership in a autosign directory.
'''
autosign_dir = os.path.join(self.opts['pki_dir'], 'minions_autosign')
# cleanup expired files
expire_minutes = self.opts.get('autosign_timeout', 120)
if expire_minu... | def check_autosign_dir(self, keyid):
'''
Check a keyid for membership in a autosign directory.
'''
autosign_dir = os.path.join(self.opts['pki_dir'], 'minions_autosign')
# cleanup expired files
expire_minutes = self.opts.get('autosign_timeout', 120)
if expire_minu... | [
"Check",
"a",
"keyid",
"for",
"membership",
"in",
"a",
"autosign",
"directory",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L365-L387 | [
"def",
"check_autosign_dir",
"(",
"self",
",",
"keyid",
")",
":",
"autosign_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"opts",
"[",
"'pki_dir'",
"]",
",",
"'minions_autosign'",
")",
"# cleanup expired files",
"expire_minutes",
"=",
"self",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AutoKey.check_autosign_grains | Check for matching grains in the autosign_grains_dir. | salt/daemons/masterapi.py | def check_autosign_grains(self, autosign_grains):
'''
Check for matching grains in the autosign_grains_dir.
'''
if not autosign_grains or 'autosign_grains_dir' not in self.opts:
return False
autosign_grains_dir = self.opts['autosign_grains_dir']
for root, dir... | def check_autosign_grains(self, autosign_grains):
'''
Check for matching grains in the autosign_grains_dir.
'''
if not autosign_grains or 'autosign_grains_dir' not in self.opts:
return False
autosign_grains_dir = self.opts['autosign_grains_dir']
for root, dir... | [
"Check",
"for",
"matching",
"grains",
"in",
"the",
"autosign_grains_dir",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L389-L416 | [
"def",
"check_autosign_grains",
"(",
"self",
",",
"autosign_grains",
")",
":",
"if",
"not",
"autosign_grains",
"or",
"'autosign_grains_dir'",
"not",
"in",
"self",
".",
"opts",
":",
"return",
"False",
"autosign_grains_dir",
"=",
"self",
".",
"opts",
"[",
"'autosi... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AutoKey.check_autosign | Checks if the specified keyid should automatically be signed. | salt/daemons/masterapi.py | def check_autosign(self, keyid, autosign_grains=None):
'''
Checks if the specified keyid should automatically be signed.
'''
if self.opts['auto_accept']:
return True
if self.check_signing_file(keyid, self.opts.get('autosign_file', None)):
return True
... | def check_autosign(self, keyid, autosign_grains=None):
'''
Checks if the specified keyid should automatically be signed.
'''
if self.opts['auto_accept']:
return True
if self.check_signing_file(keyid, self.opts.get('autosign_file', None)):
return True
... | [
"Checks",
"if",
"the",
"specified",
"keyid",
"should",
"automatically",
"be",
"signed",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L427-L439 | [
"def",
"check_autosign",
"(",
"self",
",",
"keyid",
",",
"autosign_grains",
"=",
"None",
")",
":",
"if",
"self",
".",
"opts",
"[",
"'auto_accept'",
"]",
":",
"return",
"True",
"if",
"self",
".",
"check_signing_file",
"(",
"keyid",
",",
"self",
".",
"opts... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RemoteFuncs.__setup_fileserver | Set the local file objects from the file server interface | salt/daemons/masterapi.py | def __setup_fileserver(self):
'''
Set the local file objects from the file server interface
'''
fs_ = salt.fileserver.Fileserver(self.opts)
self._serve_file = fs_.serve_file
self._file_find = fs_._find_file
self._file_hash = fs_.file_hash
self._file_list =... | def __setup_fileserver(self):
'''
Set the local file objects from the file server interface
'''
fs_ = salt.fileserver.Fileserver(self.opts)
self._serve_file = fs_.serve_file
self._file_find = fs_._find_file
self._file_hash = fs_.file_hash
self._file_list =... | [
"Set",
"the",
"local",
"file",
"objects",
"from",
"the",
"file",
"server",
"interface"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L469-L481 | [
"def",
"__setup_fileserver",
"(",
"self",
")",
":",
"fs_",
"=",
"salt",
".",
"fileserver",
".",
"Fileserver",
"(",
"self",
".",
"opts",
")",
"self",
".",
"_serve_file",
"=",
"fs_",
".",
"serve_file",
"self",
".",
"_file_find",
"=",
"fs_",
".",
"_find_fil... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RemoteFuncs.__verify_minion_publish | Verify that the passed information authorized a minion to execute | salt/daemons/masterapi.py | def __verify_minion_publish(self, load):
'''
Verify that the passed information authorized a minion to execute
'''
# Verify that the load is valid
if 'peer' not in self.opts:
return False
if not isinstance(self.opts['peer'], dict):
return False
... | def __verify_minion_publish(self, load):
'''
Verify that the passed information authorized a minion to execute
'''
# Verify that the load is valid
if 'peer' not in self.opts:
return False
if not isinstance(self.opts['peer'], dict):
return False
... | [
"Verify",
"that",
"the",
"passed",
"information",
"authorized",
"a",
"minion",
"to",
"execute"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L483-L517 | [
"def",
"__verify_minion_publish",
"(",
"self",
",",
"load",
")",
":",
"# Verify that the load is valid",
"if",
"'peer'",
"not",
"in",
"self",
".",
"opts",
":",
"return",
"False",
"if",
"not",
"isinstance",
"(",
"self",
".",
"opts",
"[",
"'peer'",
"]",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RemoteFuncs._master_opts | Return the master options to the minion | salt/daemons/masterapi.py | def _master_opts(self, load):
'''
Return the master options to the minion
'''
mopts = {}
file_roots = {}
envs = self._file_envs()
for saltenv in envs:
if saltenv not in file_roots:
file_roots[saltenv] = []
mopts['file_roots'] = ... | def _master_opts(self, load):
'''
Return the master options to the minion
'''
mopts = {}
file_roots = {}
envs = self._file_envs()
for saltenv in envs:
if saltenv not in file_roots:
file_roots[saltenv] = []
mopts['file_roots'] = ... | [
"Return",
"the",
"master",
"options",
"to",
"the",
"minion"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L519-L547 | [
"def",
"_master_opts",
"(",
"self",
",",
"load",
")",
":",
"mopts",
"=",
"{",
"}",
"file_roots",
"=",
"{",
"}",
"envs",
"=",
"self",
".",
"_file_envs",
"(",
")",
"for",
"saltenv",
"in",
"envs",
":",
"if",
"saltenv",
"not",
"in",
"file_roots",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RemoteFuncs._master_tops | Return the results from master_tops if configured | salt/daemons/masterapi.py | def _master_tops(self, load, skip_verify=False):
'''
Return the results from master_tops if configured
'''
if not skip_verify:
if 'id' not in load:
log.error('Received call for external nodes without an id')
return {}
if not salt.ut... | def _master_tops(self, load, skip_verify=False):
'''
Return the results from master_tops if configured
'''
if not skip_verify:
if 'id' not in load:
log.error('Received call for external nodes without an id')
return {}
if not salt.ut... | [
"Return",
"the",
"results",
"from",
"master_tops",
"if",
"configured"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L549-L580 | [
"def",
"_master_tops",
"(",
"self",
",",
"load",
",",
"skip_verify",
"=",
"False",
")",
":",
"if",
"not",
"skip_verify",
":",
"if",
"'id'",
"not",
"in",
"load",
":",
"log",
".",
"error",
"(",
"'Received call for external nodes without an id'",
")",
"return",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RemoteFuncs._mine_get | Gathers the data from the specified minions' mine | salt/daemons/masterapi.py | def _mine_get(self, load, skip_verify=False):
'''
Gathers the data from the specified minions' mine
'''
if not skip_verify:
if any(key not in load for key in ('id', 'tgt', 'fun')):
return {}
if isinstance(load['fun'], six.string_types):
fu... | def _mine_get(self, load, skip_verify=False):
'''
Gathers the data from the specified minions' mine
'''
if not skip_verify:
if any(key not in load for key in ('id', 'tgt', 'fun')):
return {}
if isinstance(load['fun'], six.string_types):
fu... | [
"Gathers",
"the",
"data",
"from",
"the",
"specified",
"minions",
"mine"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L582-L658 | [
"def",
"_mine_get",
"(",
"self",
",",
"load",
",",
"skip_verify",
"=",
"False",
")",
":",
"if",
"not",
"skip_verify",
":",
"if",
"any",
"(",
"key",
"not",
"in",
"load",
"for",
"key",
"in",
"(",
"'id'",
",",
"'tgt'",
",",
"'fun'",
")",
")",
":",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RemoteFuncs._mine | Return the mine data | salt/daemons/masterapi.py | def _mine(self, load, skip_verify=False):
'''
Return the mine data
'''
if not skip_verify:
if 'id' not in load or 'data' not in load:
return False
if self.opts.get('minion_data_cache', False) or self.opts.get('enforce_mine_cache', False):
c... | def _mine(self, load, skip_verify=False):
'''
Return the mine data
'''
if not skip_verify:
if 'id' not in load or 'data' not in load:
return False
if self.opts.get('minion_data_cache', False) or self.opts.get('enforce_mine_cache', False):
c... | [
"Return",
"the",
"mine",
"data"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L660-L676 | [
"def",
"_mine",
"(",
"self",
",",
"load",
",",
"skip_verify",
"=",
"False",
")",
":",
"if",
"not",
"skip_verify",
":",
"if",
"'id'",
"not",
"in",
"load",
"or",
"'data'",
"not",
"in",
"load",
":",
"return",
"False",
"if",
"self",
".",
"opts",
".",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RemoteFuncs._mine_delete | Allow the minion to delete a specific function from its own mine | salt/daemons/masterapi.py | def _mine_delete(self, load):
'''
Allow the minion to delete a specific function from its own mine
'''
if 'id' not in load or 'fun' not in load:
return False
if self.opts.get('minion_data_cache', False) or self.opts.get('enforce_mine_cache', False):
cbank ... | def _mine_delete(self, load):
'''
Allow the minion to delete a specific function from its own mine
'''
if 'id' not in load or 'fun' not in load:
return False
if self.opts.get('minion_data_cache', False) or self.opts.get('enforce_mine_cache', False):
cbank ... | [
"Allow",
"the",
"minion",
"to",
"delete",
"a",
"specific",
"function",
"from",
"its",
"own",
"mine"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L678-L696 | [
"def",
"_mine_delete",
"(",
"self",
",",
"load",
")",
":",
"if",
"'id'",
"not",
"in",
"load",
"or",
"'fun'",
"not",
"in",
"load",
":",
"return",
"False",
"if",
"self",
".",
"opts",
".",
"get",
"(",
"'minion_data_cache'",
",",
"False",
")",
"or",
"sel... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RemoteFuncs._mine_flush | Allow the minion to delete all of its own mine contents | salt/daemons/masterapi.py | def _mine_flush(self, load, skip_verify=False):
'''
Allow the minion to delete all of its own mine contents
'''
if not skip_verify and 'id' not in load:
return False
if self.opts.get('minion_data_cache', False) or self.opts.get('enforce_mine_cache', False):
... | def _mine_flush(self, load, skip_verify=False):
'''
Allow the minion to delete all of its own mine contents
'''
if not skip_verify and 'id' not in load:
return False
if self.opts.get('minion_data_cache', False) or self.opts.get('enforce_mine_cache', False):
... | [
"Allow",
"the",
"minion",
"to",
"delete",
"all",
"of",
"its",
"own",
"mine",
"contents"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L698-L706 | [
"def",
"_mine_flush",
"(",
"self",
",",
"load",
",",
"skip_verify",
"=",
"False",
")",
":",
"if",
"not",
"skip_verify",
"and",
"'id'",
"not",
"in",
"load",
":",
"return",
"False",
"if",
"self",
".",
"opts",
".",
"get",
"(",
"'minion_data_cache'",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RemoteFuncs._file_recv | Allows minions to send files to the master, files are sent to the
master file cache | salt/daemons/masterapi.py | def _file_recv(self, load):
'''
Allows minions to send files to the master, files are sent to the
master file cache
'''
if any(key not in load for key in ('id', 'path', 'loc')):
return False
if not self.opts['file_recv'] or os.path.isabs(load['path']):
... | def _file_recv(self, load):
'''
Allows minions to send files to the master, files are sent to the
master file cache
'''
if any(key not in load for key in ('id', 'path', 'loc')):
return False
if not self.opts['file_recv'] or os.path.isabs(load['path']):
... | [
"Allows",
"minions",
"to",
"send",
"files",
"to",
"the",
"master",
"files",
"are",
"sent",
"to",
"the",
"master",
"file",
"cache"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L708-L767 | [
"def",
"_file_recv",
"(",
"self",
",",
"load",
")",
":",
"if",
"any",
"(",
"key",
"not",
"in",
"load",
"for",
"key",
"in",
"(",
"'id'",
",",
"'path'",
",",
"'loc'",
")",
")",
":",
"return",
"False",
"if",
"not",
"self",
".",
"opts",
"[",
"'file_r... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RemoteFuncs._pillar | Return the pillar data for the minion | salt/daemons/masterapi.py | def _pillar(self, load):
'''
Return the pillar data for the minion
'''
if any(key not in load for key in ('id', 'grains')):
return False
# pillar = salt.pillar.Pillar(
log.debug('Master _pillar using ext: %s', load.get('ext'))
pillar = salt.pillar.get_p... | def _pillar(self, load):
'''
Return the pillar data for the minion
'''
if any(key not in load for key in ('id', 'grains')):
return False
# pillar = salt.pillar.Pillar(
log.debug('Master _pillar using ext: %s', load.get('ext'))
pillar = salt.pillar.get_p... | [
"Return",
"the",
"pillar",
"data",
"for",
"the",
"minion"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L769-L792 | [
"def",
"_pillar",
"(",
"self",
",",
"load",
")",
":",
"if",
"any",
"(",
"key",
"not",
"in",
"load",
"for",
"key",
"in",
"(",
"'id'",
",",
"'grains'",
")",
")",
":",
"return",
"False",
"# pillar = salt.pillar.Pillar(",
"log",
".",
"debug",
"(",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RemoteFuncs._minion_event | Receive an event from the minion and fire it on the master event
interface | salt/daemons/masterapi.py | def _minion_event(self, load):
'''
Receive an event from the minion and fire it on the master event
interface
'''
if 'id' not in load:
return False
if 'events' not in load and ('tag' not in load or 'data' not in load):
return False
if 'even... | def _minion_event(self, load):
'''
Receive an event from the minion and fire it on the master event
interface
'''
if 'id' not in load:
return False
if 'events' not in load and ('tag' not in load or 'data' not in load):
return False
if 'even... | [
"Receive",
"an",
"event",
"from",
"the",
"minion",
"and",
"fire",
"it",
"on",
"the",
"master",
"event",
"interface"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L794-L815 | [
"def",
"_minion_event",
"(",
"self",
",",
"load",
")",
":",
"if",
"'id'",
"not",
"in",
"load",
":",
"return",
"False",
"if",
"'events'",
"not",
"in",
"load",
"and",
"(",
"'tag'",
"not",
"in",
"load",
"or",
"'data'",
"not",
"in",
"load",
")",
":",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RemoteFuncs._return | Handle the return data sent from the minions | salt/daemons/masterapi.py | def _return(self, load):
'''
Handle the return data sent from the minions
'''
# Generate EndTime
endtime = salt.utils.jid.jid_to_time(salt.utils.jid.gen_jid(self.opts))
# If the return data is invalid, just ignore it
if any(key not in load for key in ('return', 'j... | def _return(self, load):
'''
Handle the return data sent from the minions
'''
# Generate EndTime
endtime = salt.utils.jid.jid_to_time(salt.utils.jid.gen_jid(self.opts))
# If the return data is invalid, just ignore it
if any(key not in load for key in ('return', 'j... | [
"Handle",
"the",
"return",
"data",
"sent",
"from",
"the",
"minions"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L817-L848 | [
"def",
"_return",
"(",
"self",
",",
"load",
")",
":",
"# Generate EndTime",
"endtime",
"=",
"salt",
".",
"utils",
".",
"jid",
".",
"jid_to_time",
"(",
"salt",
".",
"utils",
".",
"jid",
".",
"gen_jid",
"(",
"self",
".",
"opts",
")",
")",
"# If the retur... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RemoteFuncs._syndic_return | Receive a syndic minion return and format it to look like returns from
individual minions. | salt/daemons/masterapi.py | def _syndic_return(self, load):
'''
Receive a syndic minion return and format it to look like returns from
individual minions.
'''
# Verify the load
if any(key not in load for key in ('return', 'jid', 'id')):
return None
# if we have a load, save it
... | def _syndic_return(self, load):
'''
Receive a syndic minion return and format it to look like returns from
individual minions.
'''
# Verify the load
if any(key not in load for key in ('return', 'jid', 'id')):
return None
# if we have a load, save it
... | [
"Receive",
"a",
"syndic",
"minion",
"return",
"and",
"format",
"it",
"to",
"look",
"like",
"returns",
"from",
"individual",
"minions",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L850-L870 | [
"def",
"_syndic_return",
"(",
"self",
",",
"load",
")",
":",
"# Verify the load",
"if",
"any",
"(",
"key",
"not",
"in",
"load",
"for",
"key",
"in",
"(",
"'return'",
",",
"'jid'",
",",
"'id'",
")",
")",
":",
"return",
"None",
"# if we have a load, save it",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RemoteFuncs.minion_runner | Execute a runner from a minion, return the runner's function data | salt/daemons/masterapi.py | def minion_runner(self, load):
'''
Execute a runner from a minion, return the runner's function data
'''
if 'peer_run' not in self.opts:
return {}
if not isinstance(self.opts['peer_run'], dict):
return {}
if any(key not in load for key in ('fun', '... | def minion_runner(self, load):
'''
Execute a runner from a minion, return the runner's function data
'''
if 'peer_run' not in self.opts:
return {}
if not isinstance(self.opts['peer_run'], dict):
return {}
if any(key not in load for key in ('fun', '... | [
"Execute",
"a",
"runner",
"from",
"a",
"minion",
"return",
"the",
"runner",
"s",
"function",
"data"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L872-L908 | [
"def",
"minion_runner",
"(",
"self",
",",
"load",
")",
":",
"if",
"'peer_run'",
"not",
"in",
"self",
".",
"opts",
":",
"return",
"{",
"}",
"if",
"not",
"isinstance",
"(",
"self",
".",
"opts",
"[",
"'peer_run'",
"]",
",",
"dict",
")",
":",
"return",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RemoteFuncs.pub_ret | Request the return data from a specific jid, only allowed
if the requesting minion also initialted the execution. | salt/daemons/masterapi.py | def pub_ret(self, load, skip_verify=False):
'''
Request the return data from a specific jid, only allowed
if the requesting minion also initialted the execution.
'''
if not skip_verify and any(key not in load for key in ('jid', 'id')):
return {}
else:
... | def pub_ret(self, load, skip_verify=False):
'''
Request the return data from a specific jid, only allowed
if the requesting minion also initialted the execution.
'''
if not skip_verify and any(key not in load for key in ('jid', 'id')):
return {}
else:
... | [
"Request",
"the",
"return",
"data",
"from",
"a",
"specific",
"jid",
"only",
"allowed",
"if",
"the",
"requesting",
"minion",
"also",
"initialted",
"the",
"execution",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L910-L928 | [
"def",
"pub_ret",
"(",
"self",
",",
"load",
",",
"skip_verify",
"=",
"False",
")",
":",
"if",
"not",
"skip_verify",
"and",
"any",
"(",
"key",
"not",
"in",
"load",
"for",
"key",
"in",
"(",
"'jid'",
",",
"'id'",
")",
")",
":",
"return",
"{",
"}",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RemoteFuncs.minion_pub | Publish a command initiated from a minion, this method executes minion
restrictions so that the minion publication will only work if it is
enabled in the config.
The configuration on the master allows minions to be matched to
salt functions, so the minions can only publish allowed salt f... | salt/daemons/masterapi.py | def minion_pub(self, load):
'''
Publish a command initiated from a minion, this method executes minion
restrictions so that the minion publication will only work if it is
enabled in the config.
The configuration on the master allows minions to be matched to
salt functions... | def minion_pub(self, load):
'''
Publish a command initiated from a minion, this method executes minion
restrictions so that the minion publication will only work if it is
enabled in the config.
The configuration on the master allows minions to be matched to
salt functions... | [
"Publish",
"a",
"command",
"initiated",
"from",
"a",
"minion",
"this",
"method",
"executes",
"minion",
"restrictions",
"so",
"that",
"the",
"minion",
"publication",
"will",
"only",
"work",
"if",
"it",
"is",
"enabled",
"in",
"the",
"config",
".",
"The",
"conf... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L930-L984 | [
"def",
"minion_pub",
"(",
"self",
",",
"load",
")",
":",
"if",
"not",
"self",
".",
"__verify_minion_publish",
"(",
"load",
")",
":",
"return",
"{",
"}",
"# Set up the publication payload",
"pub_load",
"=",
"{",
"'fun'",
":",
"load",
"[",
"'fun'",
"]",
",",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RemoteFuncs.minion_publish | Publish a command initiated from a minion, this method executes minion
restrictions so that the minion publication will only work if it is
enabled in the config.
The configuration on the master allows minions to be matched to
salt functions, so the minions can only publish allowed salt f... | salt/daemons/masterapi.py | def minion_publish(self, load):
'''
Publish a command initiated from a minion, this method executes minion
restrictions so that the minion publication will only work if it is
enabled in the config.
The configuration on the master allows minions to be matched to
salt funct... | def minion_publish(self, load):
'''
Publish a command initiated from a minion, this method executes minion
restrictions so that the minion publication will only work if it is
enabled in the config.
The configuration on the master allows minions to be matched to
salt funct... | [
"Publish",
"a",
"command",
"initiated",
"from",
"a",
"minion",
"this",
"method",
"executes",
"minion",
"restrictions",
"so",
"that",
"the",
"minion",
"publication",
"will",
"only",
"work",
"if",
"it",
"is",
"enabled",
"in",
"the",
"config",
".",
"The",
"conf... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L986-L1060 | [
"def",
"minion_publish",
"(",
"self",
",",
"load",
")",
":",
"if",
"not",
"self",
".",
"__verify_minion_publish",
"(",
"load",
")",
":",
"return",
"{",
"}",
"# Set up the publication payload",
"pub_load",
"=",
"{",
"'fun'",
":",
"load",
"[",
"'fun'",
"]",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RemoteFuncs.revoke_auth | Allow a minion to request revocation of its own key | salt/daemons/masterapi.py | def revoke_auth(self, load):
'''
Allow a minion to request revocation of its own key
'''
if 'id' not in load:
return False
keyapi = salt.key.Key(self.opts)
keyapi.delete_key(load['id'],
preserve_minions=load.get('preserve_minion_cache... | def revoke_auth(self, load):
'''
Allow a minion to request revocation of its own key
'''
if 'id' not in load:
return False
keyapi = salt.key.Key(self.opts)
keyapi.delete_key(load['id'],
preserve_minions=load.get('preserve_minion_cache... | [
"Allow",
"a",
"minion",
"to",
"request",
"revocation",
"of",
"its",
"own",
"key"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L1062-L1072 | [
"def",
"revoke_auth",
"(",
"self",
",",
"load",
")",
":",
"if",
"'id'",
"not",
"in",
"load",
":",
"return",
"False",
"keyapi",
"=",
"salt",
".",
"key",
".",
"Key",
"(",
"self",
".",
"opts",
")",
"keyapi",
".",
"delete_key",
"(",
"load",
"[",
"'id'"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalFuncs.runner | Send a master control function back to the runner system | salt/daemons/masterapi.py | def runner(self, load):
'''
Send a master control function back to the runner system
'''
# All runner opts pass through eauth
auth_type, err_name, key = self._prep_auth_info(load)
# Authenticate
auth_check = self.loadauth.check_authentication(load, auth_type)
... | def runner(self, load):
'''
Send a master control function back to the runner system
'''
# All runner opts pass through eauth
auth_type, err_name, key = self._prep_auth_info(load)
# Authenticate
auth_check = self.loadauth.check_authentication(load, auth_type)
... | [
"Send",
"a",
"master",
"control",
"function",
"back",
"to",
"the",
"runner",
"system"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L1108-L1149 | [
"def",
"runner",
"(",
"self",
",",
"load",
")",
":",
"# All runner opts pass through eauth",
"auth_type",
",",
"err_name",
",",
"key",
"=",
"self",
".",
"_prep_auth_info",
"(",
"load",
")",
"# Authenticate",
"auth_check",
"=",
"self",
".",
"loadauth",
".",
"ch... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalFuncs.wheel | Send a master control function back to the wheel system | salt/daemons/masterapi.py | def wheel(self, load):
'''
Send a master control function back to the wheel system
'''
# All wheel ops pass through eauth
auth_type, err_name, key = self._prep_auth_info(load)
# Authenticate
auth_check = self.loadauth.check_authentication(
load,
... | def wheel(self, load):
'''
Send a master control function back to the wheel system
'''
# All wheel ops pass through eauth
auth_type, err_name, key = self._prep_auth_info(load)
# Authenticate
auth_check = self.loadauth.check_authentication(
load,
... | [
"Send",
"a",
"master",
"control",
"function",
"back",
"to",
"the",
"wheel",
"system"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L1151-L1213 | [
"def",
"wheel",
"(",
"self",
",",
"load",
")",
":",
"# All wheel ops pass through eauth",
"auth_type",
",",
"err_name",
",",
"key",
"=",
"self",
".",
"_prep_auth_info",
"(",
"load",
")",
"# Authenticate",
"auth_check",
"=",
"self",
".",
"loadauth",
".",
"check... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalFuncs.mk_token | Create and return an authentication token, the clear load needs to
contain the eauth key and the needed authentication creds. | salt/daemons/masterapi.py | def mk_token(self, load):
'''
Create and return an authentication token, the clear load needs to
contain the eauth key and the needed authentication creds.
'''
token = self.loadauth.mk_token(load)
if not token:
log.warning('Authentication failure of type "eaut... | def mk_token(self, load):
'''
Create and return an authentication token, the clear load needs to
contain the eauth key and the needed authentication creds.
'''
token = self.loadauth.mk_token(load)
if not token:
log.warning('Authentication failure of type "eaut... | [
"Create",
"and",
"return",
"an",
"authentication",
"token",
"the",
"clear",
"load",
"needs",
"to",
"contain",
"the",
"eauth",
"key",
"and",
"the",
"needed",
"authentication",
"creds",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L1215-L1224 | [
"def",
"mk_token",
"(",
"self",
",",
"load",
")",
":",
"token",
"=",
"self",
".",
"loadauth",
".",
"mk_token",
"(",
"load",
")",
"if",
"not",
"token",
":",
"log",
".",
"warning",
"(",
"'Authentication failure of type \"eauth\" occurred.'",
")",
"return",
"''... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalFuncs.publish | This method sends out publications to the minions, it can only be used
by the LocalClient. | salt/daemons/masterapi.py | def publish(self, load):
'''
This method sends out publications to the minions, it can only be used
by the LocalClient.
'''
extra = load.get('kwargs', {})
publisher_acl = salt.acl.PublisherACL(self.opts['publisher_acl_blacklist'])
if publisher_acl.user_is_blackl... | def publish(self, load):
'''
This method sends out publications to the minions, it can only be used
by the LocalClient.
'''
extra = load.get('kwargs', {})
publisher_acl = salt.acl.PublisherACL(self.opts['publisher_acl_blacklist'])
if publisher_acl.user_is_blackl... | [
"This",
"method",
"sends",
"out",
"publications",
"to",
"the",
"minions",
"it",
"can",
"only",
"be",
"used",
"by",
"the",
"LocalClient",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L1234-L1428 | [
"def",
"publish",
"(",
"self",
",",
"load",
")",
":",
"extra",
"=",
"load",
".",
"get",
"(",
"'kwargs'",
",",
"{",
"}",
")",
"publisher_acl",
"=",
"salt",
".",
"acl",
".",
"PublisherACL",
"(",
"self",
".",
"opts",
"[",
"'publisher_acl_blacklist'",
"]",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | start | Listen to slack events and forward them to salt, new version | salt/engines/slack.py | def start(token,
control=False,
trigger='!',
groups=None,
groups_pillar_name=None,
fire_all=False,
tag='salt/engines/slack'):
'''
Listen to slack events and forward them to salt, new version
'''
if (not token) or (not token.startswith('xoxb'))... | def start(token,
control=False,
trigger='!',
groups=None,
groups_pillar_name=None,
fire_all=False,
tag='salt/engines/slack'):
'''
Listen to slack events and forward them to salt, new version
'''
if (not token) or (not token.startswith('xoxb'))... | [
"Listen",
"to",
"slack",
"events",
"and",
"forward",
"them",
"to",
"salt",
"new",
"version"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/slack.py#L828-L849 | [
"def",
"start",
"(",
"token",
",",
"control",
"=",
"False",
",",
"trigger",
"=",
"'!'",
",",
"groups",
"=",
"None",
",",
"groups_pillar_name",
"=",
"None",
",",
"fire_all",
"=",
"False",
",",
"tag",
"=",
"'salt/engines/slack'",
")",
":",
"if",
"(",
"no... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SlackClient.get_slack_users | Get all users from Slack | salt/engines/slack.py | def get_slack_users(self, token):
'''
Get all users from Slack
'''
ret = salt.utils.slack.query(function='users',
api_key=token,
opts=__opts__)
users = {}
if 'message' in ret:
for item ... | def get_slack_users(self, token):
'''
Get all users from Slack
'''
ret = salt.utils.slack.query(function='users',
api_key=token,
opts=__opts__)
users = {}
if 'message' in ret:
for item ... | [
"Get",
"all",
"users",
"from",
"Slack"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/slack.py#L197-L212 | [
"def",
"get_slack_users",
"(",
"self",
",",
"token",
")",
":",
"ret",
"=",
"salt",
".",
"utils",
".",
"slack",
".",
"query",
"(",
"function",
"=",
"'users'",
",",
"api_key",
"=",
"token",
",",
"opts",
"=",
"__opts__",
")",
"users",
"=",
"{",
"}",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SlackClient.get_slack_channels | Get all channel names from Slack | salt/engines/slack.py | def get_slack_channels(self, token):
'''
Get all channel names from Slack
'''
ret = salt.utils.slack.query(
function='rooms',
api_key=token,
# These won't be honored until https://github.com/saltstack/salt/pull/41187/files is merged
opts={... | def get_slack_channels(self, token):
'''
Get all channel names from Slack
'''
ret = salt.utils.slack.query(
function='rooms',
api_key=token,
# These won't be honored until https://github.com/saltstack/salt/pull/41187/files is merged
opts={... | [
"Get",
"all",
"channel",
"names",
"from",
"Slack"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/slack.py#L214-L231 | [
"def",
"get_slack_channels",
"(",
"self",
",",
"token",
")",
":",
"ret",
"=",
"salt",
".",
"utils",
".",
"slack",
".",
"query",
"(",
"function",
"=",
"'rooms'",
",",
"api_key",
"=",
"token",
",",
"# These won't be honored until https://github.com/saltstack/salt/pu... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SlackClient.get_config_groups | get info from groups in config, and from the named pillar
todo: add specification for the minion to use to recover pillar | salt/engines/slack.py | def get_config_groups(self, groups_conf, groups_pillar_name):
'''
get info from groups in config, and from the named pillar
todo: add specification for the minion to use to recover pillar
'''
# Get groups
# Default to returning something that'll never match
ret_g... | def get_config_groups(self, groups_conf, groups_pillar_name):
'''
get info from groups in config, and from the named pillar
todo: add specification for the minion to use to recover pillar
'''
# Get groups
# Default to returning something that'll never match
ret_g... | [
"get",
"info",
"from",
"groups",
"in",
"config",
"and",
"from",
"the",
"named",
"pillar"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/slack.py#L233-L286 | [
"def",
"get_config_groups",
"(",
"self",
",",
"groups_conf",
",",
"groups_pillar_name",
")",
":",
"# Get groups",
"# Default to returning something that'll never match",
"ret_groups",
"=",
"{",
"'default'",
":",
"{",
"'users'",
":",
"set",
"(",
")",
",",
"'commands'",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SlackClient._groups_from_pillar | pillar_prefix is the pillar.get syntax for the pillar to be queried.
Group name is gotten via the equivalent of using
``salt['pillar.get']('{}:{}'.format(pillar_prefix, group_name))``
in a jinja template.
returns a dictionary (unless the pillar is mis-formatted)
XXX: instead of ... | salt/engines/slack.py | def _groups_from_pillar(self, pillar_name):
'''
pillar_prefix is the pillar.get syntax for the pillar to be queried.
Group name is gotten via the equivalent of using
``salt['pillar.get']('{}:{}'.format(pillar_prefix, group_name))``
in a jinja template.
returns a dictiona... | def _groups_from_pillar(self, pillar_name):
'''
pillar_prefix is the pillar.get syntax for the pillar to be queried.
Group name is gotten via the equivalent of using
``salt['pillar.get']('{}:{}'.format(pillar_prefix, group_name))``
in a jinja template.
returns a dictiona... | [
"pillar_prefix",
"is",
"the",
"pillar",
".",
"get",
"syntax",
"for",
"the",
"pillar",
"to",
"be",
"queried",
".",
"Group",
"name",
"is",
"gotten",
"via",
"the",
"equivalent",
"of",
"using",
"salt",
"[",
"pillar",
".",
"get",
"]",
"(",
"{}",
":",
"{}",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/slack.py#L288-L306 | [
"def",
"_groups_from_pillar",
"(",
"self",
",",
"pillar_name",
")",
":",
"if",
"pillar_name",
"and",
"__opts__",
"[",
"'__role'",
"]",
"==",
"'minion'",
":",
"pillar_groups",
"=",
"__salt__",
"[",
"'pillar.get'",
"]",
"(",
"pillar_name",
",",
"{",
"}",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SlackClient.fire | This replaces a function in main called 'fire'
It fires an event into the salt bus. | salt/engines/slack.py | def fire(self, tag, msg):
'''
This replaces a function in main called 'fire'
It fires an event into the salt bus.
'''
if __opts__.get('__role') == 'master':
fire_master = salt.utils.event.get_master_event(
__opts__,
__opts__['sock_dir'... | def fire(self, tag, msg):
'''
This replaces a function in main called 'fire'
It fires an event into the salt bus.
'''
if __opts__.get('__role') == 'master':
fire_master = salt.utils.event.get_master_event(
__opts__,
__opts__['sock_dir'... | [
"This",
"replaces",
"a",
"function",
"in",
"main",
"called",
"fire"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/slack.py#L308-L324 | [
"def",
"fire",
"(",
"self",
",",
"tag",
",",
"msg",
")",
":",
"if",
"__opts__",
".",
"get",
"(",
"'__role'",
")",
"==",
"'master'",
":",
"fire_master",
"=",
"salt",
".",
"utils",
".",
"event",
".",
"get_master_event",
"(",
"__opts__",
",",
"__opts__",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SlackClient.can_user_run | Break out the permissions into the following:
Check whether a user is in any group, including whether a group has the '*' membership
:type user: str
:param user: The username being checked against
:type command: str
:param command: The command that is being invoked (e.g. test.... | salt/engines/slack.py | def can_user_run(self, user, command, groups):
'''
Break out the permissions into the following:
Check whether a user is in any group, including whether a group has the '*' membership
:type user: str
:param user: The username being checked against
:type command: str
... | def can_user_run(self, user, command, groups):
'''
Break out the permissions into the following:
Check whether a user is in any group, including whether a group has the '*' membership
:type user: str
:param user: The username being checked against
:type command: str
... | [
"Break",
"out",
"the",
"permissions",
"into",
"the",
"following",
":"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/slack.py#L326-L360 | [
"def",
"can_user_run",
"(",
"self",
",",
"user",
",",
"command",
",",
"groups",
")",
":",
"log",
".",
"info",
"(",
"'%s wants to run %s with groups %s'",
",",
"user",
",",
"command",
",",
"groups",
")",
"for",
"key",
",",
"val",
"in",
"groups",
".",
"ite... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SlackClient.commandline_to_list | cmdline_str is the string of the command line
trigger_string is the trigger string, to be removed | salt/engines/slack.py | def commandline_to_list(self, cmdline_str, trigger_string):
'''
cmdline_str is the string of the command line
trigger_string is the trigger string, to be removed
'''
cmdline = salt.utils.args.shlex_split(cmdline_str[len(trigger_string):])
# Remove slack url parsing
... | def commandline_to_list(self, cmdline_str, trigger_string):
'''
cmdline_str is the string of the command line
trigger_string is the trigger string, to be removed
'''
cmdline = salt.utils.args.shlex_split(cmdline_str[len(trigger_string):])
# Remove slack url parsing
... | [
"cmdline_str",
"is",
"the",
"string",
"of",
"the",
"command",
"line",
"trigger_string",
"is",
"the",
"trigger",
"string",
"to",
"be",
"removed"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/slack.py#L362-L380 | [
"def",
"commandline_to_list",
"(",
"self",
",",
"cmdline_str",
",",
"trigger_string",
")",
":",
"cmdline",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"shlex_split",
"(",
"cmdline_str",
"[",
"len",
"(",
"trigger_string",
")",
":",
"]",
")",
"# Remove slack ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SlackClient.control_message_target | Returns a tuple of (target, cmdline,) for the response
Raises IndexError if a user can't be looked up from all_slack_users
Returns (False, False) if the user doesn't have permission
These are returned together because the commandline and the targeting
interact with the group config (s... | salt/engines/slack.py | def control_message_target(self, slack_user_name, text, loaded_groups, trigger_string):
'''Returns a tuple of (target, cmdline,) for the response
Raises IndexError if a user can't be looked up from all_slack_users
Returns (False, False) if the user doesn't have permission
These are re... | def control_message_target(self, slack_user_name, text, loaded_groups, trigger_string):
'''Returns a tuple of (target, cmdline,) for the response
Raises IndexError if a user can't be looked up from all_slack_users
Returns (False, False) if the user doesn't have permission
These are re... | [
"Returns",
"a",
"tuple",
"of",
"(",
"target",
"cmdline",
")",
"for",
"the",
"response"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/slack.py#L382-L424 | [
"def",
"control_message_target",
"(",
"self",
",",
"slack_user_name",
",",
"text",
",",
"loaded_groups",
",",
"trigger_string",
")",
":",
"# Trim the trigger string from the front",
"# cmdline = _text[1:].split(' ', 1)",
"cmdline",
"=",
"self",
".",
"commandline_to_list",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SlackClient.message_text | Raises ValueError if a value doesn't work out, and TypeError if
this isn't a message type | salt/engines/slack.py | def message_text(self, m_data):
'''
Raises ValueError if a value doesn't work out, and TypeError if
this isn't a message type
'''
if m_data.get('type') != 'message':
raise TypeError('This is not a message')
# Edited messages have text in message
_text ... | def message_text(self, m_data):
'''
Raises ValueError if a value doesn't work out, and TypeError if
this isn't a message type
'''
if m_data.get('type') != 'message':
raise TypeError('This is not a message')
# Edited messages have text in message
_text ... | [
"Raises",
"ValueError",
"if",
"a",
"value",
"doesn",
"t",
"work",
"out",
"and",
"TypeError",
"if",
"this",
"isn",
"t",
"a",
"message",
"type"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/slack.py#L426-L446 | [
"def",
"message_text",
"(",
"self",
",",
"m_data",
")",
":",
"if",
"m_data",
".",
"get",
"(",
"'type'",
")",
"!=",
"'message'",
":",
"raise",
"TypeError",
"(",
"'This is not a message'",
")",
"# Edited messages have text in message",
"_text",
"=",
"m_data",
".",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SlackClient.generate_triggered_messages | slack_token = string
trigger_string = string
input_valid_users = set
input_valid_commands = set
When the trigger_string prefixes the message text, yields a dictionary
of::
{
'message_data': m_data,
'cmdline': cmdline_list, # this is a... | salt/engines/slack.py | def generate_triggered_messages(self, token, trigger_string, groups, groups_pillar_name):
'''
slack_token = string
trigger_string = string
input_valid_users = set
input_valid_commands = set
When the trigger_string prefixes the message text, yields a dictionary
of... | def generate_triggered_messages(self, token, trigger_string, groups, groups_pillar_name):
'''
slack_token = string
trigger_string = string
input_valid_users = set
input_valid_commands = set
When the trigger_string prefixes the message text, yields a dictionary
of... | [
"slack_token",
"=",
"string",
"trigger_string",
"=",
"string",
"input_valid_users",
"=",
"set",
"input_valid_commands",
"=",
"set"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/slack.py#L448-L569 | [
"def",
"generate_triggered_messages",
"(",
"self",
",",
"token",
",",
"trigger_string",
",",
"groups",
",",
"groups_pillar_name",
")",
":",
"all_slack_users",
"=",
"self",
".",
"get_slack_users",
"(",
"token",
")",
"# re-checks this if we have an negative lookup result",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SlackClient.get_target | When we are permitted to run a command on a target, look to see
what the default targeting is for that group, and for that specific
command (if provided).
It's possible for None or False to be the result of either, which means
that it's expected that the caller provide a specific target... | salt/engines/slack.py | def get_target(self, permitted_group, cmdline, alias_cmdline):
'''
When we are permitted to run a command on a target, look to see
what the default targeting is for that group, and for that specific
command (if provided).
It's possible for None or False to be the result of eithe... | def get_target(self, permitted_group, cmdline, alias_cmdline):
'''
When we are permitted to run a command on a target, look to see
what the default targeting is for that group, and for that specific
command (if provided).
It's possible for None or False to be the result of eithe... | [
"When",
"we",
"are",
"permitted",
"to",
"run",
"a",
"command",
"on",
"a",
"target",
"look",
"to",
"see",
"what",
"the",
"default",
"targeting",
"is",
"for",
"that",
"group",
"and",
"for",
"that",
"specific",
"command",
"(",
"if",
"provided",
")",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/slack.py#L571-L631 | [
"def",
"get_target",
"(",
"self",
",",
"permitted_group",
",",
"cmdline",
",",
"alias_cmdline",
")",
":",
"# Default to targeting all minions with a type of glob",
"null_target",
"=",
"{",
"'target'",
":",
"'*'",
",",
"'tgt_type'",
":",
"'glob'",
"}",
"def",
"check_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SlackClient.format_return_text | Print out YAML using the block mode | salt/engines/slack.py | def format_return_text(self, data, function, **kwargs): # pylint: disable=unused-argument
'''
Print out YAML using the block mode
'''
# emulate the yaml_out output formatter. It relies on a global __opts__ object which
# we can't obviously pass in
try:
try:
... | def format_return_text(self, data, function, **kwargs): # pylint: disable=unused-argument
'''
Print out YAML using the block mode
'''
# emulate the yaml_out output formatter. It relies on a global __opts__ object which
# we can't obviously pass in
try:
try:
... | [
"Print",
"out",
"YAML",
"using",
"the",
"block",
"mode"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/slack.py#L633-L655 | [
"def",
"format_return_text",
"(",
"self",
",",
"data",
",",
"function",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"# emulate the yaml_out output formatter. It relies on a global __opts__ object which",
"# we can't obviously pass in",
"try",
":",
"t... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SlackClient.parse_args_and_kwargs | cmdline: list
returns tuple of: args (list), kwargs (dict) | salt/engines/slack.py | def parse_args_and_kwargs(self, cmdline):
'''
cmdline: list
returns tuple of: args (list), kwargs (dict)
'''
# Parse args and kwargs
args = []
kwargs = {}
if len(cmdline) > 1:
for item in cmdline[1:]:
if '=' in item:
... | def parse_args_and_kwargs(self, cmdline):
'''
cmdline: list
returns tuple of: args (list), kwargs (dict)
'''
# Parse args and kwargs
args = []
kwargs = {}
if len(cmdline) > 1:
for item in cmdline[1:]:
if '=' in item:
... | [
"cmdline",
":",
"list"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/slack.py#L657-L674 | [
"def",
"parse_args_and_kwargs",
"(",
"self",
",",
"cmdline",
")",
":",
"# Parse args and kwargs",
"args",
"=",
"[",
"]",
"kwargs",
"=",
"{",
"}",
"if",
"len",
"(",
"cmdline",
")",
">",
"1",
":",
"for",
"item",
"in",
"cmdline",
"[",
"1",
":",
"]",
":"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SlackClient.get_jobs_from_runner | Given a list of job_ids, return a dictionary of those job_ids that have
completed and their results.
Query the salt event bus via the jobs runner. jobs.list_job will show
a job in progress, jobs.lookup_jid will return a job that has
completed.
returns a dictionary of job id: re... | salt/engines/slack.py | def get_jobs_from_runner(self, outstanding_jids):
'''
Given a list of job_ids, return a dictionary of those job_ids that have
completed and their results.
Query the salt event bus via the jobs runner. jobs.list_job will show
a job in progress, jobs.lookup_jid will return a job t... | def get_jobs_from_runner(self, outstanding_jids):
'''
Given a list of job_ids, return a dictionary of those job_ids that have
completed and their results.
Query the salt event bus via the jobs runner. jobs.list_job will show
a job in progress, jobs.lookup_jid will return a job t... | [
"Given",
"a",
"list",
"of",
"job_ids",
"return",
"a",
"dictionary",
"of",
"those",
"job_ids",
"that",
"have",
"completed",
"and",
"their",
"results",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/slack.py#L676-L706 | [
"def",
"get_jobs_from_runner",
"(",
"self",
",",
"outstanding_jids",
")",
":",
"# Can't use the runner because of https://github.com/saltstack/salt/issues/40671",
"runner",
"=",
"salt",
".",
"runner",
".",
"RunnerClient",
"(",
"__opts__",
")",
"source",
"=",
"__opts__",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SlackClient.run_commands_from_slack_async | Pull any pending messages from the message_generator, sending each
one to either the event bus, the command_async or both, depending on
the values of fire_all and command | salt/engines/slack.py | def run_commands_from_slack_async(self, message_generator, fire_all, tag, control, interval=1):
'''
Pull any pending messages from the message_generator, sending each
one to either the event bus, the command_async or both, depending on
the values of fire_all and command
'''
... | def run_commands_from_slack_async(self, message_generator, fire_all, tag, control, interval=1):
'''
Pull any pending messages from the message_generator, sending each
one to either the event bus, the command_async or both, depending on
the values of fire_all and command
'''
... | [
"Pull",
"any",
"pending",
"messages",
"from",
"the",
"message_generator",
"sending",
"each",
"one",
"to",
"either",
"the",
"event",
"bus",
"the",
"command_async",
"or",
"both",
"depending",
"on",
"the",
"values",
"of",
"fire_all",
"and",
"command"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/slack.py#L708-L774 | [
"def",
"run_commands_from_slack_async",
"(",
"self",
",",
"message_generator",
",",
"fire_all",
",",
"tag",
",",
"control",
",",
"interval",
"=",
"1",
")",
":",
"outstanding",
"=",
"{",
"}",
"# set of job_id that we need to check for",
"while",
"True",
":",
"log",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SlackClient.run_command_async | :type message_generator: generator of dict
:param message_generator: Generates messages from slack that should be run
:type fire_all: bool
:param fire_all: Whether to also fire messages to the event bus
:type tag: str
:param tag: The tag to send to use to send to the event bus
... | salt/engines/slack.py | def run_command_async(self, msg):
'''
:type message_generator: generator of dict
:param message_generator: Generates messages from slack that should be run
:type fire_all: bool
:param fire_all: Whether to also fire messages to the event bus
:type tag: str
:para... | def run_command_async(self, msg):
'''
:type message_generator: generator of dict
:param message_generator: Generates messages from slack that should be run
:type fire_all: bool
:param fire_all: Whether to also fire messages to the event bus
:type tag: str
:para... | [
":",
"type",
"message_generator",
":",
"generator",
"of",
"dict",
":",
"param",
"message_generator",
":",
"Generates",
"messages",
"from",
"slack",
"that",
"should",
"be",
"run"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/slack.py#L776-L825 | [
"def",
"run_command_async",
"(",
"self",
",",
"msg",
")",
":",
"log",
".",
"debug",
"(",
"'Going to run a command asynchronous'",
")",
"runner_functions",
"=",
"sorted",
"(",
"salt",
".",
"runner",
".",
"Runner",
"(",
"__opts__",
")",
".",
"functions",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_serv | Return a Pg cursor | salt/returners/postgres.py | def _get_serv(ret=None, commit=False):
'''
Return a Pg cursor
'''
_options = _get_options(ret)
try:
conn = psycopg2.connect(host=_options.get('host'),
user=_options.get('user'),
password=_options.get('passwd'),
... | def _get_serv(ret=None, commit=False):
'''
Return a Pg cursor
'''
_options = _get_options(ret)
try:
conn = psycopg2.connect(host=_options.get('host'),
user=_options.get('user'),
password=_options.get('passwd'),
... | [
"Return",
"a",
"Pg",
"cursor"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/postgres.py#L190-L220 | [
"def",
"_get_serv",
"(",
"ret",
"=",
"None",
",",
"commit",
"=",
"False",
")",
":",
"_options",
"=",
"_get_options",
"(",
"ret",
")",
"try",
":",
"conn",
"=",
"psycopg2",
".",
"connect",
"(",
"host",
"=",
"_options",
".",
"get",
"(",
"'host'",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | returner | Return data to a postgres server | salt/returners/postgres.py | def returner(ret):
'''
Return data to a postgres server
'''
try:
with _get_serv(ret, commit=True) as cur:
sql = '''INSERT INTO salt_returns
(fun, jid, return, id, success, full_ret)
VALUES (%s, %s, %s, %s, %s, %s)'''
cur.execute(
... | def returner(ret):
'''
Return data to a postgres server
'''
try:
with _get_serv(ret, commit=True) as cur:
sql = '''INSERT INTO salt_returns
(fun, jid, return, id, success, full_ret)
VALUES (%s, %s, %s, %s, %s, %s)'''
cur.execute(
... | [
"Return",
"data",
"to",
"a",
"postgres",
"server"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/postgres.py#L223-L241 | [
"def",
"returner",
"(",
"ret",
")",
":",
"try",
":",
"with",
"_get_serv",
"(",
"ret",
",",
"commit",
"=",
"True",
")",
"as",
"cur",
":",
"sql",
"=",
"'''INSERT INTO salt_returns\n (fun, jid, return, id, success, full_ret)\n VALUES (%s... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_jids | Return a list of all job ids | salt/returners/postgres.py | def get_jids():
'''
Return a list of all job ids
'''
with _get_serv(ret=None, commit=True) as cur:
sql = '''SELECT jid, load
FROM jids'''
cur.execute(sql)
data = cur.fetchall()
ret = {}
for jid, load in data:
ret[jid] = salt.utils.jid... | def get_jids():
'''
Return a list of all job ids
'''
with _get_serv(ret=None, commit=True) as cur:
sql = '''SELECT jid, load
FROM jids'''
cur.execute(sql)
data = cur.fetchall()
ret = {}
for jid, load in data:
ret[jid] = salt.utils.jid... | [
"Return",
"a",
"list",
"of",
"all",
"job",
"ids"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/postgres.py#L344-L359 | [
"def",
"get_jids",
"(",
")",
":",
"with",
"_get_serv",
"(",
"ret",
"=",
"None",
",",
"commit",
"=",
"True",
")",
"as",
"cur",
":",
"sql",
"=",
"'''SELECT jid, load\n FROM jids'''",
"cur",
".",
"execute",
"(",
"sql",
")",
"data",
"=",
"cur",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | present | Ensures that the host group exists, eventually creates new host group.
.. versionadded:: 2016.3.0
:param name: name of the host group
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_password: Optional - zabbix password (can... | salt/states/zabbix_hostgroup.py | def present(name, **kwargs):
'''
Ensures that the host group exists, eventually creates new host group.
.. versionadded:: 2016.3.0
:param name: name of the host group
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_... | def present(name, **kwargs):
'''
Ensures that the host group exists, eventually creates new host group.
.. versionadded:: 2016.3.0
:param name: name of the host group
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_... | [
"Ensures",
"that",
"the",
"host",
"group",
"exists",
"eventually",
"creates",
"new",
"host",
"group",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_hostgroup.py#L24-L88 | [
"def",
"present",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"connection_args",
"=",
"{",
"}",
"if",
"'_connection_user'",
"in",
"kwargs",
":",
"connection_args",
"[",
"'_connection_user'",
"]",
"=",
"kwargs",
"[",
"'_connection_user'",
"]",
"if",
"'_co... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | absent | Ensures that the host group does not exist, eventually delete host group.
.. versionadded:: 2016.3.0
:param name: name of the host group
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_password: Optional - zabbix password (... | salt/states/zabbix_hostgroup.py | def absent(name, **kwargs):
'''
Ensures that the host group does not exist, eventually delete host group.
.. versionadded:: 2016.3.0
:param name: name of the host group
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connectio... | def absent(name, **kwargs):
'''
Ensures that the host group does not exist, eventually delete host group.
.. versionadded:: 2016.3.0
:param name: name of the host group
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connectio... | [
"Ensures",
"that",
"the",
"host",
"group",
"does",
"not",
"exist",
"eventually",
"delete",
"host",
"group",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_hostgroup.py#L91-L162 | [
"def",
"absent",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
"# Comment and change messages",
"comment_hostgroup... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _json_to_unicode | Encode json values in unicode to match that of the API | salt/states/glassfish.py | def _json_to_unicode(data):
'''
Encode json values in unicode to match that of the API
'''
ret = {}
for key, value in data.items():
if not isinstance(value, six.text_type):
if isinstance(value, dict):
ret[key] = _json_to_unicode(value)
else:
... | def _json_to_unicode(data):
'''
Encode json values in unicode to match that of the API
'''
ret = {}
for key, value in data.items():
if not isinstance(value, six.text_type):
if isinstance(value, dict):
ret[key] = _json_to_unicode(value)
else:
... | [
"Encode",
"json",
"values",
"in",
"unicode",
"to",
"match",
"that",
"of",
"the",
"API"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/glassfish.py#L36-L49 | [
"def",
"_json_to_unicode",
"(",
"data",
")",
":",
"ret",
"=",
"{",
"}",
"for",
"key",
",",
"value",
"in",
"data",
".",
"items",
"(",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"six",
".",
"text_type",
")",
":",
"if",
"isinstance",
"(",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _is_updated | Compare the API results to the current statefile data | salt/states/glassfish.py | def _is_updated(old_conf, new_conf):
'''
Compare the API results to the current statefile data
'''
changed = {}
# Dirty json hacking to get parameters in the same format
new_conf = _json_to_unicode(salt.utils.json.loads(
salt.utils.json.dumps(new_conf, ensure_ascii=False)))
old_conf... | def _is_updated(old_conf, new_conf):
'''
Compare the API results to the current statefile data
'''
changed = {}
# Dirty json hacking to get parameters in the same format
new_conf = _json_to_unicode(salt.utils.json.loads(
salt.utils.json.dumps(new_conf, ensure_ascii=False)))
old_conf... | [
"Compare",
"the",
"API",
"results",
"to",
"the",
"current",
"statefile",
"data"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/glassfish.py#L52-L71 | [
"def",
"_is_updated",
"(",
"old_conf",
",",
"new_conf",
")",
":",
"changed",
"=",
"{",
"}",
"# Dirty json hacking to get parameters in the same format",
"new_conf",
"=",
"_json_to_unicode",
"(",
"salt",
".",
"utils",
".",
"json",
".",
"loads",
"(",
"salt",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _do_element_present | Generic function to create or update an element | salt/states/glassfish.py | def _do_element_present(name, elem_type, data, server=None):
'''
Generic function to create or update an element
'''
ret = {'changes': {}, 'update': False, 'create': False, 'error': None}
try:
elements = __salt__['glassfish.enum_{0}'.format(elem_type)]()
except requests.ConnectionError a... | def _do_element_present(name, elem_type, data, server=None):
'''
Generic function to create or update an element
'''
ret = {'changes': {}, 'update': False, 'create': False, 'error': None}
try:
elements = __salt__['glassfish.enum_{0}'.format(elem_type)]()
except requests.ConnectionError a... | [
"Generic",
"function",
"to",
"create",
"or",
"update",
"an",
"element"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/glassfish.py#L74-L110 | [
"def",
"_do_element_present",
"(",
"name",
",",
"elem_type",
",",
"data",
",",
"server",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'changes'",
":",
"{",
"}",
",",
"'update'",
":",
"False",
",",
"'create'",
":",
"False",
",",
"'error'",
":",
"None",
"}... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _do_element_absent | Generic function to delete an element | salt/states/glassfish.py | def _do_element_absent(name, elem_type, data, server=None):
'''
Generic function to delete an element
'''
ret = {'delete': False, 'error': None}
try:
elements = __salt__['glassfish.enum_{0}'.format(elem_type)]()
except requests.ConnectionError as error:
if __opts__['test']:
... | def _do_element_absent(name, elem_type, data, server=None):
'''
Generic function to delete an element
'''
ret = {'delete': False, 'error': None}
try:
elements = __salt__['glassfish.enum_{0}'.format(elem_type)]()
except requests.ConnectionError as error:
if __opts__['test']:
... | [
"Generic",
"function",
"to",
"delete",
"an",
"element"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/glassfish.py#L113-L135 | [
"def",
"_do_element_absent",
"(",
"name",
",",
"elem_type",
",",
"data",
",",
"server",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'delete'",
":",
"False",
",",
"'error'",
":",
"None",
"}",
"try",
":",
"elements",
"=",
"__salt__",
"[",
"'glassfish.enum_{0}... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | connection_factory_present | Ensures that the Connection Factory is present
name
Name of the connection factory
restype
Type of the connection factory, can be either ``connection_factory``,
``queue_connection_factory` or ``topic_connection_factory``,
defaults to ``connection_factory``
description
... | salt/states/glassfish.py | def connection_factory_present(name,
restype='connection_factory',
description='',
enabled=True,
min_size=1,
max_size=250,
resize_quan... | def connection_factory_present(name,
restype='connection_factory',
description='',
enabled=True,
min_size=1,
max_size=250,
resize_quan... | [
"Ensures",
"that",
"the",
"Connection",
"Factory",
"is",
"present"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/glassfish.py#L138-L259 | [
"def",
"connection_factory_present",
"(",
"name",
",",
"restype",
"=",
"'connection_factory'",
",",
"description",
"=",
"''",
",",
"enabled",
"=",
"True",
",",
"min_size",
"=",
"1",
",",
"max_size",
"=",
"250",
",",
"resize_quantity",
"=",
"2",
",",
"idle_ti... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | connection_factory_absent | Ensures the transaction factory is absent.
name
Name of the connection factory
both
Delete both the pool and the resource, defaults to ``true`` | salt/states/glassfish.py | def connection_factory_absent(name, both=True, server=None):
'''
Ensures the transaction factory is absent.
name
Name of the connection factory
both
Delete both the pool and the resource, defaults to ``true``
'''
ret = {'name': name, 'result': None, 'comment': None, 'changes': ... | def connection_factory_absent(name, both=True, server=None):
'''
Ensures the transaction factory is absent.
name
Name of the connection factory
both
Delete both the pool and the resource, defaults to ``true``
'''
ret = {'name': name, 'result': None, 'comment': None, 'changes': ... | [
"Ensures",
"the",
"transaction",
"factory",
"is",
"absent",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/glassfish.py#L262-L288 | [
"def",
"connection_factory_absent",
"(",
"name",
",",
"both",
"=",
"True",
",",
"server",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"None",
",",
"'changes'",
":",
"{",
"}",
"}"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | destination_present | Ensures that the JMS Destination Resource (queue or topic) is present
name
The JMS Queue/Topic name
physical
The Physical destination name
restype
The JMS Destination resource type, either ``queue`` or ``topic``, defaults is ``queue``
description
A description of the ... | salt/states/glassfish.py | def destination_present(name,
physical,
restype='queue',
description='',
enabled=True,
server=None):
'''
Ensures that the JMS Destination Resource (queue or topic) is present
name
... | def destination_present(name,
physical,
restype='queue',
description='',
enabled=True,
server=None):
'''
Ensures that the JMS Destination Resource (queue or topic) is present
name
... | [
"Ensures",
"that",
"the",
"JMS",
"Destination",
"Resource",
"(",
"queue",
"or",
"topic",
")",
"is",
"present"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/glassfish.py#L291-L353 | [
"def",
"destination_present",
"(",
"name",
",",
"physical",
",",
"restype",
"=",
"'queue'",
",",
"description",
"=",
"''",
",",
"enabled",
"=",
"True",
",",
"server",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | destination_absent | Ensures that the JMS Destination doesn't exists
name
Name of the JMS Destination | salt/states/glassfish.py | def destination_absent(name, server=None):
'''
Ensures that the JMS Destination doesn't exists
name
Name of the JMS Destination
'''
ret = {'name': name, 'result': None, 'comment': None, 'changes': {}}
jms_ret = _do_element_absent(name, 'admin_object_resource', {}, server)
if not jms... | def destination_absent(name, server=None):
'''
Ensures that the JMS Destination doesn't exists
name
Name of the JMS Destination
'''
ret = {'name': name, 'result': None, 'comment': None, 'changes': {}}
jms_ret = _do_element_absent(name, 'admin_object_resource', {}, server)
if not jms... | [
"Ensures",
"that",
"the",
"JMS",
"Destination",
"doesn",
"t",
"exists"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/glassfish.py#L356-L377 | [
"def",
"destination_absent",
"(",
"name",
",",
"server",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"None",
",",
"'changes'",
":",
"{",
"}",
"}",
"jms_ret",
"=",
"_do_element_abse... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | jdbc_datasource_present | Ensures that the JDBC Datasource exists
name
Name of the datasource
description
Description of the datasource
enabled
Is the datasource enabled? defaults to ``true``
restype
Resource type, can be ``datasource``, ``xa_datasource``,
``connection_pool_datasource`... | salt/states/glassfish.py | def jdbc_datasource_present(name,
description='',
enabled=True,
restype='datasource',
vendor='mysql',
sql_url='',
sql_user='',
... | def jdbc_datasource_present(name,
description='',
enabled=True,
restype='datasource',
vendor='mysql',
sql_url='',
sql_user='',
... | [
"Ensures",
"that",
"the",
"JDBC",
"Datasource",
"exists"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/glassfish.py#L380-L537 | [
"def",
"jdbc_datasource_present",
"(",
"name",
",",
"description",
"=",
"''",
",",
"enabled",
"=",
"True",
",",
"restype",
"=",
"'datasource'",
",",
"vendor",
"=",
"'mysql'",
",",
"sql_url",
"=",
"''",
",",
"sql_user",
"=",
"''",
",",
"sql_password",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | jdbc_datasource_absent | Ensures the JDBC Datasource doesn't exists
name
Name of the datasource
both
Delete both the pool and the resource, defaults to ``true`` | salt/states/glassfish.py | def jdbc_datasource_absent(name, both=True, server=None):
'''
Ensures the JDBC Datasource doesn't exists
name
Name of the datasource
both
Delete both the pool and the resource, defaults to ``true``
'''
ret = {'name': name, 'result': None, 'comment': None, 'changes': {}}
pool... | def jdbc_datasource_absent(name, both=True, server=None):
'''
Ensures the JDBC Datasource doesn't exists
name
Name of the datasource
both
Delete both the pool and the resource, defaults to ``true``
'''
ret = {'name': name, 'result': None, 'comment': None, 'changes': {}}
pool... | [
"Ensures",
"the",
"JDBC",
"Datasource",
"doesn",
"t",
"exists"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/glassfish.py#L540-L564 | [
"def",
"jdbc_datasource_absent",
"(",
"name",
",",
"both",
"=",
"True",
",",
"server",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"None",
",",
"'changes'",
":",
"{",
"}",
"}",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | system_properties_present | Ensures that the system properties are present
properties
The system properties | salt/states/glassfish.py | def system_properties_present(server=None, **kwargs):
'''
Ensures that the system properties are present
properties
The system properties
'''
ret = {'name': '', 'result': None, 'comment': None, 'changes': {}}
del kwargs['name']
try:
data = __salt__['glassfish.get_system_pro... | def system_properties_present(server=None, **kwargs):
'''
Ensures that the system properties are present
properties
The system properties
'''
ret = {'name': '', 'result': None, 'comment': None, 'changes': {}}
del kwargs['name']
try:
data = __salt__['glassfish.get_system_pro... | [
"Ensures",
"that",
"the",
"system",
"properties",
"are",
"present"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/glassfish.py#L567-L608 | [
"def",
"system_properties_present",
"(",
"server",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"''",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"None",
",",
"'changes'",
":",
"{",
"}",
"}",
"del",
"kwargs... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | system_properties_absent | Ensures that the system property doesn't exists
name
Name of the system property | salt/states/glassfish.py | def system_properties_absent(name, server=None):
'''
Ensures that the system property doesn't exists
name
Name of the system property
'''
ret = {'name': '', 'result': None, 'comment': None, 'changes': {}}
try:
data = __salt__['glassfish.get_system_properties'](server=server)
... | def system_properties_absent(name, server=None):
'''
Ensures that the system property doesn't exists
name
Name of the system property
'''
ret = {'name': '', 'result': None, 'comment': None, 'changes': {}}
try:
data = __salt__['glassfish.get_system_properties'](server=server)
... | [
"Ensures",
"that",
"the",
"system",
"property",
"doesn",
"t",
"exists"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/glassfish.py#L611-L647 | [
"def",
"system_properties_absent",
"(",
"name",
",",
"server",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"''",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"None",
",",
"'changes'",
":",
"{",
"}",
"}",
"try",
":",
"data",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | parse_target | Parse `target_expressing` splitting it into `engine`, `delimiter`,
`pattern` - returns a dict | salt/utils/minions.py | def parse_target(target_expression):
'''Parse `target_expressing` splitting it into `engine`, `delimiter`,
`pattern` - returns a dict'''
match = TARGET_REX.match(target_expression)
if not match:
log.warning('Unable to parse target "%s"', target_expression)
ret = {
'engine':... | def parse_target(target_expression):
'''Parse `target_expressing` splitting it into `engine`, `delimiter`,
`pattern` - returns a dict'''
match = TARGET_REX.match(target_expression)
if not match:
log.warning('Unable to parse target "%s"', target_expression)
ret = {
'engine':... | [
"Parse",
"target_expressing",
"splitting",
"it",
"into",
"engine",
"delimiter",
"pattern",
"-",
"returns",
"a",
"dict"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/minions.py#L50-L64 | [
"def",
"parse_target",
"(",
"target_expression",
")",
":",
"match",
"=",
"TARGET_REX",
".",
"match",
"(",
"target_expression",
")",
"if",
"not",
"match",
":",
"log",
".",
"warning",
"(",
"'Unable to parse target \"%s\"'",
",",
"target_expression",
")",
"ret",
"=... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_minion_data | Get the grains/pillar for a specific minion. If minion is None, it
will return the grains/pillar for the first minion it finds.
Return value is a tuple of the minion ID, grains, and pillar | salt/utils/minions.py | def get_minion_data(minion, opts):
'''
Get the grains/pillar for a specific minion. If minion is None, it
will return the grains/pillar for the first minion it finds.
Return value is a tuple of the minion ID, grains, and pillar
'''
grains = None
pillar = None
if opts.get('minion_data_c... | def get_minion_data(minion, opts):
'''
Get the grains/pillar for a specific minion. If minion is None, it
will return the grains/pillar for the first minion it finds.
Return value is a tuple of the minion ID, grains, and pillar
'''
grains = None
pillar = None
if opts.get('minion_data_c... | [
"Get",
"the",
"grains",
"/",
"pillar",
"for",
"a",
"specific",
"minion",
".",
"If",
"minion",
"is",
"None",
"it",
"will",
"return",
"the",
"grains",
"/",
"pillar",
"for",
"the",
"first",
"minion",
"it",
"finds",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/minions.py#L67-L88 | [
"def",
"get_minion_data",
"(",
"minion",
",",
"opts",
")",
":",
"grains",
"=",
"None",
"pillar",
"=",
"None",
"if",
"opts",
".",
"get",
"(",
"'minion_data_cache'",
",",
"False",
")",
":",
"cache",
"=",
"salt",
".",
"cache",
".",
"factory",
"(",
"opts",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | nodegroup_comp | Recursively expand ``nodegroup`` from ``nodegroups``; ignore nodegroups in ``skip``
If a top-level (non-recursive) call finds no nodegroups, return the original
nodegroup definition (for backwards compatibility). Keep track of recursive
calls via `first_call` argument | salt/utils/minions.py | def nodegroup_comp(nodegroup, nodegroups, skip=None, first_call=True):
'''
Recursively expand ``nodegroup`` from ``nodegroups``; ignore nodegroups in ``skip``
If a top-level (non-recursive) call finds no nodegroups, return the original
nodegroup definition (for backwards compatibility). Keep track of r... | def nodegroup_comp(nodegroup, nodegroups, skip=None, first_call=True):
'''
Recursively expand ``nodegroup`` from ``nodegroups``; ignore nodegroups in ``skip``
If a top-level (non-recursive) call finds no nodegroups, return the original
nodegroup definition (for backwards compatibility). Keep track of r... | [
"Recursively",
"expand",
"nodegroup",
"from",
"nodegroups",
";",
"ignore",
"nodegroups",
"in",
"skip"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/minions.py#L91-L179 | [
"def",
"nodegroup_comp",
"(",
"nodegroup",
",",
"nodegroups",
",",
"skip",
"=",
"None",
",",
"first_call",
"=",
"True",
")",
":",
"expanded_nodegroup",
"=",
"False",
"if",
"skip",
"is",
"None",
":",
"skip",
"=",
"set",
"(",
")",
"elif",
"nodegroup",
"in"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | mine_get | Gathers the data from the specified minions' mine, pass in the target,
function to look up and the target type | salt/utils/minions.py | def mine_get(tgt, fun, tgt_type='glob', opts=None):
'''
Gathers the data from the specified minions' mine, pass in the target,
function to look up and the target type
'''
ret = {}
serial = salt.payload.Serial(opts)
checker = CkMinions(opts)
_res = checker.check_minions(
tgt,
... | def mine_get(tgt, fun, tgt_type='glob', opts=None):
'''
Gathers the data from the specified minions' mine, pass in the target,
function to look up and the target type
'''
ret = {}
serial = salt.payload.Serial(opts)
checker = CkMinions(opts)
_res = checker.check_minions(
tgt,
... | [
"Gathers",
"the",
"data",
"from",
"the",
"specified",
"minions",
"mine",
"pass",
"in",
"the",
"target",
"function",
"to",
"look",
"up",
"and",
"the",
"target",
"type"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/minions.py#L1130-L1166 | [
"def",
"mine_get",
"(",
"tgt",
",",
"fun",
",",
"tgt_type",
"=",
"'glob'",
",",
"opts",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"serial",
"=",
"salt",
".",
"payload",
".",
"Serial",
"(",
"opts",
")",
"checker",
"=",
"CkMinions",
"(",
"opts",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CkMinions._check_nodegroup_minions | Return minions found by looking at nodegroups | salt/utils/minions.py | def _check_nodegroup_minions(self, expr, greedy): # pylint: disable=unused-argument
'''
Return minions found by looking at nodegroups
'''
return self._check_compound_minions(nodegroup_comp(expr, self.opts['nodegroups']),
DEFAULT_TARGET_DELIM,
greedy) | def _check_nodegroup_minions(self, expr, greedy): # pylint: disable=unused-argument
'''
Return minions found by looking at nodegroups
'''
return self._check_compound_minions(nodegroup_comp(expr, self.opts['nodegroups']),
DEFAULT_TARGET_DELIM,
greedy) | [
"Return",
"minions",
"found",
"by",
"looking",
"at",
"nodegroups"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/minions.py#L201-L207 | [
"def",
"_check_nodegroup_minions",
"(",
"self",
",",
"expr",
",",
"greedy",
")",
":",
"# pylint: disable=unused-argument",
"return",
"self",
".",
"_check_compound_minions",
"(",
"nodegroup_comp",
"(",
"expr",
",",
"self",
".",
"opts",
"[",
"'nodegroups'",
"]",
")"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CkMinions._check_list_minions | Return the minions found by looking via a list | salt/utils/minions.py | def _check_list_minions(self, expr, greedy, ignore_missing=False): # pylint: disable=unused-argument
'''
Return the minions found by looking via a list
'''
if isinstance(expr, six.string_types):
expr = [m for m in expr.split(',') if m]
minions = self._pki_minions()
... | def _check_list_minions(self, expr, greedy, ignore_missing=False): # pylint: disable=unused-argument
'''
Return the minions found by looking via a list
'''
if isinstance(expr, six.string_types):
expr = [m for m in expr.split(',') if m]
minions = self._pki_minions()
... | [
"Return",
"the",
"minions",
"found",
"by",
"looking",
"via",
"a",
"list"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/minions.py#L216-L224 | [
"def",
"_check_list_minions",
"(",
"self",
",",
"expr",
",",
"greedy",
",",
"ignore_missing",
"=",
"False",
")",
":",
"# pylint: disable=unused-argument",
"if",
"isinstance",
"(",
"expr",
",",
"six",
".",
"string_types",
")",
":",
"expr",
"=",
"[",
"m",
"for... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CkMinions._check_pcre_minions | Return the minions found by looking via regular expressions | salt/utils/minions.py | def _check_pcre_minions(self, expr, greedy): # pylint: disable=unused-argument
'''
Return the minions found by looking via regular expressions
'''
reg = re.compile(expr)
return {'minions': [m for m in self._pki_minions() if reg.match(m)],
'missing': []} | def _check_pcre_minions(self, expr, greedy): # pylint: disable=unused-argument
'''
Return the minions found by looking via regular expressions
'''
reg = re.compile(expr)
return {'minions': [m for m in self._pki_minions() if reg.match(m)],
'missing': []} | [
"Return",
"the",
"minions",
"found",
"by",
"looking",
"via",
"regular",
"expressions"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/minions.py#L226-L232 | [
"def",
"_check_pcre_minions",
"(",
"self",
",",
"expr",
",",
"greedy",
")",
":",
"# pylint: disable=unused-argument",
"reg",
"=",
"re",
".",
"compile",
"(",
"expr",
")",
"return",
"{",
"'minions'",
":",
"[",
"m",
"for",
"m",
"in",
"self",
".",
"_pki_minion... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CkMinions._pki_minions | Retreive complete minion list from PKI dir.
Respects cache if configured | salt/utils/minions.py | def _pki_minions(self):
'''
Retreive complete minion list from PKI dir.
Respects cache if configured
'''
minions = []
pki_cache_fn = os.path.join(self.opts['pki_dir'], self.acc, '.key_cache')
try:
os.makedirs(os.path.dirname(pki_cache_fn))
exce... | def _pki_minions(self):
'''
Retreive complete minion list from PKI dir.
Respects cache if configured
'''
minions = []
pki_cache_fn = os.path.join(self.opts['pki_dir'], self.acc, '.key_cache')
try:
os.makedirs(os.path.dirname(pki_cache_fn))
exce... | [
"Retreive",
"complete",
"minion",
"list",
"from",
"PKI",
"dir",
".",
"Respects",
"cache",
"if",
"configured"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/minions.py#L234-L264 | [
"def",
"_pki_minions",
"(",
"self",
")",
":",
"minions",
"=",
"[",
"]",
"pki_cache_fn",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"opts",
"[",
"'pki_dir'",
"]",
",",
"self",
".",
"acc",
",",
"'.key_cache'",
")",
"try",
":",
"os",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CkMinions._check_cache_minions | Helper function to search for minions in master caches If 'greedy',
then return accepted minions matched by the condition or those absent
from the cache. If not 'greedy' return the only minions have cache
data and matched by the condition. | salt/utils/minions.py | def _check_cache_minions(self,
expr,
delimiter,
greedy,
search_type,
regex_match=False,
exact_match=False):
'''
Helper function to... | def _check_cache_minions(self,
expr,
delimiter,
greedy,
search_type,
regex_match=False,
exact_match=False):
'''
Helper function to... | [
"Helper",
"function",
"to",
"search",
"for",
"minions",
"in",
"master",
"caches",
"If",
"greedy",
"then",
"return",
"accepted",
"minions",
"matched",
"by",
"the",
"condition",
"or",
"those",
"absent",
"from",
"the",
"cache",
".",
"If",
"not",
"greedy",
"retu... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/minions.py#L266-L321 | [
"def",
"_check_cache_minions",
"(",
"self",
",",
"expr",
",",
"delimiter",
",",
"greedy",
",",
"search_type",
",",
"regex_match",
"=",
"False",
",",
"exact_match",
"=",
"False",
")",
":",
"cache_enabled",
"=",
"self",
".",
"opts",
".",
"get",
"(",
"'minion... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CkMinions._check_grain_minions | Return the minions found by looking via grains | salt/utils/minions.py | def _check_grain_minions(self, expr, delimiter, greedy):
'''
Return the minions found by looking via grains
'''
return self._check_cache_minions(expr, delimiter, greedy, 'grains') | def _check_grain_minions(self, expr, delimiter, greedy):
'''
Return the minions found by looking via grains
'''
return self._check_cache_minions(expr, delimiter, greedy, 'grains') | [
"Return",
"the",
"minions",
"found",
"by",
"looking",
"via",
"grains"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/minions.py#L323-L327 | [
"def",
"_check_grain_minions",
"(",
"self",
",",
"expr",
",",
"delimiter",
",",
"greedy",
")",
":",
"return",
"self",
".",
"_check_cache_minions",
"(",
"expr",
",",
"delimiter",
",",
"greedy",
",",
"'grains'",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CkMinions._check_grain_pcre_minions | Return the minions found by looking via grains with PCRE | salt/utils/minions.py | def _check_grain_pcre_minions(self, expr, delimiter, greedy):
'''
Return the minions found by looking via grains with PCRE
'''
return self._check_cache_minions(expr,
delimiter,
greedy,
... | def _check_grain_pcre_minions(self, expr, delimiter, greedy):
'''
Return the minions found by looking via grains with PCRE
'''
return self._check_cache_minions(expr,
delimiter,
greedy,
... | [
"Return",
"the",
"minions",
"found",
"by",
"looking",
"via",
"grains",
"with",
"PCRE"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/minions.py#L329-L337 | [
"def",
"_check_grain_pcre_minions",
"(",
"self",
",",
"expr",
",",
"delimiter",
",",
"greedy",
")",
":",
"return",
"self",
".",
"_check_cache_minions",
"(",
"expr",
",",
"delimiter",
",",
"greedy",
",",
"'grains'",
",",
"regex_match",
"=",
"True",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CkMinions._check_pillar_minions | Return the minions found by looking via pillar | salt/utils/minions.py | def _check_pillar_minions(self, expr, delimiter, greedy):
'''
Return the minions found by looking via pillar
'''
return self._check_cache_minions(expr, delimiter, greedy, 'pillar') | def _check_pillar_minions(self, expr, delimiter, greedy):
'''
Return the minions found by looking via pillar
'''
return self._check_cache_minions(expr, delimiter, greedy, 'pillar') | [
"Return",
"the",
"minions",
"found",
"by",
"looking",
"via",
"pillar"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/minions.py#L339-L343 | [
"def",
"_check_pillar_minions",
"(",
"self",
",",
"expr",
",",
"delimiter",
",",
"greedy",
")",
":",
"return",
"self",
".",
"_check_cache_minions",
"(",
"expr",
",",
"delimiter",
",",
"greedy",
",",
"'pillar'",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CkMinions._check_pillar_pcre_minions | Return the minions found by looking via pillar with PCRE | salt/utils/minions.py | def _check_pillar_pcre_minions(self, expr, delimiter, greedy):
'''
Return the minions found by looking via pillar with PCRE
'''
return self._check_cache_minions(expr,
delimiter,
greedy,
... | def _check_pillar_pcre_minions(self, expr, delimiter, greedy):
'''
Return the minions found by looking via pillar with PCRE
'''
return self._check_cache_minions(expr,
delimiter,
greedy,
... | [
"Return",
"the",
"minions",
"found",
"by",
"looking",
"via",
"pillar",
"with",
"PCRE"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/minions.py#L345-L353 | [
"def",
"_check_pillar_pcre_minions",
"(",
"self",
",",
"expr",
",",
"delimiter",
",",
"greedy",
")",
":",
"return",
"self",
".",
"_check_cache_minions",
"(",
"expr",
",",
"delimiter",
",",
"greedy",
",",
"'pillar'",
",",
"regex_match",
"=",
"True",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CkMinions._check_pillar_exact_minions | Return the minions found by looking via pillar | salt/utils/minions.py | def _check_pillar_exact_minions(self, expr, delimiter, greedy):
'''
Return the minions found by looking via pillar
'''
return self._check_cache_minions(expr,
delimiter,
greedy,
... | def _check_pillar_exact_minions(self, expr, delimiter, greedy):
'''
Return the minions found by looking via pillar
'''
return self._check_cache_minions(expr,
delimiter,
greedy,
... | [
"Return",
"the",
"minions",
"found",
"by",
"looking",
"via",
"pillar"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/minions.py#L355-L363 | [
"def",
"_check_pillar_exact_minions",
"(",
"self",
",",
"expr",
",",
"delimiter",
",",
"greedy",
")",
":",
"return",
"self",
".",
"_check_cache_minions",
"(",
"expr",
",",
"delimiter",
",",
"greedy",
",",
"'pillar'",
",",
"exact_match",
"=",
"True",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CkMinions._check_ipcidr_minions | Return the minions found by looking via ipcidr | salt/utils/minions.py | def _check_ipcidr_minions(self, expr, greedy):
'''
Return the minions found by looking via ipcidr
'''
cache_enabled = self.opts.get('minion_data_cache', False)
if greedy:
minions = self._pki_minions()
elif cache_enabled:
minions = self.cache.list(... | def _check_ipcidr_minions(self, expr, greedy):
'''
Return the minions found by looking via ipcidr
'''
cache_enabled = self.opts.get('minion_data_cache', False)
if greedy:
minions = self._pki_minions()
elif cache_enabled:
minions = self.cache.list(... | [
"Return",
"the",
"minions",
"found",
"by",
"looking",
"via",
"ipcidr"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/minions.py#L365-L421 | [
"def",
"_check_ipcidr_minions",
"(",
"self",
",",
"expr",
",",
"greedy",
")",
":",
"cache_enabled",
"=",
"self",
".",
"opts",
".",
"get",
"(",
"'minion_data_cache'",
",",
"False",
")",
"if",
"greedy",
":",
"minions",
"=",
"self",
".",
"_pki_minions",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CkMinions._check_range_minions | Return the minions found by looking via range expression | salt/utils/minions.py | def _check_range_minions(self, expr, greedy):
'''
Return the minions found by looking via range expression
'''
if not HAS_RANGE:
raise CommandExecutionError(
'Range matcher unavailable (unable to import seco.range, '
'module most likely not ins... | def _check_range_minions(self, expr, greedy):
'''
Return the minions found by looking via range expression
'''
if not HAS_RANGE:
raise CommandExecutionError(
'Range matcher unavailable (unable to import seco.range, '
'module most likely not ins... | [
"Return",
"the",
"minions",
"found",
"by",
"looking",
"via",
"range",
"expression"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/minions.py#L423-L453 | [
"def",
"_check_range_minions",
"(",
"self",
",",
"expr",
",",
"greedy",
")",
":",
"if",
"not",
"HAS_RANGE",
":",
"raise",
"CommandExecutionError",
"(",
"'Range matcher unavailable (unable to import seco.range, '",
"'module most likely not installed)'",
")",
"if",
"not",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CkMinions._check_compound_pillar_exact_minions | Return the minions found by looking via compound matcher
Disable pillar glob matching | salt/utils/minions.py | def _check_compound_pillar_exact_minions(self, expr, delimiter, greedy):
'''
Return the minions found by looking via compound matcher
Disable pillar glob matching
'''
return self._check_compound_minions(expr,
delimiter,
... | def _check_compound_pillar_exact_minions(self, expr, delimiter, greedy):
'''
Return the minions found by looking via compound matcher
Disable pillar glob matching
'''
return self._check_compound_minions(expr,
delimiter,
... | [
"Return",
"the",
"minions",
"found",
"by",
"looking",
"via",
"compound",
"matcher"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/minions.py#L455-L464 | [
"def",
"_check_compound_pillar_exact_minions",
"(",
"self",
",",
"expr",
",",
"delimiter",
",",
"greedy",
")",
":",
"return",
"self",
".",
"_check_compound_minions",
"(",
"expr",
",",
"delimiter",
",",
"greedy",
",",
"pillar_exact",
"=",
"True",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CkMinions._check_compound_minions | Return the minions found by looking via compound matcher | salt/utils/minions.py | def _check_compound_minions(self,
expr,
delimiter,
greedy,
pillar_exact=False): # pylint: disable=unused-argument
'''
Return the minions found by looking via compound matcher
... | def _check_compound_minions(self,
expr,
delimiter,
greedy,
pillar_exact=False): # pylint: disable=unused-argument
'''
Return the minions found by looking via compound matcher
... | [
"Return",
"the",
"minions",
"found",
"by",
"looking",
"via",
"compound",
"matcher"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/minions.py#L466-L620 | [
"def",
"_check_compound_minions",
"(",
"self",
",",
"expr",
",",
"delimiter",
",",
"greedy",
",",
"pillar_exact",
"=",
"False",
")",
":",
"# pylint: disable=unused-argument",
"if",
"not",
"isinstance",
"(",
"expr",
",",
"six",
".",
"string_types",
")",
"and",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CkMinions.connected_ids | Return a set of all connected minion ids, optionally within a subset | salt/utils/minions.py | def connected_ids(self, subset=None, show_ip=False, show_ipv4=None, include_localhost=None):
'''
Return a set of all connected minion ids, optionally within a subset
'''
if include_localhost is not None:
salt.utils.versions.warn_until(
'Sodium',
... | def connected_ids(self, subset=None, show_ip=False, show_ipv4=None, include_localhost=None):
'''
Return a set of all connected minion ids, optionally within a subset
'''
if include_localhost is not None:
salt.utils.versions.warn_until(
'Sodium',
... | [
"Return",
"a",
"set",
"of",
"all",
"connected",
"minion",
"ids",
"optionally",
"within",
"a",
"subset"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/minions.py#L622-L681 | [
"def",
"connected_ids",
"(",
"self",
",",
"subset",
"=",
"None",
",",
"show_ip",
"=",
"False",
",",
"show_ipv4",
"=",
"None",
",",
"include_localhost",
"=",
"None",
")",
":",
"if",
"include_localhost",
"is",
"not",
"None",
":",
"salt",
".",
"utils",
".",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CkMinions._all_minions | Return a list of all minions that have auth'd | salt/utils/minions.py | def _all_minions(self, expr=None):
'''
Return a list of all minions that have auth'd
'''
mlist = []
for fn_ in salt.utils.data.sorted_ignorecase(os.listdir(os.path.join(self.opts['pki_dir'], self.acc))):
if not fn_.startswith('.') and os.path.isfile(os.path.join(self.... | def _all_minions(self, expr=None):
'''
Return a list of all minions that have auth'd
'''
mlist = []
for fn_ in salt.utils.data.sorted_ignorecase(os.listdir(os.path.join(self.opts['pki_dir'], self.acc))):
if not fn_.startswith('.') and os.path.isfile(os.path.join(self.... | [
"Return",
"a",
"list",
"of",
"all",
"minions",
"that",
"have",
"auth",
"d"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/minions.py#L683-L691 | [
"def",
"_all_minions",
"(",
"self",
",",
"expr",
"=",
"None",
")",
":",
"mlist",
"=",
"[",
"]",
"for",
"fn_",
"in",
"salt",
".",
"utils",
".",
"data",
".",
"sorted_ignorecase",
"(",
"os",
".",
"listdir",
"(",
"os",
".",
"path",
".",
"join",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CkMinions.check_minions | Check the passed regex against the available minions' public keys
stored for authentication. This should return a set of ids which
match the regex, this will then be used to parse the returns to
make sure everyone has checked back in. | salt/utils/minions.py | def check_minions(self,
expr,
tgt_type='glob',
delimiter=DEFAULT_TARGET_DELIM,
greedy=True):
'''
Check the passed regex against the available minions' public keys
stored for authentication. This should return... | def check_minions(self,
expr,
tgt_type='glob',
delimiter=DEFAULT_TARGET_DELIM,
greedy=True):
'''
Check the passed regex against the available minions' public keys
stored for authentication. This should return... | [
"Check",
"the",
"passed",
"regex",
"against",
"the",
"available",
"minions",
"public",
"keys",
"stored",
"for",
"authentication",
".",
"This",
"should",
"return",
"a",
"set",
"of",
"ids",
"which",
"match",
"the",
"regex",
"this",
"will",
"then",
"be",
"used"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/minions.py#L693-L731 | [
"def",
"check_minions",
"(",
"self",
",",
"expr",
",",
"tgt_type",
"=",
"'glob'",
",",
"delimiter",
"=",
"DEFAULT_TARGET_DELIM",
",",
"greedy",
"=",
"True",
")",
":",
"try",
":",
"if",
"expr",
"is",
"None",
":",
"expr",
"=",
"''",
"check_func",
"=",
"g... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CkMinions.validate_tgt | Return a Bool. This function returns if the expression sent in is
within the scope of the valid expression | salt/utils/minions.py | def validate_tgt(self, valid, expr, tgt_type, minions=None, expr_form=None):
'''
Return a Bool. This function returns if the expression sent in is
within the scope of the valid expression
'''
v_minions = set(self.check_minions(valid, 'compound').get('minions', []))
if mi... | def validate_tgt(self, valid, expr, tgt_type, minions=None, expr_form=None):
'''
Return a Bool. This function returns if the expression sent in is
within the scope of the valid expression
'''
v_minions = set(self.check_minions(valid, 'compound').get('minions', []))
if mi... | [
"Return",
"a",
"Bool",
".",
"This",
"function",
"returns",
"if",
"the",
"expression",
"sent",
"in",
"is",
"within",
"the",
"scope",
"of",
"the",
"valid",
"expression"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/minions.py#L733-L748 | [
"def",
"validate_tgt",
"(",
"self",
",",
"valid",
",",
"expr",
",",
"tgt_type",
",",
"minions",
"=",
"None",
",",
"expr_form",
"=",
"None",
")",
":",
"v_minions",
"=",
"set",
"(",
"self",
".",
"check_minions",
"(",
"valid",
",",
"'compound'",
")",
".",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CkMinions.match_check | Validate a single regex to function comparison, the function argument
can be a list of functions. It is all or nothing for a list of
functions | salt/utils/minions.py | def match_check(self, regex, fun):
'''
Validate a single regex to function comparison, the function argument
can be a list of functions. It is all or nothing for a list of
functions
'''
vals = []
if isinstance(fun, six.string_types):
fun = [fun]
... | def match_check(self, regex, fun):
'''
Validate a single regex to function comparison, the function argument
can be a list of functions. It is all or nothing for a list of
functions
'''
vals = []
if isinstance(fun, six.string_types):
fun = [fun]
... | [
"Validate",
"a",
"single",
"regex",
"to",
"function",
"comparison",
"the",
"function",
"argument",
"can",
"be",
"a",
"list",
"of",
"functions",
".",
"It",
"is",
"all",
"or",
"nothing",
"for",
"a",
"list",
"of",
"functions"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/minions.py#L750-L767 | [
"def",
"match_check",
"(",
"self",
",",
"regex",
",",
"fun",
")",
":",
"vals",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"fun",
",",
"six",
".",
"string_types",
")",
":",
"fun",
"=",
"[",
"fun",
"]",
"for",
"func",
"in",
"fun",
":",
"try",
":",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CkMinions.any_auth | Read in the form and determine which auth check routine to execute | salt/utils/minions.py | def any_auth(self, form, auth_list, fun, arg, tgt=None, tgt_type='glob'):
'''
Read in the form and determine which auth check routine to execute
'''
# This function is only called from salt.auth.Authorize(), which is also
# deprecated and will be removed in Neon.
salt.uti... | def any_auth(self, form, auth_list, fun, arg, tgt=None, tgt_type='glob'):
'''
Read in the form and determine which auth check routine to execute
'''
# This function is only called from salt.auth.Authorize(), which is also
# deprecated and will be removed in Neon.
salt.uti... | [
"Read",
"in",
"the",
"form",
"and",
"determine",
"which",
"auth",
"check",
"routine",
"to",
"execute"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/minions.py#L769-L791 | [
"def",
"any_auth",
"(",
"self",
",",
"form",
",",
"auth_list",
",",
"fun",
",",
"arg",
",",
"tgt",
"=",
"None",
",",
"tgt_type",
"=",
"'glob'",
")",
":",
"# This function is only called from salt.auth.Authorize(), which is also",
"# deprecated and will be removed in Neo... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.