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/freebsdpkg.py | list_pkgs | python | def list_pkgs(versions_as_list=False, with_origin=False, **kwargs):
'''
List the packages currently installed as a dict::
{'<package_name>': '<version>'}
with_origin : False
Return a nested dictionary containing both the origin name and version
for each installed package.
... | List the packages currently installed as a dict::
{'<package_name>': '<version>'}
with_origin : False
Return a nested dictionary containing both the origin name and version
for each installed package.
.. versionadded:: 2014.1.0
CLI Example:
.. code-block:: bash
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsdpkg.py#L257-L319 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def is_true(value=None):\n '''\n Returns a boolean value representing the \"truth\" of the value passed. The\n rules for what is a \"True\" value are:\n\n 1. Integer/float values greater than 0\n 2. The string values \"True\" and \... | # -*- coding: utf-8 -*-
'''
Remote package support using ``pkg_add(1)``
.. 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-ov... |
saltstack/salt | salt/modules/freebsdpkg.py | install | python | def install(name=None,
refresh=False,
fromrepo=None,
pkgs=None,
sources=None,
**kwargs):
'''
Install package(s) using ``pkg_add(1)``
name
The name of the package to be installed.
refresh
Whether or not to refresh the package d... | Install package(s) using ``pkg_add(1)``
name
The name of the package to be installed.
refresh
Whether or not to refresh the package database before installing.
fromrepo or packageroot
Specify a package repository from which to install. Overrides the
system default, as well... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsdpkg.py#L322-L425 | [
"def list_pkgs(versions_as_list=False, with_origin=False, **kwargs):\n '''\n List the packages currently installed as a dict::\n\n {'<package_name>': '<version>'}\n\n with_origin : False\n Return a nested dictionary containing both the origin name and version\n for each installed packa... | # -*- coding: utf-8 -*-
'''
Remote package support using ``pkg_add(1)``
.. 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-ov... |
saltstack/salt | salt/modules/freebsdpkg.py | remove | python | def remove(name=None, pkgs=None, **kwargs):
'''
Remove packages using ``pkg_delete(1)``
name
The name of the package to be deleted.
Multiple Package Options:
pkgs
A list of packages to delete. Must be passed as a python list. The
``name`` parameter will be ignored if this... | Remove packages using ``pkg_delete(1)``
name
The name of the package to be deleted.
Multiple Package Options:
pkgs
A list of packages to delete. Must be passed as a python list. The
``name`` parameter will be ignored if this option is passed.
.. versionadded:: 0.16.0
R... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsdpkg.py#L428-L487 | [
"def list_pkgs(versions_as_list=False, with_origin=False, **kwargs):\n '''\n List the packages currently installed as a dict::\n\n {'<package_name>': '<version>'}\n\n with_origin : False\n Return a nested dictionary containing both the origin name and version\n for each installed packa... | # -*- coding: utf-8 -*-
'''
Remote package support using ``pkg_add(1)``
.. 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-ov... |
saltstack/salt | salt/modules/freebsdpkg.py | file_dict | python | def file_dict(*packages, **kwargs):
'''
List the files that belong to a package, grouped by package. Not
specifying any packages will return a list of _every_ file on the
system's package database (not generally recommended).
CLI Examples:
.. code-block:: bash
salt '*' pkg.file_list h... | List the files that belong to a package, grouped by package. Not
specifying any packages will return a list of _every_ file on the
system's package database (not generally recommended).
CLI Examples:
.. code-block:: bash
salt '*' pkg.file_list httpd
salt '*' pkg.file_list httpd postfi... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsdpkg.py#L528-L569 | null | # -*- coding: utf-8 -*-
'''
Remote package support using ``pkg_add(1)``
.. 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-ov... |
saltstack/salt | salt/utils/functools.py | namespaced_function | python | def namespaced_function(function, global_dict, defaults=None, preserve_context=False):
'''
Redefine (clone) a function under a different globals() namespace scope
preserve_context:
Allow keeping the context taken from orignal namespace,
and extend it with globals() taken from
... | Redefine (clone) a function under a different globals() namespace scope
preserve_context:
Allow keeping the context taken from orignal namespace,
and extend it with globals() taken from
new targetted namespace. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/functools.py#L15-L39 | null | # -*- coding: utf-8 -*-
'''
Utility functions to modify other functions
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import Python libs
import types
# Import 3rd-party libs
from salt.ext import six
def alias_function(fun, name, doc=None):
'''
Copy a function
'''
a... |
saltstack/salt | salt/utils/functools.py | alias_function | python | def alias_function(fun, name, doc=None):
'''
Copy a function
'''
alias_fun = types.FunctionType(fun.__code__,
fun.__globals__,
str(name), # future lint: disable=blacklisted-function
fun.__defaults__... | Copy a function | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/functools.py#L42-L61 | null | # -*- coding: utf-8 -*-
'''
Utility functions to modify other functions
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import Python libs
import types
# Import 3rd-party libs
from salt.ext import six
def namespaced_function(function, global_dict, defaults=None, preserve_context=Fals... |
saltstack/salt | salt/states/win_dns_client.py | dns_exists | python | def dns_exists(name, servers=None, interface='Local Area Connection', replace=False):
'''
Configure the DNS server list in the specified interface
Example:
.. code-block:: yaml
config_dns_servers:
win_dns_client.dns_exists:
- replace: True #remove any servers not in the ... | Configure the DNS server list in the specified interface
Example:
.. code-block:: yaml
config_dns_servers:
win_dns_client.dns_exists:
- replace: True #remove any servers not in the "servers" list, default is False
- servers:
- 8.8.8.8
- 8.... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_dns_client.py#L15-L93 | null | # -*- coding: utf-8 -*-
'''
Module for configuring DNS Client on Windows systems
'''
from __future__ import absolute_import, unicode_literals, print_function
def __virtual__():
'''
Load if the module win_dns_client is loaded
'''
return 'win_dns_client' if 'win_dns_client.add_dns' in __salt__ else Fals... |
saltstack/salt | salt/states/win_dns_client.py | dns_dhcp | python | def dns_dhcp(name, interface='Local Area Connection'):
'''
Configure the DNS server list from DHCP Server
'''
ret = {'name': name,
'result': True,
'changes': {},
'comment': ''}
# Check the config
config = __salt__['win_dns_client.get_dns_config'](interface)
... | Configure the DNS server list from DHCP Server | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_dns_client.py#L96-L126 | null | # -*- coding: utf-8 -*-
'''
Module for configuring DNS Client on Windows systems
'''
from __future__ import absolute_import, unicode_literals, print_function
def __virtual__():
'''
Load if the module win_dns_client is loaded
'''
return 'win_dns_client' if 'win_dns_client.add_dns' in __salt__ else Fals... |
saltstack/salt | salt/states/win_dns_client.py | primary_suffix | python | def primary_suffix(name,
suffix=None,
updates=False):
'''
.. versionadded:: 2014.7.0
Configure the global primary DNS suffix of a DHCP client.
suffix : None
The suffix which is advertised for this client when acquiring a DHCP lease
When none is set, the explicitly confi... | .. versionadded:: 2014.7.0
Configure the global primary DNS suffix of a DHCP client.
suffix : None
The suffix which is advertised for this client when acquiring a DHCP lease
When none is set, the explicitly configured DNS suffix will be removed.
updates : False
Allow syncing the D... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_dns_client.py#L129-L254 | null | # -*- coding: utf-8 -*-
'''
Module for configuring DNS Client on Windows systems
'''
from __future__ import absolute_import, unicode_literals, print_function
def __virtual__():
'''
Load if the module win_dns_client is loaded
'''
return 'win_dns_client' if 'win_dns_client.add_dns' in __salt__ else Fals... |
saltstack/salt | salt/states/iptables.py | insert | python | def insert(name, table='filter', family='ipv4', **kwargs):
'''
.. versionadded:: 2014.1.0
Insert a rule into a chain
name
A user-defined name to call this rule by in another part of a state or
formula. This should not be an actual rule.
table
The table that owns the chain ... | .. versionadded:: 2014.1.0
Insert a rule into a chain
name
A user-defined name to call this rule by in another part of a state or
formula. This should not be an actual rule.
table
The table that owns the chain that should be modified
family
Networking family, either i... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/iptables.py#L489-L614 | [
"def insert(name, table='filter', family='ipv4', **kwargs):\n '''\n .. versionadded:: 2014.1.0\n\n Insert a rule into a chain\n\n name\n A user-defined name to call this rule by in another part of a state or\n formula. This should not be an actual rule.\n\n table\n The table that... | # -*- coding: utf-8 -*-
'''
Management of iptables
======================
This is an iptables-specific module designed to manage Linux firewalls. It is
expected that this state module, and other system-specific firewall states, may
at some point be deprecated in favor of a more generic ``firewall`` state.
.. code-blo... |
saltstack/salt | salt/states/iptables.py | delete | python | def delete(name, table='filter', family='ipv4', **kwargs):
'''
.. versionadded:: 2014.1.0
Delete a rule to a chain
name
A user-defined name to call this rule by in another part of a state or
formula. This should not be an actual rule.
table
The table that owns the chain th... | .. versionadded:: 2014.1.0
Delete a rule to a chain
name
A user-defined name to call this rule by in another part of a state or
formula. This should not be an actual rule.
table
The table that owns the chain that should be modified
family
Networking family, either ipv... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/iptables.py#L617-L732 | [
"def delete(name, table='filter', family='ipv4', **kwargs):\n '''\n .. versionadded:: 2014.1.0\n\n Delete a rule to a chain\n\n name\n A user-defined name to call this rule by in another part of a state or\n formula. This should not be an actual rule.\n\n table\n The table that o... | # -*- coding: utf-8 -*-
'''
Management of iptables
======================
This is an iptables-specific module designed to manage Linux firewalls. It is
expected that this state module, and other system-specific firewall states, may
at some point be deprecated in favor of a more generic ``firewall`` state.
.. code-blo... |
saltstack/salt | salt/states/iptables.py | set_policy | python | def set_policy(name, table='filter', family='ipv4', **kwargs):
'''
.. versionadded:: 2014.1.0
Sets the default policy for iptables firewall tables
table
The table that owns the chain that should be modified
family
Networking family, either ipv4 or ipv6
policy
The requ... | .. versionadded:: 2014.1.0
Sets the default policy for iptables firewall tables
table
The table that owns the chain that should be modified
family
Networking family, either ipv4 or ipv6
policy
The requested table policy | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/iptables.py#L735-L800 | null | # -*- coding: utf-8 -*-
'''
Management of iptables
======================
This is an iptables-specific module designed to manage Linux firewalls. It is
expected that this state module, and other system-specific firewall states, may
at some point be deprecated in favor of a more generic ``firewall`` state.
.. code-blo... |
saltstack/salt | salt/states/iptables.py | flush | python | def flush(name, table='filter', family='ipv4', **kwargs):
'''
.. versionadded:: 2014.1.0
Flush current iptables state
table
The table that owns the chain that should be modified
family
Networking family, either ipv4 or ipv6
'''
ret = {'name': name,
'changes': {... | .. versionadded:: 2014.1.0
Flush current iptables state
table
The table that owns the chain that should be modified
family
Networking family, either ipv4 or ipv6 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/iptables.py#L803-L845 | null | # -*- coding: utf-8 -*-
'''
Management of iptables
======================
This is an iptables-specific module designed to manage Linux firewalls. It is
expected that this state module, and other system-specific firewall states, may
at some point be deprecated in favor of a more generic ``firewall`` state.
.. code-blo... |
saltstack/salt | salt/states/iptables.py | mod_aggregate | python | def mod_aggregate(low, chunks, running):
'''
The mod_aggregate function which looks up all rules in the available
low chunks and merges them into a single rules ref in the present low data
'''
rules = []
agg_enabled = [
'append',
'insert',
]
if low.get('fun') not ... | The mod_aggregate function which looks up all rules in the available
low chunks and merges them into a single rules ref in the present low data | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/iptables.py#L848-L881 | null | # -*- coding: utf-8 -*-
'''
Management of iptables
======================
This is an iptables-specific module designed to manage Linux firewalls. It is
expected that this state module, and other system-specific firewall states, may
at some point be deprecated in favor of a more generic ``firewall`` state.
.. code-blo... |
saltstack/salt | salt/beacons/memusage.py | beacon | python | def beacon(config):
'''
Monitor the memory usage of the minion
Specify thresholds for percent used and only emit a beacon
if it is exceeded.
.. code-block:: yaml
beacons:
memusage:
- percent: 63%
'''
ret = []
_config = {}
list(map(_config.update, con... | Monitor the memory usage of the minion
Specify thresholds for percent used and only emit a beacon
if it is exceeded.
.. code-block:: yaml
beacons:
memusage:
- percent: 63% | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/memusage.py#L54-L81 | null | # -*- coding: utf-8 -*-
'''
Beacon to monitor memory usage.
.. versionadded:: 2016.3.0
:depends: python-psutil
'''
# Import Python libs
from __future__ import absolute_import, unicode_literals
import logging
import re
from salt.ext.six.moves import map
# Import Third Party Libs
try:
import psutil
HAS_PSUTIL... |
saltstack/salt | doc/_ext/saltautodoc.py | SaltFunctionDocumenter.format_name | python | def format_name(self):
'''
Format the function name
'''
if not hasattr(self.module, '__func_alias__'):
# Resume normal sphinx.ext.autodoc operation
return super(FunctionDocumenter, self).format_name()
if not self.objpath:
# Resume normal sphin... | Format the function name | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/doc/_ext/saltautodoc.py#L22-L39 | null | class SaltFunctionDocumenter(FunctionDocumenter):
'''
Simple override of sphinx.ext.autodoc.FunctionDocumenter to properly render
salt's aliased function names.
'''
|
saltstack/salt | salt/states/ntp.py | managed | python | def managed(name, servers=None):
'''
Manage NTP servers
servers
A list of NTP servers
'''
ret = {'name': name,
'changes': {},
'result': True,
'comment': 'NTP servers already configured as specified'}
if not _check_servers(servers):
ret['result']... | Manage NTP servers
servers
A list of NTP servers | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/ntp.py#L58-L100 | [
"def _check_servers(servers):\n if not isinstance(servers, list):\n return False\n for server in servers:\n if not isinstance(server, six.string_types):\n return False\n return True\n",
"def _get_servers():\n try:\n return set(__salt__['ntp.get_servers']())\n except ... | # -*- coding: utf-8 -*-
'''
Management of NTP servers
=========================
.. versionadded:: 2014.1.0
This state is used to manage NTP servers. Currently only Windows is supported.
.. code-block:: yaml
win_ntp:
ntp.managed:
- servers:
- pool.ntp.org
- us.pool.ntp.org
'''
f... |
saltstack/salt | salt/modules/iptables.py | _iptables_cmd | python | def _iptables_cmd(family='ipv4'):
'''
Return correct command based on the family, e.g. ipv4 or ipv6
'''
if family == 'ipv6':
return salt.utils.path.which('ip6tables')
else:
return salt.utils.path.which('iptables') | Return correct command based on the family, e.g. ipv4 or ipv6 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L59-L66 | null | # -*- coding: utf-8 -*-
'''
Support for iptables
Configuration Options
---------------------
The following options can be set in the minion config, grains, pillar, or
master config. The configuration is read using :py:func:`config.get
<salt.modules.config.get>`.
- ``iptables.save_filters``: List of REGEX strings to ... |
saltstack/salt | salt/modules/iptables.py | _has_option | python | def _has_option(option, family='ipv4'):
'''
Return truth of whether iptables has `option`. For example:
.. code-block:: python
_has_option('--wait')
_has_option('--check', family='ipv6')
'''
cmd = '{0} --help'.format(_iptables_cmd(family))
if option in __salt__['cmd.run'](cmd,... | Return truth of whether iptables has `option`. For example:
.. code-block:: python
_has_option('--wait')
_has_option('--check', family='ipv6') | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L69-L81 | [
"def _iptables_cmd(family='ipv4'):\n '''\n Return correct command based on the family, e.g. ipv4 or ipv6\n '''\n if family == 'ipv6':\n return salt.utils.path.which('ip6tables')\n else:\n return salt.utils.path.which('iptables')\n"
] | # -*- coding: utf-8 -*-
'''
Support for iptables
Configuration Options
---------------------
The following options can be set in the minion config, grains, pillar, or
master config. The configuration is read using :py:func:`config.get
<salt.modules.config.get>`.
- ``iptables.save_filters``: List of REGEX strings to ... |
saltstack/salt | salt/modules/iptables.py | _conf | python | def _conf(family='ipv4'):
'''
Some distros have a specific location for config files
'''
if __grains__['os_family'] == 'RedHat':
if family == 'ipv6':
return '/etc/sysconfig/ip6tables'
else:
return '/etc/sysconfig/iptables'
elif __grains__['os_family'] == 'Arch... | Some distros have a specific location for config files | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L84-L124 | null | # -*- coding: utf-8 -*-
'''
Support for iptables
Configuration Options
---------------------
The following options can be set in the minion config, grains, pillar, or
master config. The configuration is read using :py:func:`config.get
<salt.modules.config.get>`.
- ``iptables.save_filters``: List of REGEX strings to ... |
saltstack/salt | salt/modules/iptables.py | _regex_iptables_save | python | def _regex_iptables_save(cmd_output, filters=None):
'''
Return string with `save_filter` regex entries removed. For example:
If `filters` is not provided, it will be pulled from minion config,
minion grains, minion pillar, or master config. Default return value
if no filters found is the original ... | Return string with `save_filter` regex entries removed. For example:
If `filters` is not provided, it will be pulled from minion config,
minion grains, minion pillar, or master config. Default return value
if no filters found is the original cmd_output string.
.. code-block:: python
_regex_i... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L142-L174 | null | # -*- coding: utf-8 -*-
'''
Support for iptables
Configuration Options
---------------------
The following options can be set in the minion config, grains, pillar, or
master config. The configuration is read using :py:func:`config.get
<salt.modules.config.get>`.
- ``iptables.save_filters``: List of REGEX strings to ... |
saltstack/salt | salt/modules/iptables.py | version | python | def version(family='ipv4'):
'''
Return version from iptables --version
CLI Example:
.. code-block:: bash
salt '*' iptables.version
IPv6:
salt '*' iptables.version family=ipv6
'''
cmd = '{0} --version' . format(_iptables_cmd(family))
out = __salt__['cmd.run'](cmd).... | Return version from iptables --version
CLI Example:
.. code-block:: bash
salt '*' iptables.version
IPv6:
salt '*' iptables.version family=ipv6 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L177-L192 | [
"def _iptables_cmd(family='ipv4'):\n '''\n Return correct command based on the family, e.g. ipv4 or ipv6\n '''\n if family == 'ipv6':\n return salt.utils.path.which('ip6tables')\n else:\n return salt.utils.path.which('iptables')\n"
] | # -*- coding: utf-8 -*-
'''
Support for iptables
Configuration Options
---------------------
The following options can be set in the minion config, grains, pillar, or
master config. The configuration is read using :py:func:`config.get
<salt.modules.config.get>`.
- ``iptables.save_filters``: List of REGEX strings to ... |
saltstack/salt | salt/modules/iptables.py | build_rule | python | def build_rule(table='filter', chain=None, command=None, position='', full=None, family='ipv4',
**kwargs):
'''
Build a well-formatted iptables rule based on kwargs. A `table` and `chain`
are not required, unless `full` is True.
If `full` is `True`, then `table`, `chain` and `command` are... | Build a well-formatted iptables rule based on kwargs. A `table` and `chain`
are not required, unless `full` is True.
If `full` is `True`, then `table`, `chain` and `command` are required.
`command` may be specified as either a short option ('I') or a long option
(`--insert`). This will return the iptab... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L195-L545 | [
"def _iptables_cmd(family='ipv4'):\n '''\n Return correct command based on the family, e.g. ipv4 or ipv6\n '''\n if family == 'ipv6':\n return salt.utils.path.which('ip6tables')\n else:\n return salt.utils.path.which('iptables')\n",
"def _has_option(option, family='ipv4'):\n '''\n ... | # -*- coding: utf-8 -*-
'''
Support for iptables
Configuration Options
---------------------
The following options can be set in the minion config, grains, pillar, or
master config. The configuration is read using :py:func:`config.get
<salt.modules.config.get>`.
- ``iptables.save_filters``: List of REGEX strings to ... |
saltstack/salt | salt/modules/iptables.py | get_saved_policy | python | def get_saved_policy(table='filter', chain=None, conf_file=None, family='ipv4'):
'''
Return the current policy for the specified table/chain
CLI Examples:
.. code-block:: bash
salt '*' iptables.get_saved_policy filter INPUT
salt '*' iptables.get_saved_policy filter INPUT \\
... | Return the current policy for the specified table/chain
CLI Examples:
.. code-block:: bash
salt '*' iptables.get_saved_policy filter INPUT
salt '*' iptables.get_saved_policy filter INPUT \\
conf_file=/etc/iptables.saved
IPv6:
salt '*' iptables.get_saved_policy fil... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L581-L606 | [
"def _parse_conf(conf_file=None, in_mem=False, family='ipv4'):\n '''\n If a file is not passed in, and the correct one for this OS is not\n detected, return False\n '''\n if _conf() and not conf_file and not in_mem:\n conf_file = _conf(family)\n\n rules = ''\n if conf_file:\n with... | # -*- coding: utf-8 -*-
'''
Support for iptables
Configuration Options
---------------------
The following options can be set in the minion config, grains, pillar, or
master config. The configuration is read using :py:func:`config.get
<salt.modules.config.get>`.
- ``iptables.save_filters``: List of REGEX strings to ... |
saltstack/salt | salt/modules/iptables.py | get_policy | python | def get_policy(table='filter', chain=None, family='ipv4'):
'''
Return the current policy for the specified table/chain
CLI Example:
.. code-block:: bash
salt '*' iptables.get_policy filter INPUT
IPv6:
salt '*' iptables.get_policy filter INPUT family=ipv6
'''
if not ch... | Return the current policy for the specified table/chain
CLI Example:
.. code-block:: bash
salt '*' iptables.get_policy filter INPUT
IPv6:
salt '*' iptables.get_policy filter INPUT family=ipv6 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L609-L629 | [
"def _parse_conf(conf_file=None, in_mem=False, family='ipv4'):\n '''\n If a file is not passed in, and the correct one for this OS is not\n detected, return False\n '''\n if _conf() and not conf_file and not in_mem:\n conf_file = _conf(family)\n\n rules = ''\n if conf_file:\n with... | # -*- coding: utf-8 -*-
'''
Support for iptables
Configuration Options
---------------------
The following options can be set in the minion config, grains, pillar, or
master config. The configuration is read using :py:func:`config.get
<salt.modules.config.get>`.
- ``iptables.save_filters``: List of REGEX strings to ... |
saltstack/salt | salt/modules/iptables.py | set_policy | python | def set_policy(table='filter', chain=None, policy=None, family='ipv4'):
'''
Set the current policy for the specified table/chain
CLI Example:
.. code-block:: bash
salt '*' iptables.set_policy filter INPUT ACCEPT
IPv6:
salt '*' iptables.set_policy filter INPUT ACCEPT family=ip... | Set the current policy for the specified table/chain
CLI Example:
.. code-block:: bash
salt '*' iptables.set_policy filter INPUT ACCEPT
IPv6:
salt '*' iptables.set_policy filter INPUT ACCEPT family=ipv6 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L632-L654 | [
"def _iptables_cmd(family='ipv4'):\n '''\n Return correct command based on the family, e.g. ipv4 or ipv6\n '''\n if family == 'ipv6':\n return salt.utils.path.which('ip6tables')\n else:\n return salt.utils.path.which('iptables')\n",
"def _has_option(option, family='ipv4'):\n '''\n ... | # -*- coding: utf-8 -*-
'''
Support for iptables
Configuration Options
---------------------
The following options can be set in the minion config, grains, pillar, or
master config. The configuration is read using :py:func:`config.get
<salt.modules.config.get>`.
- ``iptables.save_filters``: List of REGEX strings to ... |
saltstack/salt | salt/modules/iptables.py | save | python | def save(filename=None, family='ipv4'):
'''
Save the current in-memory rules to disk
CLI Example:
.. code-block:: bash
salt '*' iptables.save /etc/sysconfig/iptables
IPv6:
salt '*' iptables.save /etc/sysconfig/iptables family=ipv6
'''
if _conf() and not filename:
... | Save the current in-memory rules to disk
CLI Example:
.. code-block:: bash
salt '*' iptables.save /etc/sysconfig/iptables
IPv6:
salt '*' iptables.save /etc/sysconfig/iptables family=ipv6 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L657-L686 | [
"def _conf(family='ipv4'):\n '''\n Some distros have a specific location for config files\n '''\n if __grains__['os_family'] == 'RedHat':\n if family == 'ipv6':\n return '/etc/sysconfig/ip6tables'\n else:\n return '/etc/sysconfig/iptables'\n elif __grains__['os_fam... | # -*- coding: utf-8 -*-
'''
Support for iptables
Configuration Options
---------------------
The following options can be set in the minion config, grains, pillar, or
master config. The configuration is read using :py:func:`config.get
<salt.modules.config.get>`.
- ``iptables.save_filters``: List of REGEX strings to ... |
saltstack/salt | salt/modules/iptables.py | check | python | def check(table='filter', chain=None, rule=None, family='ipv4'):
'''
Check for the existence of a rule in the table and chain
This function accepts a rule in a standard iptables command format,
starting with the chain. Trying to force users to adapt to a new
method of creating rules would b... | Check for the existence of a rule in the table and chain
This function accepts a rule in a standard iptables command format,
starting with the chain. Trying to force users to adapt to a new
method of creating rules would be irritating at best, and we
already have a parser that can handle it... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L689-L741 | [
"def _iptables_cmd(family='ipv4'):\n '''\n Return correct command based on the family, e.g. ipv4 or ipv6\n '''\n if family == 'ipv6':\n return salt.utils.path.which('ip6tables')\n else:\n return salt.utils.path.which('iptables')\n",
"def _has_option(option, family='ipv4'):\n '''\n ... | # -*- coding: utf-8 -*-
'''
Support for iptables
Configuration Options
---------------------
The following options can be set in the minion config, grains, pillar, or
master config. The configuration is read using :py:func:`config.get
<salt.modules.config.get>`.
- ``iptables.save_filters``: List of REGEX strings to ... |
saltstack/salt | salt/modules/iptables.py | check_chain | python | def check_chain(table='filter', chain=None, family='ipv4'):
'''
.. versionadded:: 2014.1.0
Check for the existence of a chain in the table
CLI Example:
.. code-block:: bash
salt '*' iptables.check_chain filter INPUT
IPv6:
salt '*' iptables.check_chain filter INPUT family... | .. versionadded:: 2014.1.0
Check for the existence of a chain in the table
CLI Example:
.. code-block:: bash
salt '*' iptables.check_chain filter INPUT
IPv6:
salt '*' iptables.check_chain filter INPUT family=ipv6 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L744-L771 | [
"def _iptables_cmd(family='ipv4'):\n '''\n Return correct command based on the family, e.g. ipv4 or ipv6\n '''\n if family == 'ipv6':\n return salt.utils.path.which('ip6tables')\n else:\n return salt.utils.path.which('iptables')\n"
] | # -*- coding: utf-8 -*-
'''
Support for iptables
Configuration Options
---------------------
The following options can be set in the minion config, grains, pillar, or
master config. The configuration is read using :py:func:`config.get
<salt.modules.config.get>`.
- ``iptables.save_filters``: List of REGEX strings to ... |
saltstack/salt | salt/modules/iptables.py | new_chain | python | def new_chain(table='filter', chain=None, family='ipv4'):
'''
.. versionadded:: 2014.1.0
Create new custom chain to the specified table.
CLI Example:
.. code-block:: bash
salt '*' iptables.new_chain filter CUSTOM_CHAIN
IPv6:
salt '*' iptables.new_chain filter CUSTOM_CHAI... | .. versionadded:: 2014.1.0
Create new custom chain to the specified table.
CLI Example:
.. code-block:: bash
salt '*' iptables.new_chain filter CUSTOM_CHAIN
IPv6:
salt '*' iptables.new_chain filter CUSTOM_CHAIN family=ipv6 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L774-L800 | [
"def _iptables_cmd(family='ipv4'):\n '''\n Return correct command based on the family, e.g. ipv4 or ipv6\n '''\n if family == 'ipv6':\n return salt.utils.path.which('ip6tables')\n else:\n return salt.utils.path.which('iptables')\n",
"def _has_option(option, family='ipv4'):\n '''\n ... | # -*- coding: utf-8 -*-
'''
Support for iptables
Configuration Options
---------------------
The following options can be set in the minion config, grains, pillar, or
master config. The configuration is read using :py:func:`config.get
<salt.modules.config.get>`.
- ``iptables.save_filters``: List of REGEX strings to ... |
saltstack/salt | salt/modules/iptables.py | append | python | def append(table='filter', chain=None, rule=None, family='ipv4'):
'''
Append a rule to the specified table/chain.
This function accepts a rule in a standard iptables command format,
starting with the chain. Trying to force users to adapt to a new
method of creating rules would be irritating... | Append a rule to the specified table/chain.
This function accepts a rule in a standard iptables command format,
starting with the chain. Trying to force users to adapt to a new
method of creating rules would be irritating at best, and we
already have a parser that can handle it.
CLI Ex... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L832-L865 | [
"def check(table='filter', chain=None, rule=None, family='ipv4'):\n '''\n Check for the existence of a rule in the table and chain\n\n This function accepts a rule in a standard iptables command format,\n starting with the chain. Trying to force users to adapt to a new\n method of creating ru... | # -*- coding: utf-8 -*-
'''
Support for iptables
Configuration Options
---------------------
The following options can be set in the minion config, grains, pillar, or
master config. The configuration is read using :py:func:`config.get
<salt.modules.config.get>`.
- ``iptables.save_filters``: List of REGEX strings to ... |
saltstack/salt | salt/modules/iptables.py | insert | python | def insert(table='filter', chain=None, position=None, rule=None, family='ipv4'):
'''
Insert a rule into the specified table/chain, at the specified position.
This function accepts a rule in a standard iptables command format,
starting with the chain. Trying to force users to adapt to a new
... | Insert a rule into the specified table/chain, at the specified position.
This function accepts a rule in a standard iptables command format,
starting with the chain. Trying to force users to adapt to a new
method of creating rules would be irritating at best, and we
already have a parser th... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L868-L915 | [
"def check(table='filter', chain=None, rule=None, family='ipv4'):\n '''\n Check for the existence of a rule in the table and chain\n\n This function accepts a rule in a standard iptables command format,\n starting with the chain. Trying to force users to adapt to a new\n method of creating ru... | # -*- coding: utf-8 -*-
'''
Support for iptables
Configuration Options
---------------------
The following options can be set in the minion config, grains, pillar, or
master config. The configuration is read using :py:func:`config.get
<salt.modules.config.get>`.
- ``iptables.save_filters``: List of REGEX strings to ... |
saltstack/salt | salt/modules/iptables.py | delete | python | def delete(table, chain=None, position=None, rule=None, family='ipv4'):
'''
Delete a rule from the specified table/chain, specifying either the rule
in its entirety, or the rule's position in the chain.
This function accepts a rule in a standard iptables command format,
starting with the ch... | Delete a rule from the specified table/chain, specifying either the rule
in its entirety, or the rule's position in the chain.
This function accepts a rule in a standard iptables command format,
starting with the chain. Trying to force users to adapt to a new
method of creating rules would ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L918-L953 | [
"def _iptables_cmd(family='ipv4'):\n '''\n Return correct command based on the family, e.g. ipv4 or ipv6\n '''\n if family == 'ipv6':\n return salt.utils.path.which('ip6tables')\n else:\n return salt.utils.path.which('iptables')\n",
"def _has_option(option, family='ipv4'):\n '''\n ... | # -*- coding: utf-8 -*-
'''
Support for iptables
Configuration Options
---------------------
The following options can be set in the minion config, grains, pillar, or
master config. The configuration is read using :py:func:`config.get
<salt.modules.config.get>`.
- ``iptables.save_filters``: List of REGEX strings to ... |
saltstack/salt | salt/modules/iptables.py | flush | python | def flush(table='filter', chain='', family='ipv4'):
'''
Flush the chain in the specified table, flush all chains in the specified
table if not specified chain.
CLI Example:
.. code-block:: bash
salt '*' iptables.flush filter INPUT
IPv6:
salt '*' iptables.flush filter INPU... | Flush the chain in the specified table, flush all chains in the specified
table if not specified chain.
CLI Example:
.. code-block:: bash
salt '*' iptables.flush filter INPUT
IPv6:
salt '*' iptables.flush filter INPUT family=ipv6 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L956-L974 | [
"def _iptables_cmd(family='ipv4'):\n '''\n Return correct command based on the family, e.g. ipv4 or ipv6\n '''\n if family == 'ipv6':\n return salt.utils.path.which('ip6tables')\n else:\n return salt.utils.path.which('iptables')\n",
"def _has_option(option, family='ipv4'):\n '''\n ... | # -*- coding: utf-8 -*-
'''
Support for iptables
Configuration Options
---------------------
The following options can be set in the minion config, grains, pillar, or
master config. The configuration is read using :py:func:`config.get
<salt.modules.config.get>`.
- ``iptables.save_filters``: List of REGEX strings to ... |
saltstack/salt | salt/modules/iptables.py | _parse_conf | python | def _parse_conf(conf_file=None, in_mem=False, family='ipv4'):
'''
If a file is not passed in, and the correct one for this OS is not
detected, return False
'''
if _conf() and not conf_file and not in_mem:
conf_file = _conf(family)
rules = ''
if conf_file:
with salt.utils.fil... | If a file is not passed in, and the correct one for this OS is not
detected, return False | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L977-L1046 | [
"def _parser():\n '''\n This function attempts to list all the options documented in the\n iptables(8) and iptables-extensions(8) man pages. They will not all be\n used by all parts of the module; use them intelligently and appropriately.\n '''\n add_arg = None\n if sys.version.startswith('2.6... | # -*- coding: utf-8 -*-
'''
Support for iptables
Configuration Options
---------------------
The following options can be set in the minion config, grains, pillar, or
master config. The configuration is read using :py:func:`config.get
<salt.modules.config.get>`.
- ``iptables.save_filters``: List of REGEX strings to ... |
saltstack/salt | salt/modules/iptables.py | _parser | python | def _parser():
'''
This function attempts to list all the options documented in the
iptables(8) and iptables-extensions(8) man pages. They will not all be
used by all parts of the module; use them intelligently and appropriately.
'''
add_arg = None
if sys.version.startswith('2.6'):
... | This function attempts to list all the options documented in the
iptables(8) and iptables-extensions(8) man pages. They will not all be
used by all parts of the module; use them intelligently and appropriately. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iptables.py#L1049-L1597 | null | # -*- coding: utf-8 -*-
'''
Support for iptables
Configuration Options
---------------------
The following options can be set in the minion config, grains, pillar, or
master config. The configuration is read using :py:func:`config.get
<salt.modules.config.get>`.
- ``iptables.save_filters``: List of REGEX strings to ... |
saltstack/salt | salt/states/group.py | _changes | python | def _changes(name,
gid=None,
addusers=None,
delusers=None,
members=None):
'''
Return a dict of the changes required for a group if the group is present,
otherwise return False.
'''
lgrp = __salt__['group.info'](name)
if not lgrp:
return... | Return a dict of the changes required for a group if the group is present,
otherwise return False. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/group.py#L49-L104 | null | # -*- coding: utf-8 -*-
'''
Management of user groups
=========================
The group module is used to create and manage group settings, groups can be
either present or absent. User/Group names can be passed to the ``adduser``,
``deluser``, and ``members`` parameters. ``adduser`` and ``deluser`` can be used
toget... |
saltstack/salt | salt/states/group.py | present | python | def present(name,
gid=None,
system=False,
addusers=None,
delusers=None,
members=None):
r'''
Ensure that a group is present
Args:
name (str):
The name of the group to manage
gid (str):
The group id to assig... | r'''
Ensure that a group is present
Args:
name (str):
The name of the group to manage
gid (str):
The group id to assign to the named group; if left empty, then the
next available group id will be assigned. Ignored on Windows
system (bool):
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/group.py#L107-L285 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def _changes(name,\n gid=None,\n addusers=None,\n delusers=None,\n members=None):\n '''\n Return a dict of the changes required for a group if the group is present,\n otherwise return False.\n '... | # -*- coding: utf-8 -*-
'''
Management of user groups
=========================
The group module is used to create and manage group settings, groups can be
either present or absent. User/Group names can be passed to the ``adduser``,
``deluser``, and ``members`` parameters. ``adduser`` and ``deluser`` can be used
toget... |
saltstack/salt | salt/modules/nix.py | _run | python | def _run(cmd):
'''
Just a convenience function for ``__salt__['cmd.run_all'](cmd)``
'''
return __salt__['cmd.run_all'](cmd, env={'HOME': os.path.expanduser('~{0}'.format(__opts__['user']))}) | Just a convenience function for ``__salt__['cmd.run_all'](cmd)`` | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nix.py#L47-L51 | null | # -*- coding: utf-8 -*-
'''
Work with Nix packages
======================
.. versionadded:: 2017.7.0
Does not require the machine to be Nixos, just have Nix installed and available
to use for the user running this command. Their profile must be located in
their home, under ``$HOME/.nix-profile/``, and the nix store, ... |
saltstack/salt | salt/modules/nix.py | _nix_env | python | def _nix_env():
'''
nix-env with quiet option. By default, nix is extremely verbose and prints the build log of every package to stderr. This tells nix to
only show changes.
'''
nixhome = os.path.join(os.path.expanduser('~{0}'.format(__opts__['user'])), '.nix-profile/bin/')
return [os.path.join(... | nix-env with quiet option. By default, nix is extremely verbose and prints the build log of every package to stderr. This tells nix to
only show changes. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nix.py#L54-L60 | null | # -*- coding: utf-8 -*-
'''
Work with Nix packages
======================
.. versionadded:: 2017.7.0
Does not require the machine to be Nixos, just have Nix installed and available
to use for the user running this command. Their profile must be located in
their home, under ``$HOME/.nix-profile/``, and the nix store, ... |
saltstack/salt | salt/modules/nix.py | _nix_collect_garbage | python | def _nix_collect_garbage():
'''
Make sure we get the right nix-store, too.
'''
nixhome = os.path.join(os.path.expanduser('~{0}'.format(__opts__['user'])), '.nix-profile/bin/')
return [os.path.join(nixhome, 'nix-collect-garbage')] | Make sure we get the right nix-store, too. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nix.py#L63-L68 | null | # -*- coding: utf-8 -*-
'''
Work with Nix packages
======================
.. versionadded:: 2017.7.0
Does not require the machine to be Nixos, just have Nix installed and available
to use for the user running this command. Their profile must be located in
their home, under ``$HOME/.nix-profile/``, and the nix store, ... |
saltstack/salt | salt/modules/nix.py | _zip_flatten | python | def _zip_flatten(x, ys):
'''
intersperse x into ys, with an extra element at the beginning.
'''
return itertools.chain.from_iterable(
zip(itertools.repeat(x), ys)) | intersperse x into ys, with an extra element at the beginning. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nix.py#L81-L86 | null | # -*- coding: utf-8 -*-
'''
Work with Nix packages
======================
.. versionadded:: 2017.7.0
Does not require the machine to be Nixos, just have Nix installed and available
to use for the user running this command. Their profile must be located in
their home, under ``$HOME/.nix-profile/``, and the nix store, ... |
saltstack/salt | salt/modules/nix.py | _output_format | python | def _output_format(out,
operation):
'''
gets a list of all the packages that were affected by ``operation``, splits it up (there can be multiple packages on a line), and then
flattens that list. We make it to a list for easier parsing.
'''
return [s.split()[1:] for s in out
... | gets a list of all the packages that were affected by ``operation``, splits it up (there can be multiple packages on a line), and then
flattens that list. We make it to a list for easier parsing. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nix.py#L89-L96 | null | # -*- coding: utf-8 -*-
'''
Work with Nix packages
======================
.. versionadded:: 2017.7.0
Does not require the machine to be Nixos, just have Nix installed and available
to use for the user running this command. Their profile must be located in
their home, under ``$HOME/.nix-profile/``, and the nix store, ... |
saltstack/salt | salt/modules/nix.py | upgrade | python | def upgrade(*pkgs):
'''
Runs an update operation on the specified packages, or all packages if none is specified.
:type pkgs: list(str)
:param pkgs:
List of packages to update
:return: The upgraded packages. Example element: ``['libxslt-1.1.0', 'libxslt-1.1.10']``
:rtype: list(tuple(st... | Runs an update operation on the specified packages, or all packages if none is specified.
:type pkgs: list(str)
:param pkgs:
List of packages to update
:return: The upgraded packages. Example element: ``['libxslt-1.1.0', 'libxslt-1.1.10']``
:rtype: list(tuple(str, str))
.. code-block:: ba... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nix.py#L113-L140 | [
"def _run(cmd):\n '''\n Just a convenience function for ``__salt__['cmd.run_all'](cmd)``\n '''\n return __salt__['cmd.run_all'](cmd, env={'HOME': os.path.expanduser('~{0}'.format(__opts__['user']))})\n",
"def _quietnix():\n '''\n nix-env with quiet option. By default, nix is extremely verbose an... | # -*- coding: utf-8 -*-
'''
Work with Nix packages
======================
.. versionadded:: 2017.7.0
Does not require the machine to be Nixos, just have Nix installed and available
to use for the user running this command. Their profile must be located in
their home, under ``$HOME/.nix-profile/``, and the nix store, ... |
saltstack/salt | salt/modules/nix.py | install | python | def install(*pkgs, **kwargs):
'''
Installs a single or multiple packages via nix
:type pkgs: list(str)
:param pkgs:
packages to update
:param bool attributes:
Pass the list of packages or single package as attribues, not package names.
default: False
:return: Installed ... | Installs a single or multiple packages via nix
:type pkgs: list(str)
:param pkgs:
packages to update
:param bool attributes:
Pass the list of packages or single package as attribues, not package names.
default: False
:return: Installed packages. Example element: ``gcc-3.3.2``
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nix.py#L143-L183 | [
"def _run(cmd):\n '''\n Just a convenience function for ``__salt__['cmd.run_all'](cmd)``\n '''\n return __salt__['cmd.run_all'](cmd, env={'HOME': os.path.expanduser('~{0}'.format(__opts__['user']))})\n",
"def _quietnix():\n '''\n nix-env with quiet option. By default, nix is extremely verbose an... | # -*- coding: utf-8 -*-
'''
Work with Nix packages
======================
.. versionadded:: 2017.7.0
Does not require the machine to be Nixos, just have Nix installed and available
to use for the user running this command. Their profile must be located in
their home, under ``$HOME/.nix-profile/``, and the nix store, ... |
saltstack/salt | salt/modules/nix.py | list_pkgs | python | def list_pkgs(installed=True,
attributes=True):
'''
Lists installed packages. Due to how nix works, it defaults to just doing a ``nix-env -q``.
:param bool installed:
list only installed packages. This can be a very long list (12,000+ elements), so caution is advised.
Default:... | Lists installed packages. Due to how nix works, it defaults to just doing a ``nix-env -q``.
:param bool installed:
list only installed packages. This can be a very long list (12,000+ elements), so caution is advised.
Default: True
:param bool attributes:
show the attributes of the pack... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nix.py#L186-L228 | [
"def split(orig, sep=None):\n '''\n Generator function for iterating through large strings, particularly useful\n as a replacement for str.splitlines().\n\n See http://stackoverflow.com/a/3865367\n '''\n exp = re.compile(r'\\s+' if sep is None else re.escape(sep))\n pos = 0\n length = len(or... | # -*- coding: utf-8 -*-
'''
Work with Nix packages
======================
.. versionadded:: 2017.7.0
Does not require the machine to be Nixos, just have Nix installed and available
to use for the user running this command. Their profile must be located in
their home, under ``$HOME/.nix-profile/``, and the nix store, ... |
saltstack/salt | salt/modules/nix.py | uninstall | python | def uninstall(*pkgs):
'''
Erases a package from the current nix profile. Nix uninstalls work differently than other package managers, and the symlinks in the
profile are removed, while the actual package remains. There is also a ``nix.purge`` function, to clear the package cache of unused
packages.
... | Erases a package from the current nix profile. Nix uninstalls work differently than other package managers, and the symlinks in the
profile are removed, while the actual package remains. There is also a ``nix.purge`` function, to clear the package cache of unused
packages.
:type pkgs: list(str)
:param ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nix.py#L231-L259 | [
"def _run(cmd):\n '''\n Just a convenience function for ``__salt__['cmd.run_all'](cmd)``\n '''\n return __salt__['cmd.run_all'](cmd, env={'HOME': os.path.expanduser('~{0}'.format(__opts__['user']))})\n",
"def _quietnix():\n '''\n nix-env with quiet option. By default, nix is extremely verbose an... | # -*- coding: utf-8 -*-
'''
Work with Nix packages
======================
.. versionadded:: 2017.7.0
Does not require the machine to be Nixos, just have Nix installed and available
to use for the user running this command. Their profile must be located in
their home, under ``$HOME/.nix-profile/``, and the nix store, ... |
saltstack/salt | salt/modules/nix.py | collect_garbage | python | def collect_garbage():
'''
Completely removed all currently 'uninstalled' packages in the nix store.
Tells the user how many store paths were removed and how much space was freed.
:return: How much space was freed and how many derivations were removed
:rtype: str
.. warning::
This is a... | Completely removed all currently 'uninstalled' packages in the nix store.
Tells the user how many store paths were removed and how much space was freed.
:return: How much space was freed and how many derivations were removed
:rtype: str
.. warning::
This is a destructive action on the nix stor... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nix.py#L262-L283 | [
"def _run(cmd):\n '''\n Just a convenience function for ``__salt__['cmd.run_all'](cmd)``\n '''\n return __salt__['cmd.run_all'](cmd, env={'HOME': os.path.expanduser('~{0}'.format(__opts__['user']))})\n",
"def _nix_collect_garbage():\n '''\n Make sure we get the right nix-store, too.\n '''\n ... | # -*- coding: utf-8 -*-
'''
Work with Nix packages
======================
.. versionadded:: 2017.7.0
Does not require the machine to be Nixos, just have Nix installed and available
to use for the user running this command. Their profile must be located in
their home, under ``$HOME/.nix-profile/``, and the nix store, ... |
saltstack/salt | salt/pillar/rethinkdb_pillar.py | ext_pillar | python | def ext_pillar(minion_id,
pillar,
table='pillar',
id_field=None,
field=None,
pillar_key=None):
'''
Collect minion external pillars from a RethinkDB database
Arguments:
* `table`: The RethinkDB table containing external pillar in... | Collect minion external pillars from a RethinkDB database
Arguments:
* `table`: The RethinkDB table containing external pillar information.
Defaults to ``'pillar'``
* `id_field`: Field in document containing the minion id.
If blank then we assume the table index matches minion ids
* `field`... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/rethinkdb_pillar.py#L78-L163 | null | # -*- coding: utf-8 -*-
'''
Provide external pillar data from RethinkDB
.. versionadded:: 2018.3.0
:depends: rethinkdb (on the salt-master)
salt master rethinkdb configuration
===================================
These variables must be configured in your master configuration file.
* ``rethinkdb.host`` - The Ret... |
saltstack/salt | salt/cli/support/localrunner.py | LocalRunner._proc_function | python | def _proc_function(self, fun, low, user, tag, jid, daemonize=True):
'''
Same as original _proc_function in AsyncClientMixin,
except it calls "low" without firing a print event.
'''
if daemonize and not salt.utils.platform.is_windows():
salt.log.setup.shutdown_multipro... | Same as original _proc_function in AsyncClientMixin,
except it calls "low" without firing a print event. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/localrunner.py#L20-L34 | null | class LocalRunner(salt.runner.Runner):
'''
Runner class that changes its default behaviour.
'''
|
saltstack/salt | salt/modules/puppet.py | run | python | def run(*args, **kwargs):
'''
Execute a puppet run and return a dict with the stderr, stdout,
return code, etc. The first positional argument given is checked as a
subcommand. Following positional arguments should be ordered with arguments
required by the subcommand first, followed by non-keyword ar... | Execute a puppet run and return a dict with the stderr, stdout,
return code, etc. The first positional argument given is checked as a
subcommand. Following positional arguments should be ordered with arguments
required by the subcommand first, followed by non-keyword arguments.
Tags are specified by a t... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/puppet.py#L138-L175 | [
"def clean_kwargs(**kwargs):\n '''\n Return a dict without any of the __pub* keys (or any other keys starting\n with a dunder) from the kwargs dict passed into the execution module\n functions. These keys are useful for tracking what was used to invoke\n the function call, but they may not be desirab... | # -*- coding: utf-8 -*-
'''
Execute puppet routines
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
from distutils import version # pylint: disable=no-name-in-module
import logging
import os
import datetime
# Import salt libs
import salt.utils.args
import salt.utils.... |
saltstack/salt | salt/modules/puppet.py | enable | python | def enable():
'''
.. versionadded:: 2014.7.0
Enable the puppet agent
CLI Example:
.. code-block:: bash
salt '*' puppet.enable
'''
puppet = _Puppet()
if os.path.isfile(puppet.disabled_lockfile):
try:
os.remove(puppet.disabled_lockfile)
except (IOEr... | .. versionadded:: 2014.7.0
Enable the puppet agent
CLI Example:
.. code-block:: bash
salt '*' puppet.enable | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/puppet.py#L196-L219 | null | # -*- coding: utf-8 -*-
'''
Execute puppet routines
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
from distutils import version # pylint: disable=no-name-in-module
import logging
import os
import datetime
# Import salt libs
import salt.utils.args
import salt.utils.... |
saltstack/salt | salt/modules/puppet.py | disable | python | def disable(message=None):
'''
.. versionadded:: 2014.7.0
Disable the puppet agent
message
.. versionadded:: 2015.5.2
Disable message to send to puppet
CLI Example:
.. code-block:: bash
salt '*' puppet.disable
salt '*' puppet.disable 'Disabled, contact XYZ b... | .. versionadded:: 2014.7.0
Disable the puppet agent
message
.. versionadded:: 2015.5.2
Disable message to send to puppet
CLI Example:
.. code-block:: bash
salt '*' puppet.disable
salt '*' puppet.disable 'Disabled, contact XYZ before enabling' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/puppet.py#L222-L256 | [
"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 -*-
'''
Execute puppet routines
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
from distutils import version # pylint: disable=no-name-in-module
import logging
import os
import datetime
# Import salt libs
import salt.utils.args
import salt.utils.... |
saltstack/salt | salt/modules/puppet.py | status | python | def status():
'''
.. versionadded:: 2014.7.0
Display puppet agent status
CLI Example:
.. code-block:: bash
salt '*' puppet.status
'''
puppet = _Puppet()
if os.path.isfile(puppet.disabled_lockfile):
return 'Administratively disabled'
if os.path.isfile(puppet.run_... | .. versionadded:: 2014.7.0
Display puppet agent status
CLI Example:
.. code-block:: bash
salt '*' puppet.status | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/puppet.py#L259-L296 | null | # -*- coding: utf-8 -*-
'''
Execute puppet routines
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
from distutils import version # pylint: disable=no-name-in-module
import logging
import os
import datetime
# Import salt libs
import salt.utils.args
import salt.utils.... |
saltstack/salt | salt/modules/puppet.py | summary | python | def summary():
'''
.. versionadded:: 2014.7.0
Show a summary of the last puppet agent run
CLI Example:
.. code-block:: bash
salt '*' puppet.summary
'''
puppet = _Puppet()
try:
with salt.utils.files.fopen(puppet.lastrunfile, 'r') as fp_:
report = salt.uti... | .. versionadded:: 2014.7.0
Show a summary of the last puppet agent run
CLI Example:
.. code-block:: bash
salt '*' puppet.summary | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/puppet.py#L299-L343 | [
"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 -*-
'''
Execute puppet routines
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
from distutils import version # pylint: disable=no-name-in-module
import logging
import os
import datetime
# Import salt libs
import salt.utils.args
import salt.utils.... |
saltstack/salt | salt/modules/puppet.py | facts | python | def facts(puppet=False):
'''
Run facter and return the results
CLI Example:
.. code-block:: bash
salt '*' puppet.facts
'''
ret = {}
opt_puppet = '--puppet' if puppet else ''
cmd_ret = __salt__['cmd.run_all']('facter {0}'.format(opt_puppet))
if cmd_ret['retcode'] != 0:
... | Run facter and return the results
CLI Example:
.. code-block:: bash
salt '*' puppet.facts | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/puppet.py#L363-L392 | [
"def _format_fact(output):\n try:\n fact, value = output.split(' => ', 1)\n value = value.strip()\n except ValueError:\n fact = None\n value = None\n return (fact, value)\n"
] | # -*- coding: utf-8 -*-
'''
Execute puppet routines
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
from distutils import version # pylint: disable=no-name-in-module
import logging
import os
import datetime
# Import salt libs
import salt.utils.args
import salt.utils.... |
saltstack/salt | salt/modules/puppet.py | fact | python | def fact(name, puppet=False):
'''
Run facter for a specific fact
CLI Example:
.. code-block:: bash
salt '*' puppet.fact kernel
'''
opt_puppet = '--puppet' if puppet else ''
ret = __salt__['cmd.run_all'](
'facter {0} {1}'.format(opt_puppet, name),
python_she... | Run facter for a specific fact
CLI Example:
.. code-block:: bash
salt '*' puppet.fact kernel | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/puppet.py#L395-L415 | null | # -*- coding: utf-8 -*-
'''
Execute puppet routines
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
from distutils import version # pylint: disable=no-name-in-module
import logging
import os
import datetime
# Import salt libs
import salt.utils.args
import salt.utils.... |
saltstack/salt | salt/modules/puppet.py | _Puppet.arguments | python | def arguments(self, args=None):
'''
Read in arguments for the current subcommand. These are added to the
cmd line without '--' appended. Any others are redirected as standard
options with the double hyphen prefixed.
'''
# permits deleting elements rather than using slices... | Read in arguments for the current subcommand. These are added to the
cmd line without '--' appended. Any others are redirected as standard
options with the double hyphen prefixed. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/puppet.py#L113-L135 | null | class _Puppet(object):
'''
Puppet helper class. Used to format command for execution.
'''
def __init__(self):
'''
Setup a puppet instance, based on the premis that default usage is to
run 'puppet agent --test'. Configuration and run states are stored in
the default locati... |
saltstack/salt | salt/states/boto_iam.py | keys_present | python | def keys_present(name, number, save_dir, region=None, key=None, keyid=None, profile=None,
save_format="{2}\n{0}\n{3}\n{1}\n"):
'''
.. versionadded:: 2015.8.0
Ensure the IAM access keys are present.
name (string)
The name of the new user.
number (int)
Number of key... | .. versionadded:: 2015.8.0
Ensure the IAM access keys are present.
name (string)
The name of the new user.
number (int)
Number of keys that user should have.
save_dir (string)
The directory that the key/keys will be saved. Keys are saved to a file named according
to t... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_iam.py#L313-L414 | [
"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 -*-
'''
Manage IAM objects
==================
.. versionadded:: 2015.8.0
This module uses ``boto``, which can be installed via package, or pip.
This module accepts explicit IAM credentials but can also utilize
IAM roles assigned to the instance through Instance Profiles. Dynamic
credentials are t... |
saltstack/salt | salt/states/boto_iam.py | account_policy | python | def account_policy(name=None, allow_users_to_change_password=None,
hard_expiry=None, max_password_age=None,
minimum_password_length=None, password_reuse_prevention=None,
require_lowercase_characters=None, require_numbers=None,
require_symbols=N... | Change account policy.
.. versionadded:: 2015.8.0
name (string)
The name of the account policy
allow_users_to_change_password (bool)
Allows all IAM users in your account to
use the AWS Management Console to change their own passwords.
hard_expiry (bool)
Prevents IAM u... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_iam.py#L1235-L1329 | null | # -*- coding: utf-8 -*-
'''
Manage IAM objects
==================
.. versionadded:: 2015.8.0
This module uses ``boto``, which can be installed via package, or pip.
This module accepts explicit IAM credentials but can also utilize
IAM roles assigned to the instance through Instance Profiles. Dynamic
credentials are t... |
saltstack/salt | salt/states/boto_iam.py | server_cert_present | python | def server_cert_present(name, public_key, private_key, cert_chain=None, path=None,
region=None, key=None, keyid=None, profile=None):
'''
Crete server certificate.
.. versionadded:: 2015.8.0
name (string)
The name for the server certificate. Do not include the path in th... | Crete server certificate.
.. versionadded:: 2015.8.0
name (string)
The name for the server certificate. Do not include the path in this value.
public_key (string)
The contents of the public key certificate in PEM-encoded format.
private_key (string)
The contents of the privat... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_iam.py#L1372-L1449 | null | # -*- coding: utf-8 -*-
'''
Manage IAM objects
==================
.. versionadded:: 2015.8.0
This module uses ``boto``, which can be installed via package, or pip.
This module accepts explicit IAM credentials but can also utilize
IAM roles assigned to the instance through Instance Profiles. Dynamic
credentials are t... |
saltstack/salt | salt/states/boto_iam.py | saml_provider_present | python | def saml_provider_present(name, saml_metadata_document, region=None, key=None, keyid=None, profile=None):
'''
.. versionadded:: 2016.11.0
Ensure the SAML provider with the specified name is present.
name (string)
The name of the SAML provider.
saml_metadata_document (string)
The x... | .. versionadded:: 2016.11.0
Ensure the SAML provider with the specified name is present.
name (string)
The name of the SAML provider.
saml_metadata_document (string)
The xml document of the SAML provider.
region (string)
Region to connect to.
key (string)
Secret ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_iam.py#L1611-L1665 | null | # -*- coding: utf-8 -*-
'''
Manage IAM objects
==================
.. versionadded:: 2015.8.0
This module uses ``boto``, which can be installed via package, or pip.
This module accepts explicit IAM credentials but can also utilize
IAM roles assigned to the instance through Instance Profiles. Dynamic
credentials are t... |
saltstack/salt | salt/states/boto_iam.py | saml_provider_absent | python | def saml_provider_absent(name, region=None, key=None, keyid=None, profile=None):
'''
.. versionadded:: 2016.11.0
Ensure the SAML provider with the specified name is absent.
name (string)
The name of the SAML provider.
saml_metadata_document (string)
The xml document of the SAML pr... | .. versionadded:: 2016.11.0
Ensure the SAML provider with the specified name is absent.
name (string)
The name of the SAML provider.
saml_metadata_document (string)
The xml document of the SAML provider.
region (string)
Region to connect to.
key (string)
Secret k... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_iam.py#L1668-L1713 | null | # -*- coding: utf-8 -*-
'''
Manage IAM objects
==================
.. versionadded:: 2015.8.0
This module uses ``boto``, which can be installed via package, or pip.
This module accepts explicit IAM credentials but can also utilize
IAM roles assigned to the instance through Instance Profiles. Dynamic
credentials are t... |
saltstack/salt | salt/modules/napalm_bgp.py | config | python | def config(group=None, neighbor=None, **kwargs):
'''
Provides the BGP configuration on the device.
:param group: Name of the group selected to display the configuration.
:param neighbor: IP Address of the neighbor to display the configuration.
If the group parameter is not specified, the neigh... | Provides the BGP configuration on the device.
:param group: Name of the group selected to display the configuration.
:param neighbor: IP Address of the neighbor to display the configuration.
If the group parameter is not specified, the neighbor setting will be
ignored.
:return: A dictionar... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_bgp.py#L61-L170 | [
"def call(napalm_device, method, *args, **kwargs):\n '''\n Calls arbitrary methods from the network driver instance.\n Please check the readthedocs_ page for the updated list of getters.\n\n .. _readthedocs: http://napalm.readthedocs.org/en/latest/support/index.html#getters-support-matrix\n\n method\... | # -*- coding: utf-8 -*-
'''
NAPALM BGP
==========
Manages BGP configuration on network devices and provides statistics.
:codeauthor: Mircea Ulinic <mircea@cloudflare.com> & Jerome Fleury <jf@cloudflare.com>
:maturity: new
:depends: napalm
:platform: unix
Dependencies
------------
- :mod:`napalm proxy minion ... |
saltstack/salt | salt/cloud/clouds/lxc.py | _salt | python | def _salt(fun, *args, **kw):
'''Execute a salt function on a specific minion
Special kwargs:
salt_target
target to exec things on
salt_timeout
timeout for jobs
salt_job_poll
poll interval to wait for job finish result
'''
... | Execute a salt function on a specific minion
Special kwargs:
salt_target
target to exec things on
salt_timeout
timeout for jobs
salt_job_poll
poll interval to wait for job finish result | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/lxc.py#L97-L254 | [
"def _runner():\n # opts = _master_opts()\n # opts['output'] = 'quiet'\n return salt.runner.RunnerClient(_master_opts())\n",
"def dumps(obj, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.dumps, and assumes that ensure_ascii is False (unless explicitly\n passed as True) for unic... | # -*- coding: utf-8 -*-
'''
Install Salt on an LXC Container
================================
.. versionadded:: 2014.7.0
Please read :ref:`core config documentation <config_lxc>`.
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import copy
import logging
import os
im... |
saltstack/salt | salt/cloud/clouds/lxc.py | list_nodes_select | python | def list_nodes_select(call=None):
'''
Return a list of the VMs that are on the provider, with select fields
'''
if not call:
call = 'select'
if not get_configured_provider():
return
info = ['id', 'name', 'image', 'size', 'state', 'public_ips', 'private_ips']
return salt.utils... | Return a list of the VMs that are on the provider, with select fields | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/lxc.py#L338-L349 | [
"def list_nodes_full(conn=None, call=None):\n if not get_configured_provider():\n return\n if not call:\n call = 'action'\n return list_nodes(conn=conn, call=call)\n",
"def list_nodes_select(nodes, selection, call=None):\n '''\n Return a list of the VMs that are on the provider, with ... | # -*- coding: utf-8 -*-
'''
Install Salt on an LXC Container
================================
.. versionadded:: 2014.7.0
Please read :ref:`core config documentation <config_lxc>`.
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import copy
import logging
import os
im... |
saltstack/salt | salt/cloud/clouds/lxc.py | destroy | python | def destroy(vm_, call=None):
'''Destroy a lxc container'''
destroy_opt = __opts__.get('destroy', False)
profiles = __opts__.get('profiles', {})
profile = __opts__.get('profile',
__opts__.get('internal_lxc_profile', []))
path = None
if profile and profile in profiles:
... | Destroy a lxc container | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/lxc.py#L375-L417 | [
"def get_configured_provider(vm_=None):\n '''\n Return the contextual provider of None if no configured\n one can be found.\n '''\n if vm_ is None:\n vm_ = {}\n dalias, driver = __active_provider_name__.split(':')\n data = None\n tgt = 'unknown'\n img_provider = __opts__.get('list_... | # -*- coding: utf-8 -*-
'''
Install Salt on an LXC Container
================================
.. versionadded:: 2014.7.0
Please read :ref:`core config documentation <config_lxc>`.
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import copy
import logging
import os
im... |
saltstack/salt | salt/cloud/clouds/lxc.py | create | python | def create(vm_, call=None):
'''Create an lxc Container.
This function is idempotent and will try to either provision
or finish the provision of an lxc container.
NOTE: Most of the initialization code has been moved and merged
with the lxc runner and lxc.init functions
'''
prov = get_configu... | Create an lxc Container.
This function is idempotent and will try to either provision
or finish the provision of an lxc container.
NOTE: Most of the initialization code has been moved and merged
with the lxc runner and lxc.init functions | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/lxc.py#L420-L497 | [
"def _runner():\n # opts = _master_opts()\n # opts['output'] = 'quiet'\n return salt.runner.RunnerClient(_master_opts())\n",
"def get_cloud_config_value(name, vm_, opts, default=None, search_global=True):\n '''\n Search and return a setting in a known order:\n\n 1. In the virtual machine's c... | # -*- coding: utf-8 -*-
'''
Install Salt on an LXC Container
================================
.. versionadded:: 2014.7.0
Please read :ref:`core config documentation <config_lxc>`.
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import copy
import logging
import os
im... |
saltstack/salt | salt/cloud/clouds/lxc.py | get_configured_provider | python | def get_configured_provider(vm_=None):
'''
Return the contextual provider of None if no configured
one can be found.
'''
if vm_ is None:
vm_ = {}
dalias, driver = __active_provider_name__.split(':')
data = None
tgt = 'unknown'
img_provider = __opts__.get('list_images', '')
... | Return the contextual provider of None if no configured
one can be found. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/lxc.py#L511-L570 | [
"def get_provider(name):\n data = None\n if name in __opts__['providers']:\n data = __opts__['providers'][name]\n if 'lxc' in data:\n data = data['lxc']\n else:\n data = None\n return data\n",
"def _salt(fun, *args, **kw):\n '''Execute a salt function on a sp... | # -*- coding: utf-8 -*-
'''
Install Salt on an LXC Container
================================
.. versionadded:: 2014.7.0
Please read :ref:`core config documentation <config_lxc>`.
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import copy
import logging
import os
im... |
saltstack/salt | salt/runners/launchd.py | write_launchd_plist | python | def write_launchd_plist(program):
'''
Write a launchd plist for managing salt-master or salt-minion
CLI Example:
.. code-block:: bash
salt-run launchd.write_launchd_plist salt-master
'''
plist_sample_text = '''
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//D... | Write a launchd plist for managing salt-master or salt-minion
CLI Example:
.. code-block:: bash
salt-run launchd.write_launchd_plist salt-master | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/launchd.py#L12-L63 | null | # -*- coding: utf-8 -*-
'''
Manage launchd plist files
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import python libs
import os
import sys
|
saltstack/salt | salt/grains/core.py | _windows_cpudata | python | def _windows_cpudata():
'''
Return some CPU information on Windows minions
'''
# Provides:
# num_cpus
# cpu_model
grains = {}
if 'NUMBER_OF_PROCESSORS' in os.environ:
# Cast to int so that the logic isn't broken when used as a
# conditional in templating. Also follows... | Return some CPU information on Windows minions | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L110-L129 | null | # -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | _linux_cpudata | python | def _linux_cpudata():
'''
Return some CPU information for Linux minions
'''
# Provides:
# num_cpus
# cpu_model
# cpu_flags
grains = {}
cpuinfo = '/proc/cpuinfo'
# Parse over the cpuinfo file
if os.path.isfile(cpuinfo):
with salt.utils.files.fopen(cpuinfo, 'r') a... | Return some CPU information for Linux minions | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L132-L183 | null | # -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | _linux_gpu_data | python | def _linux_gpu_data():
'''
num_gpus: int
gpus:
- vendor: nvidia|amd|ati|...
model: string
'''
if __opts__.get('enable_lspci', True) is False:
return {}
if __opts__.get('enable_gpu_grains', True) is False:
return {}
lspci = salt.utils.path.which('lspci')
if... | num_gpus: int
gpus:
- vendor: nvidia|amd|ati|...
model: string | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L186-L259 | null | # -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | _netbsd_gpu_data | python | def _netbsd_gpu_data():
'''
num_gpus: int
gpus:
- vendor: nvidia|amd|ati|...
model: string
'''
known_vendors = ['nvidia', 'amd', 'ati', 'intel', 'cirrus logic', 'vmware', 'matrox', 'aspeed']
gpus = []
try:
pcictl_out = __salt__['cmd.run']('pcictl pci0 list')
f... | num_gpus: int
gpus:
- vendor: nvidia|amd|ati|...
model: string | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L262-L290 | null | # -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | _osx_gpudata | python | def _osx_gpudata():
'''
num_gpus: int
gpus:
- vendor: nvidia|amd|ati|...
model: string
'''
gpus = []
try:
pcictl_out = __salt__['cmd.run']('system_profiler SPDisplaysDataType')
for line in pcictl_out.splitlines():
fieldname, _, fieldval = line.partitio... | num_gpus: int
gpus:
- vendor: nvidia|amd|ati|...
model: string | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L293-L318 | null | # -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | _bsd_cpudata | python | def _bsd_cpudata(osdata):
'''
Return CPU information for BSD-like systems
'''
# Provides:
# cpuarch
# num_cpus
# cpu_model
# cpu_flags
sysctl = salt.utils.path.which('sysctl')
arch = salt.utils.path.which('arch')
cmds = {}
if sysctl:
cmds.update({
... | Return CPU information for BSD-like systems | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L321-L384 | null | # -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | _sunos_cpudata | python | def _sunos_cpudata():
'''
Return the CPU information for Solaris-like systems
'''
# Provides:
# cpuarch
# num_cpus
# cpu_model
# cpu_flags
grains = {}
grains['cpu_flags'] = []
grains['cpuarch'] = __salt__['cmd.run']('isainfo -k')
psrinfo = '/usr/sbin/psrinfo 2>/d... | Return the CPU information for Solaris-like systems | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L387-L414 | null | # -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | _aix_cpudata | python | def _aix_cpudata():
'''
Return CPU information for AIX systems
'''
# Provides:
# cpuarch
# num_cpus
# cpu_model
# cpu_flags
grains = {}
cmd = salt.utils.path.which('prtconf')
if cmd:
data = __salt__['cmd.run']('{0}'.format(cmd)) + os.linesep
for dest, ... | Return CPU information for AIX systems | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L417-L440 | null | # -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | _linux_memdata | python | def _linux_memdata():
'''
Return the memory information for Linux-like systems
'''
grains = {'mem_total': 0, 'swap_total': 0}
meminfo = '/proc/meminfo'
if os.path.isfile(meminfo):
with salt.utils.files.fopen(meminfo, 'r') as ifile:
for line in ifile:
comps = ... | Return the memory information for Linux-like systems | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L443-L462 | [
"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 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | _osx_memdata | python | def _osx_memdata():
'''
Return the memory information for BSD-like systems
'''
grains = {'mem_total': 0, 'swap_total': 0}
sysctl = salt.utils.path.which('sysctl')
if sysctl:
mem = __salt__['cmd.run']('{0} -n hw.memsize'.format(sysctl))
swap_total = __salt__['cmd.run']('{0} -n vm... | Return the memory information for BSD-like systems | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L465-L485 | null | # -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | _bsd_memdata | python | def _bsd_memdata(osdata):
'''
Return the memory information for BSD-like systems
'''
grains = {'mem_total': 0, 'swap_total': 0}
sysctl = salt.utils.path.which('sysctl')
if sysctl:
mem = __salt__['cmd.run']('{0} -n hw.physmem'.format(sysctl))
if osdata['kernel'] == 'NetBSD' and m... | Return the memory information for BSD-like systems | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L488-L511 | null | # -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | _sunos_memdata | python | def _sunos_memdata():
'''
Return the memory information for SunOS-like systems
'''
grains = {'mem_total': 0, 'swap_total': 0}
prtconf = '/usr/sbin/prtconf 2>/dev/null'
for line in __salt__['cmd.run'](prtconf, python_shell=True).splitlines():
comps = line.split(' ')
if comps[0].s... | Return the memory information for SunOS-like systems | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L514-L535 | null | # -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | _aix_memdata | python | def _aix_memdata():
'''
Return the memory information for AIX systems
'''
grains = {'mem_total': 0, 'swap_total': 0}
prtconf = salt.utils.path.which('prtconf')
if prtconf:
for line in __salt__['cmd.run'](prtconf, python_shell=True).splitlines():
comps = [x for x in line.strip... | Return the memory information for AIX systems | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L538-L563 | null | # -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | _memdata | python | def _memdata(osdata):
'''
Gather information about the system memory
'''
# Provides:
# mem_total
# swap_total, for supported systems.
grains = {'mem_total': 0}
if osdata['kernel'] == 'Linux':
grains.update(_linux_memdata())
elif osdata['kernel'] in ('FreeBSD', 'OpenBSD', ... | Gather information about the system memory | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L578-L598 | null | # -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | _aix_get_machine_id | python | def _aix_get_machine_id():
'''
Parse the output of lsattr -El sys0 for os_uuid
'''
grains = {}
cmd = salt.utils.path.which('lsattr')
if cmd:
data = __salt__['cmd.run']('{0} -El sys0'.format(cmd)) + os.linesep
uuid_regexes = [re.compile(r'(?im)^\s*os_uuid\s+(\S+)\s+(.*)')]
... | Parse the output of lsattr -El sys0 for os_uuid | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L601-L617 | null | # -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | _windows_virtual | python | def _windows_virtual(osdata):
'''
Returns what type of virtual hardware is under the hood, kvm or physical
'''
# Provides:
# virtual
# virtual_subtype
grains = dict()
if osdata['kernel'] != 'Windows':
return grains
grains['virtual'] = 'physical'
# It is possible tha... | Returns what type of virtual hardware is under the hood, kvm or physical | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L620-L674 | null | # -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | _virtual | python | def _virtual(osdata):
'''
Returns what type of virtual hardware is under the hood, kvm or physical
'''
# This is going to be a monster, if you are running a vm you can test this
# grain with please submit patches!
# Provides:
# virtual
# virtual_subtype
grains = {'virtual': 'phys... | Returns what type of virtual hardware is under the hood, kvm or physical | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L677-L1068 | null | # -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | _virtual_hv | python | def _virtual_hv(osdata):
'''
Returns detailed hypervisor information from sysfs
Currently this seems to be used only by Xen
'''
grains = {}
# Bail early if we're not running on Xen
try:
if 'xen' not in osdata['virtual']:
return grains
except KeyError:
return ... | Returns detailed hypervisor information from sysfs
Currently this seems to be used only by Xen | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L1071-L1125 | null | # -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | _ps | python | def _ps(osdata):
'''
Return the ps grain
'''
grains = {}
bsd_choices = ('FreeBSD', 'NetBSD', 'OpenBSD', 'MacOS')
if osdata['os'] in bsd_choices:
grains['ps'] = 'ps auxwww'
elif osdata['os_family'] == 'Solaris':
grains['ps'] = '/usr/ucb/ps auxwww'
elif osdata['os'] == 'Win... | Return the ps grain | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L1128-L1152 | null | # -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | _clean_value | python | def _clean_value(key, val):
'''
Clean out well-known bogus values.
If it isn't clean (for example has value 'None'), return None.
Otherwise, return the original value.
NOTE: This logic also exists in the smbios module. This function is
for use when not using smbios to retrieve the value.
... | Clean out well-known bogus values.
If it isn't clean (for example has value 'None'), return None.
Otherwise, return the original value.
NOTE: This logic also exists in the smbios module. This function is
for use when not using smbios to retrieve the value. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L1155-L1197 | null | # -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | _windows_platform_data | python | def _windows_platform_data():
'''
Use the platform module for as much as we can.
'''
# Provides:
# kernelrelease
# kernelversion
# osversion
# osrelease
# osservicepack
# osmanufacturer
# manufacturer
# productname
# biosversion
# ser... | Use the platform module for as much as we can. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L1200-L1319 | [
"def _clean_value(key, val):\n '''\n Clean out well-known bogus values.\n If it isn't clean (for example has value 'None'), return None.\n Otherwise, return the original value.\n\n NOTE: This logic also exists in the smbios module. This function is\n for use when not using smbios to retrieve... | # -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | _osx_platform_data | python | def _osx_platform_data():
'''
Additional data for macOS systems
Returns: A dictionary containing values for the following:
- model_name
- boot_rom_version
- smc_version
- system_serialnumber
'''
cmd = 'system_profiler SPHardwareDataType'
hardware = __salt__['cmd.r... | Additional data for macOS systems
Returns: A dictionary containing values for the following:
- model_name
- boot_rom_version
- smc_version
- system_serialnumber | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L1322-L1350 | null | # -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | _linux_bin_exists | python | def _linux_bin_exists(binary):
'''
Does a binary exist in linux (depends on which, type, or whereis)
'''
for search_cmd in ('which', 'type -ap'):
try:
return __salt__['cmd.retcode'](
'{0} {1}'.format(search_cmd, binary)
) == 0
except salt.exception... | Does a binary exist in linux (depends on which, type, or whereis) | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L1483-L1500 | null | # -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | _parse_os_release | python | def _parse_os_release(*os_release_files):
'''
Parse os-release and return a parameter dictionary
See http://www.freedesktop.org/software/systemd/man/os-release.html
for specification of the file format.
'''
ret = {}
for filename in os_release_files:
try:
with salt.utils.... | Parse os-release and return a parameter dictionary
See http://www.freedesktop.org/software/systemd/man/os-release.html
for specification of the file format. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L1532-L1556 | [
"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 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | _parse_cpe_name | python | def _parse_cpe_name(cpe):
'''
Parse CPE_NAME data from the os-release
Info: https://csrc.nist.gov/projects/security-content-automation-protocol/scap-specifications/cpe
:param cpe:
:return:
'''
part = {
'o': 'operating system',
'h': 'hardware',
'a': 'application',
... | Parse CPE_NAME data from the os-release
Info: https://csrc.nist.gov/projects/security-content-automation-protocol/scap-specifications/cpe
:param cpe:
:return: | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L1559-L1584 | null | # -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | os_data | python | def os_data():
'''
Return grains pertaining to the operating system
'''
grains = {
'num_gpus': 0,
'gpus': [],
}
# Windows Server 2008 64-bit
# ('Windows', 'MINIONNAME', '2008ServerR2', '6.1.7601', 'AMD64',
# 'Intel64 Fam ily 6 Model 23 Stepping 6, GenuineIntel')
... | Return grains pertaining to the operating system | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L1587-L2084 | [
"def _memdata(osdata):\n '''\n Gather information about the system memory\n '''\n # Provides:\n # mem_total\n # swap_total, for supported systems.\n grains = {'mem_total': 0}\n if osdata['kernel'] == 'Linux':\n grains.update(_linux_memdata())\n elif osdata['kernel'] in ('FreeBS... | # -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | locale_info | python | def locale_info():
'''
Provides
defaultlanguage
defaultencoding
'''
grains = {}
grains['locale_info'] = {}
if salt.utils.platform.is_proxy():
return grains
try:
(
grains['locale_info']['defaultlanguage'],
grains['locale_info']['defaul... | Provides
defaultlanguage
defaultencoding | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L2087-L2112 | null | # -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | hostname | python | def hostname():
'''
Return fqdn, hostname, domainname
'''
# This is going to need some work
# Provides:
# fqdn
# host
# localhost
# domain
global __FQDN__
grains = {}
if salt.utils.platform.is_proxy():
return grains
grains['localhost'] = socket.getho... | Return fqdn, hostname, domainname | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L2115-L2146 | null | # -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | append_domain | python | def append_domain():
'''
Return append_domain if set
'''
grain = {}
if salt.utils.platform.is_proxy():
return grain
if 'append_domain' in __opts__:
grain['append_domain'] = __opts__['append_domain']
return grain | Return append_domain if set | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L2149-L2161 | null | # -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
saltstack/salt | salt/grains/core.py | fqdns | python | def fqdns():
'''
Return all known FQDNs for the system by enumerating all interfaces and
then trying to reverse resolve them (excluding 'lo' interface).
'''
# Provides:
# fqdns
grains = {}
fqdns = set()
addresses = salt.utils.network.ip_addrs(include_loopback=False, interface_data=... | Return all known FQDNs for the system by enumerating all interfaces and
then trying to reverse resolve them (excluding 'lo' interface). | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/core.py#L2164-L2191 | [
"def _get_interfaces():\n '''\n Provide a dict of the connected interfaces and their ip addresses\n '''\n\n global _INTERFACES\n if not _INTERFACES:\n _INTERFACES = salt.utils.network.interfaces()\n return _INTERFACES\n",
"def ip_addrs(interface=None, include_loopback=False, interface_dat... | # -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.