repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/modules/opkg.py | owner | def owner(*paths, **kwargs): # pylint: disable=unused-argument
'''
Return the name of the package that owns the file. Multiple file paths can
be passed. Like :mod:`pkg.version <salt.modules.opkg.version`, if a single
path is passed, a string will be returned, and if multiple paths are passed,
a dic... | python | def owner(*paths, **kwargs): # pylint: disable=unused-argument
'''
Return the name of the package that owns the file. Multiple file paths can
be passed. Like :mod:`pkg.version <salt.modules.opkg.version`, if a single
path is passed, a string will be returned, and if multiple paths are passed,
a dic... | [
"def",
"owner",
"(",
"*",
"paths",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"if",
"not",
"paths",
":",
"return",
"''",
"ret",
"=",
"{",
"}",
"cmd_search",
"=",
"[",
"'opkg'",
",",
"'search'",
"]",
"for",
"path",
"in",
"pa... | Return the name of the package that owns the file. Multiple file paths can
be passed. Like :mod:`pkg.version <salt.modules.opkg.version`, if a single
path is passed, a string will be returned, and if multiple paths are passed,
a dictionary of file/package name pairs will be returned.
If the file is not... | [
"Return",
"the",
"name",
"of",
"the",
"package",
"that",
"owns",
"the",
"file",
".",
"Multiple",
"file",
"paths",
"can",
"be",
"passed",
".",
"Like",
":",
"mod",
":",
"pkg",
".",
"version",
"<salt",
".",
"modules",
".",
"opkg",
".",
"version",
"if",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1599-L1630 | train |
saltstack/salt | salt/modules/splunk.py | _send_email | def _send_email(name, email):
"send a email to inform user of account creation"
config = __salt__['config.option']('splunk')
email_object = config.get('email')
if email_object:
cc = email_object.get('cc')
subject = email_object.get('subject')
message = email_object.get('message')... | python | def _send_email(name, email):
"send a email to inform user of account creation"
config = __salt__['config.option']('splunk')
email_object = config.get('email')
if email_object:
cc = email_object.get('cc')
subject = email_object.get('subject')
message = email_object.get('message')... | [
"def",
"_send_email",
"(",
"name",
",",
"email",
")",
":",
"config",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"'splunk'",
")",
"email_object",
"=",
"config",
".",
"get",
"(",
"'email'",
")",
"if",
"email_object",
":",
"cc",
"=",
"email_object",
... | send a email to inform user of account creation | [
"send",
"a",
"email",
"to",
"inform",
"user",
"of",
"account",
"creation"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/splunk.py#L84-L100 | train |
saltstack/salt | salt/modules/splunk.py | _get_splunk | def _get_splunk(profile):
'''
Return the splunk client, cached into __context__ for performance
'''
config = __salt__['config.option'](profile)
key = "splunk.{0}:{1}:{2}:{3}".format(
config.get('host'),
config.get('port'),
config.get('username'),
config.get('password... | python | def _get_splunk(profile):
'''
Return the splunk client, cached into __context__ for performance
'''
config = __salt__['config.option'](profile)
key = "splunk.{0}:{1}:{2}:{3}".format(
config.get('host'),
config.get('port'),
config.get('username'),
config.get('password... | [
"def",
"_get_splunk",
"(",
"profile",
")",
":",
"config",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"profile",
")",
"key",
"=",
"\"splunk.{0}:{1}:{2}:{3}\"",
".",
"format",
"(",
"config",
".",
"get",
"(",
"'host'",
")",
",",
"config",
".",
"get",
... | Return the splunk client, cached into __context__ for performance | [
"Return",
"the",
"splunk",
"client",
"cached",
"into",
"__context__",
"for",
"performance"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/splunk.py#L124-L144 | train |
saltstack/salt | salt/modules/splunk.py | list_users | def list_users(profile="splunk"):
'''
List all users in the splunk DB
CLI Example:
salt myminion splunk.list_users
'''
config = __salt__['config.option'](profile)
key = "splunk.users.{0}".format(
config.get('host')
)
if key not in __context__:
_populate_cache(... | python | def list_users(profile="splunk"):
'''
List all users in the splunk DB
CLI Example:
salt myminion splunk.list_users
'''
config = __salt__['config.option'](profile)
key = "splunk.users.{0}".format(
config.get('host')
)
if key not in __context__:
_populate_cache(... | [
"def",
"list_users",
"(",
"profile",
"=",
"\"splunk\"",
")",
":",
"config",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"profile",
")",
"key",
"=",
"\"splunk.users.{0}\"",
".",
"format",
"(",
"config",
".",
"get",
"(",
"'host'",
")",
")",
"if",
"k... | List all users in the splunk DB
CLI Example:
salt myminion splunk.list_users | [
"List",
"all",
"users",
"in",
"the",
"splunk",
"DB"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/splunk.py#L147-L164 | train |
saltstack/salt | salt/modules/splunk.py | get_user | def get_user(email, profile="splunk", **kwargs):
'''
Get a splunk user by name/email
CLI Example:
salt myminion splunk.get_user 'user@example.com' user_details=false
salt myminion splunk.get_user 'user@example.com' user_details=true
'''
user_map = list_users(profile)
user_foun... | python | def get_user(email, profile="splunk", **kwargs):
'''
Get a splunk user by name/email
CLI Example:
salt myminion splunk.get_user 'user@example.com' user_details=false
salt myminion splunk.get_user 'user@example.com' user_details=true
'''
user_map = list_users(profile)
user_foun... | [
"def",
"get_user",
"(",
"email",
",",
"profile",
"=",
"\"splunk\"",
",",
"*",
"*",
"kwargs",
")",
":",
"user_map",
"=",
"list_users",
"(",
"profile",
")",
"user_found",
"=",
"email",
".",
"lower",
"(",
")",
"in",
"user_map",
".",
"keys",
"(",
")",
"i... | Get a splunk user by name/email
CLI Example:
salt myminion splunk.get_user 'user@example.com' user_details=false
salt myminion splunk.get_user 'user@example.com' user_details=true | [
"Get",
"a",
"splunk",
"user",
"by",
"name",
"/",
"email"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/splunk.py#L167-L196 | train |
saltstack/salt | salt/modules/splunk.py | create_user | def create_user(email, profile="splunk", **kwargs):
'''
create a splunk user by name/email
CLI Example:
salt myminion splunk.create_user user@example.com roles=['user'] realname="Test User" name=testuser
'''
client = _get_splunk(profile)
email = email.lower()
user = list_users(p... | python | def create_user(email, profile="splunk", **kwargs):
'''
create a splunk user by name/email
CLI Example:
salt myminion splunk.create_user user@example.com roles=['user'] realname="Test User" name=testuser
'''
client = _get_splunk(profile)
email = email.lower()
user = list_users(p... | [
"def",
"create_user",
"(",
"email",
",",
"profile",
"=",
"\"splunk\"",
",",
"*",
"*",
"kwargs",
")",
":",
"client",
"=",
"_get_splunk",
"(",
"profile",
")",
"email",
"=",
"email",
".",
"lower",
"(",
")",
"user",
"=",
"list_users",
"(",
"profile",
")",
... | create a splunk user by name/email
CLI Example:
salt myminion splunk.create_user user@example.com roles=['user'] realname="Test User" name=testuser | [
"create",
"a",
"splunk",
"user",
"by",
"name",
"/",
"email"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/splunk.py#L199-L246 | train |
saltstack/salt | salt/modules/splunk.py | update_user | def update_user(email, profile="splunk", **kwargs):
'''
Create a splunk user by email
CLI Example:
salt myminion splunk.update_user example@domain.com roles=['user'] realname="Test User"
'''
client = _get_splunk(profile)
email = email.lower()
user = list_users(profile).get(email... | python | def update_user(email, profile="splunk", **kwargs):
'''
Create a splunk user by email
CLI Example:
salt myminion splunk.update_user example@domain.com roles=['user'] realname="Test User"
'''
client = _get_splunk(profile)
email = email.lower()
user = list_users(profile).get(email... | [
"def",
"update_user",
"(",
"email",
",",
"profile",
"=",
"\"splunk\"",
",",
"*",
"*",
"kwargs",
")",
":",
"client",
"=",
"_get_splunk",
"(",
"profile",
")",
"email",
"=",
"email",
".",
"lower",
"(",
")",
"user",
"=",
"list_users",
"(",
"profile",
")",
... | Create a splunk user by email
CLI Example:
salt myminion splunk.update_user example@domain.com roles=['user'] realname="Test User" | [
"Create",
"a",
"splunk",
"user",
"by",
"email"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/splunk.py#L249-L301 | train |
saltstack/salt | salt/modules/splunk.py | delete_user | def delete_user(email, profile="splunk"):
'''
Delete a splunk user by email
CLI Example:
salt myminion splunk_user.delete 'user@example.com'
'''
client = _get_splunk(profile)
user = list_users(profile).get(email)
if user:
try:
client.users.delete(user.name)
... | python | def delete_user(email, profile="splunk"):
'''
Delete a splunk user by email
CLI Example:
salt myminion splunk_user.delete 'user@example.com'
'''
client = _get_splunk(profile)
user = list_users(profile).get(email)
if user:
try:
client.users.delete(user.name)
... | [
"def",
"delete_user",
"(",
"email",
",",
"profile",
"=",
"\"splunk\"",
")",
":",
"client",
"=",
"_get_splunk",
"(",
"profile",
")",
"user",
"=",
"list_users",
"(",
"profile",
")",
".",
"get",
"(",
"email",
")",
"if",
"user",
":",
"try",
":",
"client",
... | Delete a splunk user by email
CLI Example:
salt myminion splunk_user.delete 'user@example.com' | [
"Delete",
"a",
"splunk",
"user",
"by",
"email"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/splunk.py#L304-L326 | train |
saltstack/salt | salt/grains/extra.py | shell | def shell():
'''
Return the default shell to use on this system
'''
# Provides:
# shell
if salt.utils.platform.is_windows():
env_var = 'COMSPEC'
default = r'C:\Windows\system32\cmd.exe'
else:
env_var = 'SHELL'
default = '/bin/sh'
return {'shell': os.env... | python | def shell():
'''
Return the default shell to use on this system
'''
# Provides:
# shell
if salt.utils.platform.is_windows():
env_var = 'COMSPEC'
default = r'C:\Windows\system32\cmd.exe'
else:
env_var = 'SHELL'
default = '/bin/sh'
return {'shell': os.env... | [
"def",
"shell",
"(",
")",
":",
"# Provides:",
"# shell",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"env_var",
"=",
"'COMSPEC'",
"default",
"=",
"r'C:\\Windows\\system32\\cmd.exe'",
"else",
":",
"env_var",
"=",
"'SHELL'",
... | Return the default shell to use on this system | [
"Return",
"the",
"default",
"shell",
"to",
"use",
"on",
"this",
"system"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/extra.py#L21-L34 | train |
saltstack/salt | salt/grains/extra.py | config | def config():
'''
Return the grains set in the grains file
'''
if 'conf_file' not in __opts__:
return {}
if os.path.isdir(__opts__['conf_file']):
if salt.utils.platform.is_proxy():
gfn = os.path.join(
__opts__['conf_file'],
'proxy.d... | python | def config():
'''
Return the grains set in the grains file
'''
if 'conf_file' not in __opts__:
return {}
if os.path.isdir(__opts__['conf_file']):
if salt.utils.platform.is_proxy():
gfn = os.path.join(
__opts__['conf_file'],
'proxy.d... | [
"def",
"config",
"(",
")",
":",
"if",
"'conf_file'",
"not",
"in",
"__opts__",
":",
"return",
"{",
"}",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"__opts__",
"[",
"'conf_file'",
"]",
")",
":",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_... | Return the grains set in the grains file | [
"Return",
"the",
"grains",
"set",
"in",
"the",
"grains",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/extra.py#L37-L77 | train |
saltstack/salt | salt/modules/mac_desktop.py | get_output_volume | def get_output_volume():
'''
Get the output volume (range 0 to 100)
CLI Example:
.. code-block:: bash
salt '*' desktop.get_output_volume
'''
cmd = 'osascript -e "get output volume of (get volume settings)"'
call = __salt__['cmd.run_all'](
cmd,
output_loglevel='debu... | python | def get_output_volume():
'''
Get the output volume (range 0 to 100)
CLI Example:
.. code-block:: bash
salt '*' desktop.get_output_volume
'''
cmd = 'osascript -e "get output volume of (get volume settings)"'
call = __salt__['cmd.run_all'](
cmd,
output_loglevel='debu... | [
"def",
"get_output_volume",
"(",
")",
":",
"cmd",
"=",
"'osascript -e \"get output volume of (get volume settings)\"'",
"call",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
",",
"output_loglevel",
"=",
"'debug'",
",",
"python_shell",
"=",
"False",
")",
"_... | Get the output volume (range 0 to 100)
CLI Example:
.. code-block:: bash
salt '*' desktop.get_output_volume | [
"Get",
"the",
"output",
"volume",
"(",
"range",
"0",
"to",
"100",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_desktop.py#L24-L42 | train |
saltstack/salt | salt/modules/mac_desktop.py | set_output_volume | def set_output_volume(volume):
'''
Set the volume of sound.
volume
The level of volume. Can range from 0 to 100.
CLI Example:
.. code-block:: bash
salt '*' desktop.set_output_volume <volume>
'''
cmd = 'osascript -e "set volume output volume {0}"'.format(volume)
call =... | python | def set_output_volume(volume):
'''
Set the volume of sound.
volume
The level of volume. Can range from 0 to 100.
CLI Example:
.. code-block:: bash
salt '*' desktop.set_output_volume <volume>
'''
cmd = 'osascript -e "set volume output volume {0}"'.format(volume)
call =... | [
"def",
"set_output_volume",
"(",
"volume",
")",
":",
"cmd",
"=",
"'osascript -e \"set volume output volume {0}\"'",
".",
"format",
"(",
"volume",
")",
"call",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
",",
"output_loglevel",
"=",
"'debug'",
",",
"p... | Set the volume of sound.
volume
The level of volume. Can range from 0 to 100.
CLI Example:
.. code-block:: bash
salt '*' desktop.set_output_volume <volume> | [
"Set",
"the",
"volume",
"of",
"sound",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_desktop.py#L45-L66 | train |
saltstack/salt | salt/modules/mac_desktop.py | screensaver | def screensaver():
'''
Launch the screensaver.
CLI Example:
.. code-block:: bash
salt '*' desktop.screensaver
'''
cmd = 'open /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app'
call = __salt__['cmd.run_all'](
cmd,
output_lo... | python | def screensaver():
'''
Launch the screensaver.
CLI Example:
.. code-block:: bash
salt '*' desktop.screensaver
'''
cmd = 'open /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app'
call = __salt__['cmd.run_all'](
cmd,
output_lo... | [
"def",
"screensaver",
"(",
")",
":",
"cmd",
"=",
"'open /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app'",
"call",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
",",
"output_loglevel",
"=",
"'debug'",
",",
"python_shell"... | Launch the screensaver.
CLI Example:
.. code-block:: bash
salt '*' desktop.screensaver | [
"Launch",
"the",
"screensaver",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_desktop.py#L69-L87 | train |
saltstack/salt | salt/modules/mac_desktop.py | say | def say(*words):
'''
Say some words.
words
The words to execute the say command with.
CLI Example:
.. code-block:: bash
salt '*' desktop.say <word0> <word1> ... <wordN>
'''
cmd = 'say {0}'.format(' '.join(words))
call = __salt__['cmd.run_all'](
cmd,
ou... | python | def say(*words):
'''
Say some words.
words
The words to execute the say command with.
CLI Example:
.. code-block:: bash
salt '*' desktop.say <word0> <word1> ... <wordN>
'''
cmd = 'say {0}'.format(' '.join(words))
call = __salt__['cmd.run_all'](
cmd,
ou... | [
"def",
"say",
"(",
"*",
"words",
")",
":",
"cmd",
"=",
"'say {0}'",
".",
"format",
"(",
"' '",
".",
"join",
"(",
"words",
")",
")",
"call",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
",",
"output_loglevel",
"=",
"'debug'",
",",
"python_s... | Say some words.
words
The words to execute the say command with.
CLI Example:
.. code-block:: bash
salt '*' desktop.say <word0> <word1> ... <wordN> | [
"Say",
"some",
"words",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_desktop.py#L111-L132 | train |
saltstack/salt | salt/modules/mac_desktop.py | _check_cmd | def _check_cmd(call):
'''
Check the output of the cmd.run_all function call.
'''
if call['retcode'] != 0:
comment = ''
std_err = call.get('stderr')
std_out = call.get('stdout')
if std_err:
comment += std_err
if std_out:
comment += std_out
... | python | def _check_cmd(call):
'''
Check the output of the cmd.run_all function call.
'''
if call['retcode'] != 0:
comment = ''
std_err = call.get('stderr')
std_out = call.get('stdout')
if std_err:
comment += std_err
if std_out:
comment += std_out
... | [
"def",
"_check_cmd",
"(",
"call",
")",
":",
"if",
"call",
"[",
"'retcode'",
"]",
"!=",
"0",
":",
"comment",
"=",
"''",
"std_err",
"=",
"call",
".",
"get",
"(",
"'stderr'",
")",
"std_out",
"=",
"call",
".",
"get",
"(",
"'stdout'",
")",
"if",
"std_er... | Check the output of the cmd.run_all function call. | [
"Check",
"the",
"output",
"of",
"the",
"cmd",
".",
"run_all",
"function",
"call",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_desktop.py#L135-L150 | train |
saltstack/salt | salt/utils/win_pdh.py | build_counter_list | def build_counter_list(counter_list):
r'''
Create a list of Counter objects to be used in the pdh query
Args:
counter_list (list):
A list of tuples containing counter information. Each tuple should
contain the object, instance, and counter name. For example, to
g... | python | def build_counter_list(counter_list):
r'''
Create a list of Counter objects to be used in the pdh query
Args:
counter_list (list):
A list of tuples containing counter information. Each tuple should
contain the object, instance, and counter name. For example, to
g... | [
"def",
"build_counter_list",
"(",
"counter_list",
")",
":",
"counters",
"=",
"[",
"]",
"index",
"=",
"0",
"for",
"obj",
",",
"instance",
",",
"counter_name",
"in",
"counter_list",
":",
"try",
":",
"counter",
"=",
"Counter",
".",
"build_counter",
"(",
"obj"... | r'''
Create a list of Counter objects to be used in the pdh query
Args:
counter_list (list):
A list of tuples containing counter information. Each tuple should
contain the object, instance, and counter name. For example, to
get the ``% Processor Time`` counter for al... | [
"r",
"Create",
"a",
"list",
"of",
"Counter",
"objects",
"to",
"be",
"used",
"in",
"the",
"pdh",
"query"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_pdh.py#L292-L334 | train |
saltstack/salt | salt/utils/win_pdh.py | get_all_counters | def get_all_counters(obj, instance_list=None):
'''
Get the values for all counters available to a Counter object
Args:
obj (str):
The name of the counter object. You can get a list of valid names
using the ``list_objects`` function
instance_list (list):
... | python | def get_all_counters(obj, instance_list=None):
'''
Get the values for all counters available to a Counter object
Args:
obj (str):
The name of the counter object. You can get a list of valid names
using the ``list_objects`` function
instance_list (list):
... | [
"def",
"get_all_counters",
"(",
"obj",
",",
"instance_list",
"=",
"None",
")",
":",
"counters",
",",
"instances_avail",
"=",
"win32pdh",
".",
"EnumObjectItems",
"(",
"None",
",",
"None",
",",
"obj",
",",
"-",
"1",
",",
"0",
")",
"if",
"instance_list",
"i... | Get the values for all counters available to a Counter object
Args:
obj (str):
The name of the counter object. You can get a list of valid names
using the ``list_objects`` function
instance_list (list):
A list of instances to return. Use this to narrow down the... | [
"Get",
"the",
"values",
"for",
"all",
"counters",
"available",
"to",
"a",
"Counter",
"object"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_pdh.py#L337-L370 | train |
saltstack/salt | salt/utils/win_pdh.py | get_counters | def get_counters(counter_list):
'''
Get the values for the passes list of counters
Args:
counter_list (list):
A list of counters to lookup
Returns:
dict: A dictionary of counters and their values
'''
if not isinstance(counter_list, list):
raise CommandExecut... | python | def get_counters(counter_list):
'''
Get the values for the passes list of counters
Args:
counter_list (list):
A list of counters to lookup
Returns:
dict: A dictionary of counters and their values
'''
if not isinstance(counter_list, list):
raise CommandExecut... | [
"def",
"get_counters",
"(",
"counter_list",
")",
":",
"if",
"not",
"isinstance",
"(",
"counter_list",
",",
"list",
")",
":",
"raise",
"CommandExecutionError",
"(",
"'counter_list must be a list of tuples'",
")",
"try",
":",
"# Start a Query instances",
"query",
"=",
... | Get the values for the passes list of counters
Args:
counter_list (list):
A list of counters to lookup
Returns:
dict: A dictionary of counters and their values | [
"Get",
"the",
"values",
"for",
"the",
"passes",
"list",
"of",
"counters"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_pdh.py#L373-L420 | train |
saltstack/salt | salt/utils/win_pdh.py | Counter.build_counter | def build_counter(obj, instance, instance_index, counter):
r'''
Makes a fully resolved counter path. Counter names are formatted like
this:
``\Processor(*)\% Processor Time``
The above breaks down like this:
obj = 'Processor'
instance = '*'
... | python | def build_counter(obj, instance, instance_index, counter):
r'''
Makes a fully resolved counter path. Counter names are formatted like
this:
``\Processor(*)\% Processor Time``
The above breaks down like this:
obj = 'Processor'
instance = '*'
... | [
"def",
"build_counter",
"(",
"obj",
",",
"instance",
",",
"instance_index",
",",
"counter",
")",
":",
"path",
"=",
"win32pdh",
".",
"MakeCounterPath",
"(",
"(",
"None",
",",
"obj",
",",
"instance",
",",
"None",
",",
"instance_index",
",",
"counter",
")",
... | r'''
Makes a fully resolved counter path. Counter names are formatted like
this:
``\Processor(*)\% Processor Time``
The above breaks down like this:
obj = 'Processor'
instance = '*'
counter = '% Processor Time'
Args:
obj (str):... | [
"r",
"Makes",
"a",
"fully",
"resolved",
"counter",
"path",
".",
"Counter",
"names",
"are",
"formatted",
"like",
"this",
":"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_pdh.py#L132-L169 | train |
saltstack/salt | salt/utils/win_pdh.py | Counter.add_to_query | def add_to_query(self, query):
'''
Add the current path to the query
Args:
query (obj):
The handle to the query to add the counter
'''
self.handle = win32pdh.AddCounter(query, self.path) | python | def add_to_query(self, query):
'''
Add the current path to the query
Args:
query (obj):
The handle to the query to add the counter
'''
self.handle = win32pdh.AddCounter(query, self.path) | [
"def",
"add_to_query",
"(",
"self",
",",
"query",
")",
":",
"self",
".",
"handle",
"=",
"win32pdh",
".",
"AddCounter",
"(",
"query",
",",
"self",
".",
"path",
")"
] | Add the current path to the query
Args:
query (obj):
The handle to the query to add the counter | [
"Add",
"the",
"current",
"path",
"to",
"the",
"query"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_pdh.py#L183-L191 | train |
saltstack/salt | salt/utils/win_pdh.py | Counter.get_info | def get_info(self):
'''
Get information about the counter
.. note::
GetCounterInfo sometimes crashes in the wrapper code. Fewer crashes
if this is called after sampling data.
'''
if not self.info:
ci = win32pdh.GetCounterInfo(self.handle, 0)
... | python | def get_info(self):
'''
Get information about the counter
.. note::
GetCounterInfo sometimes crashes in the wrapper code. Fewer crashes
if this is called after sampling data.
'''
if not self.info:
ci = win32pdh.GetCounterInfo(self.handle, 0)
... | [
"def",
"get_info",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"info",
":",
"ci",
"=",
"win32pdh",
".",
"GetCounterInfo",
"(",
"self",
".",
"handle",
",",
"0",
")",
"self",
".",
"info",
"=",
"{",
"'type'",
":",
"ci",
"[",
"0",
"]",
",",
"'... | Get information about the counter
.. note::
GetCounterInfo sometimes crashes in the wrapper code. Fewer crashes
if this is called after sampling data. | [
"Get",
"information",
"about",
"the",
"counter"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_pdh.py#L193-L219 | train |
saltstack/salt | salt/utils/win_pdh.py | Counter.value | def value(self):
'''
Return the counter value
Returns:
long: The counter value
'''
(counter_type, value) = win32pdh.GetFormattedCounterValue(
self.handle, win32pdh.PDH_FMT_DOUBLE)
self.type = counter_type
return value | python | def value(self):
'''
Return the counter value
Returns:
long: The counter value
'''
(counter_type, value) = win32pdh.GetFormattedCounterValue(
self.handle, win32pdh.PDH_FMT_DOUBLE)
self.type = counter_type
return value | [
"def",
"value",
"(",
"self",
")",
":",
"(",
"counter_type",
",",
"value",
")",
"=",
"win32pdh",
".",
"GetFormattedCounterValue",
"(",
"self",
".",
"handle",
",",
"win32pdh",
".",
"PDH_FMT_DOUBLE",
")",
"self",
".",
"type",
"=",
"counter_type",
"return",
"v... | Return the counter value
Returns:
long: The counter value | [
"Return",
"the",
"counter",
"value"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_pdh.py#L221-L231 | train |
saltstack/salt | salt/utils/win_pdh.py | Counter.type_string | def type_string(self):
'''
Returns the names of the flags that are set in the Type field
It can be used to format the counter.
'''
type = self.get_info()['type']
type_list = []
for member in dir(self):
if member.startswith("PERF_"):
bi... | python | def type_string(self):
'''
Returns the names of the flags that are set in the Type field
It can be used to format the counter.
'''
type = self.get_info()['type']
type_list = []
for member in dir(self):
if member.startswith("PERF_"):
bi... | [
"def",
"type_string",
"(",
"self",
")",
":",
"type",
"=",
"self",
".",
"get_info",
"(",
")",
"[",
"'type'",
"]",
"type_list",
"=",
"[",
"]",
"for",
"member",
"in",
"dir",
"(",
"self",
")",
":",
"if",
"member",
".",
"startswith",
"(",
"\"PERF_\"",
"... | Returns the names of the flags that are set in the Type field
It can be used to format the counter. | [
"Returns",
"the",
"names",
"of",
"the",
"flags",
"that",
"are",
"set",
"in",
"the",
"Type",
"field"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_pdh.py#L233-L246 | train |
saltstack/salt | salt/states/win_path.py | exists | def exists(name, index=None):
'''
Add the directory to the system PATH at index location
index
Position where the directory should be placed in the PATH. This is
0-indexed, so 0 means to prepend at the very start of the PATH.
.. note::
If the index is not specified, and... | python | def exists(name, index=None):
'''
Add the directory to the system PATH at index location
index
Position where the directory should be placed in the PATH. This is
0-indexed, so 0 means to prepend at the very start of the PATH.
.. note::
If the index is not specified, and... | [
"def",
"exists",
"(",
"name",
",",
"index",
"=",
"None",
")",
":",
"try",
":",
"name",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"salt",
".",
"utils",
".",
"stringutils",
".",
"to_unicode",
"(",
"name",
")",
")",
"except",
"TypeError",
":",
"na... | Add the directory to the system PATH at index location
index
Position where the directory should be placed in the PATH. This is
0-indexed, so 0 means to prepend at the very start of the PATH.
.. note::
If the index is not specified, and the directory needs to be added
... | [
"Add",
"the",
"directory",
"to",
"the",
"system",
"PATH",
"at",
"index",
"location"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_path.py#L66-L234 | train |
saltstack/salt | salt/proxy/rest_sample.py | id | def id(opts):
'''
Return a unique ID for this proxy minion. This ID MUST NOT CHANGE.
If it changes while the proxy is running the salt-master will get
really confused and may stop talking to this minion
'''
r = salt.utils.http.query(opts['proxy']['url']+'id', decode_type='json', decode=True)
... | python | def id(opts):
'''
Return a unique ID for this proxy minion. This ID MUST NOT CHANGE.
If it changes while the proxy is running the salt-master will get
really confused and may stop talking to this minion
'''
r = salt.utils.http.query(opts['proxy']['url']+'id', decode_type='json', decode=True)
... | [
"def",
"id",
"(",
"opts",
")",
":",
"r",
"=",
"salt",
".",
"utils",
".",
"http",
".",
"query",
"(",
"opts",
"[",
"'proxy'",
"]",
"[",
"'url'",
"]",
"+",
"'id'",
",",
"decode_type",
"=",
"'json'",
",",
"decode",
"=",
"True",
")",
"return",
"r",
... | Return a unique ID for this proxy minion. This ID MUST NOT CHANGE.
If it changes while the proxy is running the salt-master will get
really confused and may stop talking to this minion | [
"Return",
"a",
"unique",
"ID",
"for",
"this",
"proxy",
"minion",
".",
"This",
"ID",
"MUST",
"NOT",
"CHANGE",
".",
"If",
"it",
"changes",
"while",
"the",
"proxy",
"is",
"running",
"the",
"salt",
"-",
"master",
"will",
"get",
"really",
"confused",
"and",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/rest_sample.py#L69-L76 | train |
saltstack/salt | salt/proxy/rest_sample.py | grains | def grains():
'''
Get the grains from the proxied device
'''
if not DETAILS.get('grains_cache', {}):
r = salt.utils.http.query(DETAILS['url']+'info', decode_type='json', decode=True)
DETAILS['grains_cache'] = r['dict']
return DETAILS['grains_cache'] | python | def grains():
'''
Get the grains from the proxied device
'''
if not DETAILS.get('grains_cache', {}):
r = salt.utils.http.query(DETAILS['url']+'info', decode_type='json', decode=True)
DETAILS['grains_cache'] = r['dict']
return DETAILS['grains_cache'] | [
"def",
"grains",
"(",
")",
":",
"if",
"not",
"DETAILS",
".",
"get",
"(",
"'grains_cache'",
",",
"{",
"}",
")",
":",
"r",
"=",
"salt",
".",
"utils",
".",
"http",
".",
"query",
"(",
"DETAILS",
"[",
"'url'",
"]",
"+",
"'info'",
",",
"decode_type",
"... | Get the grains from the proxied device | [
"Get",
"the",
"grains",
"from",
"the",
"proxied",
"device"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/rest_sample.py#L79-L86 | train |
saltstack/salt | salt/proxy/rest_sample.py | service_start | def service_start(name):
'''
Start a "service" on the REST server
'''
r = salt.utils.http.query(DETAILS['url']+'service/start/'+name, decode_type='json', decode=True)
return r['dict'] | python | def service_start(name):
'''
Start a "service" on the REST server
'''
r = salt.utils.http.query(DETAILS['url']+'service/start/'+name, decode_type='json', decode=True)
return r['dict'] | [
"def",
"service_start",
"(",
"name",
")",
":",
"r",
"=",
"salt",
".",
"utils",
".",
"http",
".",
"query",
"(",
"DETAILS",
"[",
"'url'",
"]",
"+",
"'service/start/'",
"+",
"name",
",",
"decode_type",
"=",
"'json'",
",",
"decode",
"=",
"True",
")",
"re... | Start a "service" on the REST server | [
"Start",
"a",
"service",
"on",
"the",
"REST",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/rest_sample.py#L102-L107 | train |
saltstack/salt | salt/proxy/rest_sample.py | service_list | def service_list():
'''
List "services" on the REST server
'''
r = salt.utils.http.query(DETAILS['url']+'service/list', decode_type='json', decode=True)
return r['dict'] | python | def service_list():
'''
List "services" on the REST server
'''
r = salt.utils.http.query(DETAILS['url']+'service/list', decode_type='json', decode=True)
return r['dict'] | [
"def",
"service_list",
"(",
")",
":",
"r",
"=",
"salt",
".",
"utils",
".",
"http",
".",
"query",
"(",
"DETAILS",
"[",
"'url'",
"]",
"+",
"'service/list'",
",",
"decode_type",
"=",
"'json'",
",",
"decode",
"=",
"True",
")",
"return",
"r",
"[",
"'dict'... | List "services" on the REST server | [
"List",
"services",
"on",
"the",
"REST",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/rest_sample.py#L126-L131 | train |
saltstack/salt | salt/proxy/rest_sample.py | package_install | def package_install(name, **kwargs):
'''
Install a "package" on the REST server
'''
cmd = DETAILS['url']+'package/install/'+name
if kwargs.get('version', False):
cmd += '/'+kwargs['version']
else:
cmd += '/1.0'
r = salt.utils.http.query(cmd, decode_type='json', decode=True)
... | python | def package_install(name, **kwargs):
'''
Install a "package" on the REST server
'''
cmd = DETAILS['url']+'package/install/'+name
if kwargs.get('version', False):
cmd += '/'+kwargs['version']
else:
cmd += '/1.0'
r = salt.utils.http.query(cmd, decode_type='json', decode=True)
... | [
"def",
"package_install",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"cmd",
"=",
"DETAILS",
"[",
"'url'",
"]",
"+",
"'package/install/'",
"+",
"name",
"if",
"kwargs",
".",
"get",
"(",
"'version'",
",",
"False",
")",
":",
"cmd",
"+=",
"'/'",
"+",... | Install a "package" on the REST server | [
"Install",
"a",
"package",
"on",
"the",
"REST",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/rest_sample.py#L150-L160 | train |
saltstack/salt | salt/proxy/rest_sample.py | ping | def ping():
'''
Is the REST server up?
'''
r = salt.utils.http.query(DETAILS['url']+'ping', decode_type='json', decode=True)
try:
return r['dict'].get('ret', False)
except Exception:
return False | python | def ping():
'''
Is the REST server up?
'''
r = salt.utils.http.query(DETAILS['url']+'ping', decode_type='json', decode=True)
try:
return r['dict'].get('ret', False)
except Exception:
return False | [
"def",
"ping",
"(",
")",
":",
"r",
"=",
"salt",
".",
"utils",
".",
"http",
".",
"query",
"(",
"DETAILS",
"[",
"'url'",
"]",
"+",
"'ping'",
",",
"decode_type",
"=",
"'json'",
",",
"decode",
"=",
"True",
")",
"try",
":",
"return",
"r",
"[",
"'dict'... | Is the REST server up? | [
"Is",
"the",
"REST",
"server",
"up?"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/rest_sample.py#L194-L202 | train |
saltstack/salt | salt/states/mac_xattr.py | exists | def exists(name, attributes):
'''
Make sure the given attributes exist on the file/directory
name
The path to the file/directory
attributes
The attributes that should exist on the file/directory, this is accepted as
an array, with key and value split with an equals sign, if you... | python | def exists(name, attributes):
'''
Make sure the given attributes exist on the file/directory
name
The path to the file/directory
attributes
The attributes that should exist on the file/directory, this is accepted as
an array, with key and value split with an equals sign, if you... | [
"def",
"exists",
"(",
"name",
",",
"attributes",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
"}",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"("... | Make sure the given attributes exist on the file/directory
name
The path to the file/directory
attributes
The attributes that should exist on the file/directory, this is accepted as
an array, with key and value split with an equals sign, if you want to specify
a hex value then ... | [
"Make",
"sure",
"the",
"given",
"attributes",
"exist",
"on",
"the",
"file",
"/",
"directory"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mac_xattr.py#L35-L85 | train |
saltstack/salt | salt/states/mac_xattr.py | delete | def delete(name, attributes):
'''
Make sure the given attributes are deleted from the file/directory
name
The path to the file/directory
attributes
The attributes that should be removed from the file/directory, this is accepted as
an array.
'''
ret = {'name': name,
... | python | def delete(name, attributes):
'''
Make sure the given attributes are deleted from the file/directory
name
The path to the file/directory
attributes
The attributes that should be removed from the file/directory, this is accepted as
an array.
'''
ret = {'name': name,
... | [
"def",
"delete",
"(",
"name",
",",
"attributes",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
"}",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"("... | Make sure the given attributes are deleted from the file/directory
name
The path to the file/directory
attributes
The attributes that should be removed from the file/directory, this is accepted as
an array. | [
"Make",
"sure",
"the",
"given",
"attributes",
"are",
"deleted",
"from",
"the",
"file",
"/",
"directory"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mac_xattr.py#L88-L121 | train |
saltstack/salt | salt/utils/validate/path.py | is_writeable | def is_writeable(path, check_parent=False):
'''
Check if a given path is writeable by the current user.
:param path: The path to check
:param check_parent: If the path to check does not exist, check for the
ability to write to the parent directory instead
:returns: True or False
'''
... | python | def is_writeable(path, check_parent=False):
'''
Check if a given path is writeable by the current user.
:param path: The path to check
:param check_parent: If the path to check does not exist, check for the
ability to write to the parent directory instead
:returns: True or False
'''
... | [
"def",
"is_writeable",
"(",
"path",
",",
"check_parent",
"=",
"False",
")",
":",
"if",
"os",
".",
"access",
"(",
"path",
",",
"os",
".",
"F_OK",
")",
"and",
"os",
".",
"access",
"(",
"path",
",",
"os",
".",
"W_OK",
")",
":",
"# The path exists and is... | Check if a given path is writeable by the current user.
:param path: The path to check
:param check_parent: If the path to check does not exist, check for the
ability to write to the parent directory instead
:returns: True or False | [
"Check",
"if",
"a",
"given",
"path",
"is",
"writeable",
"by",
"the",
"current",
"user",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/validate/path.py#L17-L50 | train |
saltstack/salt | salt/utils/validate/path.py | is_readable | def is_readable(path):
'''
Check if a given path is readable by the current user.
:param path: The path to check
:returns: True or False
'''
if os.access(path, os.F_OK) and os.access(path, os.R_OK):
# The path exists and is readable
return True
# The path does not exist
... | python | def is_readable(path):
'''
Check if a given path is readable by the current user.
:param path: The path to check
:returns: True or False
'''
if os.access(path, os.F_OK) and os.access(path, os.R_OK):
# The path exists and is readable
return True
# The path does not exist
... | [
"def",
"is_readable",
"(",
"path",
")",
":",
"if",
"os",
".",
"access",
"(",
"path",
",",
"os",
".",
"F_OK",
")",
"and",
"os",
".",
"access",
"(",
"path",
",",
"os",
".",
"R_OK",
")",
":",
"# The path exists and is readable",
"return",
"True",
"# The p... | Check if a given path is readable by the current user.
:param path: The path to check
:returns: True or False | [
"Check",
"if",
"a",
"given",
"path",
"is",
"readable",
"by",
"the",
"current",
"user",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/validate/path.py#L53-L66 | train |
saltstack/salt | salt/engines/junos_syslog.py | _SyslogServerFactory.parseData | def parseData(self, data, host, port, options):
'''
This function will parse the raw syslog data, dynamically create the
topic according to the topic specified by the user (if specified) and
decide whether to send the syslog data as an event on the master bus,
based on the constr... | python | def parseData(self, data, host, port, options):
'''
This function will parse the raw syslog data, dynamically create the
topic according to the topic specified by the user (if specified) and
decide whether to send the syslog data as an event on the master bus,
based on the constr... | [
"def",
"parseData",
"(",
"self",
",",
"data",
",",
"host",
",",
"port",
",",
"options",
")",
":",
"data",
"=",
"self",
".",
"obj",
".",
"parse",
"(",
"data",
")",
"data",
"[",
"'hostip'",
"]",
"=",
"host",
"log",
".",
"debug",
"(",
"'Junos Syslog -... | This function will parse the raw syslog data, dynamically create the
topic according to the topic specified by the user (if specified) and
decide whether to send the syslog data as an event on the master bus,
based on the constraints given by the user.
:param data: The raw syslog event ... | [
"This",
"function",
"will",
"parse",
"the",
"raw",
"syslog",
"data",
"dynamically",
"create",
"the",
"topic",
"according",
"to",
"the",
"topic",
"specified",
"by",
"the",
"user",
"(",
"if",
"specified",
")",
"and",
"decide",
"whether",
"to",
"send",
"the",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/junos_syslog.py#L289-L350 | train |
saltstack/salt | salt/engines/junos_syslog.py | _SyslogServerFactory.send_event_to_salt | def send_event_to_salt(self, result):
'''
This function identifies whether the engine is running on the master
or the minion and sends the data to the master event bus accordingly.
:param result: It's a dictionary which has the final data and topic.
'''
if result['send'... | python | def send_event_to_salt(self, result):
'''
This function identifies whether the engine is running on the master
or the minion and sends the data to the master event bus accordingly.
:param result: It's a dictionary which has the final data and topic.
'''
if result['send'... | [
"def",
"send_event_to_salt",
"(",
"self",
",",
"result",
")",
":",
"if",
"result",
"[",
"'send'",
"]",
":",
"data",
"=",
"result",
"[",
"'data'",
"]",
"topic",
"=",
"result",
"[",
"'topic'",
"]",
"# If the engine is run on master, get the event bus and send the",
... | This function identifies whether the engine is running on the master
or the minion and sends the data to the master event bus accordingly.
:param result: It's a dictionary which has the final data and topic. | [
"This",
"function",
"identifies",
"whether",
"the",
"engine",
"is",
"running",
"on",
"the",
"master",
"or",
"the",
"minion",
"and",
"sends",
"the",
"data",
"to",
"the",
"master",
"event",
"bus",
"accordingly",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/junos_syslog.py#L352-L372 | train |
saltstack/salt | salt/utils/sdb.py | sdb_get | def sdb_get(uri, opts, utils=None):
'''
Get a value from a db, using a uri in the form of ``sdb://<profile>/<key>``. If
the uri provided does not start with ``sdb://``, then it will be returned as-is.
'''
if not isinstance(uri, string_types) or not uri.startswith('sdb://'):
return uri
i... | python | def sdb_get(uri, opts, utils=None):
'''
Get a value from a db, using a uri in the form of ``sdb://<profile>/<key>``. If
the uri provided does not start with ``sdb://``, then it will be returned as-is.
'''
if not isinstance(uri, string_types) or not uri.startswith('sdb://'):
return uri
i... | [
"def",
"sdb_get",
"(",
"uri",
",",
"opts",
",",
"utils",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"uri",
",",
"string_types",
")",
"or",
"not",
"uri",
".",
"startswith",
"(",
"'sdb://'",
")",
":",
"return",
"uri",
"if",
"utils",
"is",
... | Get a value from a db, using a uri in the form of ``sdb://<profile>/<key>``. If
the uri provided does not start with ``sdb://``, then it will be returned as-is. | [
"Get",
"a",
"value",
"from",
"a",
"db",
"using",
"a",
"uri",
"in",
"the",
"form",
"of",
"sdb",
":",
"//",
"<profile",
">",
"/",
"<key",
">",
".",
"If",
"the",
"uri",
"provided",
"does",
"not",
"start",
"with",
"sdb",
":",
"//",
"then",
"it",
"wil... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/sdb.py#L19-L46 | train |
saltstack/salt | salt/utils/sdb.py | sdb_get_or_set_hash | def sdb_get_or_set_hash(uri,
opts,
length=8,
chars='abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)',
utils=None):
'''
Check if value exists in sdb. If it does, return, otherwise generate a
random string and ... | python | def sdb_get_or_set_hash(uri,
opts,
length=8,
chars='abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)',
utils=None):
'''
Check if value exists in sdb. If it does, return, otherwise generate a
random string and ... | [
"def",
"sdb_get_or_set_hash",
"(",
"uri",
",",
"opts",
",",
"length",
"=",
"8",
",",
"chars",
"=",
"'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'",
",",
"utils",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"uri",
",",
"string_types",
")",
"or... | Check if value exists in sdb. If it does, return, otherwise generate a
random string and store it. This can be used for storing secrets in a
centralized place. | [
"Check",
"if",
"value",
"exists",
"in",
"sdb",
".",
"If",
"it",
"does",
"return",
"otherwise",
"generate",
"a",
"random",
"string",
"and",
"store",
"it",
".",
"This",
"can",
"be",
"used",
"for",
"storing",
"secrets",
"in",
"a",
"centralized",
"place",
".... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/sdb.py#L111-L133 | train |
saltstack/salt | salt/modules/grafana4.py | get_users | def get_users(profile='grafana'):
'''
List all users.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
CLI Example:
.. code-block:: bash
salt '*' grafana4.get_users
'''
if isinstance(profile, string_types):
profi... | python | def get_users(profile='grafana'):
'''
List all users.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
CLI Example:
.. code-block:: bash
salt '*' grafana4.get_users
'''
if isinstance(profile, string_types):
profi... | [
"def",
"get_users",
"(",
"profile",
"=",
"'grafana'",
")",
":",
"if",
"isinstance",
"(",
"profile",
",",
"string_types",
")",
":",
"profile",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"profile",
")",
"response",
"=",
"requests",
".",
"get",
"(",
... | List all users.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
CLI Example:
.. code-block:: bash
salt '*' grafana4.get_users | [
"List",
"all",
"users",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grafana4.py#L65-L89 | train |
saltstack/salt | salt/modules/grafana4.py | get_user | def get_user(login, profile='grafana'):
'''
Show a single user.
login
Login of the user.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
CLI Example:
.. code-block:: bash
salt '*' grafana4.get_user <login>
'''
... | python | def get_user(login, profile='grafana'):
'''
Show a single user.
login
Login of the user.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
CLI Example:
.. code-block:: bash
salt '*' grafana4.get_user <login>
'''
... | [
"def",
"get_user",
"(",
"login",
",",
"profile",
"=",
"'grafana'",
")",
":",
"data",
"=",
"get_users",
"(",
"profile",
")",
"for",
"user",
"in",
"data",
":",
"if",
"user",
"[",
"'login'",
"]",
"==",
"login",
":",
"return",
"user",
"return",
"None"
] | Show a single user.
login
Login of the user.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
CLI Example:
.. code-block:: bash
salt '*' grafana4.get_user <login> | [
"Show",
"a",
"single",
"user",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grafana4.py#L92-L113 | train |
saltstack/salt | salt/modules/grafana4.py | update_user | def update_user(userid, profile='grafana', orgid=None, **kwargs):
'''
Update an existing user.
userid
Id of the user.
login
Optional - Login of the user.
email
Optional - Email of the user.
name
Optional - Full name of the user.
orgid
Optional - D... | python | def update_user(userid, profile='grafana', orgid=None, **kwargs):
'''
Update an existing user.
userid
Id of the user.
login
Optional - Login of the user.
email
Optional - Email of the user.
name
Optional - Full name of the user.
orgid
Optional - D... | [
"def",
"update_user",
"(",
"userid",
",",
"profile",
"=",
"'grafana'",
",",
"orgid",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"profile",
",",
"string_types",
")",
":",
"profile",
"=",
"__salt__",
"[",
"'config.option'",
"]... | Update an existing user.
userid
Id of the user.
login
Optional - Login of the user.
email
Optional - Email of the user.
name
Optional - Full name of the user.
orgid
Optional - Default Organization of the user.
profile
Configuration profile us... | [
"Update",
"an",
"existing",
"user",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grafana4.py#L186-L235 | train |
saltstack/salt | salt/modules/grafana4.py | switch_org | def switch_org(orgname, profile='grafana'):
'''
Switch the current organization.
name
Name of the organization to switch to.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
CLI Example:
.. code-block:: bash
salt '*... | python | def switch_org(orgname, profile='grafana'):
'''
Switch the current organization.
name
Name of the organization to switch to.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
CLI Example:
.. code-block:: bash
salt '*... | [
"def",
"switch_org",
"(",
"orgname",
",",
"profile",
"=",
"'grafana'",
")",
":",
"if",
"isinstance",
"(",
"profile",
",",
"string_types",
")",
":",
"profile",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"profile",
")",
"org",
"=",
"get_org",
"(",
... | Switch the current organization.
name
Name of the organization to switch to.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
CLI Example:
.. code-block:: bash
salt '*' grafana4.switch_org <name> | [
"Switch",
"the",
"current",
"organization",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grafana4.py#L459-L487 | train |
saltstack/salt | salt/modules/grafana4.py | update_org_user | def update_org_user(userid, orgname=None, profile='grafana', **kwargs):
'''
Update user role in the organization.
userid
Id of the user.
loginOrEmail
Login or email of the user.
role
Role of the user for this organization. Should be one of:
- Admin
... | python | def update_org_user(userid, orgname=None, profile='grafana', **kwargs):
'''
Update user role in the organization.
userid
Id of the user.
loginOrEmail
Login or email of the user.
role
Role of the user for this organization. Should be one of:
- Admin
... | [
"def",
"update_org_user",
"(",
"userid",
",",
"orgname",
"=",
"None",
",",
"profile",
"=",
"'grafana'",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"profile",
",",
"string_types",
")",
":",
"profile",
"=",
"__salt__",
"[",
"'config.option'"... | Update user role in the organization.
userid
Id of the user.
loginOrEmail
Login or email of the user.
role
Role of the user for this organization. Should be one of:
- Admin
- Editor
- Read Only Editor
- Viewer
orgname
Na... | [
"Update",
"user",
"role",
"in",
"the",
"organization",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grafana4.py#L565-L608 | train |
saltstack/salt | salt/modules/grafana4.py | get_datasource | def get_datasource(name, orgname=None, profile='grafana'):
'''
Show a single datasource in an organisation.
name
Name of the datasource.
orgname
Name of the organization.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
... | python | def get_datasource(name, orgname=None, profile='grafana'):
'''
Show a single datasource in an organisation.
name
Name of the datasource.
orgname
Name of the organization.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
... | [
"def",
"get_datasource",
"(",
"name",
",",
"orgname",
"=",
"None",
",",
"profile",
"=",
"'grafana'",
")",
":",
"data",
"=",
"get_datasources",
"(",
"orgname",
"=",
"orgname",
",",
"profile",
"=",
"profile",
")",
"for",
"datasource",
"in",
"data",
":",
"i... | Show a single datasource in an organisation.
name
Name of the datasource.
orgname
Name of the organization.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
CLI Example:
.. code-block:: bash
salt '*' grafana4.g... | [
"Show",
"a",
"single",
"datasource",
"in",
"an",
"organisation",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grafana4.py#L930-L954 | train |
saltstack/salt | salt/modules/grafana4.py | delete_datasource | def delete_datasource(datasourceid, orgname=None, profile='grafana'):
'''
Delete a datasource.
datasourceid
Id of the datasource.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
CLI Example:
.. code-block:: bash
sa... | python | def delete_datasource(datasourceid, orgname=None, profile='grafana'):
'''
Delete a datasource.
datasourceid
Id of the datasource.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
CLI Example:
.. code-block:: bash
sa... | [
"def",
"delete_datasource",
"(",
"datasourceid",
",",
"orgname",
"=",
"None",
",",
"profile",
"=",
"'grafana'",
")",
":",
"if",
"isinstance",
"(",
"profile",
",",
"string_types",
")",
":",
"profile",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"profil... | Delete a datasource.
datasourceid
Id of the datasource.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
CLI Example:
.. code-block:: bash
salt '*' grafana4.delete_datasource <datasource_id> | [
"Delete",
"a",
"datasource",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grafana4.py#L1113-L1140 | train |
saltstack/salt | salt/pillar/libvirt.py | ext_pillar | def ext_pillar(minion_id,
pillar, # pylint: disable=W0613
command): # pylint: disable=W0613
'''
Read in the generated libvirt keys
'''
key_dir = os.path.join(
__opts__['pki_dir'],
'libvirt',
minion_id)
cacert = os.path.join(__opts__... | python | def ext_pillar(minion_id,
pillar, # pylint: disable=W0613
command): # pylint: disable=W0613
'''
Read in the generated libvirt keys
'''
key_dir = os.path.join(
__opts__['pki_dir'],
'libvirt',
minion_id)
cacert = os.path.join(__opts__... | [
"def",
"ext_pillar",
"(",
"minion_id",
",",
"pillar",
",",
"# pylint: disable=W0613",
"command",
")",
":",
"# pylint: disable=W0613",
"key_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"__opts__",
"[",
"'pki_dir'",
"]",
",",
"'libvirt'",
",",
"minion_id",
")... | Read in the generated libvirt keys | [
"Read",
"in",
"the",
"generated",
"libvirt",
"keys"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/libvirt.py#L27-L61 | train |
saltstack/salt | salt/pillar/libvirt.py | gen_hyper_keys | def gen_hyper_keys(minion_id,
country='US',
state='Utah',
locality='Salt Lake City',
organization='Salted',
expiration_days='365'):
'''
Generate the keys to be used by libvirt hypervisors, this routine gens
the ke... | python | def gen_hyper_keys(minion_id,
country='US',
state='Utah',
locality='Salt Lake City',
organization='Salted',
expiration_days='365'):
'''
Generate the keys to be used by libvirt hypervisors, this routine gens
the ke... | [
"def",
"gen_hyper_keys",
"(",
"minion_id",
",",
"country",
"=",
"'US'",
",",
"state",
"=",
"'Utah'",
",",
"locality",
"=",
"'Salt Lake City'",
",",
"organization",
"=",
"'Salted'",
",",
"expiration_days",
"=",
"'365'",
")",
":",
"key_dir",
"=",
"os",
".",
... | Generate the keys to be used by libvirt hypervisors, this routine gens
the keys and applies them to the pillar for the hypervisor minions | [
"Generate",
"the",
"keys",
"to",
"be",
"used",
"by",
"libvirt",
"hypervisors",
"this",
"routine",
"gens",
"the",
"keys",
"and",
"applies",
"them",
"to",
"the",
"pillar",
"for",
"the",
"hypervisor",
"minions"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/libvirt.py#L64-L146 | train |
saltstack/salt | salt/states/boto_ec2.py | key_present | def key_present(name, save_private=None, upload_public=None, region=None,
key=None, keyid=None, profile=None):
'''
Ensure key pair is present.
'''
ret = {'name': name,
'result': True,
'comment': '',
'changes': {}
}
exists = __salt__['boto_e... | python | def key_present(name, save_private=None, upload_public=None, region=None,
key=None, keyid=None, profile=None):
'''
Ensure key pair is present.
'''
ret = {'name': name,
'result': True,
'comment': '',
'changes': {}
}
exists = __salt__['boto_e... | [
"def",
"key_present",
"(",
"name",
",",
"save_private",
"=",
"None",
",",
"upload_public",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
... | Ensure key pair is present. | [
"Ensure",
"key",
"pair",
"is",
"present",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L79-L133 | train |
saltstack/salt | salt/states/boto_ec2.py | key_absent | def key_absent(name, region=None, key=None, keyid=None, profile=None):
'''
Deletes a key pair
'''
ret = {'name': name,
'result': True,
'comment': '',
'changes': {}
}
exists = __salt__['boto_ec2.get_key'](name, region, key, keyid, profile)
if exists:
... | python | def key_absent(name, region=None, key=None, keyid=None, profile=None):
'''
Deletes a key pair
'''
ret = {'name': name,
'result': True,
'comment': '',
'changes': {}
}
exists = __salt__['boto_ec2.get_key'](name, region, key, keyid, profile)
if exists:
... | [
"def",
"key_absent",
"(",
"name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
... | Deletes a key pair | [
"Deletes",
"a",
"key",
"pair"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L136-L165 | train |
saltstack/salt | salt/states/boto_ec2.py | eni_present | def eni_present(
name,
subnet_id=None,
subnet_name=None,
private_ip_address=None,
description=None,
groups=None,
source_dest_check=True,
allocate_eip=None,
arecords=None,
region=None,
key=None,
keyid=None,
profile=No... | python | def eni_present(
name,
subnet_id=None,
subnet_name=None,
private_ip_address=None,
description=None,
groups=None,
source_dest_check=True,
allocate_eip=None,
arecords=None,
region=None,
key=None,
keyid=None,
profile=No... | [
"def",
"eni_present",
"(",
"name",
",",
"subnet_id",
"=",
"None",
",",
"subnet_name",
"=",
"None",
",",
"private_ip_address",
"=",
"None",
",",
"description",
"=",
"None",
",",
"groups",
"=",
"None",
",",
"source_dest_check",
"=",
"True",
",",
"allocate_eip"... | Ensure the EC2 ENI exists.
.. versionadded:: 2016.3.0
name
Name tag associated with the ENI.
subnet_id
The VPC subnet ID the ENI will exist within.
subnet_name
The VPC subnet name the ENI will exist within.
private_ip_address
The private ip address to use for thi... | [
"Ensure",
"the",
"EC2",
"ENI",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L168-L393 | train |
saltstack/salt | salt/states/boto_ec2.py | eni_absent | def eni_absent(
name,
release_eip=False,
region=None,
key=None,
keyid=None,
profile=None):
'''
Ensure the EC2 ENI is absent.
.. versionadded:: 2016.3.0
name
Name tag associated with the ENI.
release_eip
True/False - release any EIP a... | python | def eni_absent(
name,
release_eip=False,
region=None,
key=None,
keyid=None,
profile=None):
'''
Ensure the EC2 ENI is absent.
.. versionadded:: 2016.3.0
name
Name tag associated with the ENI.
release_eip
True/False - release any EIP a... | [
"def",
"eni_absent",
"(",
"name",
",",
"release_eip",
"=",
"False",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",... | Ensure the EC2 ENI is absent.
.. versionadded:: 2016.3.0
name
Name tag associated with the ENI.
release_eip
True/False - release any EIP associated with the ENI
region
Region to connect to.
key
Secret key to be used.
keyid
Access key to be used.
... | [
"Ensure",
"the",
"EC2",
"ENI",
"is",
"absent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L456-L547 | train |
saltstack/salt | salt/states/boto_ec2.py | snapshot_created | def snapshot_created(name, ami_name, instance_name, wait_until_available=True, wait_timeout_seconds=300, **kwargs):
'''
Create a snapshot from the given instance
.. versionadded:: 2016.3.0
'''
ret = {'name': name,
'result': True,
'comment': '',
'changes': {}
... | python | def snapshot_created(name, ami_name, instance_name, wait_until_available=True, wait_timeout_seconds=300, **kwargs):
'''
Create a snapshot from the given instance
.. versionadded:: 2016.3.0
'''
ret = {'name': name,
'result': True,
'comment': '',
'changes': {}
... | [
"def",
"snapshot_created",
"(",
"name",
",",
"ami_name",
",",
"instance_name",
",",
"wait_until_available",
"=",
"True",
",",
"wait_timeout_seconds",
"=",
"300",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":... | Create a snapshot from the given instance
.. versionadded:: 2016.3.0 | [
"Create",
"a",
"snapshot",
"from",
"the",
"given",
"instance"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L550-L586 | train |
saltstack/salt | salt/states/boto_ec2.py | instance_present | def instance_present(name, instance_name=None, instance_id=None, image_id=None,
image_name=None, tags=None, key_name=None,
security_groups=None, user_data=None, instance_type=None,
placement=None, kernel_id=None, ramdisk_id=None,
vpc_id... | python | def instance_present(name, instance_name=None, instance_id=None, image_id=None,
image_name=None, tags=None, key_name=None,
security_groups=None, user_data=None, instance_type=None,
placement=None, kernel_id=None, ramdisk_id=None,
vpc_id... | [
"def",
"instance_present",
"(",
"name",
",",
"instance_name",
"=",
"None",
",",
"instance_id",
"=",
"None",
",",
"image_id",
"=",
"None",
",",
"image_name",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"key_name",
"=",
"None",
",",
"security_groups",
"=",
... | Ensure an EC2 instance is running with the given attributes and state.
name
(string) - The name of the state definition. Recommended that this
match the instance_name attribute (generally the FQDN of the instance).
instance_name
(string) - The name of the instance, generally its FQDN. ... | [
"Ensure",
"an",
"EC2",
"instance",
"is",
"running",
"with",
"the",
"given",
"attributes",
"and",
"state",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L589-L988 | train |
saltstack/salt | salt/states/boto_ec2.py | instance_absent | def instance_absent(name, instance_name=None, instance_id=None,
release_eip=False, region=None, key=None, keyid=None,
profile=None, filters=None):
'''
Ensure an EC2 instance does not exist (is stopped and removed).
.. versionchanged:: 2016.11.0
name
(str... | python | def instance_absent(name, instance_name=None, instance_id=None,
release_eip=False, region=None, key=None, keyid=None,
profile=None, filters=None):
'''
Ensure an EC2 instance does not exist (is stopped and removed).
.. versionchanged:: 2016.11.0
name
(str... | [
"def",
"instance_absent",
"(",
"name",
",",
"instance_name",
"=",
"None",
",",
"instance_id",
"=",
"None",
",",
"release_eip",
"=",
"False",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
",... | Ensure an EC2 instance does not exist (is stopped and removed).
.. versionchanged:: 2016.11.0
name
(string) - The name of the state definition.
instance_name
(string) - The name of the instance.
instance_id
(string) - The ID of the instance.
release_eip
(bool) - R... | [
"Ensure",
"an",
"EC2",
"instance",
"does",
"not",
"exist",
"(",
"is",
"stopped",
"and",
"removed",
")",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L991-L1115 | train |
saltstack/salt | salt/states/boto_ec2.py | volume_absent | def volume_absent(name, volume_name=None, volume_id=None, instance_name=None,
instance_id=None, device=None, region=None, key=None, keyid=None, profile=None):
'''
Ensure the EC2 volume is detached and absent.
.. versionadded:: 2016.11.0
name
State definition name.
volume... | python | def volume_absent(name, volume_name=None, volume_id=None, instance_name=None,
instance_id=None, device=None, region=None, key=None, keyid=None, profile=None):
'''
Ensure the EC2 volume is detached and absent.
.. versionadded:: 2016.11.0
name
State definition name.
volume... | [
"def",
"volume_absent",
"(",
"name",
",",
"volume_name",
"=",
"None",
",",
"volume_id",
"=",
"None",
",",
"instance_name",
"=",
"None",
",",
"instance_id",
"=",
"None",
",",
"device",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",... | Ensure the EC2 volume is detached and absent.
.. versionadded:: 2016.11.0
name
State definition name.
volume_name
Name tag associated with the volume. For safety, if this matches more than
one volume, the state will refuse to apply.
volume_id
Resource ID of the volum... | [
"Ensure",
"the",
"EC2",
"volume",
"is",
"detached",
"and",
"absent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L1118-L1218 | train |
saltstack/salt | salt/states/boto_ec2.py | volumes_tagged | def volumes_tagged(name, tag_maps, authoritative=False, region=None, key=None,
keyid=None, profile=None):
'''
Ensure EC2 volume(s) matching the given filters have the defined tags.
.. versionadded:: 2016.11.0
name
State definition name.
tag_maps
List of dicts of... | python | def volumes_tagged(name, tag_maps, authoritative=False, region=None, key=None,
keyid=None, profile=None):
'''
Ensure EC2 volume(s) matching the given filters have the defined tags.
.. versionadded:: 2016.11.0
name
State definition name.
tag_maps
List of dicts of... | [
"def",
"volumes_tagged",
"(",
"name",
",",
"tag_maps",
",",
"authoritative",
"=",
"False",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
... | Ensure EC2 volume(s) matching the given filters have the defined tags.
.. versionadded:: 2016.11.0
name
State definition name.
tag_maps
List of dicts of filters and tags, where 'filters' is a dict suitable for passing
to the 'filters' argument of boto_ec2.get_all_volumes(), and 't... | [
"Ensure",
"EC2",
"volume",
"(",
"s",
")",
"matching",
"the",
"given",
"filters",
"have",
"the",
"defined",
"tags",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L1221-L1309 | train |
saltstack/salt | salt/states/boto_ec2.py | volume_present | def volume_present(name, volume_name=None, volume_id=None, instance_name=None,
instance_id=None, device=None, size=None, snapshot_id=None,
volume_type=None, iops=None, encrypted=False, kms_key_id=None,
region=None, key=None, keyid=None, profile=None):
'''
... | python | def volume_present(name, volume_name=None, volume_id=None, instance_name=None,
instance_id=None, device=None, size=None, snapshot_id=None,
volume_type=None, iops=None, encrypted=False, kms_key_id=None,
region=None, key=None, keyid=None, profile=None):
'''
... | [
"def",
"volume_present",
"(",
"name",
",",
"volume_name",
"=",
"None",
",",
"volume_id",
"=",
"None",
",",
"instance_name",
"=",
"None",
",",
"instance_id",
"=",
"None",
",",
"device",
"=",
"None",
",",
"size",
"=",
"None",
",",
"snapshot_id",
"=",
"None... | Ensure the EC2 volume is present and attached.
..
name
State definition name.
volume_name
The Name tag value for the volume. If no volume with that matching name tag is found,
a new volume will be created. If multiple volumes are matched, the state will fail.
volume_id
... | [
"Ensure",
"the",
"EC2",
"volume",
"is",
"present",
"and",
"attached",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L1312-L1509 | train |
saltstack/salt | salt/states/boto_ec2.py | private_ips_present | def private_ips_present(name, network_interface_name=None, network_interface_id=None,
private_ip_addresses=None, allow_reassignment=False, region=None, key=None,
keyid=None, profile=None):
'''
Ensure an ENI has secondary private ip addresses associated with it
... | python | def private_ips_present(name, network_interface_name=None, network_interface_id=None,
private_ip_addresses=None, allow_reassignment=False, region=None, key=None,
keyid=None, profile=None):
'''
Ensure an ENI has secondary private ip addresses associated with it
... | [
"def",
"private_ips_present",
"(",
"name",
",",
"network_interface_name",
"=",
"None",
",",
"network_interface_id",
"=",
"None",
",",
"private_ip_addresses",
"=",
"None",
",",
"allow_reassignment",
"=",
"False",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None... | Ensure an ENI has secondary private ip addresses associated with it
name
(String) - State definition name
network_interface_id
(String) - The EC2 network interface id, example eni-123456789
private_ip_addresses
(List or String) - The secondary private ip address(es) that should be p... | [
"Ensure",
"an",
"ENI",
"has",
"secondary",
"private",
"ip",
"addresses",
"associated",
"with",
"it"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L1512-L1634 | train |
saltstack/salt | salt/states/boto_ec2.py | private_ips_absent | def private_ips_absent(name, network_interface_name=None, network_interface_id=None,
private_ip_addresses=None, region=None, key=None, keyid=None, profile=None):
'''
Ensure an ENI does not have secondary private ip addresses associated with it
name
(String) - State definitio... | python | def private_ips_absent(name, network_interface_name=None, network_interface_id=None,
private_ip_addresses=None, region=None, key=None, keyid=None, profile=None):
'''
Ensure an ENI does not have secondary private ip addresses associated with it
name
(String) - State definitio... | [
"def",
"private_ips_absent",
"(",
"name",
",",
"network_interface_name",
"=",
"None",
",",
"network_interface_id",
"=",
"None",
",",
"private_ip_addresses",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"pr... | Ensure an ENI does not have secondary private ip addresses associated with it
name
(String) - State definition name
network_interface_id
(String) - The EC2 network interface id, example eni-123456789
private_ip_addresses
(List or String) - The secondary private ip address(es) that s... | [
"Ensure",
"an",
"ENI",
"does",
"not",
"have",
"secondary",
"private",
"ip",
"addresses",
"associated",
"with",
"it"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L1637-L1767 | train |
saltstack/salt | salt/utils/docker/translate/network.py | _post_processing | def _post_processing(kwargs, skip_translate, invalid): # pylint: disable=unused-argument
'''
Additional network-specific post-translation processing
'''
# If any defaults were not expicitly passed, add them
for item in DEFAULTS:
if item not in kwargs:
kwargs[item] = DEFAULTS[ite... | python | def _post_processing(kwargs, skip_translate, invalid): # pylint: disable=unused-argument
'''
Additional network-specific post-translation processing
'''
# If any defaults were not expicitly passed, add them
for item in DEFAULTS:
if item not in kwargs:
kwargs[item] = DEFAULTS[ite... | [
"def",
"_post_processing",
"(",
"kwargs",
",",
"skip_translate",
",",
"invalid",
")",
":",
"# pylint: disable=unused-argument",
"# If any defaults were not expicitly passed, add them",
"for",
"item",
"in",
"DEFAULTS",
":",
"if",
"item",
"not",
"in",
"kwargs",
":",
"kwar... | Additional network-specific post-translation processing | [
"Additional",
"network",
"-",
"specific",
"post",
"-",
"translation",
"processing"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/docker/translate/network.py#L33-L40 | train |
saltstack/salt | salt/client/__init__.py | get_local_client | def get_local_client(
c_path=os.path.join(syspaths.CONFIG_DIR, 'master'),
mopts=None,
skip_perm_errors=False,
io_loop=None,
auto_reconnect=False):
'''
.. versionadded:: 2014.7.0
Read in the config and return the correct LocalClient object based on
the configured ... | python | def get_local_client(
c_path=os.path.join(syspaths.CONFIG_DIR, 'master'),
mopts=None,
skip_perm_errors=False,
io_loop=None,
auto_reconnect=False):
'''
.. versionadded:: 2014.7.0
Read in the config and return the correct LocalClient object based on
the configured ... | [
"def",
"get_local_client",
"(",
"c_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"syspaths",
".",
"CONFIG_DIR",
",",
"'master'",
")",
",",
"mopts",
"=",
"None",
",",
"skip_perm_errors",
"=",
"False",
",",
"io_loop",
"=",
"None",
",",
"auto_reconnect",
... | .. versionadded:: 2014.7.0
Read in the config and return the correct LocalClient object based on
the configured transport
:param IOLoop io_loop: io_loop used for events.
Pass in an io_loop if you want asynchronous
operation for obtaining events. Eg use... | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L76-L106 | train |
saltstack/salt | salt/client/__init__.py | LocalClient.__read_master_key | def __read_master_key(self):
'''
Read in the rotating master authentication key
'''
key_user = self.salt_user
if key_user == 'root':
if self.opts.get('user', 'root') != 'root':
key_user = self.opts.get('user', 'root')
if key_user.startswith('su... | python | def __read_master_key(self):
'''
Read in the rotating master authentication key
'''
key_user = self.salt_user
if key_user == 'root':
if self.opts.get('user', 'root') != 'root':
key_user = self.opts.get('user', 'root')
if key_user.startswith('su... | [
"def",
"__read_master_key",
"(",
"self",
")",
":",
"key_user",
"=",
"self",
".",
"salt_user",
"if",
"key_user",
"==",
"'root'",
":",
"if",
"self",
".",
"opts",
".",
"get",
"(",
"'user'",
",",
"'root'",
")",
"!=",
"'root'",
":",
"key_user",
"=",
"self",... | Read in the rotating master authentication key | [
"Read",
"in",
"the",
"rotating",
"master",
"authentication",
"key"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L175-L200 | train |
saltstack/salt | salt/client/__init__.py | LocalClient._convert_range_to_list | def _convert_range_to_list(self, tgt):
'''
convert a seco.range range into a list target
'''
range_ = seco.range.Range(self.opts['range_server'])
try:
return range_.expand(tgt)
except seco.range.RangeException as err:
print('Range server exception:... | python | def _convert_range_to_list(self, tgt):
'''
convert a seco.range range into a list target
'''
range_ = seco.range.Range(self.opts['range_server'])
try:
return range_.expand(tgt)
except seco.range.RangeException as err:
print('Range server exception:... | [
"def",
"_convert_range_to_list",
"(",
"self",
",",
"tgt",
")",
":",
"range_",
"=",
"seco",
".",
"range",
".",
"Range",
"(",
"self",
".",
"opts",
"[",
"'range_server'",
"]",
")",
"try",
":",
"return",
"range_",
".",
"expand",
"(",
"tgt",
")",
"except",
... | convert a seco.range range into a list target | [
"convert",
"a",
"seco",
".",
"range",
"range",
"into",
"a",
"list",
"target"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L202-L211 | train |
saltstack/salt | salt/client/__init__.py | LocalClient._get_timeout | def _get_timeout(self, timeout):
'''
Return the timeout to use
'''
if timeout is None:
return self.opts['timeout']
if isinstance(timeout, int):
return timeout
if isinstance(timeout, six.string_types):
try:
return int(tim... | python | def _get_timeout(self, timeout):
'''
Return the timeout to use
'''
if timeout is None:
return self.opts['timeout']
if isinstance(timeout, int):
return timeout
if isinstance(timeout, six.string_types):
try:
return int(tim... | [
"def",
"_get_timeout",
"(",
"self",
",",
"timeout",
")",
":",
"if",
"timeout",
"is",
"None",
":",
"return",
"self",
".",
"opts",
"[",
"'timeout'",
"]",
"if",
"isinstance",
"(",
"timeout",
",",
"int",
")",
":",
"return",
"timeout",
"if",
"isinstance",
"... | Return the timeout to use | [
"Return",
"the",
"timeout",
"to",
"use"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L213-L227 | train |
saltstack/salt | salt/client/__init__.py | LocalClient.gather_job_info | def gather_job_info(self, jid, tgt, tgt_type, listen=True, **kwargs):
'''
Return the information about a given job
'''
log.debug('Checking whether jid %s is still running', jid)
timeout = int(kwargs.get('gather_job_timeout', self.opts['gather_job_timeout']))
pub_data = s... | python | def gather_job_info(self, jid, tgt, tgt_type, listen=True, **kwargs):
'''
Return the information about a given job
'''
log.debug('Checking whether jid %s is still running', jid)
timeout = int(kwargs.get('gather_job_timeout', self.opts['gather_job_timeout']))
pub_data = s... | [
"def",
"gather_job_info",
"(",
"self",
",",
"jid",
",",
"tgt",
",",
"tgt_type",
",",
"listen",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"log",
".",
"debug",
"(",
"'Checking whether jid %s is still running'",
",",
"jid",
")",
"timeout",
"=",
"int",
... | Return the information about a given job | [
"Return",
"the",
"information",
"about",
"a",
"given",
"job"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L229-L248 | train |
saltstack/salt | salt/client/__init__.py | LocalClient._check_pub_data | def _check_pub_data(self, pub_data, listen=True):
'''
Common checks on the pub_data data structure returned from running pub
'''
if pub_data == '':
# Failed to authenticate, this could be a bunch of things
raise EauthAuthenticationError(
'Failed to... | python | def _check_pub_data(self, pub_data, listen=True):
'''
Common checks on the pub_data data structure returned from running pub
'''
if pub_data == '':
# Failed to authenticate, this could be a bunch of things
raise EauthAuthenticationError(
'Failed to... | [
"def",
"_check_pub_data",
"(",
"self",
",",
"pub_data",
",",
"listen",
"=",
"True",
")",
":",
"if",
"pub_data",
"==",
"''",
":",
"# Failed to authenticate, this could be a bunch of things",
"raise",
"EauthAuthenticationError",
"(",
"'Failed to authenticate! This is most lik... | Common checks on the pub_data data structure returned from running pub | [
"Common",
"checks",
"on",
"the",
"pub_data",
"data",
"structure",
"returned",
"from",
"running",
"pub"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L250-L294 | train |
saltstack/salt | salt/client/__init__.py | LocalClient.run_job | def run_job(
self,
tgt,
fun,
arg=(),
tgt_type='glob',
ret='',
timeout=None,
jid='',
kwarg=None,
listen=False,
**kwargs):
'''
Asynchronously send a command to connected mini... | python | def run_job(
self,
tgt,
fun,
arg=(),
tgt_type='glob',
ret='',
timeout=None,
jid='',
kwarg=None,
listen=False,
**kwargs):
'''
Asynchronously send a command to connected mini... | [
"def",
"run_job",
"(",
"self",
",",
"tgt",
",",
"fun",
",",
"arg",
"=",
"(",
")",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"timeout",
"=",
"None",
",",
"jid",
"=",
"''",
",",
"kwarg",
"=",
"None",
",",
"listen",
"=",
"False",... | Asynchronously send a command to connected minions
Prep the job directory and publish a command to any targeted minions.
:return: A dictionary of (validated) ``pub_data`` or an empty
dictionary on failure. The ``pub_data`` contains the job ID and a
list of all minions that are ... | [
"Asynchronously",
"send",
"a",
"command",
"to",
"connected",
"minions"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L296-L348 | train |
saltstack/salt | salt/client/__init__.py | LocalClient.run_job_async | def run_job_async(
self,
tgt,
fun,
arg=(),
tgt_type='glob',
ret='',
timeout=None,
jid='',
kwarg=None,
listen=True,
io_loop=None,
**kwargs):
'''
Asynchronously s... | python | def run_job_async(
self,
tgt,
fun,
arg=(),
tgt_type='glob',
ret='',
timeout=None,
jid='',
kwarg=None,
listen=True,
io_loop=None,
**kwargs):
'''
Asynchronously s... | [
"def",
"run_job_async",
"(",
"self",
",",
"tgt",
",",
"fun",
",",
"arg",
"=",
"(",
")",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"timeout",
"=",
"None",
",",
"jid",
"=",
"''",
",",
"kwarg",
"=",
"None",
",",
"listen",
"=",
"T... | Asynchronously send a command to connected minions
Prep the job directory and publish a command to any targeted minions.
:return: A dictionary of (validated) ``pub_data`` or an empty
dictionary on failure. The ``pub_data`` contains the job ID and a
list of all minions that are ... | [
"Asynchronously",
"send",
"a",
"command",
"to",
"connected",
"minions"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L355-L409 | train |
saltstack/salt | salt/client/__init__.py | LocalClient.cmd_async | def cmd_async(
self,
tgt,
fun,
arg=(),
tgt_type='glob',
ret='',
jid='',
kwarg=None,
**kwargs):
'''
Asynchronously send a command to connected minions
The function signature is the same as... | python | def cmd_async(
self,
tgt,
fun,
arg=(),
tgt_type='glob',
ret='',
jid='',
kwarg=None,
**kwargs):
'''
Asynchronously send a command to connected minions
The function signature is the same as... | [
"def",
"cmd_async",
"(",
"self",
",",
"tgt",
",",
"fun",
",",
"arg",
"=",
"(",
")",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"jid",
"=",
"''",
",",
"kwarg",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"pub_data",
"=",
"... | Asynchronously send a command to connected minions
The function signature is the same as :py:meth:`cmd` with the
following exceptions.
:returns: A job ID or 0 on failure.
.. code-block:: python
>>> local.cmd_async('*', 'test.sleep', [300])
'2013121921592185771... | [
"Asynchronously",
"send",
"a",
"command",
"to",
"connected",
"minions"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L411-L446 | train |
saltstack/salt | salt/client/__init__.py | LocalClient.cmd_subset | def cmd_subset(
self,
tgt,
fun,
arg=(),
tgt_type='glob',
ret='',
kwarg=None,
sub=3,
cli=False,
progress=False,
full_return=False,
**kwargs):
'''
Execute a comma... | python | def cmd_subset(
self,
tgt,
fun,
arg=(),
tgt_type='glob',
ret='',
kwarg=None,
sub=3,
cli=False,
progress=False,
full_return=False,
**kwargs):
'''
Execute a comma... | [
"def",
"cmd_subset",
"(",
"self",
",",
"tgt",
",",
"fun",
",",
"arg",
"=",
"(",
")",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"kwarg",
"=",
"None",
",",
"sub",
"=",
"3",
",",
"cli",
"=",
"False",
",",
"progress",
"=",
"False"... | Execute a command on a random subset of the targeted systems
The function signature is the same as :py:meth:`cmd` with the
following exceptions.
:param sub: The number of systems to execute on
:param cli: When this is set to True, a generator is returned,
otherwise ... | [
"Execute",
"a",
"command",
"on",
"a",
"random",
"subset",
"of",
"the",
"targeted",
"systems"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L448-L500 | train |
saltstack/salt | salt/client/__init__.py | LocalClient.cmd_batch | def cmd_batch(
self,
tgt,
fun,
arg=(),
tgt_type='glob',
ret='',
kwarg=None,
batch='10%',
**kwargs):
'''
Iteratively execute a command on subsets of minions at a time
The function signatur... | python | def cmd_batch(
self,
tgt,
fun,
arg=(),
tgt_type='glob',
ret='',
kwarg=None,
batch='10%',
**kwargs):
'''
Iteratively execute a command on subsets of minions at a time
The function signatur... | [
"def",
"cmd_batch",
"(",
"self",
",",
"tgt",
",",
"fun",
",",
"arg",
"=",
"(",
")",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"kwarg",
"=",
"None",
",",
"batch",
"=",
"'10%'",
",",
"*",
"*",
"kwargs",
")",
":",
"# Late import - ... | Iteratively execute a command on subsets of minions at a time
The function signature is the same as :py:meth:`cmd` with the
following exceptions.
:param batch: The batch identifier of systems to execute on
:returns: A generator of minion returns
.. code-block:: python
... | [
"Iteratively",
"execute",
"a",
"command",
"on",
"subsets",
"of",
"minions",
"at",
"a",
"time"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L502-L572 | train |
saltstack/salt | salt/client/__init__.py | LocalClient.cmd | def cmd(self,
tgt,
fun,
arg=(),
timeout=None,
tgt_type='glob',
ret='',
jid='',
full_return=False,
kwarg=None,
**kwargs):
'''
Synchronously execute a command on targeted minions
... | python | def cmd(self,
tgt,
fun,
arg=(),
timeout=None,
tgt_type='glob',
ret='',
jid='',
full_return=False,
kwarg=None,
**kwargs):
'''
Synchronously execute a command on targeted minions
... | [
"def",
"cmd",
"(",
"self",
",",
"tgt",
",",
"fun",
",",
"arg",
"=",
"(",
")",
",",
"timeout",
"=",
"None",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"jid",
"=",
"''",
",",
"full_return",
"=",
"False",
",",
"kwarg",
"=",
"None"... | Synchronously execute a command on targeted minions
The cmd method will execute and wait for the timeout period for all
minions to reply, then it will return all minion data at once.
.. code-block:: python
>>> import salt.client
>>> local = salt.client.LocalClient()
... | [
"Synchronously",
"execute",
"a",
"command",
"on",
"targeted",
"minions"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L574-L724 | train |
saltstack/salt | salt/client/__init__.py | LocalClient.cmd_cli | def cmd_cli(
self,
tgt,
fun,
arg=(),
timeout=None,
tgt_type='glob',
ret='',
verbose=False,
kwarg=None,
progress=False,
**kwargs):
'''
Used by the :command:`salt` CLI. This ... | python | def cmd_cli(
self,
tgt,
fun,
arg=(),
timeout=None,
tgt_type='glob',
ret='',
verbose=False,
kwarg=None,
progress=False,
**kwargs):
'''
Used by the :command:`salt` CLI. This ... | [
"def",
"cmd_cli",
"(",
"self",
",",
"tgt",
",",
"fun",
",",
"arg",
"=",
"(",
")",
",",
"timeout",
"=",
"None",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"verbose",
"=",
"False",
",",
"kwarg",
"=",
"None",
",",
"progress",
"=",
... | Used by the :command:`salt` CLI. This method returns minion returns as
they come back and attempts to block until all minions return.
The function signature is the same as :py:meth:`cmd` with the
following exceptions.
:param verbose: Print extra information about the running command
... | [
"Used",
"by",
"the",
":",
"command",
":",
"salt",
"CLI",
".",
"This",
"method",
"returns",
"minion",
"returns",
"as",
"they",
"come",
"back",
"and",
"attempts",
"to",
"block",
"until",
"all",
"minions",
"return",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L726-L820 | train |
saltstack/salt | salt/client/__init__.py | LocalClient.cmd_iter | def cmd_iter(
self,
tgt,
fun,
arg=(),
timeout=None,
tgt_type='glob',
ret='',
kwarg=None,
**kwargs):
'''
Yields the individual minion returns as they come in
The function signature is the ... | python | def cmd_iter(
self,
tgt,
fun,
arg=(),
timeout=None,
tgt_type='glob',
ret='',
kwarg=None,
**kwargs):
'''
Yields the individual minion returns as they come in
The function signature is the ... | [
"def",
"cmd_iter",
"(",
"self",
",",
"tgt",
",",
"fun",
",",
"arg",
"=",
"(",
")",
",",
"timeout",
"=",
"None",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"kwarg",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"was_listening",
... | Yields the individual minion returns as they come in
The function signature is the same as :py:meth:`cmd` with the
following exceptions.
Normally :py:meth:`cmd_iter` does not yield results for minions that
are not connected. If you want it to return results for disconnected
min... | [
"Yields",
"the",
"individual",
"minion",
"returns",
"as",
"they",
"come",
"in"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L822-L884 | train |
saltstack/salt | salt/client/__init__.py | LocalClient.cmd_iter_no_block | def cmd_iter_no_block(
self,
tgt,
fun,
arg=(),
timeout=None,
tgt_type='glob',
ret='',
kwarg=None,
show_jid=False,
verbose=False,
**kwargs):
'''
Yields the individual minion... | python | def cmd_iter_no_block(
self,
tgt,
fun,
arg=(),
timeout=None,
tgt_type='glob',
ret='',
kwarg=None,
show_jid=False,
verbose=False,
**kwargs):
'''
Yields the individual minion... | [
"def",
"cmd_iter_no_block",
"(",
"self",
",",
"tgt",
",",
"fun",
",",
"arg",
"=",
"(",
")",
",",
"timeout",
"=",
"None",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"kwarg",
"=",
"None",
",",
"show_jid",
"=",
"False",
",",
"verbose"... | Yields the individual minion returns as they come in, or None
when no returns are available.
The function signature is the same as :py:meth:`cmd` with the
following exceptions.
:returns: A generator yielding the individual minion returns, or None
when no returns are ava... | [
"Yields",
"the",
"individual",
"minion",
"returns",
"as",
"they",
"come",
"in",
"or",
"None",
"when",
"no",
"returns",
"are",
"available",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L886-L952 | train |
saltstack/salt | salt/client/__init__.py | LocalClient.cmd_full_return | def cmd_full_return(
self,
tgt,
fun,
arg=(),
timeout=None,
tgt_type='glob',
ret='',
verbose=False,
kwarg=None,
**kwargs):
'''
Execute a salt command and return
'''
was_... | python | def cmd_full_return(
self,
tgt,
fun,
arg=(),
timeout=None,
tgt_type='glob',
ret='',
verbose=False,
kwarg=None,
**kwargs):
'''
Execute a salt command and return
'''
was_... | [
"def",
"cmd_full_return",
"(",
"self",
",",
"tgt",
",",
"fun",
",",
"arg",
"=",
"(",
")",
",",
"timeout",
"=",
"None",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"verbose",
"=",
"False",
",",
"kwarg",
"=",
"None",
",",
"*",
"*",
... | Execute a salt command and return | [
"Execute",
"a",
"salt",
"command",
"and",
"return"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L954-L993 | train |
saltstack/salt | salt/client/__init__.py | LocalClient.get_cli_returns | def get_cli_returns(
self,
jid,
minions,
timeout=None,
tgt='*',
tgt_type='glob',
verbose=False,
show_jid=False,
**kwargs):
'''
Starts a watcher looking at the return data for a specified JID
... | python | def get_cli_returns(
self,
jid,
minions,
timeout=None,
tgt='*',
tgt_type='glob',
verbose=False,
show_jid=False,
**kwargs):
'''
Starts a watcher looking at the return data for a specified JID
... | [
"def",
"get_cli_returns",
"(",
"self",
",",
"jid",
",",
"minions",
",",
"timeout",
"=",
"None",
",",
"tgt",
"=",
"'*'",
",",
"tgt_type",
"=",
"'glob'",
",",
"verbose",
"=",
"False",
",",
"show_jid",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
... | Starts a watcher looking at the return data for a specified JID
:returns: all of the information for the JID | [
"Starts",
"a",
"watcher",
"looking",
"at",
"the",
"return",
"data",
"for",
"a",
"specified",
"JID"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L995-L1043 | train |
saltstack/salt | salt/client/__init__.py | LocalClient.get_returns_no_block | def get_returns_no_block(
self,
tag,
match_type=None):
'''
Raw function to just return events of jid excluding timeout logic
Yield either the raw event data or None
Pass a list of additional regular expressions as `tags_regex` to search
the e... | python | def get_returns_no_block(
self,
tag,
match_type=None):
'''
Raw function to just return events of jid excluding timeout logic
Yield either the raw event data or None
Pass a list of additional regular expressions as `tags_regex` to search
the e... | [
"def",
"get_returns_no_block",
"(",
"self",
",",
"tag",
",",
"match_type",
"=",
"None",
")",
":",
"while",
"True",
":",
"raw",
"=",
"self",
".",
"event",
".",
"get_event",
"(",
"wait",
"=",
"0.01",
",",
"tag",
"=",
"tag",
",",
"match_type",
"=",
"mat... | Raw function to just return events of jid excluding timeout logic
Yield either the raw event data or None
Pass a list of additional regular expressions as `tags_regex` to search
the event bus for non-return data, such as minion lists returned from
syndics. | [
"Raw",
"function",
"to",
"just",
"return",
"events",
"of",
"jid",
"excluding",
"timeout",
"logic"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1046-L1063 | train |
saltstack/salt | salt/client/__init__.py | LocalClient.get_iter_returns | def get_iter_returns(
self,
jid,
minions,
timeout=None,
tgt='*',
tgt_type='glob',
expect_minions=False,
block=True,
**kwargs):
'''
Watch the event system and return job data as it comes in
... | python | def get_iter_returns(
self,
jid,
minions,
timeout=None,
tgt='*',
tgt_type='glob',
expect_minions=False,
block=True,
**kwargs):
'''
Watch the event system and return job data as it comes in
... | [
"def",
"get_iter_returns",
"(",
"self",
",",
"jid",
",",
"minions",
",",
"timeout",
"=",
"None",
",",
"tgt",
"=",
"'*'",
",",
"tgt_type",
"=",
"'glob'",
",",
"expect_minions",
"=",
"False",
",",
"block",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":"... | Watch the event system and return job data as it comes in
:returns: all of the information for the JID | [
"Watch",
"the",
"event",
"system",
"and",
"return",
"job",
"data",
"as",
"it",
"comes",
"in"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1065-L1292 | train |
saltstack/salt | salt/client/__init__.py | LocalClient.get_returns | def get_returns(
self,
jid,
minions,
timeout=None):
'''
Get the returns for the command line interface via the event system
'''
minions = set(minions)
if timeout is None:
timeout = self.opts['timeout']
start = in... | python | def get_returns(
self,
jid,
minions,
timeout=None):
'''
Get the returns for the command line interface via the event system
'''
minions = set(minions)
if timeout is None:
timeout = self.opts['timeout']
start = in... | [
"def",
"get_returns",
"(",
"self",
",",
"jid",
",",
"minions",
",",
"timeout",
"=",
"None",
")",
":",
"minions",
"=",
"set",
"(",
"minions",
")",
"if",
"timeout",
"is",
"None",
":",
"timeout",
"=",
"self",
".",
"opts",
"[",
"'timeout'",
"]",
"start",... | Get the returns for the command line interface via the event system | [
"Get",
"the",
"returns",
"for",
"the",
"command",
"line",
"interface",
"via",
"the",
"event",
"system"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1294-L1348 | train |
saltstack/salt | salt/client/__init__.py | LocalClient.get_full_returns | def get_full_returns(self, jid, minions, timeout=None):
'''
This method starts off a watcher looking at the return data for
a specified jid, it returns all of the information for the jid
'''
# TODO: change this from ret to return... or the other way.
# Its inconsist... | python | def get_full_returns(self, jid, minions, timeout=None):
'''
This method starts off a watcher looking at the return data for
a specified jid, it returns all of the information for the jid
'''
# TODO: change this from ret to return... or the other way.
# Its inconsist... | [
"def",
"get_full_returns",
"(",
"self",
",",
"jid",
",",
"minions",
",",
"timeout",
"=",
"None",
")",
":",
"# TODO: change this from ret to return... or the other way.",
"# Its inconsistent, we should pick one",
"ret",
"=",
"{",
"}",
"# create the iterator-- since we wa... | This method starts off a watcher looking at the return data for
a specified jid, it returns all of the information for the jid | [
"This",
"method",
"starts",
"off",
"a",
"watcher",
"looking",
"at",
"the",
"return",
"data",
"for",
"a",
"specified",
"jid",
"it",
"returns",
"all",
"of",
"the",
"information",
"for",
"the",
"jid"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1350-L1403 | train |
saltstack/salt | salt/client/__init__.py | LocalClient.get_cache_returns | def get_cache_returns(self, jid):
'''
Execute a single pass to gather the contents of the job cache
'''
ret = {}
try:
data = self.returners['{0}.get_jid'.format(self.opts['master_job_cache'])](jid)
except Exception as exc:
raise SaltClientError('C... | python | def get_cache_returns(self, jid):
'''
Execute a single pass to gather the contents of the job cache
'''
ret = {}
try:
data = self.returners['{0}.get_jid'.format(self.opts['master_job_cache'])](jid)
except Exception as exc:
raise SaltClientError('C... | [
"def",
"get_cache_returns",
"(",
"self",
",",
"jid",
")",
":",
"ret",
"=",
"{",
"}",
"try",
":",
"data",
"=",
"self",
".",
"returners",
"[",
"'{0}.get_jid'",
".",
"format",
"(",
"self",
".",
"opts",
"[",
"'master_job_cache'",
"]",
")",
"]",
"(",
"jid... | Execute a single pass to gather the contents of the job cache | [
"Execute",
"a",
"single",
"pass",
"to",
"gather",
"the",
"contents",
"of",
"the",
"job",
"cache"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1405-L1431 | train |
saltstack/salt | salt/client/__init__.py | LocalClient.get_cli_static_event_returns | def get_cli_static_event_returns(
self,
jid,
minions,
timeout=None,
tgt='*',
tgt_type='glob',
verbose=False,
show_timeout=False,
show_jid=False):
'''
Get the returns for the command line interface... | python | def get_cli_static_event_returns(
self,
jid,
minions,
timeout=None,
tgt='*',
tgt_type='glob',
verbose=False,
show_timeout=False,
show_jid=False):
'''
Get the returns for the command line interface... | [
"def",
"get_cli_static_event_returns",
"(",
"self",
",",
"jid",
",",
"minions",
",",
"timeout",
"=",
"None",
",",
"tgt",
"=",
"'*'",
",",
"tgt_type",
"=",
"'glob'",
",",
"verbose",
"=",
"False",
",",
"show_timeout",
"=",
"False",
",",
"show_jid",
"=",
"F... | Get the returns for the command line interface via the event system | [
"Get",
"the",
"returns",
"for",
"the",
"command",
"line",
"interface",
"via",
"the",
"event",
"system"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1433-L1512 | train |
saltstack/salt | salt/client/__init__.py | LocalClient.get_cli_event_returns | def get_cli_event_returns(
self,
jid,
minions,
timeout=None,
tgt='*',
tgt_type='glob',
verbose=False,
progress=False,
show_timeout=False,
show_jid=False,
**kwargs):
'''
Get... | python | def get_cli_event_returns(
self,
jid,
minions,
timeout=None,
tgt='*',
tgt_type='glob',
verbose=False,
progress=False,
show_timeout=False,
show_jid=False,
**kwargs):
'''
Get... | [
"def",
"get_cli_event_returns",
"(",
"self",
",",
"jid",
",",
"minions",
",",
"timeout",
"=",
"None",
",",
"tgt",
"=",
"'*'",
",",
"tgt_type",
"=",
"'glob'",
",",
"verbose",
"=",
"False",
",",
"progress",
"=",
"False",
",",
"show_timeout",
"=",
"False",
... | Get the returns for the command line interface via the event system | [
"Get",
"the",
"returns",
"for",
"the",
"command",
"line",
"interface",
"via",
"the",
"event",
"system"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1514-L1594 | train |
saltstack/salt | salt/client/__init__.py | LocalClient.get_event_iter_returns | def get_event_iter_returns(self, jid, minions, timeout=None):
'''
Gather the return data from the event system, break hard when timeout
is reached.
'''
log.trace('entered - function get_event_iter_returns()')
if timeout is None:
timeout = self.opts['timeout']
... | python | def get_event_iter_returns(self, jid, minions, timeout=None):
'''
Gather the return data from the event system, break hard when timeout
is reached.
'''
log.trace('entered - function get_event_iter_returns()')
if timeout is None:
timeout = self.opts['timeout']
... | [
"def",
"get_event_iter_returns",
"(",
"self",
",",
"jid",
",",
"minions",
",",
"timeout",
"=",
"None",
")",
":",
"log",
".",
"trace",
"(",
"'entered - function get_event_iter_returns()'",
")",
"if",
"timeout",
"is",
"None",
":",
"timeout",
"=",
"self",
".",
... | Gather the return data from the event system, break hard when timeout
is reached. | [
"Gather",
"the",
"return",
"data",
"from",
"the",
"event",
"system",
"break",
"hard",
"when",
"timeout",
"is",
"reached",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1596-L1631 | train |
saltstack/salt | salt/client/__init__.py | LocalClient._prep_pub | def _prep_pub(self,
tgt,
fun,
arg,
tgt_type,
ret,
jid,
timeout,
**kwargs):
'''
Set up the payload_kwargs to be sent down to the master
'''
if tg... | python | def _prep_pub(self,
tgt,
fun,
arg,
tgt_type,
ret,
jid,
timeout,
**kwargs):
'''
Set up the payload_kwargs to be sent down to the master
'''
if tg... | [
"def",
"_prep_pub",
"(",
"self",
",",
"tgt",
",",
"fun",
",",
"arg",
",",
"tgt_type",
",",
"ret",
",",
"jid",
",",
"timeout",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"tgt_type",
"==",
"'nodegroup'",
":",
"if",
"tgt",
"not",
"in",
"self",
".",
"o... | Set up the payload_kwargs to be sent down to the master | [
"Set",
"up",
"the",
"payload_kwargs",
"to",
"be",
"sent",
"down",
"to",
"the",
"master"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1633-L1699 | train |
saltstack/salt | salt/client/__init__.py | LocalClient.pub_async | def pub_async(self,
tgt,
fun,
arg=(),
tgt_type='glob',
ret='',
jid='',
timeout=5,
io_loop=None,
listen=True,
**kwargs):
'''
... | python | def pub_async(self,
tgt,
fun,
arg=(),
tgt_type='glob',
ret='',
jid='',
timeout=5,
io_loop=None,
listen=True,
**kwargs):
'''
... | [
"def",
"pub_async",
"(",
"self",
",",
"tgt",
",",
"fun",
",",
"arg",
"=",
"(",
")",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"jid",
"=",
"''",
",",
"timeout",
"=",
"5",
",",
"io_loop",
"=",
"None",
",",
"listen",
"=",
"True",... | Take the required arguments and publish the given command.
Arguments:
tgt:
The tgt is a regex or a glob used to match up the ids on
the minions. Salt works by always publishing every command
to all of the minions and then the minions determine if
... | [
"Take",
"the",
"required",
"arguments",
"and",
"publish",
"the",
"given",
"command",
".",
"Arguments",
":",
"tgt",
":",
"The",
"tgt",
"is",
"a",
"regex",
"or",
"a",
"glob",
"used",
"to",
"match",
"up",
"the",
"ids",
"on",
"the",
"minions",
".",
"Salt",... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1808-L1913 | train |
saltstack/salt | salt/client/__init__.py | FunctionWrapper.__load_functions | def __load_functions(self):
'''
Find out what functions are available on the minion
'''
return set(self.local.cmd(self.minion,
'sys.list_functions').get(self.minion, [])) | python | def __load_functions(self):
'''
Find out what functions are available on the minion
'''
return set(self.local.cmd(self.minion,
'sys.list_functions').get(self.minion, [])) | [
"def",
"__load_functions",
"(",
"self",
")",
":",
"return",
"set",
"(",
"self",
".",
"local",
".",
"cmd",
"(",
"self",
".",
"minion",
",",
"'sys.list_functions'",
")",
".",
"get",
"(",
"self",
".",
"minion",
",",
"[",
"]",
")",
")"
] | Find out what functions are available on the minion | [
"Find",
"out",
"what",
"functions",
"are",
"available",
"on",
"the",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1953-L1958 | train |
saltstack/salt | salt/client/__init__.py | FunctionWrapper.run_key | def run_key(self, key):
'''
Return a function that executes the arguments passed via the local
client
'''
def func(*args, **kwargs):
'''
Run a remote call
'''
args = list(args)
for _key, _val in kwargs:
a... | python | def run_key(self, key):
'''
Return a function that executes the arguments passed via the local
client
'''
def func(*args, **kwargs):
'''
Run a remote call
'''
args = list(args)
for _key, _val in kwargs:
a... | [
"def",
"run_key",
"(",
"self",
",",
"key",
")",
":",
"def",
"func",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"'''\n Run a remote call\n '''",
"args",
"=",
"list",
"(",
"args",
")",
"for",
"_key",
",",
"_val",
"in",
"kwar... | Return a function that executes the arguments passed via the local
client | [
"Return",
"a",
"function",
"that",
"executes",
"the",
"arguments",
"passed",
"via",
"the",
"local",
"client"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1960-L1973 | train |
saltstack/salt | salt/client/__init__.py | Caller.cmd | def cmd(self, fun, *args, **kwargs):
'''
Call an execution module with the given arguments and keyword arguments
.. versionchanged:: 2015.8.0
Added the ``cmd`` method for consistency with the other Salt clients.
The existing ``function`` and ``sminion.functions`` interfa... | python | def cmd(self, fun, *args, **kwargs):
'''
Call an execution module with the given arguments and keyword arguments
.. versionchanged:: 2015.8.0
Added the ``cmd`` method for consistency with the other Salt clients.
The existing ``function`` and ``sminion.functions`` interfa... | [
"def",
"cmd",
"(",
"self",
",",
"fun",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"sminion",
".",
"functions",
"[",
"fun",
"]",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | Call an execution module with the given arguments and keyword arguments
.. versionchanged:: 2015.8.0
Added the ``cmd`` method for consistency with the other Salt clients.
The existing ``function`` and ``sminion.functions`` interfaces still
exist but have been removed from th... | [
"Call",
"an",
"execution",
"module",
"with",
"the",
"given",
"arguments",
"and",
"keyword",
"arguments"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L2024-L2040 | train |
saltstack/salt | salt/client/__init__.py | Caller.function | def function(self, fun, *args, **kwargs):
'''
Call a single salt function
'''
func = self.sminion.functions[fun]
args, kwargs = salt.minion.load_args_and_kwargs(
func,
salt.utils.args.parse_input(args, kwargs=kwargs),)
return func(*args, **kwargs) | python | def function(self, fun, *args, **kwargs):
'''
Call a single salt function
'''
func = self.sminion.functions[fun]
args, kwargs = salt.minion.load_args_and_kwargs(
func,
salt.utils.args.parse_input(args, kwargs=kwargs),)
return func(*args, **kwargs) | [
"def",
"function",
"(",
"self",
",",
"fun",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"func",
"=",
"self",
".",
"sminion",
".",
"functions",
"[",
"fun",
"]",
"args",
",",
"kwargs",
"=",
"salt",
".",
"minion",
".",
"load_args_and_kwargs",
... | Call a single salt function | [
"Call",
"a",
"single",
"salt",
"function"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L2042-L2050 | train |
saltstack/salt | salt/client/__init__.py | ProxyCaller.cmd | def cmd(self, fun, *args, **kwargs):
'''
Call an execution module with the given arguments and keyword arguments
.. code-block:: python
caller.cmd('test.arg', 'Foo', 'Bar', baz='Baz')
caller.cmd('event.send', 'myco/myevent/something',
data={'foo': 'Foo'... | python | def cmd(self, fun, *args, **kwargs):
'''
Call an execution module with the given arguments and keyword arguments
.. code-block:: python
caller.cmd('test.arg', 'Foo', 'Bar', baz='Baz')
caller.cmd('event.send', 'myco/myevent/something',
data={'foo': 'Foo'... | [
"def",
"cmd",
"(",
"self",
",",
"fun",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"func",
"=",
"self",
".",
"sminion",
".",
"functions",
"[",
"fun",
"]",
"data",
"=",
"{",
"'arg'",
":",
"args",
",",
"'fun'",
":",
"fun",
"}",
"data",
... | Call an execution module with the given arguments and keyword arguments
.. code-block:: python
caller.cmd('test.arg', 'Foo', 'Bar', baz='Baz')
caller.cmd('event.send', 'myco/myevent/something',
data={'foo': 'Foo'}, with_env=['GIT_COMMIT'], with_grains=True) | [
"Call",
"an",
"execution",
"module",
"with",
"the",
"given",
"arguments",
"and",
"keyword",
"arguments"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L2097-L2125 | train |
saltstack/salt | salt/modules/win_smtp_server.py | _get_wmi_setting | def _get_wmi_setting(wmi_class_name, setting, server):
'''
Get the value of the setting for the provided class.
'''
with salt.utils.winapi.Com():
try:
connection = wmi.WMI(namespace=_WMI_NAMESPACE)
wmi_class = getattr(connection, wmi_class_name)
objs = wmi_cl... | python | def _get_wmi_setting(wmi_class_name, setting, server):
'''
Get the value of the setting for the provided class.
'''
with salt.utils.winapi.Com():
try:
connection = wmi.WMI(namespace=_WMI_NAMESPACE)
wmi_class = getattr(connection, wmi_class_name)
objs = wmi_cl... | [
"def",
"_get_wmi_setting",
"(",
"wmi_class_name",
",",
"setting",
",",
"server",
")",
":",
"with",
"salt",
".",
"utils",
".",
"winapi",
".",
"Com",
"(",
")",
":",
"try",
":",
"connection",
"=",
"wmi",
".",
"WMI",
"(",
"namespace",
"=",
"_WMI_NAMESPACE",
... | Get the value of the setting for the provided class. | [
"Get",
"the",
"value",
"of",
"the",
"setting",
"for",
"the",
"provided",
"class",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_smtp_server.py#L58-L73 | train |
saltstack/salt | salt/modules/win_smtp_server.py | _set_wmi_setting | def _set_wmi_setting(wmi_class_name, setting, value, server):
'''
Set the value of the setting for the provided class.
'''
with salt.utils.winapi.Com():
try:
connection = wmi.WMI(namespace=_WMI_NAMESPACE)
wmi_class = getattr(connection, wmi_class_name)
objs =... | python | def _set_wmi_setting(wmi_class_name, setting, value, server):
'''
Set the value of the setting for the provided class.
'''
with salt.utils.winapi.Com():
try:
connection = wmi.WMI(namespace=_WMI_NAMESPACE)
wmi_class = getattr(connection, wmi_class_name)
objs =... | [
"def",
"_set_wmi_setting",
"(",
"wmi_class_name",
",",
"setting",
",",
"value",
",",
"server",
")",
":",
"with",
"salt",
".",
"utils",
".",
"winapi",
".",
"Com",
"(",
")",
":",
"try",
":",
"connection",
"=",
"wmi",
".",
"WMI",
"(",
"namespace",
"=",
... | Set the value of the setting for the provided class. | [
"Set",
"the",
"value",
"of",
"the",
"setting",
"for",
"the",
"provided",
"class",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_smtp_server.py#L76-L98 | train |
saltstack/salt | salt/modules/win_smtp_server.py | get_log_format_types | def get_log_format_types():
'''
Get all available log format names and ids.
:return: A dictionary of the log format names and ids.
:rtype: dict
CLI Example:
.. code-block:: bash
salt '*' win_smtp_server.get_log_format_types
'''
ret = dict()
prefix = 'logging/'
with s... | python | def get_log_format_types():
'''
Get all available log format names and ids.
:return: A dictionary of the log format names and ids.
:rtype: dict
CLI Example:
.. code-block:: bash
salt '*' win_smtp_server.get_log_format_types
'''
ret = dict()
prefix = 'logging/'
with s... | [
"def",
"get_log_format_types",
"(",
")",
":",
"ret",
"=",
"dict",
"(",
")",
"prefix",
"=",
"'logging/'",
"with",
"salt",
".",
"utils",
".",
"winapi",
".",
"Com",
"(",
")",
":",
"try",
":",
"connection",
"=",
"wmi",
".",
"WMI",
"(",
"namespace",
"=",
... | Get all available log format names and ids.
:return: A dictionary of the log format names and ids.
:rtype: dict
CLI Example:
.. code-block:: bash
salt '*' win_smtp_server.get_log_format_types | [
"Get",
"all",
"available",
"log",
"format",
"names",
"and",
"ids",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_smtp_server.py#L119-L151 | train |
saltstack/salt | salt/modules/win_smtp_server.py | get_servers | def get_servers():
'''
Get the SMTP virtual server names.
:return: A list of the SMTP virtual servers.
:rtype: list
CLI Example:
.. code-block:: bash
salt '*' win_smtp_server.get_servers
'''
ret = list()
with salt.utils.winapi.Com():
try:
connection =... | python | def get_servers():
'''
Get the SMTP virtual server names.
:return: A list of the SMTP virtual servers.
:rtype: list
CLI Example:
.. code-block:: bash
salt '*' win_smtp_server.get_servers
'''
ret = list()
with salt.utils.winapi.Com():
try:
connection =... | [
"def",
"get_servers",
"(",
")",
":",
"ret",
"=",
"list",
"(",
")",
"with",
"salt",
".",
"utils",
".",
"winapi",
".",
"Com",
"(",
")",
":",
"try",
":",
"connection",
"=",
"wmi",
".",
"WMI",
"(",
"namespace",
"=",
"_WMI_NAMESPACE",
")",
"objs",
"=",
... | Get the SMTP virtual server names.
:return: A list of the SMTP virtual servers.
:rtype: list
CLI Example:
.. code-block:: bash
salt '*' win_smtp_server.get_servers | [
"Get",
"the",
"SMTP",
"virtual",
"server",
"names",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_smtp_server.py#L154-L182 | train |
saltstack/salt | salt/modules/win_smtp_server.py | get_server_setting | def get_server_setting(settings, server=_DEFAULT_SERVER):
'''
Get the value of the setting for the SMTP virtual server.
:param str settings: A list of the setting names.
:param str server: The SMTP server name.
:return: A dictionary of the provided settings and their values.
:rtype: dict
... | python | def get_server_setting(settings, server=_DEFAULT_SERVER):
'''
Get the value of the setting for the SMTP virtual server.
:param str settings: A list of the setting names.
:param str server: The SMTP server name.
:return: A dictionary of the provided settings and their values.
:rtype: dict
... | [
"def",
"get_server_setting",
"(",
"settings",
",",
"server",
"=",
"_DEFAULT_SERVER",
")",
":",
"ret",
"=",
"dict",
"(",
")",
"if",
"not",
"settings",
":",
"_LOG",
".",
"warning",
"(",
"'No settings provided.'",
")",
"return",
"ret",
"with",
"salt",
".",
"u... | Get the value of the setting for the SMTP virtual server.
:param str settings: A list of the setting names.
:param str server: The SMTP server name.
:return: A dictionary of the provided settings and their values.
:rtype: dict
CLI Example:
.. code-block:: bash
salt '*' win_smtp_serv... | [
"Get",
"the",
"value",
"of",
"the",
"setting",
"for",
"the",
"SMTP",
"virtual",
"server",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_smtp_server.py#L185-L218 | train |
saltstack/salt | salt/modules/win_smtp_server.py | set_server_setting | def set_server_setting(settings, server=_DEFAULT_SERVER):
'''
Set the value of the setting for the SMTP virtual server.
.. note::
The setting names are case-sensitive.
:param str settings: A dictionary of the setting names and their values.
:param str server: The SMTP server name.
:r... | python | def set_server_setting(settings, server=_DEFAULT_SERVER):
'''
Set the value of the setting for the SMTP virtual server.
.. note::
The setting names are case-sensitive.
:param str settings: A dictionary of the setting names and their values.
:param str server: The SMTP server name.
:r... | [
"def",
"set_server_setting",
"(",
"settings",
",",
"server",
"=",
"_DEFAULT_SERVER",
")",
":",
"if",
"not",
"settings",
":",
"_LOG",
".",
"warning",
"(",
"'No settings provided'",
")",
"return",
"False",
"# Some fields are formatted like '{data}'. Salt tries to convert th... | Set the value of the setting for the SMTP virtual server.
.. note::
The setting names are case-sensitive.
:param str settings: A dictionary of the setting names and their values.
:param str server: The SMTP server name.
:return: A boolean representing whether all changes succeeded.
:rtyp... | [
"Set",
"the",
"value",
"of",
"the",
"setting",
"for",
"the",
"SMTP",
"virtual",
"server",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_smtp_server.py#L221-L289 | train |
saltstack/salt | salt/modules/win_smtp_server.py | get_log_format | def get_log_format(server=_DEFAULT_SERVER):
'''
Get the active log format for the SMTP virtual server.
:param str server: The SMTP server name.
:return: A string of the log format name.
:rtype: str
CLI Example:
.. code-block:: bash
salt '*' win_smtp_server.get_log_format
'''... | python | def get_log_format(server=_DEFAULT_SERVER):
'''
Get the active log format for the SMTP virtual server.
:param str server: The SMTP server name.
:return: A string of the log format name.
:rtype: str
CLI Example:
.. code-block:: bash
salt '*' win_smtp_server.get_log_format
'''... | [
"def",
"get_log_format",
"(",
"server",
"=",
"_DEFAULT_SERVER",
")",
":",
"log_format_types",
"=",
"get_log_format_types",
"(",
")",
"format_id",
"=",
"_get_wmi_setting",
"(",
"'IIsSmtpServerSetting'",
",",
"'LogPluginClsid'",
",",
"server",
")",
"# Since IIsSmtpServerS... | Get the active log format for the SMTP virtual server.
:param str server: The SMTP server name.
:return: A string of the log format name.
:rtype: str
CLI Example:
.. code-block:: bash
salt '*' win_smtp_server.get_log_format | [
"Get",
"the",
"active",
"log",
"format",
"for",
"the",
"SMTP",
"virtual",
"server",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_smtp_server.py#L292-L316 | train |
saltstack/salt | salt/modules/win_smtp_server.py | set_log_format | def set_log_format(log_format, server=_DEFAULT_SERVER):
'''
Set the active log format for the SMTP virtual server.
:param str log_format: The log format name.
:param str server: The SMTP server name.
:return: A boolean representing whether the change succeeded.
:rtype: bool
CLI Example:
... | python | def set_log_format(log_format, server=_DEFAULT_SERVER):
'''
Set the active log format for the SMTP virtual server.
:param str log_format: The log format name.
:param str server: The SMTP server name.
:return: A boolean representing whether the change succeeded.
:rtype: bool
CLI Example:
... | [
"def",
"set_log_format",
"(",
"log_format",
",",
"server",
"=",
"_DEFAULT_SERVER",
")",
":",
"setting",
"=",
"'LogPluginClsid'",
"log_format_types",
"=",
"get_log_format_types",
"(",
")",
"format_id",
"=",
"log_format_types",
".",
"get",
"(",
"log_format",
",",
"N... | Set the active log format for the SMTP virtual server.
:param str log_format: The log format name.
:param str server: The SMTP server name.
:return: A boolean representing whether the change succeeded.
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' win_smtp_server.set_log_f... | [
"Set",
"the",
"active",
"log",
"format",
"for",
"the",
"SMTP",
"virtual",
"server",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_smtp_server.py#L319-L361 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.