repository_name stringclasses 316
values | func_path_in_repository stringlengths 6 223 | func_name stringlengths 1 134 | language stringclasses 1
value | func_code_string stringlengths 57 65.5k | func_documentation_string stringlengths 1 46.3k | split_name stringclasses 1
value | func_code_url stringlengths 91 315 | called_functions listlengths 1 156 ⌀ | enclosing_scope stringlengths 2 1.48M |
|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/modules/opkg.py | owner | 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... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1599-L1630 | [
"def itervalues(d, **kw):\n return d.itervalues(**kw)\n"
] | # -*- coding: utf-8 -*-
'''
Support for Opkg
.. important::
If you feel that Salt should be using this module to manage packages on a
minion, and it is using a different module (or gives an error similar to
*'pkg.install' is not available*), see :ref:`here
<module-provider-override>`.
.. versionadded:... |
saltstack/salt | salt/modules/splunk.py | _send_email | 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')... | send a email to inform user of account creation | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/splunk.py#L84-L100 | [
"def _generate_password(email):\n m = hmac.new(base64.b64decode(_get_secret_key('splunk')), six.text_type([email, SERVICE_NAME]))\n return base64.urlsafe_b64encode(m.digest()).strip().replace('=', '')\n"
] | # -*- coding: utf-8 -*-
'''
Module for interop with the Splunk API
.. versionadded:: 2016.3.0.
:depends: - splunk-sdk python module
:configuration: Configure this module by specifying the name of a configuration
profile in the minion config, minion pillar, or master config. The module
will use the 'splunk'... |
saltstack/salt | salt/modules/splunk.py | _get_splunk | 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... | Return the splunk client, cached into __context__ for performance | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/splunk.py#L124-L144 | null | # -*- coding: utf-8 -*-
'''
Module for interop with the Splunk API
.. versionadded:: 2016.3.0.
:depends: - splunk-sdk python module
:configuration: Configure this module by specifying the name of a configuration
profile in the minion config, minion pillar, or master config. The module
will use the 'splunk'... |
saltstack/salt | salt/modules/splunk.py | list_users | 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(... | List all users in the splunk DB
CLI Example:
salt myminion splunk.list_users | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/splunk.py#L147-L164 | [
"def _populate_cache(profile=\"splunk\"):\n config = __salt__['config.option'](profile)\n\n key = \"splunk.users.{0}\".format(\n config.get('host')\n )\n\n if key not in __context__:\n client = _get_splunk(profile)\n kwargs = {'sort_key': 'realname', 'sort_dir': 'asc'}\n user... | # -*- coding: utf-8 -*-
'''
Module for interop with the Splunk API
.. versionadded:: 2016.3.0.
:depends: - splunk-sdk python module
:configuration: Configure this module by specifying the name of a configuration
profile in the minion config, minion pillar, or master config. The module
will use the 'splunk'... |
saltstack/salt | salt/modules/splunk.py | get_user | 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... | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/splunk.py#L167-L196 | [
"def list_users(profile=\"splunk\"):\n '''\n List all users in the splunk DB\n\n CLI Example:\n\n salt myminion splunk.list_users\n '''\n\n config = __salt__['config.option'](profile)\n key = \"splunk.users.{0}\".format(\n config.get('host')\n )\n\n if key not in __context__:\n... | # -*- coding: utf-8 -*-
'''
Module for interop with the Splunk API
.. versionadded:: 2016.3.0.
:depends: - splunk-sdk python module
:configuration: Configure this module by specifying the name of a configuration
profile in the minion config, minion pillar, or master config. The module
will use the 'splunk'... |
saltstack/salt | salt/modules/splunk.py | create_user | 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... | create a splunk user by name/email
CLI Example:
salt myminion splunk.create_user user@example.com roles=['user'] realname="Test User" name=testuser | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/splunk.py#L199-L246 | [
"def list_users(profile=\"splunk\"):\n '''\n List all users in the splunk DB\n\n CLI Example:\n\n salt myminion splunk.list_users\n '''\n\n config = __salt__['config.option'](profile)\n key = \"splunk.users.{0}\".format(\n config.get('host')\n )\n\n if key not in __context__:\n... | # -*- coding: utf-8 -*-
'''
Module for interop with the Splunk API
.. versionadded:: 2016.3.0.
:depends: - splunk-sdk python module
:configuration: Configure this module by specifying the name of a configuration
profile in the minion config, minion pillar, or master config. The module
will use the 'splunk'... |
saltstack/salt | salt/modules/splunk.py | update_user | 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... | Create a splunk user by email
CLI Example:
salt myminion splunk.update_user example@domain.com roles=['user'] realname="Test User" | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/splunk.py#L249-L301 | [
"def list_users(profile=\"splunk\"):\n '''\n List all users in the splunk DB\n\n CLI Example:\n\n salt myminion splunk.list_users\n '''\n\n config = __salt__['config.option'](profile)\n key = \"splunk.users.{0}\".format(\n config.get('host')\n )\n\n if key not in __context__:\n... | # -*- coding: utf-8 -*-
'''
Module for interop with the Splunk API
.. versionadded:: 2016.3.0.
:depends: - splunk-sdk python module
:configuration: Configure this module by specifying the name of a configuration
profile in the minion config, minion pillar, or master config. The module
will use the 'splunk'... |
saltstack/salt | salt/modules/splunk.py | delete_user | 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)
... | Delete a splunk user by email
CLI Example:
salt myminion splunk_user.delete 'user@example.com' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/splunk.py#L304-L326 | [
"def list_users(profile=\"splunk\"):\n '''\n List all users in the splunk DB\n\n CLI Example:\n\n salt myminion splunk.list_users\n '''\n\n config = __salt__['config.option'](profile)\n key = \"splunk.users.{0}\".format(\n config.get('host')\n )\n\n if key not in __context__:\n... | # -*- coding: utf-8 -*-
'''
Module for interop with the Splunk API
.. versionadded:: 2016.3.0.
:depends: - splunk-sdk python module
:configuration: Configure this module by specifying the name of a configuration
profile in the minion config, minion pillar, or master config. The module
will use the 'splunk'... |
saltstack/salt | salt/grains/extra.py | shell | 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... | Return the default shell to use on this system | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/extra.py#L21-L34 | null | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
# Import python libs
import os
# Import third party libs
import logging
# Import salt libs
import salt.utils.data
import salt.utils.files
import salt.utils.platform
import salt.utils.yaml
__proxyenabled__ = ['*']
log =... |
saltstack/salt | salt/grains/extra.py | config | 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... | Return the grains set in the grains file | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/extra.py#L37-L77 | null | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
# Import python libs
import os
# Import third party libs
import logging
# Import salt libs
import salt.utils.data
import salt.utils.files
import salt.utils.platform
import salt.utils.yaml
__proxyenabled__ = ['*']
log =... |
saltstack/salt | salt/modules/mac_desktop.py | get_output_volume | 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... | Get the output volume (range 0 to 100)
CLI Example:
.. code-block:: bash
salt '*' desktop.get_output_volume | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_desktop.py#L24-L42 | [
"def _check_cmd(call):\n '''\n Check the output of the cmd.run_all function call.\n '''\n if call['retcode'] != 0:\n comment = ''\n std_err = call.get('stderr')\n std_out = call.get('stdout')\n if std_err:\n comment += std_err\n if std_out:\n comm... | # -*- coding: utf-8 -*-
'''
macOS implementations of various commands in the "desktop" interface
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import Salt libs
import salt.utils.platform
from salt.exceptions import CommandExecutionError
# Define the module's virtual name
__virtualname... |
saltstack/salt | salt/modules/mac_desktop.py | set_output_volume | 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 =... | 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> | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_desktop.py#L45-L66 | [
"def _check_cmd(call):\n '''\n Check the output of the cmd.run_all function call.\n '''\n if call['retcode'] != 0:\n comment = ''\n std_err = call.get('stderr')\n std_out = call.get('stdout')\n if std_err:\n comment += std_err\n if std_out:\n comm... | # -*- coding: utf-8 -*-
'''
macOS implementations of various commands in the "desktop" interface
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import Salt libs
import salt.utils.platform
from salt.exceptions import CommandExecutionError
# Define the module's virtual name
__virtualname... |
saltstack/salt | salt/modules/mac_desktop.py | screensaver | 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... | Launch the screensaver.
CLI Example:
.. code-block:: bash
salt '*' desktop.screensaver | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_desktop.py#L69-L87 | [
"def _check_cmd(call):\n '''\n Check the output of the cmd.run_all function call.\n '''\n if call['retcode'] != 0:\n comment = ''\n std_err = call.get('stderr')\n std_out = call.get('stdout')\n if std_err:\n comment += std_err\n if std_out:\n comm... | # -*- coding: utf-8 -*-
'''
macOS implementations of various commands in the "desktop" interface
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import Salt libs
import salt.utils.platform
from salt.exceptions import CommandExecutionError
# Define the module's virtual name
__virtualname... |
saltstack/salt | salt/modules/mac_desktop.py | say | 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... | Say some words.
words
The words to execute the say command with.
CLI Example:
.. code-block:: bash
salt '*' desktop.say <word0> <word1> ... <wordN> | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_desktop.py#L111-L132 | [
"def _check_cmd(call):\n '''\n Check the output of the cmd.run_all function call.\n '''\n if call['retcode'] != 0:\n comment = ''\n std_err = call.get('stderr')\n std_out = call.get('stdout')\n if std_err:\n comment += std_err\n if std_out:\n comm... | # -*- coding: utf-8 -*-
'''
macOS implementations of various commands in the "desktop" interface
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import Salt libs
import salt.utils.platform
from salt.exceptions import CommandExecutionError
# Define the module's virtual name
__virtualname... |
saltstack/salt | salt/modules/mac_desktop.py | _check_cmd | 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
... | Check the output of the cmd.run_all function call. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_desktop.py#L135-L150 | null | # -*- coding: utf-8 -*-
'''
macOS implementations of various commands in the "desktop" interface
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import Salt libs
import salt.utils.platform
from salt.exceptions import CommandExecutionError
# Define the module's virtual name
__virtualname... |
saltstack/salt | salt/utils/win_pdh.py | build_counter_list | 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... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_pdh.py#L292-L334 | [
"def build_counter(obj, instance, instance_index, counter):\n r'''\n Makes a fully resolved counter path. Counter names are formatted like\n this:\n\n ``\\Processor(*)\\% Processor Time``\n\n The above breaks down like this:\n\n obj = 'Processor'\n instance = '*'\n counter = '% P... | # -*- coding: utf-8 -*-
r'''
Salt Util for getting system information with the Performance Data Helper (pdh).
Counter information is gathered from current activity or log files.
Usage:
.. code-block:: python
import salt.utils.win_pdh
# Get a list of Counter objects
salt.utils.win_pdh.list_objects()
... |
saltstack/salt | salt/utils/win_pdh.py | get_all_counters | 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):
... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_pdh.py#L337-L370 | [
"def get_counters(counter_list):\n '''\n Get the values for the passes list of counters\n\n Args:\n counter_list (list):\n A list of counters to lookup\n\n Returns:\n dict: A dictionary of counters and their values\n '''\n if not isinstance(counter_list, list):\n ra... | # -*- coding: utf-8 -*-
r'''
Salt Util for getting system information with the Performance Data Helper (pdh).
Counter information is gathered from current activity or log files.
Usage:
.. code-block:: python
import salt.utils.win_pdh
# Get a list of Counter objects
salt.utils.win_pdh.list_objects()
... |
saltstack/salt | salt/utils/win_pdh.py | get_counters | 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... | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_pdh.py#L373-L420 | [
"def build_counter_list(counter_list):\n r'''\n Create a list of Counter objects to be used in the pdh query\n\n Args:\n counter_list (list):\n A list of tuples containing counter information. Each tuple should\n contain the object, instance, and counter name. For example, to\n... | # -*- coding: utf-8 -*-
r'''
Salt Util for getting system information with the Performance Data Helper (pdh).
Counter information is gathered from current activity or log files.
Usage:
.. code-block:: python
import salt.utils.win_pdh
# Get a list of Counter objects
salt.utils.win_pdh.list_objects()
... |
saltstack/salt | salt/utils/win_pdh.py | Counter.build_counter | 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 = '*'
... | 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):... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_pdh.py#L132-L169 | null | class Counter(object):
'''
Counter object
Has enumerations and functions for working with counters
'''
# The dwType field from GetCounterInfo returns the following, or'ed.
# These come from WinPerf.h
PERF_SIZE_DWORD = 0x00000000
PERF_SIZE_LARGE = 0x00000100
PERF_SIZE_ZERO = 0x0000020... |
saltstack/salt | salt/utils/win_pdh.py | Counter.add_to_query | 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) | Add the current path to the query
Args:
query (obj):
The handle to the query to add the counter | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_pdh.py#L183-L191 | null | class Counter(object):
'''
Counter object
Has enumerations and functions for working with counters
'''
# The dwType field from GetCounterInfo returns the following, or'ed.
# These come from WinPerf.h
PERF_SIZE_DWORD = 0x00000000
PERF_SIZE_LARGE = 0x00000100
PERF_SIZE_ZERO = 0x0000020... |
saltstack/salt | salt/utils/win_pdh.py | Counter.get_info | 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)
... | Get information about the counter
.. note::
GetCounterInfo sometimes crashes in the wrapper code. Fewer crashes
if this is called after sampling data. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_pdh.py#L193-L219 | null | class Counter(object):
'''
Counter object
Has enumerations and functions for working with counters
'''
# The dwType field from GetCounterInfo returns the following, or'ed.
# These come from WinPerf.h
PERF_SIZE_DWORD = 0x00000000
PERF_SIZE_LARGE = 0x00000100
PERF_SIZE_ZERO = 0x0000020... |
saltstack/salt | salt/utils/win_pdh.py | Counter.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 | Return the counter value
Returns:
long: The counter value | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_pdh.py#L221-L231 | null | class Counter(object):
'''
Counter object
Has enumerations and functions for working with counters
'''
# The dwType field from GetCounterInfo returns the following, or'ed.
# These come from WinPerf.h
PERF_SIZE_DWORD = 0x00000000
PERF_SIZE_LARGE = 0x00000100
PERF_SIZE_ZERO = 0x0000020... |
saltstack/salt | salt/utils/win_pdh.py | Counter.type_string | 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... | Returns the names of the flags that are set in the Type field
It can be used to format the counter. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_pdh.py#L233-L246 | [
"def get_info(self):\n '''\n Get information about the counter\n\n .. note::\n GetCounterInfo sometimes crashes in the wrapper code. Fewer crashes\n if this is called after sampling data.\n '''\n if not self.info:\n ci = win32pdh.GetCounterInfo(self.handle, 0)\n self.info ... | class Counter(object):
'''
Counter object
Has enumerations and functions for working with counters
'''
# The dwType field from GetCounterInfo returns the following, or'ed.
# These come from WinPerf.h
PERF_SIZE_DWORD = 0x00000000
PERF_SIZE_LARGE = 0x00000100
PERF_SIZE_ZERO = 0x0000020... |
saltstack/salt | salt/states/win_path.py | exists | 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... | 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
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_path.py#L66-L234 | [
"def to_unicode(s, encoding=None, errors='strict', normalize=False):\n '''\n Given str or unicode, return unicode (str for python 3)\n '''\n def _normalize(s):\n return unicodedata.normalize('NFC', s) if normalize else s\n\n if encoding is None:\n # Try utf-8 first, and fall back to det... | # -*- coding: utf-8 -*-
'''
Manage the Windows System PATH
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import Python libs
import os
# Import Salt libs
from salt.ext import six
import salt.utils.stringutils
def __virtual__():
'''
Load this state if the win_path module exist... |
saltstack/salt | salt/proxy/rest_sample.py | id | 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)
... | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/rest_sample.py#L69-L76 | null | # -*- coding: utf-8 -*-
'''
This is a simple proxy-minion designed to connect to and communicate with
the bottle-based web service contained in https://github.com/saltstack/salt-contrib/tree/master/proxyminion_rest_example
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import python lib... |
saltstack/salt | salt/proxy/rest_sample.py | grains | 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'] | Get the grains from the proxied device | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/rest_sample.py#L79-L86 | null | # -*- coding: utf-8 -*-
'''
This is a simple proxy-minion designed to connect to and communicate with
the bottle-based web service contained in https://github.com/saltstack/salt-contrib/tree/master/proxyminion_rest_example
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import python lib... |
saltstack/salt | salt/proxy/rest_sample.py | service_start | 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'] | Start a "service" on the REST server | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/rest_sample.py#L102-L107 | null | # -*- coding: utf-8 -*-
'''
This is a simple proxy-minion designed to connect to and communicate with
the bottle-based web service contained in https://github.com/saltstack/salt-contrib/tree/master/proxyminion_rest_example
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import python lib... |
saltstack/salt | salt/proxy/rest_sample.py | service_list | 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'] | List "services" on the REST server | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/rest_sample.py#L126-L131 | null | # -*- coding: utf-8 -*-
'''
This is a simple proxy-minion designed to connect to and communicate with
the bottle-based web service contained in https://github.com/saltstack/salt-contrib/tree/master/proxyminion_rest_example
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import python lib... |
saltstack/salt | salt/proxy/rest_sample.py | package_install | 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)
... | Install a "package" on the REST server | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/rest_sample.py#L150-L160 | null | # -*- coding: utf-8 -*-
'''
This is a simple proxy-minion designed to connect to and communicate with
the bottle-based web service contained in https://github.com/saltstack/salt-contrib/tree/master/proxyminion_rest_example
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import python lib... |
saltstack/salt | salt/proxy/rest_sample.py | ping | 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 | Is the REST server up? | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/rest_sample.py#L194-L202 | null | # -*- coding: utf-8 -*-
'''
This is a simple proxy-minion designed to connect to and communicate with
the bottle-based web service contained in https://github.com/saltstack/salt-contrib/tree/master/proxyminion_rest_example
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import python lib... |
saltstack/salt | salt/states/mac_xattr.py | exists | 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... | 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 ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mac_xattr.py#L35-L85 | null | # -*- coding: utf-8 -*-
'''
Allows you to manage extended attributes on files or directories
================================================================
Install, enable and disable assistive access on macOS minions
.. code-block:: yaml
/path/to/file:
xattr.exists:
- attributes:
- c... |
saltstack/salt | salt/states/mac_xattr.py | delete | 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,
... | 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. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mac_xattr.py#L88-L121 | null | # -*- coding: utf-8 -*-
'''
Allows you to manage extended attributes on files or directories
================================================================
Install, enable and disable assistive access on macOS minions
.. code-block:: yaml
/path/to/file:
xattr.exists:
- attributes:
- c... |
saltstack/salt | salt/utils/validate/path.py | is_writeable | 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
'''
... | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/validate/path.py#L17-L50 | null | # -*- coding: utf-8 -*-
'''
:codeauthor: Pedro Algarvio (pedro@algarvio.me)
salt.utils.validate.path
~~~~~~~~~~~~~~~~~~~~~~~~
Several path related validators
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import python libs
import os
def is_readable(path):
'''
... |
saltstack/salt | salt/utils/validate/path.py | is_readable | 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
... | Check if a given path is readable by the current user.
:param path: The path to check
:returns: True or False | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/validate/path.py#L53-L66 | null | # -*- coding: utf-8 -*-
'''
:codeauthor: Pedro Algarvio (pedro@algarvio.me)
salt.utils.validate.path
~~~~~~~~~~~~~~~~~~~~~~~~
Several path related validators
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import python libs
import os
def is_writeable(path, check_par... |
saltstack/salt | salt/engines/junos_syslog.py | _SyslogServerFactory.parseData | 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... | 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 ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/junos_syslog.py#L289-L350 | null | class _SyslogServerFactory(DatagramProtocol):
def __init__(self, options):
self.options = options
self.obj = _Parser()
data = [
"hostip",
"priority",
"severity",
"facility",
"timestamp",
"hostname",
"daemon"... |
saltstack/salt | salt/engines/junos_syslog.py | _SyslogServerFactory.send_event_to_salt | 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'... | 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. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/junos_syslog.py#L352-L372 | [
"def get_master_event(opts, sock_dir, listen=True, io_loop=None, raise_errors=False, keep_loop=False):\n '''\n Return an event object suitable for the named transport\n '''\n # TODO: AIO core is separate from transport\n if opts['transport'] in ('zeromq', 'tcp', 'detect'):\n return MasterEvent... | class _SyslogServerFactory(DatagramProtocol):
def __init__(self, options):
self.options = options
self.obj = _Parser()
data = [
"hostip",
"priority",
"severity",
"facility",
"timestamp",
"hostname",
"daemon"... |
saltstack/salt | salt/utils/sdb.py | sdb_get | 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... | 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. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/sdb.py#L19-L46 | null | # -*- coding: utf-8 -*-
'''
Basic functions for accessing the SDB interface
For configuration options, see the docs for specific sdb
modules.
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import python libs
import random
# Import salt libs
import salt.loader
from salt.ext.six import ... |
saltstack/salt | salt/utils/sdb.py | sdb_get_or_set_hash | 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 ... | 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. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/sdb.py#L111-L133 | [
"def sdb_get(uri, opts, utils=None):\n '''\n Get a value from a db, using a uri in the form of ``sdb://<profile>/<key>``. If\n the uri provided does not start with ``sdb://``, then it will be returned as-is.\n '''\n if not isinstance(uri, string_types) or not uri.startswith('sdb://'):\n return... | # -*- coding: utf-8 -*-
'''
Basic functions for accessing the SDB interface
For configuration options, see the docs for specific sdb
modules.
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import python libs
import random
# Import salt libs
import salt.loader
from salt.ext.six import ... |
saltstack/salt | salt/modules/grafana4.py | get_users | 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... | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grafana4.py#L65-L89 | [
"def _get_headers(profile):\n headers = {'Content-type': 'application/json'}\n if profile.get('grafana_token', False):\n headers['Authorization'] = 'Bearer {0}'.format(\n profile['grafana_token'])\n return headers\n",
"def _get_auth(profile):\n if profile.get('grafana_token', False):... | # -*- coding: utf-8 -*-
'''
Module for working with the Grafana v4 API
.. versionadded:: 2017.7.0
:depends: requests
:configuration: This module requires a configuration profile to be configured
in the minion config, minion pillar, or master config.
The module will use the 'grafana' key by default, if define... |
saltstack/salt | salt/modules/grafana4.py | get_user | 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>
'''
... | 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> | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grafana4.py#L92-L113 | [
"def get_users(profile='grafana'):\n '''\n List all users.\n\n profile\n Configuration profile used to connect to the Grafana instance.\n Default is 'grafana'.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' grafana4.get_users\n '''\n if isinstance(profile, string_ty... | # -*- coding: utf-8 -*-
'''
Module for working with the Grafana v4 API
.. versionadded:: 2017.7.0
:depends: requests
:configuration: This module requires a configuration profile to be configured
in the minion config, minion pillar, or master config.
The module will use the 'grafana' key by default, if define... |
saltstack/salt | salt/modules/grafana4.py | update_user | 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... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grafana4.py#L186-L235 | [
"def _get_headers(profile):\n headers = {'Content-type': 'application/json'}\n if profile.get('grafana_token', False):\n headers['Authorization'] = 'Bearer {0}'.format(\n profile['grafana_token'])\n return headers\n",
"def _get_auth(profile):\n if profile.get('grafana_token', False):... | # -*- coding: utf-8 -*-
'''
Module for working with the Grafana v4 API
.. versionadded:: 2017.7.0
:depends: requests
:configuration: This module requires a configuration profile to be configured
in the minion config, minion pillar, or master config.
The module will use the 'grafana' key by default, if define... |
saltstack/salt | salt/modules/grafana4.py | switch_org | 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 '*... | 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> | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grafana4.py#L459-L487 | [
"def _get_headers(profile):\n headers = {'Content-type': 'application/json'}\n if profile.get('grafana_token', False):\n headers['Authorization'] = 'Bearer {0}'.format(\n profile['grafana_token'])\n return headers\n",
"def _get_auth(profile):\n if profile.get('grafana_token', False):... | # -*- coding: utf-8 -*-
'''
Module for working with the Grafana v4 API
.. versionadded:: 2017.7.0
:depends: requests
:configuration: This module requires a configuration profile to be configured
in the minion config, minion pillar, or master config.
The module will use the 'grafana' key by default, if define... |
saltstack/salt | salt/modules/grafana4.py | update_org_user | 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
... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grafana4.py#L565-L608 | [
"def _get_headers(profile):\n headers = {'Content-type': 'application/json'}\n if profile.get('grafana_token', False):\n headers['Authorization'] = 'Bearer {0}'.format(\n profile['grafana_token'])\n return headers\n",
"def _get_auth(profile):\n if profile.get('grafana_token', False):... | # -*- coding: utf-8 -*-
'''
Module for working with the Grafana v4 API
.. versionadded:: 2017.7.0
:depends: requests
:configuration: This module requires a configuration profile to be configured
in the minion config, minion pillar, or master config.
The module will use the 'grafana' key by default, if define... |
saltstack/salt | salt/modules/grafana4.py | get_datasource | 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'.
... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grafana4.py#L930-L954 | [
"def get_datasources(orgname=None, profile='grafana'):\n '''\n List all datasources in an organisation.\n\n orgname\n Name of the organization.\n\n profile\n Configuration profile used to connect to the Grafana instance.\n Default is 'grafana'.\n\n CLI Example:\n\n .. code-blo... | # -*- coding: utf-8 -*-
'''
Module for working with the Grafana v4 API
.. versionadded:: 2017.7.0
:depends: requests
:configuration: This module requires a configuration profile to be configured
in the minion config, minion pillar, or master config.
The module will use the 'grafana' key by default, if define... |
saltstack/salt | salt/modules/grafana4.py | delete_datasource | 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... | 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> | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grafana4.py#L1113-L1140 | [
"def _get_headers(profile):\n headers = {'Content-type': 'application/json'}\n if profile.get('grafana_token', False):\n headers['Authorization'] = 'Bearer {0}'.format(\n profile['grafana_token'])\n return headers\n",
"def _get_auth(profile):\n if profile.get('grafana_token', False):... | # -*- coding: utf-8 -*-
'''
Module for working with the Grafana v4 API
.. versionadded:: 2017.7.0
:depends: requests
:configuration: This module requires a configuration profile to be configured
in the minion config, minion pillar, or master config.
The module will use the 'grafana' key by default, if define... |
saltstack/salt | salt/pillar/libvirt.py | ext_pillar | 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__... | Read in the generated libvirt keys | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/libvirt.py#L27-L61 | [
"def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ... | # -*- coding: utf-8 -*-
'''
Load up the libvirt keys into Pillar for a given minion if said keys have been
generated using the libvirt key runner
:depends: certtool
'''
from __future__ import absolute_import, print_function, unicode_literals
# Don't "fix" the above docstring to put it on two lines, as the sphinx
# au... |
saltstack/salt | salt/pillar/libvirt.py | gen_hyper_keys | 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... | Generate the keys to be used by libvirt hypervisors, this routine gens
the keys and applies them to the pillar for the hypervisor minions | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/libvirt.py#L64-L146 | null | # -*- coding: utf-8 -*-
'''
Load up the libvirt keys into Pillar for a given minion if said keys have been
generated using the libvirt key runner
:depends: certtool
'''
from __future__ import absolute_import, print_function, unicode_literals
# Don't "fix" the above docstring to put it on two lines, as the sphinx
# au... |
saltstack/salt | salt/states/boto_ec2.py | key_present | 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... | Ensure key pair is present. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L79-L133 | null | # -*- coding: utf-8 -*-
'''
Manage EC2
.. versionadded:: 2015.8.0
This module provides an interface to the Elastic Compute Cloud (EC2) service
from AWS.
The below code creates a key pair:
.. code-block:: yaml
create-key-pair:
boto_ec2.key_present:
- name: mykeypair
- save_private: /root/
... |
saltstack/salt | salt/states/boto_ec2.py | key_absent | 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:
... | Deletes a key pair | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L136-L165 | null | # -*- coding: utf-8 -*-
'''
Manage EC2
.. versionadded:: 2015.8.0
This module provides an interface to the Elastic Compute Cloud (EC2) service
from AWS.
The below code creates a key pair:
.. code-block:: yaml
create-key-pair:
boto_ec2.key_present:
- name: mykeypair
- save_private: /root/
... |
saltstack/salt | salt/states/boto_ec2.py | eni_present | 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... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L168-L393 | [
"def update(dest, upd, recursive_update=True, merge_lists=False):\n '''\n Recursive version of the default dict.update\n\n Merges upd recursively into dest\n\n If recursive_update=False, will use the classic dict.update, or fall back\n on a manual merge (helpful for non-dict types like FunctionWrappe... | # -*- coding: utf-8 -*-
'''
Manage EC2
.. versionadded:: 2015.8.0
This module provides an interface to the Elastic Compute Cloud (EC2) service
from AWS.
The below code creates a key pair:
.. code-block:: yaml
create-key-pair:
boto_ec2.key_present:
- name: mykeypair
- save_private: /root/
... |
saltstack/salt | salt/states/boto_ec2.py | eni_absent | 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... | 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.
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L456-L547 | null | # -*- coding: utf-8 -*-
'''
Manage EC2
.. versionadded:: 2015.8.0
This module provides an interface to the Elastic Compute Cloud (EC2) service
from AWS.
The below code creates a key pair:
.. code-block:: yaml
create-key-pair:
boto_ec2.key_present:
- name: mykeypair
- save_private: /root/
... |
saltstack/salt | salt/states/boto_ec2.py | snapshot_created | 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': {}
... | Create a snapshot from the given instance
.. versionadded:: 2016.3.0 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L550-L586 | null | # -*- coding: utf-8 -*-
'''
Manage EC2
.. versionadded:: 2015.8.0
This module provides an interface to the Elastic Compute Cloud (EC2) service
from AWS.
The below code creates a key pair:
.. code-block:: yaml
create-key-pair:
boto_ec2.key_present:
- name: mykeypair
- save_private: /root/
... |
saltstack/salt | salt/states/boto_ec2.py | instance_present | 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... | 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. ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L589-L988 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n"
] | # -*- coding: utf-8 -*-
'''
Manage EC2
.. versionadded:: 2015.8.0
This module provides an interface to the Elastic Compute Cloud (EC2) service
from AWS.
The below code creates a key pair:
.. code-block:: yaml
create-key-pair:
boto_ec2.key_present:
- name: mykeypair
- save_private: /root/
... |
saltstack/salt | salt/states/boto_ec2.py | instance_absent | 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... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L991-L1115 | null | # -*- coding: utf-8 -*-
'''
Manage EC2
.. versionadded:: 2015.8.0
This module provides an interface to the Elastic Compute Cloud (EC2) service
from AWS.
The below code creates a key pair:
.. code-block:: yaml
create-key-pair:
boto_ec2.key_present:
- name: mykeypair
- save_private: /root/
... |
saltstack/salt | salt/states/boto_ec2.py | volume_absent | 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... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L1118-L1218 | null | # -*- coding: utf-8 -*-
'''
Manage EC2
.. versionadded:: 2015.8.0
This module provides an interface to the Elastic Compute Cloud (EC2) service
from AWS.
The below code creates a key pair:
.. code-block:: yaml
create-key-pair:
boto_ec2.key_present:
- name: mykeypair
- save_private: /root/
... |
saltstack/salt | salt/states/boto_ec2.py | volumes_tagged | 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... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L1221-L1309 | null | # -*- coding: utf-8 -*-
'''
Manage EC2
.. versionadded:: 2015.8.0
This module provides an interface to the Elastic Compute Cloud (EC2) service
from AWS.
The below code creates a key pair:
.. code-block:: yaml
create-key-pair:
boto_ec2.key_present:
- name: mykeypair
- save_private: /root/
... |
saltstack/salt | salt/states/boto_ec2.py | volume_present | 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):
'''
... | 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
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L1312-L1509 | null | # -*- coding: utf-8 -*-
'''
Manage EC2
.. versionadded:: 2015.8.0
This module provides an interface to the Elastic Compute Cloud (EC2) service
from AWS.
The below code creates a key pair:
.. code-block:: yaml
create-key-pair:
boto_ec2.key_present:
- name: mykeypair
- save_private: /root/
... |
saltstack/salt | salt/states/boto_ec2.py | private_ips_present | 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
... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L1512-L1634 | null | # -*- coding: utf-8 -*-
'''
Manage EC2
.. versionadded:: 2015.8.0
This module provides an interface to the Elastic Compute Cloud (EC2) service
from AWS.
The below code creates a key pair:
.. code-block:: yaml
create-key-pair:
boto_ec2.key_present:
- name: mykeypair
- save_private: /root/
... |
saltstack/salt | salt/states/boto_ec2.py | private_ips_absent | 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... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L1637-L1767 | null | # -*- coding: utf-8 -*-
'''
Manage EC2
.. versionadded:: 2015.8.0
This module provides an interface to the Elastic Compute Cloud (EC2) service
from AWS.
The below code creates a key pair:
.. code-block:: yaml
create-key-pair:
boto_ec2.key_present:
- name: mykeypair
- save_private: /root/
... |
saltstack/salt | salt/utils/docker/translate/network.py | _post_processing | 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... | Additional network-specific post-translation processing | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/docker/translate/network.py#L33-L40 | null | # -*- coding: utf-8 -*-
'''
Functions to translate input for network creation
'''
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt libs
from salt.exceptions import SaltInvocationError
# Import 3rd-party libs
from salt.ext import six
# Import helpers
from . i... |
saltstack/salt | salt/client/__init__.py | get_local_client | 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 ... | .. 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L76-L106 | [
"def client_config(path, env_var='SALT_CLIENT_CONFIG', defaults=None):\n '''\n Load Master configuration data\n\n Usage:\n\n .. code-block:: python\n\n import salt.config\n master_opts = salt.config.client_config('/etc/salt/master')\n\n Returns a dictionary of the Salt Master configurat... | # -*- coding: utf-8 -*-
'''
The client module is used to create a client connection to the publisher
The data structure needs to be:
{'enc': 'clear',
'load': {'fun': '<mod.callable>',
'arg':, ('arg1', 'arg2', ...),
'tgt': '<glob or id>',
'key': '<read in the key file>'... |
saltstack/salt | salt/client/__init__.py | LocalClient.__read_master_key | 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... | Read in the rotating master authentication key | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L175-L200 | [
"def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ... | class LocalClient(object):
'''
The interface used by the :command:`salt` CLI tool on the Salt Master
``LocalClient`` is used to send a command to Salt minions to execute
:ref:`execution modules <all-salt.modules>` and return the results to the
Salt Master.
Importing and using ``LocalClient`` m... |
saltstack/salt | salt/client/__init__.py | LocalClient._convert_range_to_list | 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:... | convert a seco.range range into a list target | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L202-L211 | null | class LocalClient(object):
'''
The interface used by the :command:`salt` CLI tool on the Salt Master
``LocalClient`` is used to send a command to Salt minions to execute
:ref:`execution modules <all-salt.modules>` and return the results to the
Salt Master.
Importing and using ``LocalClient`` m... |
saltstack/salt | salt/client/__init__.py | LocalClient._get_timeout | 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... | Return the timeout to use | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L213-L227 | null | class LocalClient(object):
'''
The interface used by the :command:`salt` CLI tool on the Salt Master
``LocalClient`` is used to send a command to Salt minions to execute
:ref:`execution modules <all-salt.modules>` and return the results to the
Salt Master.
Importing and using ``LocalClient`` m... |
saltstack/salt | salt/client/__init__.py | LocalClient.gather_job_info | 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... | Return the information about a given job | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L229-L248 | [
"def run_job(\n self,\n tgt,\n fun,\n arg=(),\n tgt_type='glob',\n ret='',\n timeout=None,\n jid='',\n kwarg=None,\n listen=False,\n **kwargs):\n '''\n Asynchronously send a command to connected minions\n\n Prep the job directory ... | class LocalClient(object):
'''
The interface used by the :command:`salt` CLI tool on the Salt Master
``LocalClient`` is used to send a command to Salt minions to execute
:ref:`execution modules <all-salt.modules>` and return the results to the
Salt Master.
Importing and using ``LocalClient`` m... |
saltstack/salt | salt/client/__init__.py | LocalClient._check_pub_data | 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... | Common checks on the pub_data data structure returned from running pub | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L250-L294 | null | class LocalClient(object):
'''
The interface used by the :command:`salt` CLI tool on the Salt Master
``LocalClient`` is used to send a command to Salt minions to execute
:ref:`execution modules <all-salt.modules>` and return the results to the
Salt Master.
Importing and using ``LocalClient`` m... |
saltstack/salt | salt/client/__init__.py | LocalClient.run_job | 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... | 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 ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L296-L348 | [
"def parse_input(args, kwargs=None, condition=True, no_parse=None):\n '''\n Parse out the args and kwargs from a list of input values. Optionally,\n return the args and kwargs without passing them to condition_input().\n\n Don't pull args with key=val apart if it has a newline in it.\n '''\n if no... | class LocalClient(object):
'''
The interface used by the :command:`salt` CLI tool on the Salt Master
``LocalClient`` is used to send a command to Salt minions to execute
:ref:`execution modules <all-salt.modules>` and return the results to the
Salt Master.
Importing and using ``LocalClient`` m... |
saltstack/salt | salt/client/__init__.py | LocalClient.run_job_async | 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... | 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 ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L355-L409 | [
"def parse_input(args, kwargs=None, condition=True, no_parse=None):\n '''\n Parse out the args and kwargs from a list of input values. Optionally,\n return the args and kwargs without passing them to condition_input().\n\n Don't pull args with key=val apart if it has a newline in it.\n '''\n if no... | class LocalClient(object):
'''
The interface used by the :command:`salt` CLI tool on the Salt Master
``LocalClient`` is used to send a command to Salt minions to execute
:ref:`execution modules <all-salt.modules>` and return the results to the
Salt Master.
Importing and using ``LocalClient`` m... |
saltstack/salt | salt/client/__init__.py | LocalClient.cmd_async | 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... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L411-L446 | [
"def run_job(\n self,\n tgt,\n fun,\n arg=(),\n tgt_type='glob',\n ret='',\n timeout=None,\n jid='',\n kwarg=None,\n listen=False,\n **kwargs):\n '''\n Asynchronously send a command to connected minions\n\n Prep the job directory ... | class LocalClient(object):
'''
The interface used by the :command:`salt` CLI tool on the Salt Master
``LocalClient`` is used to send a command to Salt minions to execute
:ref:`execution modules <all-salt.modules>` and return the results to the
Salt Master.
Importing and using ``LocalClient`` m... |
saltstack/salt | salt/client/__init__.py | LocalClient.cmd_subset | 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... | 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 ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L448-L500 | [
"def cmd(self,\n tgt,\n fun,\n arg=(),\n timeout=None,\n tgt_type='glob',\n ret='',\n jid='',\n full_return=False,\n kwarg=None,\n **kwargs):\n '''\n Synchronously execute a command on targeted minions\n\n The cmd method will execute and... | class LocalClient(object):
'''
The interface used by the :command:`salt` CLI tool on the Salt Master
``LocalClient`` is used to send a command to Salt minions to execute
:ref:`execution modules <all-salt.modules>` and return the results to the
Salt Master.
Importing and using ``LocalClient`` m... |
saltstack/salt | salt/client/__init__.py | LocalClient.cmd_batch | 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... | 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
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L502-L572 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def parse_input(args, kwargs=None, condition=True, no_parse=None):\n '''\n Parse out the args and kwargs from a list of input values. Optionally,\n return the args and kwargs without passing them to condition_input().\n\n Don't pull args with... | class LocalClient(object):
'''
The interface used by the :command:`salt` CLI tool on the Salt Master
``LocalClient`` is used to send a command to Salt minions to execute
:ref:`execution modules <all-salt.modules>` and return the results to the
Salt Master.
Importing and using ``LocalClient`` m... |
saltstack/salt | salt/client/__init__.py | LocalClient.cmd | 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
... | 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()
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L574-L724 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def _get_timeout(self, timeout):\n '''\n Return the timeout to use\n '''\n if timeout is None:\n return self.opts['timeout']\n if isinstance(timeout, int):\n return timeout\n if isinstance(timeout, six.string_types):\n ... | class LocalClient(object):
'''
The interface used by the :command:`salt` CLI tool on the Salt Master
``LocalClient`` is used to send a command to Salt minions to execute
:ref:`execution modules <all-salt.modules>` and return the results to the
Salt Master.
Importing and using ``LocalClient`` m... |
saltstack/salt | salt/client/__init__.py | LocalClient.cmd_cli | 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 ... | 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
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L726-L820 | [
"def _get_timeout(self, timeout):\n '''\n Return the timeout to use\n '''\n if timeout is None:\n return self.opts['timeout']\n if isinstance(timeout, int):\n return timeout\n if isinstance(timeout, six.string_types):\n try:\n return int(timeout)\n except Val... | class LocalClient(object):
'''
The interface used by the :command:`salt` CLI tool on the Salt Master
``LocalClient`` is used to send a command to Salt minions to execute
:ref:`execution modules <all-salt.modules>` and return the results to the
Salt Master.
Importing and using ``LocalClient`` m... |
saltstack/salt | salt/client/__init__.py | LocalClient.cmd_iter | 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 ... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L822-L884 | [
"def _get_timeout(self, timeout):\n '''\n Return the timeout to use\n '''\n if timeout is None:\n return self.opts['timeout']\n if isinstance(timeout, int):\n return timeout\n if isinstance(timeout, six.string_types):\n try:\n return int(timeout)\n except Val... | class LocalClient(object):
'''
The interface used by the :command:`salt` CLI tool on the Salt Master
``LocalClient`` is used to send a command to Salt minions to execute
:ref:`execution modules <all-salt.modules>` and return the results to the
Salt Master.
Importing and using ``LocalClient`` m... |
saltstack/salt | salt/client/__init__.py | LocalClient.cmd_iter_no_block | 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... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L886-L952 | [
"def run_job(\n self,\n tgt,\n fun,\n arg=(),\n tgt_type='glob',\n ret='',\n timeout=None,\n jid='',\n kwarg=None,\n listen=False,\n **kwargs):\n '''\n Asynchronously send a command to connected minions\n\n Prep the job directory ... | class LocalClient(object):
'''
The interface used by the :command:`salt` CLI tool on the Salt Master
``LocalClient`` is used to send a command to Salt minions to execute
:ref:`execution modules <all-salt.modules>` and return the results to the
Salt Master.
Importing and using ``LocalClient`` m... |
saltstack/salt | salt/client/__init__.py | LocalClient.cmd_full_return | 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_... | Execute a salt command and return | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L954-L993 | [
"def run_job(\n self,\n tgt,\n fun,\n arg=(),\n tgt_type='glob',\n ret='',\n timeout=None,\n jid='',\n kwarg=None,\n listen=False,\n **kwargs):\n '''\n Asynchronously send a command to connected minions\n\n Prep the job directory ... | class LocalClient(object):
'''
The interface used by the :command:`salt` CLI tool on the Salt Master
``LocalClient`` is used to send a command to Salt minions to execute
:ref:`execution modules <all-salt.modules>` and return the results to the
Salt Master.
Importing and using ``LocalClient`` m... |
saltstack/salt | salt/client/__init__.py | LocalClient.get_cli_returns | 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
... | Starts a watcher looking at the return data for a specified JID
:returns: all of the information for the JID | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L995-L1043 | [
"def get_cache_returns(self, jid):\n '''\n Execute a single pass to gather the contents of the job cache\n '''\n ret = {}\n\n try:\n data = self.returners['{0}.get_jid'.format(self.opts['master_job_cache'])](jid)\n except Exception as exc:\n raise SaltClientError('Could not examine m... | class LocalClient(object):
'''
The interface used by the :command:`salt` CLI tool on the Salt Master
``LocalClient`` is used to send a command to Salt minions to execute
:ref:`execution modules <all-salt.modules>` and return the results to the
Salt Master.
Importing and using ``LocalClient`` m... |
saltstack/salt | salt/client/__init__.py | LocalClient.get_returns_no_block | 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... | 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. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1046-L1063 | null | class LocalClient(object):
'''
The interface used by the :command:`salt` CLI tool on the Salt Master
``LocalClient`` is used to send a command to Salt minions to execute
:ref:`execution modules <all-salt.modules>` and return the results to the
Salt Master.
Importing and using ``LocalClient`` m... |
saltstack/salt | salt/client/__init__.py | LocalClient.get_iter_returns | 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
... | Watch the event system and return job data as it comes in
:returns: all of the information for the JID | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1065-L1292 | [
"def gather_job_info(self, jid, tgt, tgt_type, listen=True, **kwargs):\n '''\n Return the information about a given job\n '''\n log.debug('Checking whether jid %s is still running', jid)\n timeout = int(kwargs.get('gather_job_timeout', self.opts['gather_job_timeout']))\n\n pub_data = self.run_job(... | class LocalClient(object):
'''
The interface used by the :command:`salt` CLI tool on the Salt Master
``LocalClient`` is used to send a command to Salt minions to execute
:ref:`execution modules <all-salt.modules>` and return the results to the
Salt Master.
Importing and using ``LocalClient`` m... |
saltstack/salt | salt/client/__init__.py | LocalClient.get_returns | 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... | Get the returns for the command line interface via the event system | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1294-L1348 | null | class LocalClient(object):
'''
The interface used by the :command:`salt` CLI tool on the Salt Master
``LocalClient`` is used to send a command to Salt minions to execute
:ref:`execution modules <all-salt.modules>` and return the results to the
Salt Master.
Importing and using ``LocalClient`` m... |
saltstack/salt | salt/client/__init__.py | LocalClient.get_full_returns | 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... | This method starts off a watcher looking at the return data for
a specified jid, it returns all of the information for the jid | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1350-L1403 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def get_event_iter_returns(self, jid, minions, timeout=None):\n '''\n Gather the return data from the event system, break hard when timeout\n is reached.\n '''\n log.trace('entered - function get_event_iter_returns()')\n if timeout is N... | class LocalClient(object):
'''
The interface used by the :command:`salt` CLI tool on the Salt Master
``LocalClient`` is used to send a command to Salt minions to execute
:ref:`execution modules <all-salt.modules>` and return the results to the
Salt Master.
Importing and using ``LocalClient`` m... |
saltstack/salt | salt/client/__init__.py | LocalClient.get_cache_returns | 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... | Execute a single pass to gather the contents of the job cache | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1405-L1431 | null | class LocalClient(object):
'''
The interface used by the :command:`salt` CLI tool on the Salt Master
``LocalClient`` is used to send a command to Salt minions to execute
:ref:`execution modules <all-salt.modules>` and return the results to the
Salt Master.
Importing and using ``LocalClient`` m... |
saltstack/salt | salt/client/__init__.py | LocalClient.get_cli_static_event_returns | 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... | Get the returns for the command line interface via the event system | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1433-L1512 | null | class LocalClient(object):
'''
The interface used by the :command:`salt` CLI tool on the Salt Master
``LocalClient`` is used to send a command to Salt minions to execute
:ref:`execution modules <all-salt.modules>` and return the results to the
Salt Master.
Importing and using ``LocalClient`` m... |
saltstack/salt | salt/client/__init__.py | LocalClient.get_cli_event_returns | 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... | Get the returns for the command line interface via the event system | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1514-L1594 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def factory(opts, **kwargs):\n '''\n Creates and returns the cache class.\n If memory caching is enabled by opts MemCache class will be instantiated.\n If not Cache class will be returned.\n '''\n if opts.get('memcache_expire_seconds', ... | class LocalClient(object):
'''
The interface used by the :command:`salt` CLI tool on the Salt Master
``LocalClient`` is used to send a command to Salt minions to execute
:ref:`execution modules <all-salt.modules>` and return the results to the
Salt Master.
Importing and using ``LocalClient`` m... |
saltstack/salt | salt/client/__init__.py | LocalClient.get_event_iter_returns | 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']
... | Gather the return data from the event system, break hard when timeout
is reached. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1596-L1631 | null | class LocalClient(object):
'''
The interface used by the :command:`salt` CLI tool on the Salt Master
``LocalClient`` is used to send a command to Salt minions to execute
:ref:`execution modules <all-salt.modules>` and return the results to the
Salt Master.
Importing and using ``LocalClient`` m... |
saltstack/salt | salt/client/__init__.py | LocalClient._prep_pub | 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... | Set up the payload_kwargs to be sent down to the master | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1633-L1699 | null | class LocalClient(object):
'''
The interface used by the :command:`salt` CLI tool on the Salt Master
``LocalClient`` is used to send a command to Salt minions to execute
:ref:`execution modules <all-salt.modules>` and return the results to the
Salt Master.
Importing and using ``LocalClient`` m... |
saltstack/salt | salt/client/__init__.py | LocalClient.pub_async | python | def pub_async(self,
tgt,
fun,
arg=(),
tgt_type='glob',
ret='',
jid='',
timeout=5,
io_loop=None,
listen=True,
**kwargs):
'''
... | 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
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1808-L1913 | [
"def ip_bracket(addr):\n '''\n Convert IP address representation to ZMQ (URL) format. ZMQ expects\n brackets around IPv6 literals, since they are used in URLs.\n '''\n addr = ipaddress.ip_address(addr)\n return ('[{}]' if addr.version == 6 else '{}').format(addr)\n",
"def factory(cls, opts, **kw... | class LocalClient(object):
'''
The interface used by the :command:`salt` CLI tool on the Salt Master
``LocalClient`` is used to send a command to Salt minions to execute
:ref:`execution modules <all-salt.modules>` and return the results to the
Salt Master.
Importing and using ``LocalClient`` m... |
saltstack/salt | salt/client/__init__.py | FunctionWrapper.__load_functions | 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, [])) | Find out what functions are available on the minion | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1953-L1958 | [
"def cmd(self,\n tgt,\n fun,\n arg=(),\n timeout=None,\n tgt_type='glob',\n ret='',\n jid='',\n full_return=False,\n kwarg=None,\n **kwargs):\n '''\n Synchronously execute a command on targeted minions\n\n The cmd method will execute and... | class FunctionWrapper(dict):
'''
Create a function wrapper that looks like the functions dict on the minion
but invoked commands on the minion via a LocalClient.
This allows SLS files to be loaded with an object that calls down to the
minion when the salt functions dict is referenced.
'''
d... |
saltstack/salt | salt/client/__init__.py | FunctionWrapper.run_key | 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... | Return a function that executes the arguments passed via the local
client | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1960-L1973 | null | class FunctionWrapper(dict):
'''
Create a function wrapper that looks like the functions dict on the minion
but invoked commands on the minion via a LocalClient.
This allows SLS files to be loaded with an object that calls down to the
minion when the salt functions dict is referenced.
'''
d... |
saltstack/salt | salt/client/__init__.py | Caller.cmd | 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... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L2024-L2040 | null | class Caller(object):
'''
``Caller`` is the same interface used by the :command:`salt-call`
command-line tool on the Salt Minion.
.. versionchanged:: 2015.8.0
Added the ``cmd`` method for consistency with the other Salt clients.
The existing ``function`` and ``sminion.functions`` interf... |
saltstack/salt | salt/client/__init__.py | Caller.function | 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) | Call a single salt function | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L2042-L2050 | [
"def parse_input(args, kwargs=None, condition=True, no_parse=None):\n '''\n Parse out the args and kwargs from a list of input values. Optionally,\n return the args and kwargs without passing them to condition_input().\n\n Don't pull args with key=val apart if it has a newline in it.\n '''\n if no... | class Caller(object):
'''
``Caller`` is the same interface used by the :command:`salt-call`
command-line tool on the Salt Minion.
.. versionchanged:: 2015.8.0
Added the ``cmd`` method for consistency with the other Salt clients.
The existing ``function`` and ``sminion.functions`` interf... |
saltstack/salt | salt/client/__init__.py | ProxyCaller.cmd | 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'... | 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) | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L2097-L2125 | null | class ProxyCaller(object):
'''
``ProxyCaller`` is the same interface used by the :command:`salt-call`
with the args ``--proxyid <proxyid>`` command-line tool on the Salt Proxy
Minion.
Importing and using ``ProxyCaller`` must be done on the same machine as a
Salt Minion and it must be done using... |
saltstack/salt | salt/modules/win_smtp_server.py | _get_wmi_setting | 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... | Get the value of the setting for the provided class. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_smtp_server.py#L58-L73 | null | # -*- coding: utf-8 -*-
'''
Module for managing IIS SMTP server configuration on Windows servers.
The Windows features 'SMTP-Server' and 'Web-WMI' must be installed.
:depends: wmi
'''
# IIS metabase configuration settings:
# https://goo.gl/XCt1uO
# IIS logging options:
# https://goo.gl/RL8ki9
# https://goo.gl/... |
saltstack/salt | salt/modules/win_smtp_server.py | _set_wmi_setting | 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 =... | Set the value of the setting for the provided class. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_smtp_server.py#L76-L98 | null | # -*- coding: utf-8 -*-
'''
Module for managing IIS SMTP server configuration on Windows servers.
The Windows features 'SMTP-Server' and 'Web-WMI' must be installed.
:depends: wmi
'''
# IIS metabase configuration settings:
# https://goo.gl/XCt1uO
# IIS logging options:
# https://goo.gl/RL8ki9
# https://goo.gl/... |
saltstack/salt | salt/modules/win_smtp_server.py | get_log_format_types | 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... | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_smtp_server.py#L119-L151 | null | # -*- coding: utf-8 -*-
'''
Module for managing IIS SMTP server configuration on Windows servers.
The Windows features 'SMTP-Server' and 'Web-WMI' must be installed.
:depends: wmi
'''
# IIS metabase configuration settings:
# https://goo.gl/XCt1uO
# IIS logging options:
# https://goo.gl/RL8ki9
# https://goo.gl/... |
saltstack/salt | salt/modules/win_smtp_server.py | get_servers | 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 =... | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_smtp_server.py#L154-L182 | null | # -*- coding: utf-8 -*-
'''
Module for managing IIS SMTP server configuration on Windows servers.
The Windows features 'SMTP-Server' and 'Web-WMI' must be installed.
:depends: wmi
'''
# IIS metabase configuration settings:
# https://goo.gl/XCt1uO
# IIS logging options:
# https://goo.gl/RL8ki9
# https://goo.gl/... |
saltstack/salt | salt/modules/win_smtp_server.py | get_server_setting | 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
... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_smtp_server.py#L185-L218 | null | # -*- coding: utf-8 -*-
'''
Module for managing IIS SMTP server configuration on Windows servers.
The Windows features 'SMTP-Server' and 'Web-WMI' must be installed.
:depends: wmi
'''
# IIS metabase configuration settings:
# https://goo.gl/XCt1uO
# IIS logging options:
# https://goo.gl/RL8ki9
# https://goo.gl/... |
saltstack/salt | salt/modules/win_smtp_server.py | set_server_setting | 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... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_smtp_server.py#L221-L289 | [
"def _normalize_server_settings(**settings):\n '''\n Convert setting values that had been improperly converted to a dict back to a string.\n '''\n ret = dict()\n settings = salt.utils.args.clean_kwargs(**settings)\n\n for setting in settings:\n if isinstance(settings[setting], dict):\n ... | # -*- coding: utf-8 -*-
'''
Module for managing IIS SMTP server configuration on Windows servers.
The Windows features 'SMTP-Server' and 'Web-WMI' must be installed.
:depends: wmi
'''
# IIS metabase configuration settings:
# https://goo.gl/XCt1uO
# IIS logging options:
# https://goo.gl/RL8ki9
# https://goo.gl/... |
saltstack/salt | salt/modules/win_smtp_server.py | 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
'''... | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_smtp_server.py#L292-L316 | [
"def _get_wmi_setting(wmi_class_name, setting, server):\n '''\n Get the value of the setting for the provided class.\n '''\n with salt.utils.winapi.Com():\n try:\n connection = wmi.WMI(namespace=_WMI_NAMESPACE)\n wmi_class = getattr(connection, wmi_class_name)\n\n ... | # -*- coding: utf-8 -*-
'''
Module for managing IIS SMTP server configuration on Windows servers.
The Windows features 'SMTP-Server' and 'Web-WMI' must be installed.
:depends: wmi
'''
# IIS metabase configuration settings:
# https://goo.gl/XCt1uO
# IIS logging options:
# https://goo.gl/RL8ki9
# https://goo.gl/... |
saltstack/salt | salt/modules/win_smtp_server.py | set_log_format | 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:
... | 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... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_smtp_server.py#L319-L361 | [
"def _set_wmi_setting(wmi_class_name, setting, value, server):\n '''\n Set the value of the setting for the provided class.\n '''\n with salt.utils.winapi.Com():\n try:\n connection = wmi.WMI(namespace=_WMI_NAMESPACE)\n wmi_class = getattr(connection, wmi_class_name)\n\n ... | # -*- coding: utf-8 -*-
'''
Module for managing IIS SMTP server configuration on Windows servers.
The Windows features 'SMTP-Server' and 'Web-WMI' must be installed.
:depends: wmi
'''
# IIS metabase configuration settings:
# https://goo.gl/XCt1uO
# IIS logging options:
# https://goo.gl/RL8ki9
# https://goo.gl/... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.