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/cloud/clouds/digitalocean.py | show_pricing | python | def show_pricing(kwargs=None, call=None):
'''
Show pricing for a particular profile. This is only an estimate, based on
unofficial pricing sources.
.. versionadded:: 2015.8.0
CLI Examples:
.. code-block:: bash
salt-cloud -f show_pricing my-digitalocean-config profile=my-profile
'... | Show pricing for a particular profile. This is only an estimate, based on
unofficial pricing sources.
.. versionadded:: 2015.8.0
CLI Examples:
.. code-block:: bash
salt-cloud -f show_pricing my-digitalocean-config profile=my-profile | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/digitalocean.py#L939-L975 | [
"def avail_sizes(call=None):\n '''\n Return a list of the image sizes that are on the provider\n '''\n if call == 'action':\n raise SaltCloudSystemExit(\n 'The avail_sizes function must be called with '\n '-f or --function, or with the --list-sizes option'\n )\n\n ... | # -*- coding: utf-8 -*-
'''
DigitalOcean Cloud Module
=========================
The DigitalOcean cloud module is used to control access to the DigitalOcean VPS system.
Use of this module requires a requires a ``personal_access_token``, an ``ssh_key_file``,
and at least one SSH key name in ``ssh_key_names``. More ``ss... |
saltstack/salt | salt/cloud/clouds/digitalocean.py | show_floating_ip | python | def show_floating_ip(kwargs=None, call=None):
'''
Show the details of a floating IP
.. versionadded:: 2016.3.0
CLI Examples:
.. code-block:: bash
salt-cloud -f show_floating_ip my-digitalocean-config floating_ip='45.55.96.47'
'''
if call != 'function':
log.error(
... | Show the details of a floating IP
.. versionadded:: 2016.3.0
CLI Examples:
.. code-block:: bash
salt-cloud -f show_floating_ip my-digitalocean-config floating_ip='45.55.96.47' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/digitalocean.py#L1018-L1048 | [
"def query(method='droplets', droplet_id=None, command=None, args=None, http_method='get'):\n '''\n Make a web call to DigitalOcean\n '''\n base_path = six.text_type(config.get_cloud_config_value(\n 'api_root',\n get_configured_provider(),\n __opts__,\n search_global=False,\n... | # -*- coding: utf-8 -*-
'''
DigitalOcean Cloud Module
=========================
The DigitalOcean cloud module is used to control access to the DigitalOcean VPS system.
Use of this module requires a requires a ``personal_access_token``, an ``ssh_key_file``,
and at least one SSH key name in ``ssh_key_names``. More ``ss... |
saltstack/salt | salt/cloud/clouds/digitalocean.py | create_floating_ip | python | def create_floating_ip(kwargs=None, call=None):
'''
Create a new floating IP
.. versionadded:: 2016.3.0
CLI Examples:
.. code-block:: bash
salt-cloud -f create_floating_ip my-digitalocean-config region='NYC2'
salt-cloud -f create_floating_ip my-digitalocean-config droplet_id='12... | Create a new floating IP
.. versionadded:: 2016.3.0
CLI Examples:
.. code-block:: bash
salt-cloud -f create_floating_ip my-digitalocean-config region='NYC2'
salt-cloud -f create_floating_ip my-digitalocean-config droplet_id='1234567' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/digitalocean.py#L1051-L1090 | [
"def query(method='droplets', droplet_id=None, command=None, args=None, http_method='get'):\n '''\n Make a web call to DigitalOcean\n '''\n base_path = six.text_type(config.get_cloud_config_value(\n 'api_root',\n get_configured_provider(),\n __opts__,\n search_global=False,\n... | # -*- coding: utf-8 -*-
'''
DigitalOcean Cloud Module
=========================
The DigitalOcean cloud module is used to control access to the DigitalOcean VPS system.
Use of this module requires a requires a ``personal_access_token``, an ``ssh_key_file``,
and at least one SSH key name in ``ssh_key_names``. More ``ss... |
saltstack/salt | salt/cloud/clouds/digitalocean.py | delete_floating_ip | python | def delete_floating_ip(kwargs=None, call=None):
'''
Delete a floating IP
.. versionadded:: 2016.3.0
CLI Examples:
.. code-block:: bash
salt-cloud -f delete_floating_ip my-digitalocean-config floating_ip='45.55.96.47'
'''
if call != 'function':
log.error(
'The ... | Delete a floating IP
.. versionadded:: 2016.3.0
CLI Examples:
.. code-block:: bash
salt-cloud -f delete_floating_ip my-digitalocean-config floating_ip='45.55.96.47' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/digitalocean.py#L1093-L1125 | [
"def query(method='droplets', droplet_id=None, command=None, args=None, http_method='get'):\n '''\n Make a web call to DigitalOcean\n '''\n base_path = six.text_type(config.get_cloud_config_value(\n 'api_root',\n get_configured_provider(),\n __opts__,\n search_global=False,\n... | # -*- coding: utf-8 -*-
'''
DigitalOcean Cloud Module
=========================
The DigitalOcean cloud module is used to control access to the DigitalOcean VPS system.
Use of this module requires a requires a ``personal_access_token``, an ``ssh_key_file``,
and at least one SSH key name in ``ssh_key_names``. More ``ss... |
saltstack/salt | salt/cloud/clouds/digitalocean.py | unassign_floating_ip | python | def unassign_floating_ip(kwargs=None, call=None):
'''
Unassign a floating IP
.. versionadded:: 2016.3.0
CLI Examples:
.. code-block:: bash
salt-cloud -f unassign_floating_ip my-digitalocean-config floating_ip='45.55.96.47'
'''
if call != 'function':
log.error(
... | Unassign a floating IP
.. versionadded:: 2016.3.0
CLI Examples:
.. code-block:: bash
salt-cloud -f unassign_floating_ip my-digitalocean-config floating_ip='45.55.96.47' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/digitalocean.py#L1161-L1191 | [
"def query(method='droplets', droplet_id=None, command=None, args=None, http_method='get'):\n '''\n Make a web call to DigitalOcean\n '''\n base_path = six.text_type(config.get_cloud_config_value(\n 'api_root',\n get_configured_provider(),\n __opts__,\n search_global=False,\n... | # -*- coding: utf-8 -*-
'''
DigitalOcean Cloud Module
=========================
The DigitalOcean cloud module is used to control access to the DigitalOcean VPS system.
Use of this module requires a requires a ``personal_access_token``, an ``ssh_key_file``,
and at least one SSH key name in ``ssh_key_names``. More ``ss... |
saltstack/salt | salt/cloud/clouds/digitalocean.py | _list_nodes | python | def _list_nodes(full=False, for_output=False):
'''
Helper function to format and parse node data.
'''
fetch = True
page = 1
ret = {}
while fetch:
items = query(method='droplets',
command='?page=' + six.text_type(page) + '&per_page=200')
for node in item... | Helper function to format and parse node data. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/digitalocean.py#L1194-L1228 | [
"def query(method='droplets', droplet_id=None, command=None, args=None, http_method='get'):\n '''\n Make a web call to DigitalOcean\n '''\n base_path = six.text_type(config.get_cloud_config_value(\n 'api_root',\n get_configured_provider(),\n __opts__,\n search_global=False,\n... | # -*- coding: utf-8 -*-
'''
DigitalOcean Cloud Module
=========================
The DigitalOcean cloud module is used to control access to the DigitalOcean VPS system.
Use of this module requires a requires a ``personal_access_token``, an ``ssh_key_file``,
and at least one SSH key name in ``ssh_key_names``. More ``ss... |
saltstack/salt | salt/cloud/clouds/digitalocean.py | reboot | python | def reboot(name, call=None):
'''
Reboot a droplet in DigitalOcean.
.. versionadded:: 2015.8.8
name
The name of the droplet to restart.
CLI Example:
.. code-block:: bash
salt-cloud -a reboot droplet_name
'''
if call != 'action':
raise SaltCloudSystemExit(
... | Reboot a droplet in DigitalOcean.
.. versionadded:: 2015.8.8
name
The name of the droplet to restart.
CLI Example:
.. code-block:: bash
salt-cloud -a reboot droplet_name | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/digitalocean.py#L1231-L1265 | [
"def query(method='droplets', droplet_id=None, command=None, args=None, http_method='get'):\n '''\n Make a web call to DigitalOcean\n '''\n base_path = six.text_type(config.get_cloud_config_value(\n 'api_root',\n get_configured_provider(),\n __opts__,\n search_global=False,\n... | # -*- coding: utf-8 -*-
'''
DigitalOcean Cloud Module
=========================
The DigitalOcean cloud module is used to control access to the DigitalOcean VPS system.
Use of this module requires a requires a ``personal_access_token``, an ``ssh_key_file``,
and at least one SSH key name in ``ssh_key_names``. More ``ss... |
saltstack/salt | salt/cloud/clouds/digitalocean.py | _get_full_output | python | def _get_full_output(node, for_output=False):
'''
Helper function for _list_nodes to loop through all node information.
Returns a dictionary containing the full information of a node.
'''
ret = {}
for item in six.iterkeys(node):
value = node[item]
if value is not None and for_out... | Helper function for _list_nodes to loop through all node information.
Returns a dictionary containing the full information of a node. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/digitalocean.py#L1342-L1353 | null | # -*- coding: utf-8 -*-
'''
DigitalOcean Cloud Module
=========================
The DigitalOcean cloud module is used to control access to the DigitalOcean VPS system.
Use of this module requires a requires a ``personal_access_token``, an ``ssh_key_file``,
and at least one SSH key name in ``ssh_key_names``. More ``ss... |
saltstack/salt | salt/cloud/clouds/digitalocean.py | _get_ips | python | def _get_ips(networks):
'''
Helper function for list_nodes. Returns public and private ip lists based on a
given network dictionary.
'''
v4s = networks.get('v4')
v6s = networks.get('v6')
public_ips = []
private_ips = []
if v4s:
for item in v4s:
ip_type = item.get... | Helper function for list_nodes. Returns public and private ip lists based on a
given network dictionary. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/digitalocean.py#L1356-L1384 | null | # -*- coding: utf-8 -*-
'''
DigitalOcean Cloud Module
=========================
The DigitalOcean cloud module is used to control access to the DigitalOcean VPS system.
Use of this module requires a requires a ``personal_access_token``, an ``ssh_key_file``,
and at least one SSH key name in ``ssh_key_names``. More ``ss... |
saltstack/salt | salt/modules/deb_postgres.py | cluster_create | python | def cluster_create(version,
name='main',
port=None,
locale=None,
encoding=None,
datadir=None,
allow_group_access=None,
data_checksums=None,
wal_segsize=None):
'''
... | Adds a cluster to the Postgres server.
.. warning:
Only works for debian family distros so far.
CLI Example:
.. code-block:: bash
salt '*' postgres.cluster_create '9.3'
salt '*' postgres.cluster_create '9.3' 'main'
salt '*' postgres.cluster_create '9.3' locale='fr_FR'
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/deb_postgres.py#L32-L85 | null | # -*- coding: utf-8 -*-
'''
Module to provide Postgres compatibility to salt for debian family specific tools.
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
import pipes
# Import salt libs
import salt.utils.path
from salt.ext import six
# Import 3rd... |
saltstack/salt | salt/modules/deb_postgres.py | cluster_list | python | def cluster_list(verbose=False):
'''
Return a list of cluster of Postgres server (tuples of version and name).
CLI Example:
.. code-block:: bash
salt '*' postgres.cluster_list
salt '*' postgres.cluster_list verbose=True
'''
cmd = [salt.utils.path.which('pg_lsclusters'), '--no... | Return a list of cluster of Postgres server (tuples of version and name).
CLI Example:
.. code-block:: bash
salt '*' postgres.cluster_list
salt '*' postgres.cluster_list verbose=True | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/deb_postgres.py#L88-L107 | [
"def _parse_pg_lscluster(output):\n '''\n Helper function to parse the output of pg_lscluster\n '''\n cluster_dict = {}\n for line in output.splitlines():\n version, name, port, status, user, datadir, log = (\n line.split())\n cluster_dict['{0}/{1}'.format(version, name)] = {... | # -*- coding: utf-8 -*-
'''
Module to provide Postgres compatibility to salt for debian family specific tools.
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
import pipes
# Import salt libs
import salt.utils.path
from salt.ext import six
# Import 3rd... |
saltstack/salt | salt/modules/deb_postgres.py | cluster_remove | python | def cluster_remove(version,
name='main',
stop=False):
'''
Remove a cluster on a Postgres server. By default it doesn't try
to stop the cluster.
CLI Example:
.. code-block:: bash
salt '*' postgres.cluster_remove '9.3'
salt '*' postgres.cluster... | Remove a cluster on a Postgres server. By default it doesn't try
to stop the cluster.
CLI Example:
.. code-block:: bash
salt '*' postgres.cluster_remove '9.3'
salt '*' postgres.cluster_remove '9.3' 'main'
salt '*' postgres.cluster_remove '9.3' 'main' stop=True | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/deb_postgres.py#L126-L156 | null | # -*- coding: utf-8 -*-
'''
Module to provide Postgres compatibility to salt for debian family specific tools.
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
import pipes
# Import salt libs
import salt.utils.path
from salt.ext import six
# Import 3rd... |
saltstack/salt | salt/modules/deb_postgres.py | _parse_pg_lscluster | python | def _parse_pg_lscluster(output):
'''
Helper function to parse the output of pg_lscluster
'''
cluster_dict = {}
for line in output.splitlines():
version, name, port, status, user, datadir, log = (
line.split())
cluster_dict['{0}/{1}'.format(version, name)] = {
... | Helper function to parse the output of pg_lscluster | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/deb_postgres.py#L159-L173 | null | # -*- coding: utf-8 -*-
'''
Module to provide Postgres compatibility to salt for debian family specific tools.
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
import pipes
# Import salt libs
import salt.utils.path
from salt.ext import six
# Import 3rd... |
saltstack/salt | salt/grains/esxi.py | _find_credentials | python | def _find_credentials(host):
'''
Cycle through all the possible credentials and return the first one that
works.
'''
user_names = [__pillar__['proxy'].get('username', 'root')]
passwords = __pillar__['proxy']['passwords']
for user in user_names:
for password in passwords:
... | Cycle through all the possible credentials and return the first one that
works. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/esxi.py#L59-L80 | null | # -*- coding: utf-8 -*-
'''
Generate baseline proxy minion grains for ESXi hosts.
.. versionadded:: 2015.8.4
'''
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
# Import Salt Libs
from salt.exceptions import SaltSystemExit
import salt.utils.platform
impor... |
saltstack/salt | salt/grains/esxi.py | _grains | python | def _grains():
'''
Get the grains from the proxied device.
'''
try:
host = __pillar__['proxy']['host']
if host:
username, password = _find_credentials(host)
protocol = __pillar__['proxy'].get('protocol')
port = __pillar__['proxy'].get('port')
... | Get the grains from the proxied device. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/esxi.py#L83-L102 | [
"def _find_credentials(host):\n '''\n Cycle through all the possible credentials and return the first one that\n works.\n '''\n user_names = [__pillar__['proxy'].get('username', 'root')]\n passwords = __pillar__['proxy']['passwords']\n for user in user_names:\n for password in passwords:... | # -*- coding: utf-8 -*-
'''
Generate baseline proxy minion grains for ESXi hosts.
.. versionadded:: 2015.8.4
'''
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
# Import Salt Libs
from salt.exceptions import SaltSystemExit
import salt.utils.platform
impor... |
saltstack/salt | salt/pillar/etcd_pillar.py | ext_pillar | python | def ext_pillar(minion_id,
pillar, # pylint: disable=W0613
conf):
'''
Check etcd for all data
'''
comps = conf.split()
profile = None
if comps[0]:
profile = comps[0]
client = salt.utils.etcd_util.get_conn(__opts__, profile)
path = '/'
if len(co... | Check etcd for all data | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/etcd_pillar.py#L86-L114 | [
"def tree(client, path):\n return client.tree(path)\n",
"def get_conn(opts, profile=None, **kwargs):\n client = EtcdClient(opts, profile, **kwargs)\n return client\n"
] | # -*- coding: utf-8 -*-
'''
Use etcd data as a Pillar source
.. versionadded:: 2014.7.0
:depends: - python-etcd
In order to use an etcd server, a profile must be created in the master
configuration file:
.. code-block:: yaml
my_etcd_config:
etcd.host: 127.0.0.1
etcd.port: 4001
After the profile i... |
saltstack/salt | salt/states/csf.py | rule_absent | python | def rule_absent(name,
method,
port=None,
proto='tcp',
direction='in',
port_origin='d',
ip_origin='s',
ttl=None,
reload=False):
'''
Ensure iptable is not present.
name
The ... | Ensure iptable is not present.
name
The ip address or CIDR for the rule.
method
The type of rule. Either 'allow' or 'deny'.
port
Optional port to be open or closed for the
iptables rule.
proto
The protocol. Either 'tcp', 'udp'.
Only applicable if port... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/csf.py#L131-L217 | null | # -*- coding: utf-8 -*-
'''
CSF Ip tables management
========================
:depends: - csf utility
:configuration: See http://download.configserver.com/csf/install.txt
for setup instructions.
.. code-block:: yaml
Simply allow/deny rules:
csf.rule_present:
ip: 1.2.3.4
method: allow
'''... |
saltstack/salt | salt/states/csf.py | ports_open | python | def ports_open(name, ports, proto='tcp', direction='in'):
'''
Ensure ports are open for a protocol, in a direction.
e.g. - proto='tcp', direction='in' would set the values
for TCP_IN in the csf.conf file.
ports
A list of ports that should be open.
proto
The protocol. May be one... | Ensure ports are open for a protocol, in a direction.
e.g. - proto='tcp', direction='in' would set the values
for TCP_IN in the csf.conf file.
ports
A list of ports that should be open.
proto
The protocol. May be one of 'tcp', 'udp',
'tcp6', or 'udp6'.
direction
Ch... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/csf.py#L220-L258 | null | # -*- coding: utf-8 -*-
'''
CSF Ip tables management
========================
:depends: - csf utility
:configuration: See http://download.configserver.com/csf/install.txt
for setup instructions.
.. code-block:: yaml
Simply allow/deny rules:
csf.rule_present:
ip: 1.2.3.4
method: allow
'''... |
saltstack/salt | salt/states/csf.py | nics_skip | python | def nics_skip(name, nics, ipv6):
'''
Alias for :mod:`csf.nics_skipped <salt.states.csf.nics_skipped>`
'''
return nics_skipped(name, nics=nics, ipv6=ipv6) | Alias for :mod:`csf.nics_skipped <salt.states.csf.nics_skipped>` | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/csf.py#L261-L265 | [
"def nics_skipped(name, nics, ipv6=False):\n '''\n name\n Meaningless arg, but required for state.\n\n nics\n A list of nics to skip.\n\n ipv6\n Boolean. Set to true if you want to skip\n the ipv6 interface. Default false (ipv4).\n '''\n ret = {'name': ','.join(nics),\n... | # -*- coding: utf-8 -*-
'''
CSF Ip tables management
========================
:depends: - csf utility
:configuration: See http://download.configserver.com/csf/install.txt
for setup instructions.
.. code-block:: yaml
Simply allow/deny rules:
csf.rule_present:
ip: 1.2.3.4
method: allow
'''... |
saltstack/salt | salt/states/csf.py | nics_skipped | python | def nics_skipped(name, nics, ipv6=False):
'''
name
Meaningless arg, but required for state.
nics
A list of nics to skip.
ipv6
Boolean. Set to true if you want to skip
the ipv6 interface. Default false (ipv4).
'''
ret = {'name': ','.join(nics),
'change... | name
Meaningless arg, but required for state.
nics
A list of nics to skip.
ipv6
Boolean. Set to true if you want to skip
the ipv6 interface. Default false (ipv4). | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/csf.py#L268-L290 | null | # -*- coding: utf-8 -*-
'''
CSF Ip tables management
========================
:depends: - csf utility
:configuration: See http://download.configserver.com/csf/install.txt
for setup instructions.
.. code-block:: yaml
Simply allow/deny rules:
csf.rule_present:
ip: 1.2.3.4
method: allow
'''... |
saltstack/salt | salt/states/csf.py | option_present | python | def option_present(name, value, reload=False):
'''
Ensure the state of a particular option/setting in csf.
name
The option name in csf.conf
value
The value it should be set to.
reload
Boolean. If set to true, csf will be reloaded after.
'''
ret = {'name': 'testing ... | Ensure the state of a particular option/setting in csf.
name
The option name in csf.conf
value
The value it should be set to.
reload
Boolean. If set to true, csf will be reloaded after. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/csf.py#L350-L389 | null | # -*- coding: utf-8 -*-
'''
CSF Ip tables management
========================
:depends: - csf utility
:configuration: See http://download.configserver.com/csf/install.txt
for setup instructions.
.. code-block:: yaml
Simply allow/deny rules:
csf.rule_present:
ip: 1.2.3.4
method: allow
'''... |
saltstack/salt | salt/pillar/stack.py | _parse_stack_cfg | python | def _parse_stack_cfg(content):
'''
Allow top level cfg to be YAML
'''
try:
obj = salt.utils.yaml.safe_load(content)
if isinstance(obj, list):
return obj
except Exception as e:
pass
return content.splitlines() | Allow top level cfg to be YAML | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/stack.py#L529-L539 | null | # -*- coding: utf-8 -*-
'''
Simple and flexible YAML ext_pillar which can read pillar from within pillar.
.. versionadded:: 2016.3.0
`PillarStack <https://github.com/bbinet/pillarstack>`_ is a custom saltstack
``ext_pillar`` which was inspired by `varstack
<https://github.com/conversis/varstack>`_ but is heavily base... |
saltstack/salt | salt/modules/pip.py | _clear_context | python | def _clear_context(bin_env=None):
'''
Remove the cached pip version
'''
contextkey = 'pip.version'
if bin_env is not None:
contextkey = '{0}.{1}'.format(contextkey, bin_env)
__context__.pop(contextkey, None) | Remove the cached pip version | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pip.py#L131-L138 | null | # -*- coding: utf-8 -*-
r'''
Install Python packages with pip to either the system or a virtualenv
Windows Support
===============
.. versionadded:: 2014.7.4
Salt now uses a portable python. As a result the entire pip module is now
functional on the salt installation itself. You can pip install dependencies
for your... |
saltstack/salt | salt/modules/pip.py | _get_pip_bin | python | def _get_pip_bin(bin_env):
'''
Locate the pip binary, either from `bin_env` as a virtualenv, as the
executable itself, or from searching conventional filesystem locations
'''
if not bin_env:
logger.debug('pip: Using pip from currently-running Python')
return [os.path.normpath(sys.exe... | Locate the pip binary, either from `bin_env` as a virtualenv, as the
executable itself, or from searching conventional filesystem locations | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pip.py#L141-L193 | [
"def _search_paths(*basedirs):\n ret = []\n for path in basedirs:\n ret.extend([\n os.path.join(path, python_bin),\n os.path.join(path, 'bin', python_bin),\n os.path.join(path, 'Scripts', python_bin)\n ])\n return ret\n"
] | # -*- coding: utf-8 -*-
r'''
Install Python packages with pip to either the system or a virtualenv
Windows Support
===============
.. versionadded:: 2014.7.4
Salt now uses a portable python. As a result the entire pip module is now
functional on the salt installation itself. You can pip install dependencies
for your... |
saltstack/salt | salt/modules/pip.py | _get_cached_requirements | python | def _get_cached_requirements(requirements, saltenv):
'''
Get the location of a cached requirements file; caching if necessary.
'''
req_file, senv = salt.utils.url.parse(requirements)
if senv:
saltenv = senv
if req_file not in __salt__['cp.list_master'](saltenv):
# Requirements ... | Get the location of a cached requirements file; caching if necessary. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pip.py#L196-L224 | null | # -*- coding: utf-8 -*-
r'''
Install Python packages with pip to either the system or a virtualenv
Windows Support
===============
.. versionadded:: 2014.7.4
Salt now uses a portable python. As a result the entire pip module is now
functional on the salt installation itself. You can pip install dependencies
for your... |
saltstack/salt | salt/modules/pip.py | _get_env_activate | python | def _get_env_activate(bin_env):
'''
Return the path to the activate binary
'''
if not bin_env:
raise CommandNotFoundError('Could not find a `activate` binary')
if os.path.isdir(bin_env):
if salt.utils.platform.is_windows():
activate_bin = os.path.join(bin_env, 'Scripts',... | Return the path to the activate binary | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pip.py#L227-L241 | null | # -*- coding: utf-8 -*-
r'''
Install Python packages with pip to either the system or a virtualenv
Windows Support
===============
.. versionadded:: 2014.7.4
Salt now uses a portable python. As a result the entire pip module is now
functional on the salt installation itself. You can pip install dependencies
for your... |
saltstack/salt | salt/modules/pip.py | _resolve_requirements_chain | python | def _resolve_requirements_chain(requirements):
'''
Return an array of requirements file paths that can be used to complete
the no_chown==False && user != None conundrum
'''
chain = []
if isinstance(requirements, six.string_types):
requirements = [requirements]
for req_file in requ... | Return an array of requirements file paths that can be used to complete
the no_chown==False && user != None conundrum | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pip.py#L259-L274 | null | # -*- coding: utf-8 -*-
r'''
Install Python packages with pip to either the system or a virtualenv
Windows Support
===============
.. versionadded:: 2014.7.4
Salt now uses a portable python. As a result the entire pip module is now
functional on the salt installation itself. You can pip install dependencies
for your... |
saltstack/salt | salt/modules/pip.py | _process_requirements | python | def _process_requirements(requirements, cmd, cwd, saltenv, user):
'''
Process the requirements argument
'''
cleanup_requirements = []
if requirements is not None:
if isinstance(requirements, six.string_types):
requirements = [r.strip() for r in requirements.split(',')]
e... | Process the requirements argument | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pip.py#L277-L383 | null | # -*- coding: utf-8 -*-
r'''
Install Python packages with pip to either the system or a virtualenv
Windows Support
===============
.. versionadded:: 2014.7.4
Salt now uses a portable python. As a result the entire pip module is now
functional on the salt installation itself. You can pip install dependencies
for your... |
saltstack/salt | salt/modules/pip.py | install | python | def install(pkgs=None, # pylint: disable=R0912,R0913,R0914
requirements=None,
bin_env=None,
use_wheel=False,
no_use_wheel=False,
log=None,
proxy=None,
timeout=None,
editable=None,
find_links=None,
in... | Install packages with pip
Install packages individually or from a pip requirements file. Install
packages globally or to a virtualenv.
pkgs
Comma separated list of packages to install
requirements
Path to requirements
bin_env
Path to pip (or to a virtualenv). This can be ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pip.py#L402-L961 | [
"def version(bin_env=None):\n '''\n .. versionadded:: 0.17.0\n\n Returns the version of pip. Use ``bin_env`` to specify the path to a\n virtualenv and get the version of pip in that virtualenv.\n\n If unable to detect the pip version, returns ``None``.\n\n CLI Example:\n\n .. code-block:: bash\... | # -*- coding: utf-8 -*-
r'''
Install Python packages with pip to either the system or a virtualenv
Windows Support
===============
.. versionadded:: 2014.7.4
Salt now uses a portable python. As a result the entire pip module is now
functional on the salt installation itself. You can pip install dependencies
for your... |
saltstack/salt | salt/modules/pip.py | uninstall | python | def uninstall(pkgs=None,
requirements=None,
bin_env=None,
log=None,
proxy=None,
timeout=None,
user=None,
cwd=None,
saltenv='base',
use_vt=False):
'''
Uninstall packages individually or f... | Uninstall packages individually or from a pip requirements file
pkgs
comma separated list of packages to install
requirements
Path to requirements file
bin_env
Path to pip (or to a virtualenv). This can be used to specify the path
to the pip to use when more than one Pytho... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pip.py#L964-L1086 | [
"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 -*-
r'''
Install Python packages with pip to either the system or a virtualenv
Windows Support
===============
.. versionadded:: 2014.7.4
Salt now uses a portable python. As a result the entire pip module is now
functional on the salt installation itself. You can pip install dependencies
for your... |
saltstack/salt | salt/modules/pip.py | freeze | python | def freeze(bin_env=None,
user=None,
cwd=None,
use_vt=False,
env_vars=None,
**kwargs):
'''
Return a list of installed packages either globally or in the specified
virtualenv
bin_env
Path to pip (or to a virtualenv). This can be used to speci... | Return a list of installed packages either globally or in the specified
virtualenv
bin_env
Path to pip (or to a virtualenv). This can be used to specify the path
to the pip to use when more than one Python release is installed (e.g.
``/usr/bin/pip-2.7`` or ``/usr/bin/pip-2.6``. If a dir... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pip.py#L1089-L1149 | [
"def version(bin_env=None):\n '''\n .. versionadded:: 0.17.0\n\n Returns the version of pip. Use ``bin_env`` to specify the path to a\n virtualenv and get the version of pip in that virtualenv.\n\n If unable to detect the pip version, returns ``None``.\n\n CLI Example:\n\n .. code-block:: bash\... | # -*- coding: utf-8 -*-
r'''
Install Python packages with pip to either the system or a virtualenv
Windows Support
===============
.. versionadded:: 2014.7.4
Salt now uses a portable python. As a result the entire pip module is now
functional on the salt installation itself. You can pip install dependencies
for your... |
saltstack/salt | salt/modules/pip.py | list_ | python | def list_(prefix=None,
bin_env=None,
user=None,
cwd=None,
env_vars=None,
**kwargs):
'''
Filter list of installed apps from ``freeze`` and check to see if
``prefix`` exists in the list of packages installed.
.. note::
If the version of pip avail... | Filter list of installed apps from ``freeze`` and check to see if
``prefix`` exists in the list of packages installed.
.. note::
If the version of pip available is older than 8.0.3, the packages
``wheel``, ``setuptools``, and ``distribute`` will not be reported by
this function even if... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pip.py#L1152-L1220 | [
"def version(bin_env=None):\n '''\n .. versionadded:: 0.17.0\n\n Returns the version of pip. Use ``bin_env`` to specify the path to a\n virtualenv and get the version of pip in that virtualenv.\n\n If unable to detect the pip version, returns ``None``.\n\n CLI Example:\n\n .. code-block:: bash\... | # -*- coding: utf-8 -*-
r'''
Install Python packages with pip to either the system or a virtualenv
Windows Support
===============
.. versionadded:: 2014.7.4
Salt now uses a portable python. As a result the entire pip module is now
functional on the salt installation itself. You can pip install dependencies
for your... |
saltstack/salt | salt/modules/pip.py | version | python | def version(bin_env=None):
'''
.. versionadded:: 0.17.0
Returns the version of pip. Use ``bin_env`` to specify the path to a
virtualenv and get the version of pip in that virtualenv.
If unable to detect the pip version, returns ``None``.
CLI Example:
.. code-block:: bash
salt '*... | .. versionadded:: 0.17.0
Returns the version of pip. Use ``bin_env`` to specify the path to a
virtualenv and get the version of pip in that virtualenv.
If unable to detect the pip version, returns ``None``.
CLI Example:
.. code-block:: bash
salt '*' pip.version | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pip.py#L1223-L1258 | [
"def _get_pip_bin(bin_env):\n '''\n Locate the pip binary, either from `bin_env` as a virtualenv, as the\n executable itself, or from searching conventional filesystem locations\n '''\n if not bin_env:\n logger.debug('pip: Using pip from currently-running Python')\n return [os.path.norm... | # -*- coding: utf-8 -*-
r'''
Install Python packages with pip to either the system or a virtualenv
Windows Support
===============
.. versionadded:: 2014.7.4
Salt now uses a portable python. As a result the entire pip module is now
functional on the salt installation itself. You can pip install dependencies
for your... |
saltstack/salt | salt/modules/pip.py | list_upgrades | python | def list_upgrades(bin_env=None,
user=None,
cwd=None):
'''
Check whether or not an upgrade is available for all packages
CLI Example:
.. code-block:: bash
salt '*' pip.list_upgrades
'''
cmd = _get_pip_bin(bin_env)
cmd.extend(['list', '--outdated'... | Check whether or not an upgrade is available for all packages
CLI Example:
.. code-block:: bash
salt '*' pip.list_upgrades | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pip.py#L1261-L1336 | [
"def version(bin_env=None):\n '''\n .. versionadded:: 0.17.0\n\n Returns the version of pip. Use ``bin_env`` to specify the path to a\n virtualenv and get the version of pip in that virtualenv.\n\n If unable to detect the pip version, returns ``None``.\n\n CLI Example:\n\n .. code-block:: bash\... | # -*- coding: utf-8 -*-
r'''
Install Python packages with pip to either the system or a virtualenv
Windows Support
===============
.. versionadded:: 2014.7.4
Salt now uses a portable python. As a result the entire pip module is now
functional on the salt installation itself. You can pip install dependencies
for your... |
saltstack/salt | salt/modules/pip.py | is_installed | python | def is_installed(pkgname=None,
bin_env=None,
user=None,
cwd=None):
'''
.. versionadded:: 2018.3.0
Filter list of installed apps from ``freeze`` and return True or False if
``pkgname`` exists in the list of packages installed.
.. note::
If... | .. versionadded:: 2018.3.0
Filter list of installed apps from ``freeze`` and return True or False if
``pkgname`` exists in the list of packages installed.
.. note::
If the version of pip available is older than 8.0.3, the packages
wheel, setuptools, and distribute will not be reported by ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pip.py#L1339-L1387 | [
"def freeze(bin_env=None,\n user=None,\n cwd=None,\n use_vt=False,\n env_vars=None,\n **kwargs):\n '''\n Return a list of installed packages either globally or in the specified\n virtualenv\n\n bin_env\n Path to pip (or to a virtualenv). This can ... | # -*- coding: utf-8 -*-
r'''
Install Python packages with pip to either the system or a virtualenv
Windows Support
===============
.. versionadded:: 2014.7.4
Salt now uses a portable python. As a result the entire pip module is now
functional on the salt installation itself. You can pip install dependencies
for your... |
saltstack/salt | salt/modules/pip.py | upgrade_available | python | def upgrade_available(pkg,
bin_env=None,
user=None,
cwd=None):
'''
.. versionadded:: 2015.5.0
Check whether or not an upgrade is available for a given package
CLI Example:
.. code-block:: bash
salt '*' pip.upgrade_availabl... | .. versionadded:: 2015.5.0
Check whether or not an upgrade is available for a given package
CLI Example:
.. code-block:: bash
salt '*' pip.upgrade_available <package name> | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pip.py#L1390-L1405 | [
"def list_upgrades(bin_env=None,\n user=None,\n cwd=None):\n '''\n Check whether or not an upgrade is available for all packages\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' pip.list_upgrades\n '''\n cmd = _get_pip_bin(bin_env)\n cmd.extend(['l... | # -*- coding: utf-8 -*-
r'''
Install Python packages with pip to either the system or a virtualenv
Windows Support
===============
.. versionadded:: 2014.7.4
Salt now uses a portable python. As a result the entire pip module is now
functional on the salt installation itself. You can pip install dependencies
for your... |
saltstack/salt | salt/modules/pip.py | upgrade | python | def upgrade(bin_env=None,
user=None,
cwd=None,
use_vt=False):
'''
.. versionadded:: 2015.5.0
Upgrades outdated pip packages.
.. note::
On Windows you can't update salt from pip using salt, so salt will be
skipped
Returns a dict containing the ch... | .. versionadded:: 2015.5.0
Upgrades outdated pip packages.
.. note::
On Windows you can't update salt from pip using salt, so salt will be
skipped
Returns a dict containing the changes.
{'<package>': {'old': '<old-version>',
'new': '<new-version>'}}
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pip.py#L1408-L1463 | [
"def list_(prefix=None,\n bin_env=None,\n user=None,\n cwd=None,\n env_vars=None,\n **kwargs):\n '''\n Filter list of installed apps from ``freeze`` and check to see if\n ``prefix`` exists in the list of packages installed.\n\n .. note::\n\n If the ver... | # -*- coding: utf-8 -*-
r'''
Install Python packages with pip to either the system or a virtualenv
Windows Support
===============
.. versionadded:: 2014.7.4
Salt now uses a portable python. As a result the entire pip module is now
functional on the salt installation itself. You can pip install dependencies
for your... |
saltstack/salt | salt/modules/pip.py | list_all_versions | python | def list_all_versions(pkg,
bin_env=None,
include_alpha=False,
include_beta=False,
include_rc=False,
user=None,
cwd=None,
index_url=None,
extra_i... | .. versionadded:: 2017.7.3
List all available versions of a pip package
pkg
The package to check
bin_env
Path to pip (or to a virtualenv). This can be used to specify the path
to the pip to use when more than one Python release is installed (e.g.
``/usr/bin/pip-2.7`` or ``... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pip.py#L1466-L1563 | [
"def validate(url, protos):\n '''\n Return true if the passed URL scheme is in the list of accepted protos\n '''\n if urlparse(url).scheme in protos:\n return True\n return False\n",
"def _get_pip_bin(bin_env):\n '''\n Locate the pip binary, either from `bin_env` as a virtualenv, as th... | # -*- coding: utf-8 -*-
r'''
Install Python packages with pip to either the system or a virtualenv
Windows Support
===============
.. versionadded:: 2014.7.4
Salt now uses a portable python. As a result the entire pip module is now
functional on the salt installation itself. You can pip install dependencies
for your... |
saltstack/salt | salt/netapi/rest_cherrypy/__init__.py | verify_certs | python | def verify_certs(*args):
'''
Sanity checking for the specified SSL certificates
'''
msg = ("Could not find a certificate: {0}\n"
"If you want to quickly generate a self-signed certificate, "
"use the tls.create_self_signed_cert function in Salt")
for arg in args:
if ... | Sanity checking for the specified SSL certificates | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/__init__.py#L62-L72 | null | # encoding: utf-8
'''
A script to start the CherryPy WSGI server
This is run by ``salt-api`` and started in a multiprocess.
'''
from __future__ import absolute_import, print_function, unicode_literals
# pylint: disable=C0103
# Import Python libs
import logging
import os
# Import CherryPy without traceback so we can ... |
saltstack/salt | salt/netapi/rest_cherrypy/__init__.py | start | python | def start():
'''
Start the server loop
'''
from . import app
root, apiopts, conf = app.get_app(__opts__)
if not apiopts.get('disable_ssl', False):
if 'ssl_crt' not in apiopts or 'ssl_key' not in apiopts:
logger.error("Not starting '%s'. Options 'ssl_crt' and "
... | Start the server loop | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/__init__.py#L75-L98 | null | # encoding: utf-8
'''
A script to start the CherryPy WSGI server
This is run by ``salt-api`` and started in a multiprocess.
'''
from __future__ import absolute_import, print_function, unicode_literals
# pylint: disable=C0103
# Import Python libs
import logging
import os
# Import CherryPy without traceback so we can ... |
saltstack/salt | salt/utils/pkg/rpm.py | get_osarch | python | def get_osarch():
'''
Get the os architecture using rpm --eval
'''
if salt.utils.path.which('rpm'):
ret = subprocess.Popen(
'rpm --eval "%{_host_cpu}"',
shell=True,
close_fds=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE).communi... | Get the os architecture using rpm --eval | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/rpm.py#L46-L60 | [
"def to_str(s, encoding=None, errors='strict', normalize=False):\n '''\n Given str, bytes, bytearray, or unicode (py2), return str\n '''\n def _normalize(s):\n try:\n return unicodedata.normalize('NFC', s) if normalize else s\n except TypeError:\n return s\n\n if e... | # -*- coding: utf-8 -*-
'''
Common functions for working with RPM packages
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import collections
import datetime
import logging
import subprocess
import platform
import salt.utils.stringutils
import salt.utils.path
# Import... |
saltstack/salt | salt/utils/pkg/rpm.py | check_32 | python | def check_32(arch, osarch=None):
'''
Returns True if both the OS arch and the passed arch are 32-bit
'''
if osarch is None:
osarch = get_osarch()
return all(x in ARCHES_32 for x in (osarch, arch)) | Returns True if both the OS arch and the passed arch are 32-bit | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/rpm.py#L63-L69 | [
"def get_osarch():\n '''\n Get the os architecture using rpm --eval\n '''\n if salt.utils.path.which('rpm'):\n ret = subprocess.Popen(\n 'rpm --eval \"%{_host_cpu}\"',\n shell=True,\n close_fds=True,\n stdout=subprocess.PIPE,\n stderr=subproc... | # -*- coding: utf-8 -*-
'''
Common functions for working with RPM packages
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import collections
import datetime
import logging
import subprocess
import platform
import salt.utils.stringutils
import salt.utils.path
# Import... |
saltstack/salt | salt/utils/pkg/rpm.py | pkginfo | python | def pkginfo(name, version, arch, repoid, install_date=None, install_date_time_t=None):
'''
Build and return a pkginfo namedtuple
'''
pkginfo_tuple = collections.namedtuple(
'PkgInfo',
('name', 'version', 'arch', 'repoid', 'install_date',
'install_date_time_t')
)
return p... | Build and return a pkginfo namedtuple | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/rpm.py#L72-L82 | null | # -*- coding: utf-8 -*-
'''
Common functions for working with RPM packages
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import collections
import datetime
import logging
import subprocess
import platform
import salt.utils.stringutils
import salt.utils.path
# Import... |
saltstack/salt | salt/utils/pkg/rpm.py | resolve_name | python | def resolve_name(name, arch, osarch=None):
'''
Resolve the package name and arch into a unique name referred to by salt.
For example, on a 64-bit OS, a 32-bit package will be pkgname.i386.
'''
if osarch is None:
osarch = get_osarch()
if not check_32(arch, osarch) and arch not in (ARCHMA... | Resolve the package name and arch into a unique name referred to by salt.
For example, on a 64-bit OS, a 32-bit package will be pkgname.i386. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/rpm.py#L85-L95 | [
"def get_osarch():\n '''\n Get the os architecture using rpm --eval\n '''\n if salt.utils.path.which('rpm'):\n ret = subprocess.Popen(\n 'rpm --eval \"%{_host_cpu}\"',\n shell=True,\n close_fds=True,\n stdout=subprocess.PIPE,\n stderr=subproc... | # -*- coding: utf-8 -*-
'''
Common functions for working with RPM packages
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import collections
import datetime
import logging
import subprocess
import platform
import salt.utils.stringutils
import salt.utils.path
# Import... |
saltstack/salt | salt/utils/pkg/rpm.py | parse_pkginfo | python | def parse_pkginfo(line, osarch=None):
'''
A small helper to parse an rpm/repoquery command's output. Returns a
pkginfo namedtuple.
'''
try:
name, epoch, version, release, arch, repoid, install_time = line.split('_|-')
# Handle unpack errors (should never happen with the queryformat we ar... | A small helper to parse an rpm/repoquery command's output. Returns a
pkginfo namedtuple. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/rpm.py#L98-L123 | [
"def pkginfo(name, version, arch, repoid, install_date=None, install_date_time_t=None):\n '''\n Build and return a pkginfo namedtuple\n '''\n pkginfo_tuple = collections.namedtuple(\n 'PkgInfo',\n ('name', 'version', 'arch', 'repoid', 'install_date',\n 'install_date_time_t')\n )... | # -*- coding: utf-8 -*-
'''
Common functions for working with RPM packages
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import collections
import datetime
import logging
import subprocess
import platform
import salt.utils.stringutils
import salt.utils.path
# Import... |
saltstack/salt | salt/utils/pkg/rpm.py | combine_comments | python | def combine_comments(comments):
'''
Given a list of comments, strings, a single comment or a single string,
return a single string of text containing all of the comments, prepending
the '#' and joining with newlines as necessary.
'''
if not isinstance(comments, list):
comments = [comment... | Given a list of comments, strings, a single comment or a single string,
return a single string of text containing all of the comments, prepending
the '#' and joining with newlines as necessary. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/rpm.py#L126-L140 | null | # -*- coding: utf-8 -*-
'''
Common functions for working with RPM packages
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import collections
import datetime
import logging
import subprocess
import platform
import salt.utils.stringutils
import salt.utils.path
# Import... |
saltstack/salt | salt/utils/pkg/rpm.py | version_to_evr | python | def version_to_evr(verstring):
'''
Split the package version string into epoch, version and release.
Return this as tuple.
The epoch is always not empty. The version and the release can be an empty
string if such a component could not be found in the version string.
"2:1.0-1.2" => ('2', '1.0',... | Split the package version string into epoch, version and release.
Return this as tuple.
The epoch is always not empty. The version and the release can be an empty
string if such a component could not be found in the version string.
"2:1.0-1.2" => ('2', '1.0', '1.2)
"1.0" => ('0', '1.0', '')
""... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/rpm.py#L143-L175 | null | # -*- coding: utf-8 -*-
'''
Common functions for working with RPM packages
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import collections
import datetime
import logging
import subprocess
import platform
import salt.utils.stringutils
import salt.utils.path
# Import... |
saltstack/salt | salt/states/boto_secgroup.py | present | python | def present(
name,
description,
vpc_id=None,
vpc_name=None,
rules=None,
rules_egress=None,
delete_ingress_rules=True,
delete_egress_rules=True,
region=None,
key=None,
keyid=None,
profile=None,
tags=None):
'''
... | Ensure the security group exists with the specified rules.
name
Name of the security group.
description
A description of this security group.
vpc_id
The ID of the VPC to create the security group in, if any. Exclusive with vpc_name.
vpc_name
The name of the VPC to cre... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_secgroup.py#L127-L235 | [
"def update(dest, upd, recursive_update=True, merge_lists=False):\n '''\n Recursive version of the default dict.update\n\n Merges upd recursively into dest\n\n If recursive_update=False, will use the classic dict.update, or fall back\n on a manual merge (helpful for non-dict types like FunctionWrappe... | # -*- coding: utf-8 -*-
'''
Manage Security Groups
======================
.. versionadded:: 2014.7.0
Create and destroy Security Groups. Be aware that this interacts with Amazon's
services, and so may incur charges.
This module uses ``boto``, which can be installed via package, or pip.
This module accepts explicit ... |
saltstack/salt | salt/states/boto_secgroup.py | _security_group_present | python | def _security_group_present(name, description, vpc_id=None, vpc_name=None,
region=None, key=None, keyid=None, profile=None):
'''
given a group name or a group name and vpc id (or vpc name):
1. determine if the group exists
2. if the group does not exist, creates the group
... | given a group name or a group name and vpc id (or vpc name):
1. determine if the group exists
2. if the group does not exist, creates the group
3. return the group's configuration and any changes made | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_secgroup.py#L238-L270 | null | # -*- coding: utf-8 -*-
'''
Manage Security Groups
======================
.. versionadded:: 2014.7.0
Create and destroy Security Groups. Be aware that this interacts with Amazon's
services, and so may incur charges.
This module uses ``boto``, which can be installed via package, or pip.
This module accepts explicit ... |
saltstack/salt | salt/states/boto_secgroup.py | _split_rules | python | def _split_rules(rules):
'''
Split rules with lists into individual rules.
We accept some attributes as lists or strings. The data we get back from
the execution module lists rules as individual rules. We need to split the
provided rules into individual rules to compare them.
'''
split = []... | Split rules with lists into individual rules.
We accept some attributes as lists or strings. The data we get back from
the execution module lists rules as individual rules. We need to split the
provided rules into individual rules to compare them. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_secgroup.py#L273-L303 | null | # -*- coding: utf-8 -*-
'''
Manage Security Groups
======================
.. versionadded:: 2014.7.0
Create and destroy Security Groups. Be aware that this interacts with Amazon's
services, and so may incur charges.
This module uses ``boto``, which can be installed via package, or pip.
This module accepts explicit ... |
saltstack/salt | salt/states/boto_secgroup.py | _check_rule | python | def _check_rule(rule, _rule):
'''
Check to see if two rules are the same. Needed to compare rules fetched
from boto, since they may not completely match rules defined in sls files
but may be functionally equivalent.
'''
# We need to alter what Boto returns if no ports are specified
# so tha... | Check to see if two rules are the same. Needed to compare rules fetched
from boto, since they may not completely match rules defined in sls files
but may be functionally equivalent. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_secgroup.py#L306-L338 | null | # -*- coding: utf-8 -*-
'''
Manage Security Groups
======================
.. versionadded:: 2014.7.0
Create and destroy Security Groups. Be aware that this interacts with Amazon's
services, and so may incur charges.
This module uses ``boto``, which can be installed via package, or pip.
This module accepts explicit ... |
saltstack/salt | salt/states/boto_secgroup.py | _get_rule_changes | python | def _get_rule_changes(rules, _rules):
'''
given a list of desired rules (rules) and existing rules (_rules) return
a list of rules to delete (to_delete) and to create (to_create)
'''
to_delete = []
to_create = []
# for each rule in state file
# 1. validate rule
# 2. determine if rule... | given a list of desired rules (rules) and existing rules (_rules) return
a list of rules to delete (to_delete) and to create (to_create) | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_secgroup.py#L341-L405 | [
"def _check_rule(rule, _rule):\n '''\n Check to see if two rules are the same. Needed to compare rules fetched\n from boto, since they may not completely match rules defined in sls files\n but may be functionally equivalent.\n '''\n\n # We need to alter what Boto returns if no ports are specified\... | # -*- coding: utf-8 -*-
'''
Manage Security Groups
======================
.. versionadded:: 2014.7.0
Create and destroy Security Groups. Be aware that this interacts with Amazon's
services, and so may incur charges.
This module uses ``boto``, which can be installed via package, or pip.
This module accepts explicit ... |
saltstack/salt | salt/states/boto_secgroup.py | _rules_present | python | def _rules_present(name, rules, delete_ingress_rules=True, vpc_id=None,
vpc_name=None, region=None, key=None, keyid=None, profile=None):
'''
given a group name or group name and vpc_id (or vpc name):
1. get lists of desired rule changes (using _get_rule_changes)
2. authorize/create ru... | given a group name or group name and vpc_id (or vpc name):
1. get lists of desired rule changes (using _get_rule_changes)
2. authorize/create rules missing rules
3. if delete_ingress_rules is True, delete/revoke non-requested rules
4. return 'old' and 'new' group rules | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_secgroup.py#L408-L499 | null | # -*- coding: utf-8 -*-
'''
Manage Security Groups
======================
.. versionadded:: 2014.7.0
Create and destroy Security Groups. Be aware that this interacts with Amazon's
services, and so may incur charges.
This module uses ``boto``, which can be installed via package, or pip.
This module accepts explicit ... |
saltstack/salt | salt/states/boto_secgroup.py | absent | python | def absent(
name,
vpc_id=None,
vpc_name=None,
region=None,
key=None,
keyid=None,
profile=None):
'''
Ensure a security group with the specified name does not exist.
name
Name of the security group.
vpc_id
The ID of the VPC to remov... | Ensure a security group with the specified name does not exist.
name
Name of the security group.
vpc_id
The ID of the VPC to remove the security group from, if any. Exclusive with vpc_name.
vpc_name
The name of the VPC to remove the security group from, if any. Exclusive with vpc_... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_secgroup.py#L603-L663 | null | # -*- coding: utf-8 -*-
'''
Manage Security Groups
======================
.. versionadded:: 2014.7.0
Create and destroy Security Groups. Be aware that this interacts with Amazon's
services, and so may incur charges.
This module uses ``boto``, which can be installed via package, or pip.
This module accepts explicit ... |
saltstack/salt | salt/states/boto_secgroup.py | _tags_present | python | def _tags_present(name, tags, vpc_id=None, vpc_name=None, region=None,
key=None, keyid=None, profile=None):
'''
helper function to validate tags are correct
'''
ret = {'result': True, 'comment': '', 'changes': {}}
if tags:
sg = __salt__['boto_secgroup.get_config'](name=name... | helper function to validate tags are correct | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_secgroup.py#L666-L761 | null | # -*- coding: utf-8 -*-
'''
Manage Security Groups
======================
.. versionadded:: 2014.7.0
Create and destroy Security Groups. Be aware that this interacts with Amazon's
services, and so may incur charges.
This module uses ``boto``, which can be installed via package, or pip.
This module accepts explicit ... |
saltstack/salt | salt/states/ceph.py | _ordereddict2dict | python | def _ordereddict2dict(input_ordered_dict):
'''
Convert ordered dictionary to a dictionary
'''
return salt.utils.json.loads(salt.utils.json.dumps(input_ordered_dict)) | Convert ordered dictionary to a dictionary | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/ceph.py#L47-L51 | [
"def loads(s, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.loads and prevents a traceback in the event that a bytestring is\n passed to the function. (Python < 3.6 cannot load bytestrings)\n\n You can pass an alternate json module (loaded via import_json() above)\n using the _json_... | # -*- coding: utf-8 -*-
'''
Manage ceph with salt.
.. versionadded:: 2016.11.0
'''
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
# Import Salt Libs
import salt.utils.json
from salt.exceptions import CommandExecutionError, CommandNotFoundError
log = logg... |
saltstack/salt | salt/states/ceph.py | quorum | python | def quorum(name, **kwargs):
'''
Quorum state
This state checks the mon daemons are in quorum. It does not alter the
cluster but can be used in formula as a dependency for many cluster
operations.
Example usage in sls file:
.. code-block:: yaml
quorum:
sesceph.quorum:
... | Quorum state
This state checks the mon daemons are in quorum. It does not alter the
cluster but can be used in formula as a dependency for many cluster
operations.
Example usage in sls file:
.. code-block:: yaml
quorum:
sesceph.quorum:
- require:
- ses... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/ceph.py#L54-L83 | [
"def _ordereddict2dict(input_ordered_dict):\n '''\n Convert ordered dictionary to a dictionary\n '''\n return salt.utils.json.loads(salt.utils.json.dumps(input_ordered_dict))\n"
] | # -*- coding: utf-8 -*-
'''
Manage ceph with salt.
.. versionadded:: 2016.11.0
'''
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
# Import Salt Libs
import salt.utils.json
from salt.exceptions import CommandExecutionError, CommandNotFoundError
log = logg... |
saltstack/salt | salt/pillar/consul_pillar.py | ext_pillar | python | def ext_pillar(minion_id,
pillar, # pylint: disable=W0613
conf):
'''
Check consul for all data
'''
opts = {}
temp = conf
target_re = re.compile('target="(.*?)"')
match = target_re.search(temp)
if match:
opts['target'] = match.group(1)
temp =... | Check consul for all data | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/consul_pillar.py#L170-L254 | [
"def get_conn(opts, profile):\n\n '''\n Return a client object for accessing consul\n '''\n opts_pillar = opts.get('pillar', {})\n opts_master = opts_pillar.get('master', {})\n\n opts_merged = {}\n opts_merged.update(opts_master)\n opts_merged.update(opts_pillar)\n opts_merged.update(opts... | # -*- coding: utf-8 -*-
'''
Use Consul K/V as a Pillar source with values parsed as YAML
:depends: - python-consul
In order to use an consul server, a profile must be created in the master
configuration file:
.. code-block:: yaml
my_consul_config:
consul.host: 127.0.0.1
consul.port: 8500
cons... |
saltstack/salt | salt/pillar/consul_pillar.py | consul_fetch | python | def consul_fetch(client, path):
'''
Query consul for all keys/values within base path
'''
# Unless the root path is blank, it needs a trailing slash for
# the kv get from Consul to work as expected
return client.kv.get('' if not path else path.rstrip('/') + '/', recurse=True) | Query consul for all keys/values within base path | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/consul_pillar.py#L257-L263 | null | # -*- coding: utf-8 -*-
'''
Use Consul K/V as a Pillar source with values parsed as YAML
:depends: - python-consul
In order to use an consul server, a profile must be created in the master
configuration file:
.. code-block:: yaml
my_consul_config:
consul.host: 127.0.0.1
consul.port: 8500
cons... |
saltstack/salt | salt/pillar/consul_pillar.py | fetch_tree | python | def fetch_tree(client, path, expand_keys):
'''
Grab data from consul, trim base path and remove any keys which
are folders. Take the remaining data and send it to be formatted
in such a way as to be used as pillar data.
'''
_, items = consul_fetch(client, path)
ret = {}
has_children = re... | Grab data from consul, trim base path and remove any keys which
are folders. Take the remaining data and send it to be formatted
in such a way as to be used as pillar data. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/consul_pillar.py#L266-L289 | [
"def consul_fetch(client, path):\n '''\n Query consul for all keys/values within base path\n '''\n # Unless the root path is blank, it needs a trailing slash for\n # the kv get from Consul to work as expected\n return client.kv.get('' if not path else path.rstrip('/') + '/', recurse=True)\n",
"d... | # -*- coding: utf-8 -*-
'''
Use Consul K/V as a Pillar source with values parsed as YAML
:depends: - python-consul
In order to use an consul server, a profile must be created in the master
configuration file:
.. code-block:: yaml
my_consul_config:
consul.host: 127.0.0.1
consul.port: 8500
cons... |
saltstack/salt | salt/pillar/consul_pillar.py | pillar_format | python | def pillar_format(ret, keys, value, expand_keys):
'''
Perform data formatting to be used as pillar data and
merge it with the current pillar data
'''
# if value is empty in Consul then it's None here - skip it
if value is None:
return ret
# If value is not None then it's a string
... | Perform data formatting to be used as pillar data and
merge it with the current pillar data | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/consul_pillar.py#L292-L315 | [
"def update(dest, upd, recursive_update=True, merge_lists=False):\n '''\n Recursive version of the default dict.update\n\n Merges upd recursively into dest\n\n If recursive_update=False, will use the classic dict.update, or fall back\n on a manual merge (helpful for non-dict types like FunctionWrappe... | # -*- coding: utf-8 -*-
'''
Use Consul K/V as a Pillar source with values parsed as YAML
:depends: - python-consul
In order to use an consul server, a profile must be created in the master
configuration file:
.. code-block:: yaml
my_consul_config:
consul.host: 127.0.0.1
consul.port: 8500
cons... |
saltstack/salt | salt/pillar/consul_pillar.py | get_conn | python | def get_conn(opts, profile):
'''
Return a client object for accessing consul
'''
opts_pillar = opts.get('pillar', {})
opts_master = opts_pillar.get('master', {})
opts_merged = {}
opts_merged.update(opts_master)
opts_merged.update(opts_pillar)
opts_merged.update(opts)
if profil... | Return a client object for accessing consul | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/consul_pillar.py#L318-L355 | [
"def _resolve_datacenter(dc, pillarenv):\n '''\n If ``dc`` is a string - return it as is.\n\n If it's a dict then sort it in descending order by key length and try\n to use keys as RegEx patterns to match against ``pillarenv``.\n The value for matched pattern should be a string (that can use\n ``s... | # -*- coding: utf-8 -*-
'''
Use Consul K/V as a Pillar source with values parsed as YAML
:depends: - python-consul
In order to use an consul server, a profile must be created in the master
configuration file:
.. code-block:: yaml
my_consul_config:
consul.host: 127.0.0.1
consul.port: 8500
cons... |
saltstack/salt | salt/pillar/consul_pillar.py | _resolve_datacenter | python | def _resolve_datacenter(dc, pillarenv):
'''
If ``dc`` is a string - return it as is.
If it's a dict then sort it in descending order by key length and try
to use keys as RegEx patterns to match against ``pillarenv``.
The value for matched pattern should be a string (that can use
``str.format`` ... | If ``dc`` is a string - return it as is.
If it's a dict then sort it in descending order by key length and try
to use keys as RegEx patterns to match against ``pillarenv``.
The value for matched pattern should be a string (that can use
``str.format`` syntax togetehr with captured variables from pattern... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/consul_pillar.py#L358-L397 | null | # -*- coding: utf-8 -*-
'''
Use Consul K/V as a Pillar source with values parsed as YAML
:depends: - python-consul
In order to use an consul server, a profile must be created in the master
configuration file:
.. code-block:: yaml
my_consul_config:
consul.host: 127.0.0.1
consul.port: 8500
cons... |
saltstack/salt | salt/beacons/btmp.py | _gather_group_members | python | def _gather_group_members(group, groups, users):
'''
Gather group members
'''
_group = __salt__['group.info'](group)
if not _group:
log.warning('Group %s does not exist, ignoring.', group)
return
for member in _group['members']:
if member not in users:
users... | Gather group members | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/btmp.py#L168-L180 | null | # -*- coding: utf-8 -*-
'''
Beacon to fire events at failed login of users
.. versionadded:: 2015.5.0
Example Configuration
=====================
.. code-block:: yaml
# Fire events on all failed logins
beacons:
btmp: []
# Matching on user name, using a default time range
beacons:
btmp:
... |
saltstack/salt | salt/beacons/btmp.py | _check_time_range | python | def _check_time_range(time_range, now):
'''
Check time range
'''
if _TIME_SUPPORTED:
_start = dateutil_parser.parse(time_range['start'])
_end = dateutil_parser.parse(time_range['end'])
return bool(_start <= now <= _end)
else:
log.error('Dateutil is required.')
... | Check time range | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/btmp.py#L183-L194 | null | # -*- coding: utf-8 -*-
'''
Beacon to fire events at failed login of users
.. versionadded:: 2015.5.0
Example Configuration
=====================
.. code-block:: yaml
# Fire events on all failed logins
beacons:
btmp: []
# Matching on user name, using a default time range
beacons:
btmp:
... |
saltstack/salt | salt/beacons/btmp.py | beacon | python | def beacon(config):
'''
Read the last btmp file and return information on the failed logins
'''
ret = []
users = {}
groups = {}
defaults = None
for config_item in config:
if 'users' in config_item:
users = config_item['users']
if 'groups' in config_item:
... | Read the last btmp file and return information on the failed logins | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/btmp.py#L266-L331 | [
"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 -*-
'''
Beacon to fire events at failed login of users
.. versionadded:: 2015.5.0
Example Configuration
=====================
.. code-block:: yaml
# Fire events on all failed logins
beacons:
btmp: []
# Matching on user name, using a default time range
beacons:
btmp:
... |
saltstack/salt | salt/returners/slack_webhook_return.py | _sprinkle | python | def _sprinkle(config_str):
'''
Sprinkle with grains of salt, that is
convert 'test {id} test {host} ' types of strings
:param config_str: The string to be sprinkled
:return: The string sprinkled
'''
parts = [x for sub in config_str.split('{') for x in sub.split('}')]
for i in range(1, le... | Sprinkle with grains of salt, that is
convert 'test {id} test {host} ' types of strings
:param config_str: The string to be sprinkled
:return: The string sprinkled | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/slack_webhook_return.py#L121-L131 | null | # -*- coding: utf-8 -*-
'''
Return salt data via Slack using Incoming Webhooks
:codeauthor: :email:`Carlos D. Álvaro <github@cdalvaro.io>`
The following fields can be set in the minion conf file:
.. code-block:: yaml
slack_webhook.webhook (required, the webhook id. Just the part after: 'https://hooks.slack.com/... |
saltstack/salt | salt/returners/slack_webhook_return.py | _generate_payload | python | def _generate_payload(author_icon, title, report):
'''
Prepare the payload for Slack
:param author_icon: The url for the thumbnail to be displayed
:param title: The title of the message
:param report: A dictionary with the report of the Salt function
:return: The payload ready for Slack
'''
... | Prepare the payload for Slack
:param author_icon: The url for the thumbnail to be displayed
:param title: The title of the message
:param report: A dictionary with the report of the Salt function
:return: The payload ready for Slack | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/slack_webhook_return.py#L144-L205 | [
"def _sprinkle(config_str):\n '''\n Sprinkle with grains of salt, that is\n convert 'test {id} test {host} ' types of strings\n :param config_str: The string to be sprinkled\n :return: The string sprinkled\n '''\n parts = [x for sub in config_str.split('{') for x in sub.split('}')]\n for i i... | # -*- coding: utf-8 -*-
'''
Return salt data via Slack using Incoming Webhooks
:codeauthor: :email:`Carlos D. Álvaro <github@cdalvaro.io>`
The following fields can be set in the minion conf file:
.. code-block:: yaml
slack_webhook.webhook (required, the webhook id. Just the part after: 'https://hooks.slack.com/... |
saltstack/salt | salt/returners/slack_webhook_return.py | _generate_report | python | def _generate_report(ret, show_tasks):
'''
Generate a report of the Salt function
:param ret: The Salt return
:param show_tasks: Flag to show the name of the changed and failed states
:return: The report
'''
returns = ret.get('return')
sorted_data = sorted(
returns.items(),
... | Generate a report of the Salt function
:param ret: The Salt return
:param show_tasks: Flag to show the name of the changed and failed states
:return: The report | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/slack_webhook_return.py#L208-L280 | null | # -*- coding: utf-8 -*-
'''
Return salt data via Slack using Incoming Webhooks
:codeauthor: :email:`Carlos D. Álvaro <github@cdalvaro.io>`
The following fields can be set in the minion conf file:
.. code-block:: yaml
slack_webhook.webhook (required, the webhook id. Just the part after: 'https://hooks.slack.com/... |
saltstack/salt | salt/returners/slack_webhook_return.py | _post_message | python | def _post_message(webhook, author_icon, title, report):
'''
Send a message to a Slack room through a webhook
:param webhook: The url of the incoming webhook
:param author_icon: The thumbnail image to be displayed on the right side of the message
:param title: The title of the message
:... | Send a message to a Slack room through a webhook
:param webhook: The url of the incoming webhook
:param author_icon: The thumbnail image to be displayed on the right side of the message
:param title: The title of the message
:param report: The report of the function state
:return: ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/slack_webhook_return.py#L283-L309 | [
"def _generate_payload(author_icon, title, report):\n '''\n Prepare the payload for Slack\n :param author_icon: The url for the thumbnail to be displayed\n :param title: The title of the message\n :param report: A dictionary with the report of the Salt function\n :return: The payload ready for Sla... | # -*- coding: utf-8 -*-
'''
Return salt data via Slack using Incoming Webhooks
:codeauthor: :email:`Carlos D. Álvaro <github@cdalvaro.io>`
The following fields can be set in the minion conf file:
.. code-block:: yaml
slack_webhook.webhook (required, the webhook id. Just the part after: 'https://hooks.slack.com/... |
saltstack/salt | salt/returners/slack_webhook_return.py | returner | python | def returner(ret):
'''
Send a slack message with the data through a webhook
:param ret: The Salt return
:return: The result of the post
'''
_options = _get_options(ret)
webhook = _options.get('webhook', None)
show_tasks = _options.get('show_tasks')
author_icon = _options.get('autho... | Send a slack message with the data through a webhook
:param ret: The Salt return
:return: The result of the post | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/slack_webhook_return.py#L312-L338 | [
"def _get_options(ret=None):\n '''\n Get the slack_webhook options from salt.\n :param ret: Salt return dictionary\n :return: A dictionary with options\n '''\n\n defaults = {\n 'success_title': '{id} | Succeeded',\n 'failure_title': '{id} | Failed',\n 'author_icon': '',\n ... | # -*- coding: utf-8 -*-
'''
Return salt data via Slack using Incoming Webhooks
:codeauthor: :email:`Carlos D. Álvaro <github@cdalvaro.io>`
The following fields can be set in the minion conf file:
.. code-block:: yaml
slack_webhook.webhook (required, the webhook id. Just the part after: 'https://hooks.slack.com/... |
saltstack/salt | salt/modules/winrepo.py | update_git_repos | python | def update_git_repos(clean=False):
'''
Checkout git repos containing :ref:`Windows Software Package Definitions
<windows-package-manager>`.
.. important::
This function requires `Git for Windows`_ to be installed in order to
work. When installing, make sure to select an installation opt... | Checkout git repos containing :ref:`Windows Software Package Definitions
<windows-package-manager>`.
.. important::
This function requires `Git for Windows`_ to be installed in order to
work. When installing, make sure to select an installation option which
permits the git executable to... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/winrepo.py#L81-L122 | null | # -*- coding: utf-8 -*-
r'''
Module to manage Windows software repo on a Standalone Minion
``file_client: local`` must be set in the minion config file.
For documentation on Salt's Windows Repo feature, see :ref:`here
<windows-package-manager>`.
'''
# Import python libs
from __future__ import absolute_import, unicod... |
saltstack/salt | salt/modules/winrepo.py | show_sls | python | def show_sls(name, saltenv='base'):
r'''
.. versionadded:: 2015.8.0
Display the rendered software definition from a specific sls file in the
local winrepo cache. This will parse all Jinja. Run pkg.refresh_db to pull
the latest software definitions from the master.
.. note::
This functi... | r'''
.. versionadded:: 2015.8.0
Display the rendered software definition from a specific sls file in the
local winrepo cache. This will parse all Jinja. Run pkg.refresh_db to pull
the latest software definitions from the master.
.. note::
This function does not ask a master for an sls file... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/winrepo.py#L125-L210 | [
"def compile_template(template,\n renderers,\n default,\n blacklist,\n whitelist,\n saltenv='base',\n sls='',\n input_data='',\n **kwargs):\n '''\n Ta... | # -*- coding: utf-8 -*-
r'''
Module to manage Windows software repo on a Standalone Minion
``file_client: local`` must be set in the minion config file.
For documentation on Salt's Windows Repo feature, see :ref:`here
<windows-package-manager>`.
'''
# Import python libs
from __future__ import absolute_import, unicod... |
saltstack/salt | salt/modules/lxc.py | version | python | def version():
'''
Return the actual lxc client version
.. versionadded:: 2015.8.0
CLI Example:
.. code-block:: bash
salt '*' lxc.version
'''
k = 'lxc.version'
if not __context__.get(k, None):
cversion = __salt__['cmd.run_all']('lxc-info --version')
if not cv... | Return the actual lxc client version
.. versionadded:: 2015.8.0
CLI Example:
.. code-block:: bash
salt '*' lxc.version | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L111-L132 | null | # -*- coding: utf-8 -*-
'''
Control Linux Containers via Salt
:depends: lxc package for distribution
lxc >= 1.0 (even beta alpha) is required
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import copy
import string
import textwrap
import difflib
imp... |
saltstack/salt | salt/modules/lxc.py | _clear_context | python | def _clear_context():
'''
Clear any lxc variables set in __context__
'''
for var in [x for x in __context__ if x.startswith('lxc.')]:
log.trace('Clearing __context__[\'%s\']', var)
__context__.pop(var, None) | Clear any lxc variables set in __context__ | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L135-L141 | null | # -*- coding: utf-8 -*-
'''
Control Linux Containers via Salt
:depends: lxc package for distribution
lxc >= 1.0 (even beta alpha) is required
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import copy
import string
import textwrap
import difflib
imp... |
saltstack/salt | salt/modules/lxc.py | _ip_sort | python | def _ip_sort(ip):
'''Ip sorting'''
idx = '001'
if ip == '127.0.0.1':
idx = '200'
if ip == '::1':
idx = '201'
elif '::' in ip:
idx = '100'
return '{0}___{1}'.format(idx, ip) | Ip sorting | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L144-L153 | null | # -*- coding: utf-8 -*-
'''
Control Linux Containers via Salt
:depends: lxc package for distribution
lxc >= 1.0 (even beta alpha) is required
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import copy
import string
import textwrap
import difflib
imp... |
saltstack/salt | salt/modules/lxc.py | search_lxc_bridges | python | def search_lxc_bridges():
'''
Search which bridges are potentially available as LXC bridges
CLI Example:
.. code-block:: bash
salt '*' lxc.search_lxc_bridges
'''
bridges = __context__.get('lxc.bridges', None)
# either match not yet called or no bridges were found
# to handle ... | Search which bridges are potentially available as LXC bridges
CLI Example:
.. code-block:: bash
salt '*' lxc.search_lxc_bridges | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L156-L205 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n"
] | # -*- coding: utf-8 -*-
'''
Control Linux Containers via Salt
:depends: lxc package for distribution
lxc >= 1.0 (even beta alpha) is required
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import copy
import string
import textwrap
import difflib
imp... |
saltstack/salt | salt/modules/lxc.py | cloud_init_interface | python | def cloud_init_interface(name, vm_=None, **kwargs):
'''
Interface between salt.cloud.lxc driver and lxc.init
``vm_`` is a mapping of vm opts in the salt.cloud format
as documented for the lxc driver.
This can be used either:
- from the salt cloud driver
- because you find the argument to g... | Interface between salt.cloud.lxc driver and lxc.init
``vm_`` is a mapping of vm opts in the salt.cloud format
as documented for the lxc driver.
This can be used either:
- from the salt cloud driver
- because you find the argument to give easier here
than using directly lxc.init
.. warni... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L242-L551 | [
"def update(dest, upd, recursive_update=True, merge_lists=False):\n '''\n Recursive version of the default dict.update\n\n Merges upd recursively into dest\n\n If recursive_update=False, will use the classic dict.update, or fall back\n on a manual merge (helpful for non-dict types like FunctionWrappe... | # -*- coding: utf-8 -*-
'''
Control Linux Containers via Salt
:depends: lxc package for distribution
lxc >= 1.0 (even beta alpha) is required
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import copy
import string
import textwrap
import difflib
imp... |
saltstack/salt | salt/modules/lxc.py | _rand_cpu_str | python | def _rand_cpu_str(cpu):
'''
Return a random subset of cpus for the cpuset config
'''
cpu = int(cpu)
avail = __salt__['status.nproc']()
if cpu < avail:
return '0-{0}'.format(avail)
to_set = set()
while len(to_set) < cpu:
choice = random.randint(0, avail - 1)
if cho... | Return a random subset of cpus for the cpuset config | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L686-L699 | null | # -*- coding: utf-8 -*-
'''
Control Linux Containers via Salt
:depends: lxc package for distribution
lxc >= 1.0 (even beta alpha) is required
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import copy
import string
import textwrap
import difflib
imp... |
saltstack/salt | salt/modules/lxc.py | _network_conf | python | def _network_conf(conf_tuples=None, **kwargs):
'''
Network configuration defaults
network_profile
as for containers, we can either call this function
either with a network_profile dict or network profile name
in the kwargs
nic_opts
overrides or ex... | Network configuration defaults
network_profile
as for containers, we can either call this function
either with a network_profile dict or network profile name
in the kwargs
nic_opts
overrides or extra nics in the form {nic_name: {set: tings} | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L702-L874 | [
"def _get_veths(net_data):\n '''\n Parse the nic setup inside lxc conf tuples back to a dictionary indexed by\n network interface\n '''\n if isinstance(net_data, dict):\n net_data = list(net_data.items())\n nics = salt.utils.odict.OrderedDict()\n current_nic = salt.utils.odict.OrderedDic... | # -*- coding: utf-8 -*-
'''
Control Linux Containers via Salt
:depends: lxc package for distribution
lxc >= 1.0 (even beta alpha) is required
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import copy
import string
import textwrap
import difflib
imp... |
saltstack/salt | salt/modules/lxc.py | _config_list | python | def _config_list(conf_tuples=None, only_net=False, **kwargs):
'''
Return a list of dicts from the salt level configurations
conf_tuples
_LXCConfig compatible list of entries which can contain
- string line
- tuple (lxc config param,value)
- dict of one entry: {l... | Return a list of dicts from the salt level configurations
conf_tuples
_LXCConfig compatible list of entries which can contain
- string line
- tuple (lxc config param,value)
- dict of one entry: {lxc config param: value)
only_net
by default we add to the tup... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L915-L951 | [
"def _network_conf(conf_tuples=None, **kwargs):\n '''\n Network configuration defaults\n\n network_profile\n as for containers, we can either call this function\n either with a network_profile dict or network profile name\n in the kwargs\n nic_opts\n o... | # -*- coding: utf-8 -*-
'''
Control Linux Containers via Salt
:depends: lxc package for distribution
lxc >= 1.0 (even beta alpha) is required
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import copy
import string
import textwrap
import difflib
imp... |
saltstack/salt | salt/modules/lxc.py | _get_veths | python | def _get_veths(net_data):
'''
Parse the nic setup inside lxc conf tuples back to a dictionary indexed by
network interface
'''
if isinstance(net_data, dict):
net_data = list(net_data.items())
nics = salt.utils.odict.OrderedDict()
current_nic = salt.utils.odict.OrderedDict()
no_na... | Parse the nic setup inside lxc conf tuples back to a dictionary indexed by
network interface | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L954-L985 | null | # -*- coding: utf-8 -*-
'''
Control Linux Containers via Salt
:depends: lxc package for distribution
lxc >= 1.0 (even beta alpha) is required
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import copy
import string
import textwrap
import difflib
imp... |
saltstack/salt | salt/modules/lxc.py | _get_base | python | def _get_base(**kwargs):
'''
If the needed base does not exist, then create it, if it does exist
create nothing and return the name of the base lxc container so
it can be cloned.
'''
profile = get_container_profile(copy.deepcopy(kwargs.get('profile')))
kw_overrides = copy.deepcopy(kwargs)
... | If the needed base does not exist, then create it, if it does exist
create nothing and return the name of the base lxc container so
it can be cloned. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L1070-L1122 | null | # -*- coding: utf-8 -*-
'''
Control Linux Containers via Salt
:depends: lxc package for distribution
lxc >= 1.0 (even beta alpha) is required
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import copy
import string
import textwrap
import difflib
imp... |
saltstack/salt | salt/modules/lxc.py | init | python | def init(name,
config=None,
cpuset=None,
cpushare=None,
memory=None,
profile=None,
network_profile=None,
nic_opts=None,
cpu=None,
autostart=True,
password=None,
password_encrypted=None,
users=None,
dnsse... | Initialize a new container.
This is a partial idempotent function as if it is already provisioned, we
will reset a bit the lxc configuration file but much of the hard work will
be escaped as markers will prevent re-execution of harmful tasks.
name
Name of the container
image
A tar... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L1125-L1642 | [
"def start(name, **kwargs):\n '''\n Start the named container\n\n path\n path to the container parent directory\n default: /var/lib/lxc (system)\n\n .. versionadded:: 2015.8.0\n\n lxc_config\n path to a lxc config file\n config file will be guessed from container name ... | # -*- coding: utf-8 -*-
'''
Control Linux Containers via Salt
:depends: lxc package for distribution
lxc >= 1.0 (even beta alpha) is required
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import copy
import string
import textwrap
import difflib
imp... |
saltstack/salt | salt/modules/lxc.py | cloud_init | python | def cloud_init(name, vm_=None, **kwargs):
'''
Thin wrapper to lxc.init to be used from the saltcloud lxc driver
name
Name of the container
may be None and then guessed from saltcloud mapping
`vm_`
saltcloud mapping defaults for the vm
CLI Example:
.. code-block:: bash
... | Thin wrapper to lxc.init to be used from the saltcloud lxc driver
name
Name of the container
may be None and then guessed from saltcloud mapping
`vm_`
saltcloud mapping defaults for the vm
CLI Example:
.. code-block:: bash
salt '*' lxc.cloud_init foo | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L1645-L1663 | [
"def init(name,\n config=None,\n cpuset=None,\n cpushare=None,\n memory=None,\n profile=None,\n network_profile=None,\n nic_opts=None,\n cpu=None,\n autostart=True,\n password=None,\n password_encrypted=None,\n users=Non... | # -*- coding: utf-8 -*-
'''
Control Linux Containers via Salt
:depends: lxc package for distribution
lxc >= 1.0 (even beta alpha) is required
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import copy
import string
import textwrap
import difflib
imp... |
saltstack/salt | salt/modules/lxc.py | images | python | def images(dist=None):
'''
.. versionadded:: 2015.5.0
List the available images for LXC's ``download`` template.
dist : None
Filter results to a single Linux distribution
CLI Examples:
.. code-block:: bash
salt myminion lxc.images
salt myminion lxc.images dist=centos... | .. versionadded:: 2015.5.0
List the available images for LXC's ``download`` template.
dist : None
Filter results to a single Linux distribution
CLI Examples:
.. code-block:: bash
salt myminion lxc.images
salt myminion lxc.images dist=centos | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L1666-L1714 | null | # -*- coding: utf-8 -*-
'''
Control Linux Containers via Salt
:depends: lxc package for distribution
lxc >= 1.0 (even beta alpha) is required
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import copy
import string
import textwrap
import difflib
imp... |
saltstack/salt | salt/modules/lxc.py | templates | python | def templates():
'''
.. versionadded:: 2015.5.0
List the available LXC template scripts installed on the minion
CLI Examples:
.. code-block:: bash
salt myminion lxc.templates
'''
try:
template_scripts = os.listdir('/usr/share/lxc/templates')
except OSError:
re... | .. versionadded:: 2015.5.0
List the available LXC template scripts installed on the minion
CLI Examples:
.. code-block:: bash
salt myminion lxc.templates | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L1717-L1734 | null | # -*- coding: utf-8 -*-
'''
Control Linux Containers via Salt
:depends: lxc package for distribution
lxc >= 1.0 (even beta alpha) is required
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import copy
import string
import textwrap
import difflib
imp... |
saltstack/salt | salt/modules/lxc.py | create | python | def create(name,
config=None,
profile=None,
network_profile=None,
nic_opts=None,
**kwargs):
'''
Create a new container.
name
Name of the container
config
The config file to use for the container. Defaults to system-wide
con... | Create a new container.
name
Name of the container
config
The config file to use for the container. Defaults to system-wide
config (usually in /etc/lxc/lxc.conf).
profile
Profile to use in container creation (see
:mod:`lxc.get_container_profile
<salt.module... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L1774-L1984 | [
"def exists(name, path=None):\n '''\n Returns whether the named container exists.\n\n path\n path to the container parent directory (default: /var/lib/lxc)\n\n .. versionadded:: 2015.8.0\n\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' lxc.exists name\n '''\n\n _exi... | # -*- coding: utf-8 -*-
'''
Control Linux Containers via Salt
:depends: lxc package for distribution
lxc >= 1.0 (even beta alpha) is required
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import copy
import string
import textwrap
import difflib
imp... |
saltstack/salt | salt/modules/lxc.py | clone | python | def clone(name,
orig,
profile=None,
network_profile=None,
nic_opts=None,
**kwargs):
'''
Create a new container as a clone of another container
name
Name of the container
orig
Name of the original container to be cloned
profile
... | Create a new container as a clone of another container
name
Name of the container
orig
Name of the original container to be cloned
profile
Profile to use in container cloning (see
:mod:`lxc.get_container_profile
<salt.modules.lxc.get_container_profile>`). Values in... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L1987-L2106 | [
"def version():\n '''\n Return the actual lxc client version\n\n .. versionadded:: 2015.8.0\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' lxc.version\n\n '''\n k = 'lxc.version'\n if not __context__.get(k, None):\n cversion = __salt__['cmd.run_all']('lxc-info --version... | # -*- coding: utf-8 -*-
'''
Control Linux Containers via Salt
:depends: lxc package for distribution
lxc >= 1.0 (even beta alpha) is required
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import copy
import string
import textwrap
import difflib
imp... |
saltstack/salt | salt/modules/lxc.py | ls_ | python | def ls_(active=None, cache=True, path=None):
'''
Return a list of the containers available on the minion
path
path to the container parent directory
default: /var/lib/lxc (system)
.. versionadded:: 2015.8.0
active
If ``True``, return only active (i.e. running) containe... | Return a list of the containers available on the minion
path
path to the container parent directory
default: /var/lib/lxc (system)
.. versionadded:: 2015.8.0
active
If ``True``, return only active (i.e. running) containers
.. versionadded:: 2015.5.0
CLI Example:
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2109-L2147 | null | # -*- coding: utf-8 -*-
'''
Control Linux Containers via Salt
:depends: lxc package for distribution
lxc >= 1.0 (even beta alpha) is required
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import copy
import string
import textwrap
import difflib
imp... |
saltstack/salt | salt/modules/lxc.py | list_ | python | def list_(extra=False, limit=None, path=None):
'''
List containers classified by state
extra
Also get per-container specific info. This will change the return data.
Instead of returning a list of containers, a dictionary of containers
and each container's output from :mod:`lxc.info
... | List containers classified by state
extra
Also get per-container specific info. This will change the return data.
Instead of returning a list of containers, a dictionary of containers
and each container's output from :mod:`lxc.info
<salt.modules.lxc.info>`.
path
path to... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2150-L2235 | [
"def info(name, path=None):\n '''\n Returns information about a container\n\n path\n path to the container parent directory\n default: /var/lib/lxc (system)\n\n .. versionadded:: 2015.8.0\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' lxc.info name\n '''\n ca... | # -*- coding: utf-8 -*-
'''
Control Linux Containers via Salt
:depends: lxc package for distribution
lxc >= 1.0 (even beta alpha) is required
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import copy
import string
import textwrap
import difflib
imp... |
saltstack/salt | salt/modules/lxc.py | _ensure_exists | python | def _ensure_exists(name, path=None):
'''
Raise an exception if the container does not exist
'''
if not exists(name, path=path):
raise CommandExecutionError(
'Container \'{0}\' does not exist'.format(name)
) | Raise an exception if the container does not exist | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2302-L2309 | [
"def exists(name, path=None):\n '''\n Returns whether the named container exists.\n\n path\n path to the container parent directory (default: /var/lib/lxc)\n\n .. versionadded:: 2015.8.0\n\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' lxc.exists name\n '''\n\n _exi... | # -*- coding: utf-8 -*-
'''
Control Linux Containers via Salt
:depends: lxc package for distribution
lxc >= 1.0 (even beta alpha) is required
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import copy
import string
import textwrap
import difflib
imp... |
saltstack/salt | salt/modules/lxc.py | _ensure_running | python | def _ensure_running(name, no_start=False, path=None):
'''
If the container is not currently running, start it. This function returns
the state that the container was in before changing
path
path to the container parent directory
default: /var/lib/lxc (system)
.. versionadded:: ... | If the container is not currently running, start it. This function returns
the state that the container was in before changing
path
path to the container parent directory
default: /var/lib/lxc (system)
.. versionadded:: 2015.8.0 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2312-L2340 | [
"def start(name, **kwargs):\n '''\n Start the named container\n\n path\n path to the container parent directory\n default: /var/lib/lxc (system)\n\n .. versionadded:: 2015.8.0\n\n lxc_config\n path to a lxc config file\n config file will be guessed from container name ... | # -*- coding: utf-8 -*-
'''
Control Linux Containers via Salt
:depends: lxc package for distribution
lxc >= 1.0 (even beta alpha) is required
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import copy
import string
import textwrap
import difflib
imp... |
saltstack/salt | salt/modules/lxc.py | restart | python | def restart(name, path=None, lxc_config=None, force=False):
'''
.. versionadded:: 2015.5.0
Restart the named container. If the container was not running, the
container will merely be started.
name
The name of the container
path
path to the container parent directory
de... | .. versionadded:: 2015.5.0
Restart the named container. If the container was not running, the
container will merely be started.
name
The name of the container
path
path to the container parent directory
default: /var/lib/lxc (system)
.. versionadded:: 2015.8.0
lx... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2343-L2383 | [
"def start(name, **kwargs):\n '''\n Start the named container\n\n path\n path to the container parent directory\n default: /var/lib/lxc (system)\n\n .. versionadded:: 2015.8.0\n\n lxc_config\n path to a lxc config file\n config file will be guessed from container name ... | # -*- coding: utf-8 -*-
'''
Control Linux Containers via Salt
:depends: lxc package for distribution
lxc >= 1.0 (even beta alpha) is required
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import copy
import string
import textwrap
import difflib
imp... |
saltstack/salt | salt/modules/lxc.py | start | python | def start(name, **kwargs):
'''
Start the named container
path
path to the container parent directory
default: /var/lib/lxc (system)
.. versionadded:: 2015.8.0
lxc_config
path to a lxc config file
config file will be guessed from container name otherwise
... | Start the named container
path
path to the container parent directory
default: /var/lib/lxc (system)
.. versionadded:: 2015.8.0
lxc_config
path to a lxc config file
config file will be guessed from container name otherwise
.. versionadded:: 2015.8.0
use_v... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2386-L2437 | [
"def state(name, path=None):\n '''\n Returns the state of a container.\n\n path\n path to the container parent directory (default: /var/lib/lxc)\n\n .. versionadded:: 2015.8.0\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' lxc.state name\n '''\n # Don't use _ensure_... | # -*- coding: utf-8 -*-
'''
Control Linux Containers via Salt
:depends: lxc package for distribution
lxc >= 1.0 (even beta alpha) is required
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import copy
import string
import textwrap
import difflib
imp... |
saltstack/salt | salt/modules/lxc.py | stop | python | def stop(name, kill=False, path=None, use_vt=None):
'''
Stop the named container
path
path to the container parent directory
default: /var/lib/lxc (system)
.. versionadded:: 2015.8.0
kill: False
Do not wait for the container to stop, kill all tasks in the container.
... | Stop the named container
path
path to the container parent directory
default: /var/lib/lxc (system)
.. versionadded:: 2015.8.0
kill: False
Do not wait for the container to stop, kill all tasks in the container.
Older LXC versions will stop containers like this irrespec... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2440-L2481 | [
"def state(name, path=None):\n '''\n Returns the state of a container.\n\n path\n path to the container parent directory (default: /var/lib/lxc)\n\n .. versionadded:: 2015.8.0\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' lxc.state name\n '''\n # Don't use _ensure_... | # -*- coding: utf-8 -*-
'''
Control Linux Containers via Salt
:depends: lxc package for distribution
lxc >= 1.0 (even beta alpha) is required
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import copy
import string
import textwrap
import difflib
imp... |
saltstack/salt | salt/modules/lxc.py | freeze | python | def freeze(name, **kwargs):
'''
Freeze the named container
path
path to the container parent directory
default: /var/lib/lxc (system)
.. versionadded:: 2015.8.0
start : False
If ``True`` and the container is stopped, the container will be started
before attempt... | Freeze the named container
path
path to the container parent directory
default: /var/lib/lxc (system)
.. versionadded:: 2015.8.0
start : False
If ``True`` and the container is stopped, the container will be started
before attempting to freeze.
.. versionadded:... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2484-L2530 | [
"def start(name, **kwargs):\n '''\n Start the named container\n\n path\n path to the container parent directory\n default: /var/lib/lxc (system)\n\n .. versionadded:: 2015.8.0\n\n lxc_config\n path to a lxc config file\n config file will be guessed from container name ... | # -*- coding: utf-8 -*-
'''
Control Linux Containers via Salt
:depends: lxc package for distribution
lxc >= 1.0 (even beta alpha) is required
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import copy
import string
import textwrap
import difflib
imp... |
saltstack/salt | salt/modules/lxc.py | unfreeze | python | def unfreeze(name, path=None, use_vt=None):
'''
Unfreeze the named container.
path
path to the container parent directory
default: /var/lib/lxc (system)
.. versionadded:: 2015.8.0
use_vt
run the command through VT
.. versionadded:: 2015.8.0
CLI Example:
... | Unfreeze the named container.
path
path to the container parent directory
default: /var/lib/lxc (system)
.. versionadded:: 2015.8.0
use_vt
run the command through VT
.. versionadded:: 2015.8.0
CLI Example:
.. code-block:: bash
salt '*' lxc.unfreeze ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2533-L2562 | [
"def state(name, path=None):\n '''\n Returns the state of a container.\n\n path\n path to the container parent directory (default: /var/lib/lxc)\n\n .. versionadded:: 2015.8.0\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' lxc.state name\n '''\n # Don't use _ensure_... | # -*- coding: utf-8 -*-
'''
Control Linux Containers via Salt
:depends: lxc package for distribution
lxc >= 1.0 (even beta alpha) is required
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import copy
import string
import textwrap
import difflib
imp... |
saltstack/salt | salt/modules/lxc.py | destroy | python | def destroy(name, stop=False, path=None):
'''
Destroy the named container.
.. warning::
Destroys all data associated with the container.
path
path to the container parent directory (default: /var/lib/lxc)
.. versionadded:: 2015.8.0
stop : False
If ``True``, the c... | Destroy the named container.
.. warning::
Destroys all data associated with the container.
path
path to the container parent directory (default: /var/lib/lxc)
.. versionadded:: 2015.8.0
stop : False
If ``True``, the container will be destroyed even if it is
runni... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2565-L2600 | [
"def state(name, path=None):\n '''\n Returns the state of a container.\n\n path\n path to the container parent directory (default: /var/lib/lxc)\n\n .. versionadded:: 2015.8.0\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' lxc.state name\n '''\n # Don't use _ensure_... | # -*- coding: utf-8 -*-
'''
Control Linux Containers via Salt
:depends: lxc package for distribution
lxc >= 1.0 (even beta alpha) is required
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import copy
import string
import textwrap
import difflib
imp... |
saltstack/salt | salt/modules/lxc.py | exists | python | def exists(name, path=None):
'''
Returns whether the named container exists.
path
path to the container parent directory (default: /var/lib/lxc)
.. versionadded:: 2015.8.0
CLI Example:
.. code-block:: bash
salt '*' lxc.exists name
'''
_exists = name in ls_(path... | Returns whether the named container exists.
path
path to the container parent directory (default: /var/lib/lxc)
.. versionadded:: 2015.8.0
CLI Example:
.. code-block:: bash
salt '*' lxc.exists name | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2607-L2629 | [
"def ls_(active=None, cache=True, path=None):\n '''\n Return a list of the containers available on the minion\n\n path\n path to the container parent directory\n default: /var/lib/lxc (system)\n\n .. versionadded:: 2015.8.0\n\n active\n If ``True``, return only active (i.e. r... | # -*- coding: utf-8 -*-
'''
Control Linux Containers via Salt
:depends: lxc package for distribution
lxc >= 1.0 (even beta alpha) is required
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import copy
import string
import textwrap
import difflib
imp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.