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/states/pagerduty_escalation_policy.py | _diff | python | def _diff(state_data, resource_object):
'''helper method to compare salt state info with the PagerDuty API json structure,
and determine if we need to update.
returns the dict to pass to the PD API to perform the update, or empty dict if no update.
'''
objects_differ = None
for k, v in state_d... | helper method to compare salt state info with the PagerDuty API json structure,
and determine if we need to update.
returns the dict to pass to the PD API to perform the update, or empty dict if no update. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pagerduty_escalation_policy.py#L127-L151 | null | # -*- coding: utf-8 -*-
'''
Manage PagerDuty escalation policies.
Schedules and users can be referenced by pagerduty ID, or by name, or by email address.
For example:
.. code-block:: yaml
ensure test escalation policy:
pagerduty_escalation_policy.present:
- name: bruce test escalation polic... |
saltstack/salt | salt/states/pagerduty_escalation_policy.py | _escalation_rules_to_string | python | def _escalation_rules_to_string(escalation_rules):
'convert escalation_rules dict to a string for comparison'
result = ''
for rule in escalation_rules:
result += 'escalation_delay_in_minutes: {0} '.format(rule['escalation_delay_in_minutes'])
for target in rule['targets']:
result ... | convert escalation_rules dict to a string for comparison | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pagerduty_escalation_policy.py#L154-L161 | null | # -*- coding: utf-8 -*-
'''
Manage PagerDuty escalation policies.
Schedules and users can be referenced by pagerduty ID, or by name, or by email address.
For example:
.. code-block:: yaml
ensure test escalation policy:
pagerduty_escalation_policy.present:
- name: bruce test escalation polic... |
saltstack/salt | salt/states/rabbitmq_user.py | _check_perms_changes | python | def _check_perms_changes(name, newperms, runas=None, existing=None):
'''
Check whether Rabbitmq user's permissions need to be changed.
'''
if not newperms:
return False
if existing is None:
try:
existing = __salt__['rabbitmq.list_user_permissions'](name, runas=runas)
... | Check whether Rabbitmq user's permissions need to be changed. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/rabbitmq_user.py#L44-L73 | null | # -*- coding: utf-8 -*-
'''
Manage RabbitMQ Users
=====================
Example:
.. code-block:: yaml
rabbit_user:
rabbitmq_user.present:
- password: password
- force: True
- tags:
- monitoring
- user
- perms:
- '/':
- '.*'
... |
saltstack/salt | salt/states/rabbitmq_user.py | _get_current_tags | python | def _get_current_tags(name, runas=None):
'''
Whether Rabbitmq user's tags need to be changed
'''
try:
return list(__salt__['rabbitmq.list_users'](runas=runas)[name])
except CommandExecutionError as err:
log.error('Error: %s', err)
return [] | Whether Rabbitmq user's tags need to be changed | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/rabbitmq_user.py#L76-L84 | null | # -*- coding: utf-8 -*-
'''
Manage RabbitMQ Users
=====================
Example:
.. code-block:: yaml
rabbit_user:
rabbitmq_user.present:
- password: password
- force: True
- tags:
- monitoring
- user
- perms:
- '/':
- '.*'
... |
saltstack/salt | salt/states/rabbitmq_user.py | present | python | def present(name,
password=None,
force=False,
tags=None,
perms=(),
runas=None):
'''
Ensure the RabbitMQ user exists.
name
User name
password
User's password, if one needs to be set
force
If user exists, forcibly cha... | Ensure the RabbitMQ user exists.
name
User name
password
User's password, if one needs to be set
force
If user exists, forcibly change the password
tags
Optional list of tags for the user
perms
A list of dicts with vhost keys and 3-tuple values
runas
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/rabbitmq_user.py#L87-L229 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def _check_perms_changes(name, newperms, runas=None, existing=None):\n '''\n Check whether Rabbitmq user's permissions need to be changed.\n '''\n if not newperms:\n return False\n\n if existing is None:\n try:\n e... | # -*- coding: utf-8 -*-
'''
Manage RabbitMQ Users
=====================
Example:
.. code-block:: yaml
rabbit_user:
rabbitmq_user.present:
- password: password
- force: True
- tags:
- monitoring
- user
- perms:
- '/':
- '.*'
... |
saltstack/salt | salt/states/rabbitmq_user.py | absent | python | def absent(name,
runas=None):
'''
Ensure the named user is absent
name
The name of the user to remove
runas
User to run the command
'''
ret = {'name': name, 'result': False, 'comment': '', 'changes': {}}
try:
user_exists = __salt__['rabbitmq.user_exists']... | Ensure the named user is absent
name
The name of the user to remove
runas
User to run the command | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/rabbitmq_user.py#L232-L272 | null | # -*- coding: utf-8 -*-
'''
Manage RabbitMQ Users
=====================
Example:
.. code-block:: yaml
rabbit_user:
rabbitmq_user.present:
- password: password
- force: True
- tags:
- monitoring
- user
- perms:
- '/':
- '.*'
... |
saltstack/salt | salt/runners/state.py | pause | python | def pause(jid, state_id=None, duration=None):
'''
Set up a state id pause, this instructs a running state to pause at a given
state id. This needs to pass in the jid of the running state and can
optionally pass in a duration in seconds.
'''
minion = salt.minion.MasterMinion(__opts__)
minion.... | Set up a state id pause, this instructs a running state to pause at a given
state id. This needs to pass in the jid of the running state and can
optionally pass in a duration in seconds. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/state.py#L19-L26 | null | # -*- coding: utf-8 -*-
'''
Execute orchestration functions
'''
# Import pytohn libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
# Import salt libs
import salt.loader
import salt.utils.event
import salt.utils.functools
import salt.utils.jid
from salt.exceptions import SaltIn... |
saltstack/salt | salt/runners/state.py | resume | python | def resume(jid, state_id=None):
'''
Remove a pause from a jid, allowing it to continue
'''
minion = salt.minion.MasterMinion(__opts__)
minion.functions['state.resume'](jid, state_id) | Remove a pause from a jid, allowing it to continue | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/state.py#L32-L37 | null | # -*- coding: utf-8 -*-
'''
Execute orchestration functions
'''
# Import pytohn libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
# Import salt libs
import salt.loader
import salt.utils.event
import salt.utils.functools
import salt.utils.jid
from salt.exceptions import SaltIn... |
saltstack/salt | salt/runners/state.py | soft_kill | python | def soft_kill(jid, state_id=None):
'''
Set up a state run to die before executing the given state id,
this instructs a running state to safely exit at a given
state id. This needs to pass in the jid of the running state.
If a state_id is not passed then the jid referenced will be safely exited
a... | Set up a state run to die before executing the given state id,
this instructs a running state to safely exit at a given
state id. This needs to pass in the jid of the running state.
If a state_id is not passed then the jid referenced will be safely exited
at the beginning of the next state run. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/state.py#L43-L52 | null | # -*- coding: utf-8 -*-
'''
Execute orchestration functions
'''
# Import pytohn libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
# Import salt libs
import salt.loader
import salt.utils.event
import salt.utils.functools
import salt.utils.jid
from salt.exceptions import SaltIn... |
saltstack/salt | salt/runners/state.py | orchestrate | python | def orchestrate(mods,
saltenv='base',
test=None,
exclude=None,
pillar=None,
pillarenv=None,
pillar_enc=None,
orchestration_jid=None):
'''
.. versionadded:: 0.17.0
Execute a state run from the mas... | .. versionadded:: 0.17.0
Execute a state run from the master, used as a powerful orchestration
system.
.. seealso:: More Orchestrate documentation
* :ref:`Full Orchestrate Tutorial <orchestrate-runner>`
* :py:mod:`Docs for the master-side state module <salt.states.saltmod>`
CLI Examp... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/state.py#L55-L135 | [
"def gen_jid(opts=None):\n '''\n Generate a jid\n '''\n if opts is None:\n salt.utils.versions.warn_until(\n 'Sodium',\n 'The `opts` argument was not passed into salt.utils.jid.gen_jid(). '\n 'This will be required starting in {version}.'\n )\n opts ... | # -*- coding: utf-8 -*-
'''
Execute orchestration functions
'''
# Import pytohn libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
# Import salt libs
import salt.loader
import salt.utils.event
import salt.utils.functools
import salt.utils.jid
from salt.exceptions import SaltIn... |
saltstack/salt | salt/runners/state.py | orchestrate_single | python | def orchestrate_single(fun, name, test=None, queue=False, pillar=None, **kwargs):
'''
Execute a single state orchestration routine
.. versionadded:: 2015.5.0
CLI Example:
.. code-block:: bash
salt-run state.orchestrate_single fun=salt.wheel name=key.list_all
'''
if pillar is not ... | Execute a single state orchestration routine
.. versionadded:: 2015.5.0
CLI Example:
.. code-block:: bash
salt-run state.orchestrate_single fun=salt.wheel name=key.list_all | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/state.py#L143-L170 | null | # -*- coding: utf-8 -*-
'''
Execute orchestration functions
'''
# Import pytohn libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
# Import salt libs
import salt.loader
import salt.utils.event
import salt.utils.functools
import salt.utils.jid
from salt.exceptions import SaltIn... |
saltstack/salt | salt/runners/state.py | orchestrate_high | python | def orchestrate_high(data, test=None, queue=False, pillar=None, **kwargs):
'''
Execute a single state orchestration routine
.. versionadded:: 2015.5.0
CLI Example:
.. code-block:: bash
salt-run state.orchestrate_high '{
stage_one:
{salt.state: [{tgt: "db*"}, {... | Execute a single state orchestration routine
.. versionadded:: 2015.5.0
CLI Example:
.. code-block:: bash
salt-run state.orchestrate_high '{
stage_one:
{salt.state: [{tgt: "db*"}, {sls: postgres_setup}]},
stage_two:
{salt.state: [{tgt: "web... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/state.py#L173-L206 | null | # -*- coding: utf-8 -*-
'''
Execute orchestration functions
'''
# Import pytohn libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
# Import salt libs
import salt.loader
import salt.utils.event
import salt.utils.functools
import salt.utils.jid
from salt.exceptions import SaltIn... |
saltstack/salt | salt/runners/state.py | orchestrate_show_sls | python | def orchestrate_show_sls(mods,
saltenv='base',
test=None,
queue=False,
pillar=None,
pillarenv=None,
pillar_enc=None):
'''
Display the state data from a specific s... | Display the state data from a specific sls, or list of sls files, after
being render using the master minion.
Note, the master minion adds a "_master" suffix to it's minion id.
.. seealso:: The state.show_sls module function
CLI Example:
.. code-block:: bash
salt-run state.orch_show_sls ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/state.py#L209-L245 | null | # -*- coding: utf-8 -*-
'''
Execute orchestration functions
'''
# Import pytohn libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
# Import salt libs
import salt.loader
import salt.utils.event
import salt.utils.functools
import salt.utils.jid
from salt.exceptions import SaltIn... |
saltstack/salt | salt/runners/state.py | event | python | def event(tagmatch='*',
count=-1,
quiet=False,
sock_dir=None,
pretty=False,
node='master'):
r'''
Watch Salt's event bus and block until the given tag is matched
.. versionadded:: 2014.7.0
.. versionchanged:: 2019.2.0
``tagmatch`` can now be eith... | r'''
Watch Salt's event bus and block until the given tag is matched
.. versionadded:: 2014.7.0
.. versionchanged:: 2019.2.0
``tagmatch`` can now be either a glob or regular expression.
This is useful for utilizing Salt's event bus from shell scripts or for
taking simple actions directly f... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/state.py#L251-L313 | null | # -*- coding: utf-8 -*-
'''
Execute orchestration functions
'''
# Import pytohn libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
# Import salt libs
import salt.loader
import salt.utils.event
import salt.utils.functools
import salt.utils.jid
from salt.exceptions import SaltIn... |
saltstack/salt | salt/modules/smtp.py | send_msg | python | def send_msg(recipient,
message,
subject='Message from Salt',
sender=None,
server=None,
use_ssl='True',
username=None,
password=None,
profile=None,
attachments=None):
'''
Send a message to an SMT... | Send a message to an SMTP recipient. Designed for use in states.
CLI Examples:
.. code-block:: bash
salt '*' smtp.send_msg 'admin@example.com' 'This is a salt module test' profile='my-smtp-account'
salt '*' smtp.send_msg 'admin@example.com' 'This is a salt module test' username='myuser' passw... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smtp.py#L77-L175 | [
"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 -*-
'''
Module for Sending Messages via SMTP
.. versionadded:: 2014.7.0
:depends: - smtplib python module
:configuration: This module can be used by either passing a jid and password
directly to send_message, or by specifying the name of a configuration
profile in the minion config, mini... |
saltstack/salt | salt/modules/bluecoat_sslv.py | add_distinguished_name | python | def add_distinguished_name(list_name, item_name):
'''
Adds a distinguished name to a distinguished name list.
list_name(str): The name of the specific policy distinguished name list to append to.
item_name(str): The distinguished name to append.
CLI Example:
.. code-block:: bash
sal... | Adds a distinguished name to a distinguished name list.
list_name(str): The name of the specific policy distinguished name list to append to.
item_name(str): The distinguished name to append.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.add_distinguished_name MyDistinguishedList... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluecoat_sslv.py#L76-L98 | [
"def _validate_change_result(response):\n if response['result'] == \"true\" or response['result'] is True:\n return True\n return False\n"
] | # -*- coding: utf-8 -*-
'''
Module to provide Blue Coat SSL Visibility compatibility to Salt.
:codeauthor: Spencer Ervin <spencer_ervin@hotmail.com>
:maturity: new
:depends: none
:platform: unix
Configuration
=============
This module accepts connection configuration details either as
parameters, or as confi... |
saltstack/salt | salt/modules/bluecoat_sslv.py | add_distinguished_name_list | python | def add_distinguished_name_list(list_name):
'''
Add a list of policy distinguished names.
list_name(str): The name of the specific policy distinguished name list to add.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.add_distinguished_name_list MyDistinguishedList
'''
... | Add a list of policy distinguished names.
list_name(str): The name of the specific policy distinguished name list to add.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.add_distinguished_name_list MyDistinguishedList | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluecoat_sslv.py#L101-L121 | [
"def _validate_change_result(response):\n if response['result'] == \"true\" or response['result'] is True:\n return True\n return False\n"
] | # -*- coding: utf-8 -*-
'''
Module to provide Blue Coat SSL Visibility compatibility to Salt.
:codeauthor: Spencer Ervin <spencer_ervin@hotmail.com>
:maturity: new
:depends: none
:platform: unix
Configuration
=============
This module accepts connection configuration details either as
parameters, or as confi... |
saltstack/salt | salt/modules/bluecoat_sslv.py | add_domain_name | python | def add_domain_name(list_name, item_name):
'''
Adds a domain name to a domain name list.
list_name(str): The name of the specific policy domain name list to append to.
item_name(str): The domain name to append.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.add_domain_name... | Adds a domain name to a domain name list.
list_name(str): The name of the specific policy domain name list to append to.
item_name(str): The domain name to append.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.add_domain_name MyDomainName foo.bar.com | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluecoat_sslv.py#L124-L146 | [
"def _validate_change_result(response):\n if response['result'] == \"true\" or response['result'] is True:\n return True\n return False\n"
] | # -*- coding: utf-8 -*-
'''
Module to provide Blue Coat SSL Visibility compatibility to Salt.
:codeauthor: Spencer Ervin <spencer_ervin@hotmail.com>
:maturity: new
:depends: none
:platform: unix
Configuration
=============
This module accepts connection configuration details either as
parameters, or as confi... |
saltstack/salt | salt/modules/bluecoat_sslv.py | add_domain_name_list | python | def add_domain_name_list(list_name):
'''
Add a list of policy domain names.
list_name(str): The name of the specific policy domain name list to add.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.add_domain_name_list MyDomainNameList
'''
payload = {"jsonrpc": "2.0",
... | Add a list of policy domain names.
list_name(str): The name of the specific policy domain name list to add.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.add_domain_name_list MyDomainNameList | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluecoat_sslv.py#L149-L169 | [
"def _validate_change_result(response):\n if response['result'] == \"true\" or response['result'] is True:\n return True\n return False\n"
] | # -*- coding: utf-8 -*-
'''
Module to provide Blue Coat SSL Visibility compatibility to Salt.
:codeauthor: Spencer Ervin <spencer_ervin@hotmail.com>
:maturity: new
:depends: none
:platform: unix
Configuration
=============
This module accepts connection configuration details either as
parameters, or as confi... |
saltstack/salt | salt/modules/bluecoat_sslv.py | add_ip_address | python | def add_ip_address(list_name, item_name):
'''
Add an IP address to an IP address list.
list_name(str): The name of the specific policy IP address list to append to.
item_name(str): The IP address to append to the list.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.add_ip_... | Add an IP address to an IP address list.
list_name(str): The name of the specific policy IP address list to append to.
item_name(str): The IP address to append to the list.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.add_ip_address MyIPAddressList 10.0.0.0/24 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluecoat_sslv.py#L172-L194 | [
"def _validate_change_result(response):\n if response['result'] == \"true\" or response['result'] is True:\n return True\n return False\n"
] | # -*- coding: utf-8 -*-
'''
Module to provide Blue Coat SSL Visibility compatibility to Salt.
:codeauthor: Spencer Ervin <spencer_ervin@hotmail.com>
:maturity: new
:depends: none
:platform: unix
Configuration
=============
This module accepts connection configuration details either as
parameters, or as confi... |
saltstack/salt | salt/modules/bluecoat_sslv.py | add_ip_address_list | python | def add_ip_address_list(list_name):
'''
Retrieves a list of all IP address lists.
list_name(str): The name of the specific IP address list to add.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.add_ip_address_list MyIPAddressList
'''
payload = {"jsonrpc": "2.0",
... | Retrieves a list of all IP address lists.
list_name(str): The name of the specific IP address list to add.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.add_ip_address_list MyIPAddressList | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluecoat_sslv.py#L197-L217 | [
"def _validate_change_result(response):\n if response['result'] == \"true\" or response['result'] is True:\n return True\n return False\n"
] | # -*- coding: utf-8 -*-
'''
Module to provide Blue Coat SSL Visibility compatibility to Salt.
:codeauthor: Spencer Ervin <spencer_ervin@hotmail.com>
:maturity: new
:depends: none
:platform: unix
Configuration
=============
This module accepts connection configuration details either as
parameters, or as confi... |
saltstack/salt | salt/modules/bluecoat_sslv.py | get_distinguished_name_list | python | def get_distinguished_name_list(list_name):
'''
Retrieves a specific policy distinguished name list.
list_name(str): The name of the specific policy distinguished name list to retrieve.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.get_distinguished_name_list MyDistinguishedLi... | Retrieves a specific policy distinguished name list.
list_name(str): The name of the specific policy distinguished name list to retrieve.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.get_distinguished_name_list MyDistinguishedList | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluecoat_sslv.py#L220-L240 | [
"def _convert_to_list(response, item_key):\n full_list = []\n for item in response['result'][0]:\n full_list.append(item[item_key])\n return full_list\n"
] | # -*- coding: utf-8 -*-
'''
Module to provide Blue Coat SSL Visibility compatibility to Salt.
:codeauthor: Spencer Ervin <spencer_ervin@hotmail.com>
:maturity: new
:depends: none
:platform: unix
Configuration
=============
This module accepts connection configuration details either as
parameters, or as confi... |
saltstack/salt | salt/modules/bluecoat_sslv.py | get_domain_list | python | def get_domain_list(list_name):
'''
Retrieves a specific policy domain name list.
list_name(str): The name of the specific policy domain name list to retrieve.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.get_domain_list MyDomainNameList
'''
payload = {"jsonrpc": "2.... | Retrieves a specific policy domain name list.
list_name(str): The name of the specific policy domain name list to retrieve.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.get_domain_list MyDomainNameList | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluecoat_sslv.py#L264-L284 | [
"def _convert_to_list(response, item_key):\n full_list = []\n for item in response['result'][0]:\n full_list.append(item[item_key])\n return full_list\n"
] | # -*- coding: utf-8 -*-
'''
Module to provide Blue Coat SSL Visibility compatibility to Salt.
:codeauthor: Spencer Ervin <spencer_ervin@hotmail.com>
:maturity: new
:depends: none
:platform: unix
Configuration
=============
This module accepts connection configuration details either as
parameters, or as confi... |
saltstack/salt | salt/modules/bluecoat_sslv.py | get_ip_address_list | python | def get_ip_address_list(list_name):
'''
Retrieves a specific IP address list.
list_name(str): The name of the specific policy IP address list to retrieve.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.get_ip_address_list MyIPAddressList
'''
payload = {"jsonrpc": "2.0"... | Retrieves a specific IP address list.
list_name(str): The name of the specific policy IP address list to retrieve.
CLI Example:
.. code-block:: bash
salt '*' bluecoat_sslv.get_ip_address_list MyIPAddressList | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bluecoat_sslv.py#L308-L328 | [
"def _convert_to_list(response, item_key):\n full_list = []\n for item in response['result'][0]:\n full_list.append(item[item_key])\n return full_list\n"
] | # -*- coding: utf-8 -*-
'''
Module to provide Blue Coat SSL Visibility compatibility to Salt.
:codeauthor: Spencer Ervin <spencer_ervin@hotmail.com>
:maturity: new
:depends: none
:platform: unix
Configuration
=============
This module accepts connection configuration details either as
parameters, or as confi... |
saltstack/salt | salt/utils/win_runas.py | runas | python | def runas(cmdLine, username, password=None, cwd=None):
'''
Run a command as another user. If the process is running as an admin or
system account this method does not require a password. Other non
privileged accounts need to provide a password for the user to runas.
Commands are run in with the high... | Run a command as another user. If the process is running as an admin or
system account this method does not require a password. Other non
privileged accounts need to provide a password for the user to runas.
Commands are run in with the highest level privileges possible for the
account provided. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_runas.py#L62-L224 | [
"def logon_msv1_s4u(name, local_groups=None, origin_name=py_origin_name,\n source_context=None):\n domain = ctypes.create_unicode_buffer(MAX_COMPUTER_NAME_LENGTH + 1)\n length = wintypes.DWORD(len(domain))\n kernel32.GetComputerNameW(domain, ctypes.byref(length))\n return lsa_logon_us... | # -*- coding: utf-8 -*-
'''
Run processes as a different user in Windows
'''
from __future__ import absolute_import, unicode_literals
# Import Python Libraries
import ctypes
import os
import logging
# Import Third Party Libs
try:
import psutil
HAS_PSUTIL = True
except ImportError:
HAS_PSUTIL = False
try:... |
saltstack/salt | salt/utils/win_runas.py | runas_unpriv | python | def runas_unpriv(cmd, username, password, cwd=None):
'''
Runas that works for non-priviledged users
'''
# Create a pipe to set as stdout in the child. The write handle needs to be
# inheritable.
c2pread, c2pwrite = salt.platform.win.CreatePipe(
inherit_read=False, inherit_write=True,
... | Runas that works for non-priviledged users | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_runas.py#L227-L295 | [
"def DuplicateHandle(hsrc=kernel32.GetCurrentProcess(),\n srchandle=kernel32.GetCurrentProcess(),\n htgt=kernel32.GetCurrentProcess(),\n access=0, inherit=False,\n options=win32con.DUPLICATE_SAME_ACCESS):\n tgthandle = wintypes.HANDLE()\... | # -*- coding: utf-8 -*-
'''
Run processes as a different user in Windows
'''
from __future__ import absolute_import, unicode_literals
# Import Python Libraries
import ctypes
import os
import logging
# Import Third Party Libs
try:
import psutil
HAS_PSUTIL = True
except ImportError:
HAS_PSUTIL = False
try:... |
saltstack/salt | salt/matchers/data_match.py | match | python | def match(tgt, functions=None, opts=None):
'''
Match based on the local data store on the minion
'''
if not opts:
opts = __opts__
if functions is None:
utils = salt.loader.utils(opts)
functions = salt.loader.minion_mods(opts, utils=utils)
comps = tgt.split(':')
if len... | Match based on the local data store on the minion | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/matchers/data_match.py#L19-L48 | null | # -*- coding: utf-8 -*-
'''
This is the default data matcher.
'''
from __future__ import absolute_import, print_function, unicode_literals
import fnmatch
import logging
from salt.ext import six # pylint: disable=3rd-party-module-not-gated
import salt.utils.data # pylint: disable=3rd-party-module-not-gated
import sa... |
saltstack/salt | salt/states/glance.py | _find_image | python | def _find_image(name):
'''
Tries to find image with given name, returns
- image, 'Found image <name>'
- None, 'No such image found'
- False, 'Found more than one image with given name'
'''
try:
images = __salt__['glance.image_list'](name=name)
except kstone_Unauthoriz... | Tries to find image with given name, returns
- image, 'Found image <name>'
- None, 'No such image found'
- False, 'Found more than one image with given name' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/glance.py#L43-L70 | null | # -*- coding: utf-8 -*-
'''
Managing Images in OpenStack Glance
===================================
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
import time
# Import salt libs
# Import OpenStack libs
try:
from keystoneclient.exceptions import \
... |
saltstack/salt | salt/states/glance.py | image_present | python | def image_present(name, visibility='public', protected=None,
checksum=None, location=None, disk_format='raw', wait_for=None,
timeout=30):
'''
Checks if given image is present with properties
set as specified.
An image should got through the stages 'queued', 'saving'
before becoming ... | Checks if given image is present with properties
set as specified.
An image should got through the stages 'queued', 'saving'
before becoming 'active'. The attribute 'checksum' can
only be checked once the image is active.
If you don't specify 'wait_for' but 'checksum' the function
will wait for... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/glance.py#L73-L250 | [
"def _find_image(name):\n '''\n Tries to find image with given name, returns\n - image, 'Found image <name>'\n - None, 'No such image found'\n - False, 'Found more than one image with given name'\n '''\n try:\n images = __salt__['glance.image_list'](name=name)\n except kst... | # -*- coding: utf-8 -*-
'''
Managing Images in OpenStack Glance
===================================
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
import time
# Import salt libs
# Import OpenStack libs
try:
from keystoneclient.exceptions import \
... |
saltstack/salt | salt/returners/cassandra_cql_return.py | returner | python | def returner(ret):
'''
Return data to one of potentially many clustered cassandra nodes
'''
query = '''INSERT INTO {keyspace}.salt_returns (
jid, minion_id, fun, alter_time, full_ret, return, success
) VALUES (?, ?, ?, ?, ?, ?, ?)'''.format(keyspace=_get_keyspace())
... | Return data to one of potentially many clustered cassandra nodes | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/cassandra_cql_return.py#L192-L243 | [
"def dumps(obj, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.dumps, and assumes that ensure_ascii is False (unless explicitly\n passed as True) for unicode compatibility. Note that setting it to True\n will mess up any unicode characters, as they will be dumped as the string\n lite... | # -*- coding: utf-8 -*-
'''
Return data to a cassandra server
.. versionadded:: 2015.5.0
:maintainer: Corin Kochenower<ckochenower@saltstack.com>
:maturity: new as of 2015.2
:depends: salt.modules.cassandra_cql
:depends: DataStax Python Driver for Apache Cassandra
https://github.co... |
saltstack/salt | salt/returners/cassandra_cql_return.py | event_return | python | def event_return(events):
'''
Return event to one of potentially many clustered cassandra nodes
Requires that configuration be enabled via 'event_return'
option in master config.
Cassandra does not support an auto-increment feature due to the
highly inefficient nature of creating a monotonical... | Return event to one of potentially many clustered cassandra nodes
Requires that configuration be enabled via 'event_return'
option in master config.
Cassandra does not support an auto-increment feature due to the
highly inefficient nature of creating a monotonically increasing
number across all no... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/cassandra_cql_return.py#L246-L283 | [
"def dumps(obj, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.dumps, and assumes that ensure_ascii is False (unless explicitly\n passed as True) for unicode compatibility. Note that setting it to True\n will mess up any unicode characters, as they will be dumped as the string\n lite... | # -*- coding: utf-8 -*-
'''
Return data to a cassandra server
.. versionadded:: 2015.5.0
:maintainer: Corin Kochenower<ckochenower@saltstack.com>
:maturity: new as of 2015.2
:depends: salt.modules.cassandra_cql
:depends: DataStax Python Driver for Apache Cassandra
https://github.co... |
saltstack/salt | salt/returners/cassandra_cql_return.py | save_load | python | def save_load(jid, load, minions=None):
'''
Save the load to the specified jid id
'''
# Load is being stored as a text datatype. Single quotes are used in the
# VALUES list. Therefore, all single quotes contained in the results from
# salt.utils.json.dumps(load) must be escaped Cassandra style.
... | Save the load to the specified jid id | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/cassandra_cql_return.py#L286-L312 | [
"def dumps(obj, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.dumps, and assumes that ensure_ascii is False (unless explicitly\n passed as True) for unicode compatibility. Note that setting it to True\n will mess up any unicode characters, as they will be dumped as the string\n lite... | # -*- coding: utf-8 -*-
'''
Return data to a cassandra server
.. versionadded:: 2015.5.0
:maintainer: Corin Kochenower<ckochenower@saltstack.com>
:maturity: new as of 2015.2
:depends: salt.modules.cassandra_cql
:depends: DataStax Python Driver for Apache Cassandra
https://github.co... |
saltstack/salt | salt/returners/cassandra_cql_return.py | get_jid | python | def get_jid(jid):
'''
Return the information returned when the specified job id was executed
'''
query = '''SELECT minion_id, full_ret FROM {keyspace}.salt_returns
WHERE jid = ?;'''.format(keyspace=_get_keyspace())
ret = {}
# cassandra_cql.cql_query may raise a CommandExecutionE... | Return the information returned when the specified job id was executed | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/cassandra_cql_return.py#L350-L376 | [
"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 -*-
'''
Return data to a cassandra server
.. versionadded:: 2015.5.0
:maintainer: Corin Kochenower<ckochenower@saltstack.com>
:maturity: new as of 2015.2
:depends: salt.modules.cassandra_cql
:depends: DataStax Python Driver for Apache Cassandra
https://github.co... |
saltstack/salt | salt/returners/cassandra_cql_return.py | get_fun | python | def get_fun(fun):
'''
Return a dict of the last function called for all minions
'''
query = '''SELECT minion_id, last_fun FROM {keyspace}.minions
WHERE last_fun = ?;'''.format(keyspace=_get_keyspace())
ret = {}
# cassandra_cql.cql_query may raise a CommandExecutionError
try:... | Return a dict of the last function called for all minions | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/cassandra_cql_return.py#L380-L406 | [
"def _get_keyspace():\n '''\n Return keyspace if it is specified at opts, if not, use default keyspace 'salt'.\n '''\n return (__opts__.get('cassandra', {}) or {}).get('keyspace', 'salt')\n"
] | # -*- coding: utf-8 -*-
'''
Return data to a cassandra server
.. versionadded:: 2015.5.0
:maintainer: Corin Kochenower<ckochenower@saltstack.com>
:maturity: new as of 2015.2
:depends: salt.modules.cassandra_cql
:depends: DataStax Python Driver for Apache Cassandra
https://github.co... |
saltstack/salt | salt/returners/cassandra_cql_return.py | get_jids | python | def get_jids():
'''
Return a list of all job ids
'''
query = '''SELECT jid, load FROM {keyspace}.jids;'''.format(keyspace=_get_keyspace())
ret = {}
# cassandra_cql.cql_query may raise a CommandExecutionError
try:
data = __salt__['cassandra_cql.cql_query'](query)
if data:
... | Return a list of all job ids | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/cassandra_cql_return.py#L410-L437 | [
"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 -*-
'''
Return data to a cassandra server
.. versionadded:: 2015.5.0
:maintainer: Corin Kochenower<ckochenower@saltstack.com>
:maturity: new as of 2015.2
:depends: salt.modules.cassandra_cql
:depends: DataStax Python Driver for Apache Cassandra
https://github.co... |
saltstack/salt | salt/returners/cassandra_cql_return.py | get_minions | python | def get_minions():
'''
Return a list of minions
'''
query = '''SELECT DISTINCT minion_id
FROM {keyspace}.minions;'''.format(keyspace=_get_keyspace())
ret = []
# cassandra_cql.cql_query may raise a CommandExecutionError
try:
data = __salt__['cassandra_cql.cql_query'](... | Return a list of minions | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/cassandra_cql_return.py#L441-L466 | [
"def _get_keyspace():\n '''\n Return keyspace if it is specified at opts, if not, use default keyspace 'salt'.\n '''\n return (__opts__.get('cassandra', {}) or {}).get('keyspace', 'salt')\n"
] | # -*- coding: utf-8 -*-
'''
Return data to a cassandra server
.. versionadded:: 2015.5.0
:maintainer: Corin Kochenower<ckochenower@saltstack.com>
:maturity: new as of 2015.2
:depends: salt.modules.cassandra_cql
:depends: DataStax Python Driver for Apache Cassandra
https://github.co... |
saltstack/salt | salt/output/json_out.py | output | python | def output(data, **kwargs): # pylint: disable=unused-argument
'''
Print the output data in JSON
'''
try:
if 'output_indent' not in __opts__:
return salt.utils.json.dumps(data, default=repr, indent=4)
indent = __opts__.get('output_indent')
sort_keys = False
... | Print the output data in JSON | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/json_out.py#L56-L92 | [
"def dumps(obj, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.dumps, and assumes that ensure_ascii is False (unless explicitly\n passed as True) for unicode compatibility. Note that setting it to True\n will mess up any unicode characters, as they will be dumped as the string\n lite... | # -*- coding: utf-8 -*-
'''
Display return data in JSON format
==================================
:configuration: The output format can be configured in two ways:
Using the ``--out-indent`` CLI flag and specifying a positive integer or a
negative integer to group JSON from each minion to a single line.
Or... |
saltstack/salt | salt/states/mssql_role.py | present | python | def present(name, owner=None, grants=None, **kwargs):
'''
Ensure that the named database is present with the specified options
name
The name of the database to manage
owner
Adds owner using AUTHORIZATION option
Grants
Can only be a list of strings
'''
ret = {'name': ... | Ensure that the named database is present with the specified options
name
The name of the database to manage
owner
Adds owner using AUTHORIZATION option
Grants
Can only be a list of strings | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mssql_role.py#L24-L55 | null | # -*- coding: utf-8 -*-
'''
Management of Microsoft SQLServer Databases
===========================================
The mssql_role module is used to create
and manage SQL Server Roles
.. code-block:: yaml
yolo:
mssql_role.present
'''
from __future__ import absolute_import, print_function, unicode_literals
... |
saltstack/salt | salt/modules/servicenow.py | set_change_request_state | python | def set_change_request_state(change_id, state='approved'):
'''
Set the approval state of a change request/record
:param change_id: The ID of the change request, e.g. CHG123545
:type change_id: ``str``
:param state: The target state, e.g. approved
:type state: ``str``
CLI Example:
.... | Set the approval state of a change request/record
:param change_id: The ID of the change request, e.g. CHG123545
:type change_id: ``str``
:param state: The target state, e.g. approved
:type state: ``str``
CLI Example:
.. code-block:: bash
salt myminion servicenow.set_change_reques... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/servicenow.py#L61-L88 | [
"def _get_client():\n config = __salt__['config.option'](SERVICE_NAME)\n instance_name = config['instance_name']\n username = config['username']\n password = config['password']\n return Client(instance_name, username, password)\n"
] | # -*- coding: utf-8 -*-
'''
Module for execution of ServiceNow CI (configuration items)
.. versionadded:: 2016.11.0
:depends: servicenow_rest python module
:configuration: Configure this module by specifying the name of a configuration
profile in the minion config, minion pillar, or master config. The module
... |
saltstack/salt | salt/modules/servicenow.py | delete_record | python | def delete_record(table, sys_id):
'''
Delete an existing record
:param table: The table name, e.g. sys_user
:type table: ``str``
:param sys_id: The unique ID of the record
:type sys_id: ``str``
CLI Example:
.. code-block:: bash
salt myminion servicenow.delete_record sys_co... | Delete an existing record
:param table: The table name, e.g. sys_user
:type table: ``str``
:param sys_id: The unique ID of the record
:type sys_id: ``str``
CLI Example:
.. code-block:: bash
salt myminion servicenow.delete_record sys_computer 2134566 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/servicenow.py#L91-L110 | [
"def _get_client():\n config = __salt__['config.option'](SERVICE_NAME)\n instance_name = config['instance_name']\n username = config['username']\n password = config['password']\n return Client(instance_name, username, password)\n"
] | # -*- coding: utf-8 -*-
'''
Module for execution of ServiceNow CI (configuration items)
.. versionadded:: 2016.11.0
:depends: servicenow_rest python module
:configuration: Configure this module by specifying the name of a configuration
profile in the minion config, minion pillar, or master config. The module
... |
saltstack/salt | salt/modules/servicenow.py | non_structured_query | python | def non_structured_query(table, query=None, **kwargs):
'''
Run a non-structed (not a dict) query on a servicenow table.
See http://wiki.servicenow.com/index.php?title=Encoded_Query_Strings#gsc.tab=0
for help on constructing a non-structured query string.
:param table: The table name, e.g. sys_user
... | Run a non-structed (not a dict) query on a servicenow table.
See http://wiki.servicenow.com/index.php?title=Encoded_Query_Strings#gsc.tab=0
for help on constructing a non-structured query string.
:param table: The table name, e.g. sys_user
:type table: ``str``
:param query: The query to run (or u... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/servicenow.py#L113-L145 | [
"def _get_client():\n config = __salt__['config.option'](SERVICE_NAME)\n instance_name = config['instance_name']\n username = config['username']\n password = config['password']\n return Client(instance_name, username, password)\n"
] | # -*- coding: utf-8 -*-
'''
Module for execution of ServiceNow CI (configuration items)
.. versionadded:: 2016.11.0
:depends: servicenow_rest python module
:configuration: Configure this module by specifying the name of a configuration
profile in the minion config, minion pillar, or master config. The module
... |
saltstack/salt | salt/modules/servicenow.py | update_record_field | python | def update_record_field(table, sys_id, field, value):
'''
Update the value of a record's field in a servicenow table
:param table: The table name, e.g. sys_user
:type table: ``str``
:param sys_id: The unique ID of the record
:type sys_id: ``str``
:param field: The new value
:type f... | Update the value of a record's field in a servicenow table
:param table: The table name, e.g. sys_user
:type table: ``str``
:param sys_id: The unique ID of the record
:type sys_id: ``str``
:param field: The new value
:type field: ``str``
:param value: The new value
:type value: `... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/servicenow.py#L148-L173 | [
"def _get_client():\n config = __salt__['config.option'](SERVICE_NAME)\n instance_name = config['instance_name']\n username = config['username']\n password = config['password']\n return Client(instance_name, username, password)\n"
] | # -*- coding: utf-8 -*-
'''
Module for execution of ServiceNow CI (configuration items)
.. versionadded:: 2016.11.0
:depends: servicenow_rest python module
:configuration: Configure this module by specifying the name of a configuration
profile in the minion config, minion pillar, or master config. The module
... |
saltstack/salt | salt/states/cabal.py | _parse_pkg_string | python | def _parse_pkg_string(pkg):
'''
Parse pkg string and return a tuple of package name, separator, and
package version.
Cabal support install package with following format:
* foo-1.0
* foo < 1.2
* foo > 1.3
For the sake of simplicity only the first form is supported,
support for othe... | Parse pkg string and return a tuple of package name, separator, and
package version.
Cabal support install package with following format:
* foo-1.0
* foo < 1.2
* foo > 1.3
For the sake of simplicity only the first form is supported,
support for other forms can be added later. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cabal.py#L40-L55 | null | # -*- coding: utf-8 -*-
'''
Installation of Cabal Packages
==============================
.. versionadded:: 2015.8.0
These states manage the installed packages for Haskell using
cabal. Note that cabal-install must be installed for these states to
be available, so cabal states should include a requisite to a
pkg.insta... |
saltstack/salt | salt/states/cabal.py | installed | python | def installed(name,
pkgs=None,
user=None,
install_global=False,
env=None):
'''
Verify that the given package is installed and is at the correct version
(if specified).
.. code-block:: yaml
ShellCheck-0.3.5:
cabal:
- ... | Verify that the given package is installed and is at the correct version
(if specified).
.. code-block:: yaml
ShellCheck-0.3.5:
cabal:
- installed:
name
The package to install
user
The user to run cabal install with
install_global
Install pack... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cabal.py#L58-L169 | [
"def _parse_pkg_string(pkg):\n '''\n Parse pkg string and return a tuple of package name, separator, and\n package version.\n\n Cabal support install package with following format:\n\n * foo-1.0\n * foo < 1.2\n * foo > 1.3\n\n For the sake of simplicity only the first form is supported,\n ... | # -*- coding: utf-8 -*-
'''
Installation of Cabal Packages
==============================
.. versionadded:: 2015.8.0
These states manage the installed packages for Haskell using
cabal. Note that cabal-install must be installed for these states to
be available, so cabal states should include a requisite to a
pkg.insta... |
saltstack/salt | salt/states/cabal.py | removed | python | def removed(name,
user=None,
env=None):
'''
Verify that given package is not installed.
'''
ret = {'name': name, 'result': None, 'comment': '', 'changes': {}}
try:
installed_pkgs = __salt__['cabal.list'](
user=user, installed=True, env=env)
except (C... | Verify that given package is not installed. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cabal.py#L172-L206 | null | # -*- coding: utf-8 -*-
'''
Installation of Cabal Packages
==============================
.. versionadded:: 2015.8.0
These states manage the installed packages for Haskell using
cabal. Note that cabal-install must be installed for these states to
be available, so cabal states should include a requisite to a
pkg.insta... |
saltstack/salt | salt/beacons/service.py | beacon | python | def beacon(config):
'''
Scan for the configured services and fire events
Example Config
.. code-block:: yaml
beacons:
service:
- services:
salt-master: {}
mysql: {}
The config above sets up beacons to check for
the salt-master and... | Scan for the configured services and fire events
Example Config
.. code-block:: yaml
beacons:
service:
- services:
salt-master: {}
mysql: {}
The config above sets up beacons to check for
the salt-master and mysql services.
The config... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/service.py#L44-L164 | null | # -*- coding: utf-8 -*-
'''
Send events covering service status
'''
# Import Python Libs
from __future__ import absolute_import, unicode_literals
import os
import logging
import time
from salt.ext.six.moves import map
log = logging.getLogger(__name__) # pylint: disable=invalid-name
LAST_STATUS = {}
__virtualname_... |
saltstack/salt | salt/modules/jira_mod.py | _get_credentials | python | def _get_credentials(server=None,
username=None,
password=None):
'''
Returns the credentials merged with the config data (opts + pillar).
'''
jira_cfg = __salt__['config.merge']('jira', default={})
if not server:
server = jira_cfg.get('server')
i... | Returns the credentials merged with the config data (opts + pillar). | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jira_mod.py#L50-L63 | null | # -*- coding: utf-8 -*-
'''
JIRA Execution module
=====================
.. versionadded:: 2019.2.0
Execution module to manipulate JIRA tickets via Salt.
This module requires the ``jira`` Python library to be installed.
Configuration example:
.. code-block:: yaml
jira:
server: https://jira.atlassian.org
... |
saltstack/salt | salt/modules/jira_mod.py | create_issue | python | def create_issue(project,
summary,
description,
template_engine='jinja',
context=None,
defaults=None,
saltenv='base',
issuetype='Bug',
priority='Normal',
labels=None,
... | Create a JIRA issue using the named settings. Return the JIRA ticket ID.
project
The name of the project to attach the JIRA ticket to.
summary
The summary (title) of the JIRA ticket. When the ``template_engine``
argument is set to a proper value of an existing Salt template engine
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jira_mod.py#L80-L183 | [
"def clean_kwargs(**kwargs):\n '''\n Return a dict without any of the __pub* keys (or any other keys starting\n with a dunder) from the kwargs dict passed into the execution module\n functions. These keys are useful for tracking what was used to invoke\n the function call, but they may not be desirab... | # -*- coding: utf-8 -*-
'''
JIRA Execution module
=====================
.. versionadded:: 2019.2.0
Execution module to manipulate JIRA tickets via Salt.
This module requires the ``jira`` Python library to be installed.
Configuration example:
.. code-block:: yaml
jira:
server: https://jira.atlassian.org
... |
saltstack/salt | salt/modules/jira_mod.py | assign_issue | python | def assign_issue(issue_key,
assignee,
server=None,
username=None,
password=None):
'''
Assign the issue to an existing user. Return ``True`` when the issue has
been properly assigned.
issue_key
The JIRA ID of the ticket to manip... | Assign the issue to an existing user. Return ``True`` when the issue has
been properly assigned.
issue_key
The JIRA ID of the ticket to manipulate.
assignee
The name of the user to assign the ticket to.
CLI Example:
salt '*' jira.assign_issue NET-123 example_user | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jira_mod.py#L186-L209 | [
"def _get_jira(server=None,\n username=None,\n password=None):\n global JIRA\n if not JIRA:\n server, username, password = _get_credentials(server=server,\n username=username,\n ... | # -*- coding: utf-8 -*-
'''
JIRA Execution module
=====================
.. versionadded:: 2019.2.0
Execution module to manipulate JIRA tickets via Salt.
This module requires the ``jira`` Python library to be installed.
Configuration example:
.. code-block:: yaml
jira:
server: https://jira.atlassian.org
... |
saltstack/salt | salt/modules/jira_mod.py | add_comment | python | def add_comment(issue_key,
comment,
visibility=None,
is_internal=False,
server=None,
username=None,
password=None):
'''
Add a comment to an existing ticket. Return ``True`` when it successfully
added the comment.... | Add a comment to an existing ticket. Return ``True`` when it successfully
added the comment.
issue_key
The issue ID to add the comment to.
comment
The body of the comment to be added.
visibility: ``None``
A dictionary having two keys:
- ``type``: is ``role`` (or ``gro... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jira_mod.py#L212-L253 | [
"def _get_jira(server=None,\n username=None,\n password=None):\n global JIRA\n if not JIRA:\n server, username, password = _get_credentials(server=server,\n username=username,\n ... | # -*- coding: utf-8 -*-
'''
JIRA Execution module
=====================
.. versionadded:: 2019.2.0
Execution module to manipulate JIRA tickets via Salt.
This module requires the ``jira`` Python library to be installed.
Configuration example:
.. code-block:: yaml
jira:
server: https://jira.atlassian.org
... |
saltstack/salt | salt/modules/jira_mod.py | issue_closed | python | def issue_closed(issue_key,
server=None,
username=None,
password=None):
'''
Check if the issue is closed.
issue_key
The JIRA iD of the ticket to close.
Returns:
- ``True``: the ticket exists and it is closed.
- ``False``: the ticket e... | Check if the issue is closed.
issue_key
The JIRA iD of the ticket to close.
Returns:
- ``True``: the ticket exists and it is closed.
- ``False``: the ticket exists and it has not been closed.
- ``None``: the ticket does not exist.
CLI Example:
.. code-block:: bash
salt ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jira_mod.py#L256-L288 | [
"def _get_jira(server=None,\n username=None,\n password=None):\n global JIRA\n if not JIRA:\n server, username, password = _get_credentials(server=server,\n username=username,\n ... | # -*- coding: utf-8 -*-
'''
JIRA Execution module
=====================
.. versionadded:: 2019.2.0
Execution module to manipulate JIRA tickets via Salt.
This module requires the ``jira`` Python library to be installed.
Configuration example:
.. code-block:: yaml
jira:
server: https://jira.atlassian.org
... |
saltstack/salt | salt/grains/junos.py | _remove_complex_types | python | def _remove_complex_types(dictionary):
'''
Linode-python is now returning some complex types that
are not serializable by msgpack. Kill those.
'''
for k, v in six.iteritems(dictionary):
if isinstance(v, dict):
dictionary[k] = _remove_complex_types(v)
elif hasattr(v, 'to_... | Linode-python is now returning some complex types that
are not serializable by msgpack. Kill those. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/junos.py#L30-L41 | null | # -*- coding: utf-8 -*-
'''
Grains for junos.
NOTE this is a little complicated--junos can only be accessed
via salt-proxy-minion.Thus, some grains make sense to get them
from the minion (PYTHONPATH), but others don't (ip_interfaces)
'''
# Import Python libs
from __future__ import absolute_import, print_function, unic... |
saltstack/salt | salt/states/module.py | run | python | def run(**kwargs):
'''
Run a single module function or a range of module functions in a batch.
Supersedes ``module.run`` function, which requires ``m_`` prefix to
function-specific parameters.
:param returner:
Specify a common returner for the whole batch to send the return data
:param... | Run a single module function or a range of module functions in a batch.
Supersedes ``module.run`` function, which requires ``m_`` prefix to
function-specific parameters.
:param returner:
Specify a common returner for the whole batch to send the return data
:param kwargs:
Pass any argum... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/module.py#L350-L436 | [
"def _call_function(name, returner=None, **kwargs):\n '''\n Calls a function from the specified module.\n\n :param name:\n :param kwargs:\n :return:\n '''\n argspec = salt.utils.args.get_function_argspec(__salt__[name])\n\n # func_kw is initialized to a dictionary of keyword arguments the fu... | # -*- coding: utf-8 -*-
r'''
Execution of Salt modules from within states
============================================
.. note::
There are two styles of calling ``module.run``. **The legacy style will no
longer be available starting in the Sodium release.** To opt-in early to the
new style you must add th... |
saltstack/salt | salt/states/module.py | _call_function | python | def _call_function(name, returner=None, **kwargs):
'''
Calls a function from the specified module.
:param name:
:param kwargs:
:return:
'''
argspec = salt.utils.args.get_function_argspec(__salt__[name])
# func_kw is initialized to a dictionary of keyword arguments the function to be ru... | Calls a function from the specified module.
:param name:
:param kwargs:
:return: | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/module.py#L439-L496 | [
"def iterkeys(d, **kw):\n return d.iterkeys(**kw)\n",
"def get_function_argspec(func, is_class_method=None):\n '''\n A small wrapper around getargspec that also supports callable classes\n :param is_class_method: Pass True if you are sure that the function being passed\n is ... | # -*- coding: utf-8 -*-
r'''
Execution of Salt modules from within states
============================================
.. note::
There are two styles of calling ``module.run``. **The legacy style will no
longer be available starting in the Sodium release.** To opt-in early to the
new style you must add th... |
saltstack/salt | salt/states/module.py | _run | python | def _run(name, **kwargs):
'''
.. deprecated:: 2017.7.0
Function name stays the same, behaviour will change.
Run a single module function
``name``
The module function to execute
``returner``
Specify the returner to send the return of the module execution to
``kwargs``
... | .. deprecated:: 2017.7.0
Function name stays the same, behaviour will change.
Run a single module function
``name``
The module function to execute
``returner``
Specify the returner to send the return of the module execution to
``kwargs``
Pass any arguments needed to ex... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/module.py#L499-L647 | [
"def get_function_argspec(func, is_class_method=None):\n '''\n A small wrapper around getargspec that also supports callable classes\n :param is_class_method: Pass True if you are sure that the function being passed\n is a class method. The reason for this is that on Python 3\n ... | # -*- coding: utf-8 -*-
r'''
Execution of Salt modules from within states
============================================
.. note::
There are two styles of calling ``module.run``. **The legacy style will no
longer be available starting in the Sodium release.** To opt-in early to the
new style you must add th... |
saltstack/salt | salt/matchers/list_match.py | match | python | def match(tgt, opts=None):
'''
Determines if this host is on the list
'''
if not opts:
opts = __opts__
try:
if ',' + opts['id'] + ',' in tgt \
or tgt.startswith(opts['id'] + ',') \
or tgt.endswith(',' + opts['id']):
return True
# t... | Determines if this host is on the list | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/matchers/list_match.py#L11-L42 | null | # -*- coding: utf-8 -*-
'''
This is the default list matcher.
'''
from __future__ import absolute_import, print_function, unicode_literals
import logging
log = logging.getLogger(__name__)
|
saltstack/salt | salt/modules/influxdb08mod.py | db_list | python | def db_list(user=None, password=None, host=None, port=None):
'''
List all InfluxDB databases
user
The user to connect as
password
The password of the user
host
The host to connect to
port
The port to connect to
CLI Example:
.. code-block:: bash
... | List all InfluxDB databases
user
The user to connect as
password
The password of the user
host
The host to connect to
port
The port to connect to
CLI Example:
.. code-block:: bash
salt '*' influxdb08.db_list
salt '*' influxdb08.db_list <user... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L65-L90 | [
"def _client(user=None, password=None, host=None, port=None):\n if not user:\n user = __salt__['config.option']('influxdb08.user', 'root')\n if not password:\n password = __salt__['config.option']('influxdb08.password', 'root')\n if not host:\n host = __salt__['config.option']('influxd... | # -*- coding: utf-8 -*-
'''
InfluxDB - A distributed time series database
Module to provide InfluxDB compatibility to Salt (compatible with InfluxDB
version 0.5-0.8)
.. versionadded:: 2014.7.0
:depends: - influxdb Python module (>= 1.0.0)
:configuration: This module accepts connection configuration details eithe... |
saltstack/salt | salt/modules/influxdb08mod.py | db_exists | python | def db_exists(name, user=None, password=None, host=None, port=None):
'''
Checks if a database exists in Influxdb
name
Database name to create
user
The user to connect as
password
The password of the user
host
The host to connect to
port
The port t... | Checks if a database exists in Influxdb
name
Database name to create
user
The user to connect as
password
The password of the user
host
The host to connect to
port
The port to connect to
CLI Example:
.. code-block:: bash
salt '*' influx... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L93-L122 | [
"def db_list(user=None, password=None, host=None, port=None):\n '''\n List all InfluxDB databases\n\n user\n The user to connect as\n\n password\n The password of the user\n\n host\n The host to connect to\n\n port\n The port to connect to\n\n CLI Example:\n\n .. ... | # -*- coding: utf-8 -*-
'''
InfluxDB - A distributed time series database
Module to provide InfluxDB compatibility to Salt (compatible with InfluxDB
version 0.5-0.8)
.. versionadded:: 2014.7.0
:depends: - influxdb Python module (>= 1.0.0)
:configuration: This module accepts connection configuration details eithe... |
saltstack/salt | salt/modules/influxdb08mod.py | db_create | python | def db_create(name, user=None, password=None, host=None, port=None):
'''
Create a database
name
Database name to create
user
The user to connect as
password
The password of the user
host
The host to connect to
port
The port to connect to
CLI ... | Create a database
name
Database name to create
user
The user to connect as
password
The password of the user
host
The host to connect to
port
The port to connect to
CLI Example:
.. code-block:: bash
salt '*' influxdb08.db_create <name>
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L125-L156 | [
"def db_exists(name, user=None, password=None, host=None, port=None):\n '''\n Checks if a database exists in Influxdb\n\n name\n Database name to create\n\n user\n The user to connect as\n\n password\n The password of the user\n\n host\n The host to connect to\n\n po... | # -*- coding: utf-8 -*-
'''
InfluxDB - A distributed time series database
Module to provide InfluxDB compatibility to Salt (compatible with InfluxDB
version 0.5-0.8)
.. versionadded:: 2014.7.0
:depends: - influxdb Python module (>= 1.0.0)
:configuration: This module accepts connection configuration details eithe... |
saltstack/salt | salt/modules/influxdb08mod.py | db_remove | python | def db_remove(name, user=None, password=None, host=None, port=None):
'''
Remove a database
name
Database name to remove
user
The user to connect as
password
The password of the user
host
The host to connect to
port
The port to connect to
CLI ... | Remove a database
name
Database name to remove
user
The user to connect as
password
The password of the user
host
The host to connect to
port
The port to connect to
CLI Example:
.. code-block:: bash
salt '*' influxdb08.db_remove <name>
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L159-L189 | [
"def db_exists(name, user=None, password=None, host=None, port=None):\n '''\n Checks if a database exists in Influxdb\n\n name\n Database name to create\n\n user\n The user to connect as\n\n password\n The password of the user\n\n host\n The host to connect to\n\n po... | # -*- coding: utf-8 -*-
'''
InfluxDB - A distributed time series database
Module to provide InfluxDB compatibility to Salt (compatible with InfluxDB
version 0.5-0.8)
.. versionadded:: 2014.7.0
:depends: - influxdb Python module (>= 1.0.0)
:configuration: This module accepts connection configuration details eithe... |
saltstack/salt | salt/modules/influxdb08mod.py | user_list | python | def user_list(database=None, user=None, password=None, host=None, port=None):
'''
List cluster admins or database users.
If a database is specified: it will return database users list.
If a database is not specified: it will return cluster admins list.
database
The database to list the use... | List cluster admins or database users.
If a database is specified: it will return database users list.
If a database is not specified: it will return cluster admins list.
database
The database to list the users from
user
The user to connect as
password
The password of the... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L192-L228 | [
"def _client(user=None, password=None, host=None, port=None):\n if not user:\n user = __salt__['config.option']('influxdb08.user', 'root')\n if not password:\n password = __salt__['config.option']('influxdb08.password', 'root')\n if not host:\n host = __salt__['config.option']('influxd... | # -*- coding: utf-8 -*-
'''
InfluxDB - A distributed time series database
Module to provide InfluxDB compatibility to Salt (compatible with InfluxDB
version 0.5-0.8)
.. versionadded:: 2014.7.0
:depends: - influxdb Python module (>= 1.0.0)
:configuration: This module accepts connection configuration details eithe... |
saltstack/salt | salt/modules/influxdb08mod.py | user_exists | python | def user_exists(name, database=None, user=None, password=None, host=None, port=None):
'''
Checks if a cluster admin or database user exists.
If a database is specified: it will check for database user existence.
If a database is not specified: it will check for cluster admin existence.
name
... | Checks if a cluster admin or database user exists.
If a database is specified: it will check for database user existence.
If a database is not specified: it will check for cluster admin existence.
name
User name
database
The database to check for the user to exist
user
Th... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L231-L277 | [
"def user_list(database=None, user=None, password=None, host=None, port=None):\n '''\n List cluster admins or database users.\n\n If a database is specified: it will return database users list.\n If a database is not specified: it will return cluster admins list.\n\n database\n The database to... | # -*- coding: utf-8 -*-
'''
InfluxDB - A distributed time series database
Module to provide InfluxDB compatibility to Salt (compatible with InfluxDB
version 0.5-0.8)
.. versionadded:: 2014.7.0
:depends: - influxdb Python module (>= 1.0.0)
:configuration: This module accepts connection configuration details eithe... |
saltstack/salt | salt/modules/influxdb08mod.py | user_create | python | def user_create(name,
passwd,
database=None,
user=None,
password=None,
host=None,
port=None):
'''
Create a cluster admin or a database user.
If a database is specified: it will create database user.
If a dat... | Create a cluster admin or a database user.
If a database is specified: it will create database user.
If a database is not specified: it will create a cluster admin.
name
User name for the new user to create
passwd
Password for the new user to create
database
The database ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L280-L335 | [
"def _client(user=None, password=None, host=None, port=None):\n if not user:\n user = __salt__['config.option']('influxdb08.user', 'root')\n if not password:\n password = __salt__['config.option']('influxdb08.password', 'root')\n if not host:\n host = __salt__['config.option']('influxd... | # -*- coding: utf-8 -*-
'''
InfluxDB - A distributed time series database
Module to provide InfluxDB compatibility to Salt (compatible with InfluxDB
version 0.5-0.8)
.. versionadded:: 2014.7.0
:depends: - influxdb Python module (>= 1.0.0)
:configuration: This module accepts connection configuration details eithe... |
saltstack/salt | salt/modules/influxdb08mod.py | user_chpass | python | def user_chpass(name,
passwd,
database=None,
user=None,
password=None,
host=None,
port=None):
'''
Change password for a cluster admin or a database user.
If a database is specified: it will update database user ... | Change password for a cluster admin or a database user.
If a database is specified: it will update database user password.
If a database is not specified: it will update cluster admin password.
name
User name for whom to change the password
passwd
New password
database
Th... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L338-L393 | [
"def _client(user=None, password=None, host=None, port=None):\n if not user:\n user = __salt__['config.option']('influxdb08.user', 'root')\n if not password:\n password = __salt__['config.option']('influxdb08.password', 'root')\n if not host:\n host = __salt__['config.option']('influxd... | # -*- coding: utf-8 -*-
'''
InfluxDB - A distributed time series database
Module to provide InfluxDB compatibility to Salt (compatible with InfluxDB
version 0.5-0.8)
.. versionadded:: 2014.7.0
:depends: - influxdb Python module (>= 1.0.0)
:configuration: This module accepts connection configuration details eithe... |
saltstack/salt | salt/modules/influxdb08mod.py | user_remove | python | def user_remove(name,
database=None,
user=None,
password=None,
host=None,
port=None):
'''
Remove a cluster admin or a database user.
If a database is specified: it will remove the database user.
If a database is not specifi... | Remove a cluster admin or a database user.
If a database is specified: it will remove the database user.
If a database is not specified: it will remove the cluster admin.
name
User name to remove
database
The database to remove the user from
user
User name for the new use... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L396-L450 | [
"def _client(user=None, password=None, host=None, port=None):\n if not user:\n user = __salt__['config.option']('influxdb08.user', 'root')\n if not password:\n password = __salt__['config.option']('influxdb08.password', 'root')\n if not host:\n host = __salt__['config.option']('influxd... | # -*- coding: utf-8 -*-
'''
InfluxDB - A distributed time series database
Module to provide InfluxDB compatibility to Salt (compatible with InfluxDB
version 0.5-0.8)
.. versionadded:: 2014.7.0
:depends: - influxdb Python module (>= 1.0.0)
:configuration: This module accepts connection configuration details eithe... |
saltstack/salt | salt/modules/influxdb08mod.py | retention_policy_get | python | def retention_policy_get(database,
name,
user=None,
password=None,
host=None,
port=None):
'''
Get an existing retention policy.
database
The database to operate on.
name... | Get an existing retention policy.
database
The database to operate on.
name
Name of the policy to modify.
CLI Example:
.. code-block:: bash
salt '*' influxdb08.retention_policy_get metrics default | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L453-L480 | [
"def _client(user=None, password=None, host=None, port=None):\n if not user:\n user = __salt__['config.option']('influxdb08.user', 'root')\n if not password:\n password = __salt__['config.option']('influxdb08.password', 'root')\n if not host:\n host = __salt__['config.option']('influxd... | # -*- coding: utf-8 -*-
'''
InfluxDB - A distributed time series database
Module to provide InfluxDB compatibility to Salt (compatible with InfluxDB
version 0.5-0.8)
.. versionadded:: 2014.7.0
:depends: - influxdb Python module (>= 1.0.0)
:configuration: This module accepts connection configuration details eithe... |
saltstack/salt | salt/modules/influxdb08mod.py | retention_policy_exists | python | def retention_policy_exists(database,
name,
user=None,
password=None,
host=None,
port=None):
'''
Check if a retention policy exists.
database
The database to o... | Check if a retention policy exists.
database
The database to operate on.
name
Name of the policy to modify.
CLI Example:
.. code-block:: bash
salt '*' influxdb08.retention_policy_exists metrics default | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L483-L505 | [
"def retention_policy_get(database,\n name,\n user=None,\n password=None,\n host=None,\n port=None):\n '''\n Get an existing retention policy.\n\n database\n The database to operat... | # -*- coding: utf-8 -*-
'''
InfluxDB - A distributed time series database
Module to provide InfluxDB compatibility to Salt (compatible with InfluxDB
version 0.5-0.8)
.. versionadded:: 2014.7.0
:depends: - influxdb Python module (>= 1.0.0)
:configuration: This module accepts connection configuration details eithe... |
saltstack/salt | salt/modules/influxdb08mod.py | retention_policy_add | python | def retention_policy_add(database,
name,
duration,
replication,
default=False,
user=None,
password=None,
host=None,
port... | Add a retention policy.
database
The database to operate on.
name
Name of the policy to modify.
duration
How long InfluxDB keeps the data.
replication
How many copies of the data are stored in the cluster.
default
Whether this policy should be the default... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L508-L543 | [
"def _client(user=None, password=None, host=None, port=None):\n if not user:\n user = __salt__['config.option']('influxdb08.user', 'root')\n if not password:\n password = __salt__['config.option']('influxdb08.password', 'root')\n if not host:\n host = __salt__['config.option']('influxd... | # -*- coding: utf-8 -*-
'''
InfluxDB - A distributed time series database
Module to provide InfluxDB compatibility to Salt (compatible with InfluxDB
version 0.5-0.8)
.. versionadded:: 2014.7.0
:depends: - influxdb Python module (>= 1.0.0)
:configuration: This module accepts connection configuration details eithe... |
saltstack/salt | salt/modules/influxdb08mod.py | retention_policy_alter | python | def retention_policy_alter(database,
name,
duration,
replication,
default=False,
user=None,
password=None,
host=None,
... | Modify an existing retention policy.
database
The database to operate on.
name
Name of the policy to modify.
duration
How long InfluxDB keeps the data.
replication
How many copies of the data are stored in the cluster.
default
Whether this policy should b... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L546-L581 | [
"def _client(user=None, password=None, host=None, port=None):\n if not user:\n user = __salt__['config.option']('influxdb08.user', 'root')\n if not password:\n password = __salt__['config.option']('influxdb08.password', 'root')\n if not host:\n host = __salt__['config.option']('influxd... | # -*- coding: utf-8 -*-
'''
InfluxDB - A distributed time series database
Module to provide InfluxDB compatibility to Salt (compatible with InfluxDB
version 0.5-0.8)
.. versionadded:: 2014.7.0
:depends: - influxdb Python module (>= 1.0.0)
:configuration: This module accepts connection configuration details eithe... |
saltstack/salt | salt/modules/influxdb08mod.py | query | python | def query(database,
query,
time_precision='s',
chunked=False,
user=None,
password=None,
host=None,
port=None):
'''
Querying data
database
The database to query
query
Query to be executed
time_precision
T... | Querying data
database
The database to query
query
Query to be executed
time_precision
Time precision to use ('s', 'm', or 'u')
chunked
Whether is chunked or not
user
The user to connect as
password
The password of the user
host
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdb08mod.py#L584-L628 | [
"def _client(user=None, password=None, host=None, port=None):\n if not user:\n user = __salt__['config.option']('influxdb08.user', 'root')\n if not password:\n password = __salt__['config.option']('influxdb08.password', 'root')\n if not host:\n host = __salt__['config.option']('influxd... | # -*- coding: utf-8 -*-
'''
InfluxDB - A distributed time series database
Module to provide InfluxDB compatibility to Salt (compatible with InfluxDB
version 0.5-0.8)
.. versionadded:: 2014.7.0
:depends: - influxdb Python module (>= 1.0.0)
:configuration: This module accepts connection configuration details eithe... |
saltstack/salt | salt/log/handlers/__init__.py | TemporaryLoggingHandler.sync_with_handlers | python | def sync_with_handlers(self, handlers=()):
'''
Sync the stored log records to the provided log handlers.
'''
if not handlers:
return
while self.__messages:
record = self.__messages.pop(0)
for handler in handlers:
if handler.lev... | Sync the stored log records to the provided log handlers. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/log/handlers/__init__.py#L73-L87 | null | class TemporaryLoggingHandler(logging.NullHandler):
'''
This logging handler will store all the log records up to its maximum
queue size at which stage the first messages stored will be dropped.
Should only be used as a temporary logging handler, while the logging
system is not fully configured.
... |
saltstack/salt | salt/log/handlers/__init__.py | SysLogHandler.handleError | python | def handleError(self, record):
'''
Override the default error handling mechanism for py3
Deal with syslog os errors when the log file does not exist
'''
handled = False
if sys.stderr and sys.version_info >= (3, 5, 4):
t, v, tb = sys.exc_info()
if t... | Override the default error handling mechanism for py3
Deal with syslog os errors when the log file does not exist | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/log/handlers/__init__.py#L106-L119 | null | class SysLogHandler(ExcInfoOnLogLevelFormatMixIn, logging.handlers.SysLogHandler, NewStyleClassMixIn):
'''
Syslog handler which properly handles exc_info on a per handler basis
'''
|
saltstack/salt | salt/log/handlers/__init__.py | RotatingFileHandler.handleError | python | def handleError(self, record):
'''
Override the default error handling mechanism
Deal with log file rotation errors due to log file in use
more softly.
'''
handled = False
# Can't use "salt.utils.platform.is_windows()" in this file
if (sys.platform.start... | Override the default error handling mechanism
Deal with log file rotation errors due to log file in use
more softly. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/log/handlers/__init__.py#L126-L155 | null | class RotatingFileHandler(ExcInfoOnLogLevelFormatMixIn, logging.handlers.RotatingFileHandler, NewStyleClassMixIn):
'''
Rotating file handler which properly handles exc_info on a per handler basis
'''
|
saltstack/salt | salt/beacons/status.py | beacon | python | def beacon(config):
'''
Return status for requested information
'''
log.debug(config)
ctime = datetime.datetime.utcnow().isoformat()
if not config:
config = [{
'loadavg': ['all'],
'cpustats': ['all'],
'meminfo': ['all'],
'vmstats': ['all']... | Return status for requested information | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/status.py#L119-L168 | null | # -*- coding: utf-8 -*-
'''
The status beacon is intended to send a basic health check event up to the
master, this allows for event driven routines based on presence to be set up.
The intention of this beacon is to add the config options to add monitoring
stats to the health beacon making it a one stop shop for gathe... |
saltstack/salt | salt/states/sysctl.py | present | python | def present(name, value, config=None):
'''
Ensure that the named sysctl value is set in memory and persisted to the
named configuration file. The default sysctl configuration file is
/etc/sysctl.conf
name
The name of the sysctl value to edit
value
The sysctl value to apply
... | Ensure that the named sysctl value is set in memory and persisted to the
named configuration file. The default sysctl configuration file is
/etc/sysctl.conf
name
The name of the sysctl value to edit
value
The sysctl value to apply
config
The location of the sysctl configur... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/sysctl.py#L33-L131 | null | # -*- coding: utf-8 -*-
'''
Configuration of the kernel using sysctl
========================================
Control the kernel sysctl system.
.. code-block:: yaml
vm.swappiness:
sysctl.present:
- value: 20
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import python lib... |
saltstack/salt | salt/grains/opts.py | opts | python | def opts():
'''
Return the minion configuration settings
'''
if __opts__.get('grain_opts', False) or \
(isinstance(__pillar__, dict) and __pillar__.get('grain_opts', False)):
return __opts__
return {} | Return the minion configuration settings | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/opts.py#L9-L16 | null | # -*- coding: utf-8 -*-
'''
Simple grain to merge the opts into the grains directly if the grain_opts
configuration value is set
'''
from __future__ import absolute_import, print_function, unicode_literals
|
saltstack/salt | salt/modules/freebsd_update.py | _cmd | python | def _cmd(**kwargs):
'''
.. versionadded:: 2016.3.4
Private function that returns the freebsd-update command string to be
executed. It checks if any arguments are given to freebsd-update and appends
them accordingly.
'''
update_cmd = salt.utils.path.which('freebsd-update')
if not update_... | .. versionadded:: 2016.3.4
Private function that returns the freebsd-update command string to be
executed. It checks if any arguments are given to freebsd-update and appends
them accordingly. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsd_update.py#L45-L77 | null | # -*- coding: utf-8 -*-
'''
Support for freebsd-update utility on FreeBSD.
.. versionadded:: 2017.7.0
:maintainer: George Mamalakis <mamalos@gmail.com>
:maturity: new
:platform: FreeBSD
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import python libs
import logging
# ... |
saltstack/salt | salt/modules/freebsd_update.py | _wrapper | python | def _wrapper(orig, pre='', post='', err_=None, run_args=None, **kwargs):
'''
Helper function that wraps the execution of freebsd-update command.
orig:
Originating function that called _wrapper().
pre:
String that will be prepended to freebsd-update command.
post:
String th... | Helper function that wraps the execution of freebsd-update command.
orig:
Originating function that called _wrapper().
pre:
String that will be prepended to freebsd-update command.
post:
String that will be appended to freebsd-update command.
err_:
Dictionary on which... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsd_update.py#L80-L123 | [
"def _cmd(**kwargs):\n '''\n .. versionadded:: 2016.3.4\n\n Private function that returns the freebsd-update command string to be\n executed. It checks if any arguments are given to freebsd-update and appends\n them accordingly.\n '''\n update_cmd = salt.utils.path.which('freebsd-update')\n ... | # -*- coding: utf-8 -*-
'''
Support for freebsd-update utility on FreeBSD.
.. versionadded:: 2017.7.0
:maintainer: George Mamalakis <mamalos@gmail.com>
:maturity: new
:platform: FreeBSD
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import python libs
import logging
# ... |
saltstack/salt | salt/modules/freebsd_update.py | fetch | python | def fetch(**kwargs):
'''
.. versionadded:: 2016.3.4
freebsd-update fetch wrapper. Based on the currently installed world and the
configuration options set, fetch all available binary updates.
kwargs:
Parameters of freebsd-update command.
'''
# fetch continues when no controlling te... | .. versionadded:: 2016.3.4
freebsd-update fetch wrapper. Based on the currently installed world and the
configuration options set, fetch all available binary updates.
kwargs:
Parameters of freebsd-update command. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsd_update.py#L126-L145 | [
"def _wrapper(orig, pre='', post='', err_=None, run_args=None, **kwargs):\n '''\n Helper function that wraps the execution of freebsd-update command.\n\n orig:\n Originating function that called _wrapper().\n\n pre:\n String that will be prepended to freebsd-update command.\n\n post:\n ... | # -*- coding: utf-8 -*-
'''
Support for freebsd-update utility on FreeBSD.
.. versionadded:: 2017.7.0
:maintainer: George Mamalakis <mamalos@gmail.com>
:maturity: new
:platform: FreeBSD
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import python libs
import logging
# ... |
saltstack/salt | salt/modules/freebsd_update.py | update | python | def update(**kwargs):
'''
.. versionadded:: 2016.3.4
Command that simplifies freebsd-update by running freebsd-update fetch first
and then freebsd-update install.
kwargs:
Parameters of freebsd-update command.
'''
stdout = {}
for mode in ('fetch', 'install'):
err_ = {}
... | .. versionadded:: 2016.3.4
Command that simplifies freebsd-update by running freebsd-update fetch first
and then freebsd-update install.
kwargs:
Parameters of freebsd-update command. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsd_update.py#L174-L193 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def _wrapper(orig, pre='', post='', err_=None, run_args=None, **kwargs):\n '''\n Helper function that wraps the execution of freebsd-update command.\n\n orig:\n Originating function that called _wrapper().\n\n pre:\n String that... | # -*- coding: utf-8 -*-
'''
Support for freebsd-update utility on FreeBSD.
.. versionadded:: 2017.7.0
:maintainer: George Mamalakis <mamalos@gmail.com>
:maturity: new
:platform: FreeBSD
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import python libs
import logging
# ... |
saltstack/salt | salt/states/flatpak.py | uninstalled | python | def uninstalled(name):
'''
Ensure that the named package is not installed.
Args:
name (str): The flatpak package.
Returns:
dict: The ``result`` and ``output``.
Example:
.. code-block:: yaml
uninstall_package:
flatpack.uninstalled:
- name: gimp
... | Ensure that the named package is not installed.
Args:
name (str): The flatpak package.
Returns:
dict: The ``result`` and ``output``.
Example:
.. code-block:: yaml
uninstall_package:
flatpack.uninstalled:
- name: gimp | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/flatpak.py#L79-L121 | null | # -*- coding: utf-8 -*-
'''
Management of flatpak packages
==============================
Allows the installation and uninstallation of flatpak packages.
.. versionadded:: Neon
'''
from __future__ import absolute_import, print_function, unicode_literals
import salt.utils.path
__virtualname__ = 'flatpak'
def __virt... |
saltstack/salt | salt/states/flatpak.py | add_remote | python | def add_remote(name, location):
'''
Adds a new location to install flatpak packages from.
Args:
name (str): The repository's name.
location (str): The location of the repository.
Returns:
dict: The ``result`` and ``output``.
Example:
.. code-block:: yaml
add_... | Adds a new location to install flatpak packages from.
Args:
name (str): The repository's name.
location (str): The location of the repository.
Returns:
dict: The ``result`` and ``output``.
Example:
.. code-block:: yaml
add_flathub:
flatpack.add_remote:
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/flatpak.py#L124-L177 | null | # -*- coding: utf-8 -*-
'''
Management of flatpak packages
==============================
Allows the installation and uninstallation of flatpak packages.
.. versionadded:: Neon
'''
from __future__ import absolute_import, print_function, unicode_literals
import salt.utils.path
__virtualname__ = 'flatpak'
def __virt... |
saltstack/salt | salt/modules/smartos_nictagadm.py | list_nictags | python | def list_nictags(include_etherstubs=True):
'''
List all nictags
include_etherstubs : boolean
toggle include of etherstubs
CLI Example:
.. code-block:: bash
salt '*' nictagadm.list
'''
ret = {}
cmd = 'nictagadm list -d "|" -p{0}'.format(
' -L' if not include_et... | List all nictags
include_etherstubs : boolean
toggle include of etherstubs
CLI Example:
.. code-block:: bash
salt '*' nictagadm.list | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_nictagadm.py#L48-L78 | null | # -*- coding: utf-8 -*-
'''
Module for running nictagadm command on SmartOS
:maintainer: Jorge Schrauwen <sjorge@blackdot.be>
:maturity: new
:depends: nictagadm binary, dladm binary
:platform: smartos
..versionadded:: 2016.11.0
'''
from __future__ import absolute_import, unicode_literals, print_fun... |
saltstack/salt | salt/modules/smartos_nictagadm.py | vms | python | def vms(nictag):
'''
List all vms connect to nictag
nictag : string
name of nictag
CLI Example:
.. code-block:: bash
salt '*' nictagadm.vms admin
'''
ret = {}
cmd = 'nictagadm vms {0}'.format(nictag)
res = __salt__['cmd.run_all'](cmd)
retcode = res['retcode']
... | List all vms connect to nictag
nictag : string
name of nictag
CLI Example:
.. code-block:: bash
salt '*' nictagadm.vms admin | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_nictagadm.py#L81-L102 | null | # -*- coding: utf-8 -*-
'''
Module for running nictagadm command on SmartOS
:maintainer: Jorge Schrauwen <sjorge@blackdot.be>
:maturity: new
:depends: nictagadm binary, dladm binary
:platform: smartos
..versionadded:: 2016.11.0
'''
from __future__ import absolute_import, unicode_literals, print_fun... |
saltstack/salt | salt/modules/smartos_nictagadm.py | exists | python | def exists(*nictag, **kwargs):
'''
Check if nictags exists
nictag : string
one or more nictags to check
verbose : boolean
return list of nictags
CLI Example:
.. code-block:: bash
salt '*' nictagadm.exists admin
'''
ret = {}
if not nictag:
return {'... | Check if nictags exists
nictag : string
one or more nictags to check
verbose : boolean
return list of nictags
CLI Example:
.. code-block:: bash
salt '*' nictagadm.exists admin | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_nictagadm.py#L105-L134 | null | # -*- coding: utf-8 -*-
'''
Module for running nictagadm command on SmartOS
:maintainer: Jorge Schrauwen <sjorge@blackdot.be>
:maturity: new
:depends: nictagadm binary, dladm binary
:platform: smartos
..versionadded:: 2016.11.0
'''
from __future__ import absolute_import, unicode_literals, print_fun... |
saltstack/salt | salt/modules/smartos_nictagadm.py | add | python | def add(name, mac, mtu=1500):
'''
Add a new nictag
name : string
name of new nictag
mac : string
mac of parent interface or 'etherstub' to create a ether stub
mtu : int
MTU (ignored for etherstubs)
CLI Example:
.. code-block:: bash
salt '*' nictagadm.add s... | Add a new nictag
name : string
name of new nictag
mac : string
mac of parent interface or 'etherstub' to create a ether stub
mtu : int
MTU (ignored for etherstubs)
CLI Example:
.. code-block:: bash
salt '*' nictagadm.add storage0 etherstub
salt '*' nictaga... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_nictagadm.py#L137-L176 | null | # -*- coding: utf-8 -*-
'''
Module for running nictagadm command on SmartOS
:maintainer: Jorge Schrauwen <sjorge@blackdot.be>
:maturity: new
:depends: nictagadm binary, dladm binary
:platform: smartos
..versionadded:: 2016.11.0
'''
from __future__ import absolute_import, unicode_literals, print_fun... |
saltstack/salt | salt/modules/smartos_nictagadm.py | update | python | def update(name, mac=None, mtu=None):
'''
Update a nictag
name : string
name of nictag
mac : string
optional new mac for nictag
mtu : int
optional new MTU for nictag
CLI Example:
.. code-block:: bash
salt '*' nictagadm.update trunk mtu=9000
'''
ret... | Update a nictag
name : string
name of nictag
mac : string
optional new mac for nictag
mtu : int
optional new MTU for nictag
CLI Example:
.. code-block:: bash
salt '*' nictagadm.update trunk mtu=9000 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_nictagadm.py#L179-L228 | [
"def list_nictags(include_etherstubs=True):\n '''\n List all nictags\n\n include_etherstubs : boolean\n toggle include of etherstubs\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' nictagadm.list\n '''\n ret = {}\n cmd = 'nictagadm list -d \"|\" -p{0}'.format(\n '... | # -*- coding: utf-8 -*-
'''
Module for running nictagadm command on SmartOS
:maintainer: Jorge Schrauwen <sjorge@blackdot.be>
:maturity: new
:depends: nictagadm binary, dladm binary
:platform: smartos
..versionadded:: 2016.11.0
'''
from __future__ import absolute_import, unicode_literals, print_fun... |
saltstack/salt | salt/modules/smartos_nictagadm.py | delete | python | def delete(name, force=False):
'''
Delete nictag
name : string
nictag to delete
force : boolean
force delete even if vms attached
CLI Example:
.. code-block:: bash
salt '*' nictagadm.exists admin
'''
ret = {}
if name not in list_nictags():
return ... | Delete nictag
name : string
nictag to delete
force : boolean
force delete even if vms attached
CLI Example:
.. code-block:: bash
salt '*' nictagadm.exists admin | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_nictagadm.py#L231-L257 | [
"def list_nictags(include_etherstubs=True):\n '''\n List all nictags\n\n include_etherstubs : boolean\n toggle include of etherstubs\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' nictagadm.list\n '''\n ret = {}\n cmd = 'nictagadm list -d \"|\" -p{0}'.format(\n '... | # -*- coding: utf-8 -*-
'''
Module for running nictagadm command on SmartOS
:maintainer: Jorge Schrauwen <sjorge@blackdot.be>
:maturity: new
:depends: nictagadm binary, dladm binary
:platform: smartos
..versionadded:: 2016.11.0
'''
from __future__ import absolute_import, unicode_literals, print_fun... |
saltstack/salt | salt/proxy/philips_hue.py | init | python | def init(cnf):
'''
Initialize the module.
'''
CONFIG['host'] = cnf.get('proxy', {}).get('host')
if not CONFIG['host']:
raise MinionError(message="Cannot find 'host' parameter in the proxy configuration")
CONFIG['user'] = cnf.get('proxy', {}).get('user')
if not CONFIG['user']:
... | Initialize the module. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L79-L91 | null | # -*- coding: utf-8 -*-
#
# Copyright 2015 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
saltstack/salt | salt/proxy/philips_hue.py | _query | python | def _query(lamp_id, state, action='', method='GET'):
'''
Query the URI
:return:
'''
# Because salt.utils.query is that dreadful... :(
err = None
url = "{0}/lights{1}".format(CONFIG['uri'],
lamp_id and '/{0}'.format(lamp_id) or '') \
+ (action and ... | Query the URI
:return: | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L110-L137 | [
"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 -*-
#
# Copyright 2015 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
saltstack/salt | salt/proxy/philips_hue.py | _set | python | def _set(lamp_id, state, method="state"):
'''
Set state to the device by ID.
:param lamp_id:
:param state:
:return:
'''
try:
res = _query(lamp_id, state, action=method, method='PUT')
except Exception as err:
raise CommandExecutionError(err)
res = len(res) > 1 and re... | Set state to the device by ID.
:param lamp_id:
:param state:
:return: | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L140-L161 | [
"def _query(lamp_id, state, action='', method='GET'):\n '''\n Query the URI\n\n :return:\n '''\n # Because salt.utils.query is that dreadful... :(\n\n err = None\n url = \"{0}/lights{1}\".format(CONFIG['uri'],\n lamp_id and '/{0}'.format(lamp_id) or '') \\\n ... | # -*- coding: utf-8 -*-
#
# Copyright 2015 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
saltstack/salt | salt/proxy/philips_hue.py | _get_devices | python | def _get_devices(params):
'''
Parse device(s) ID(s) from the common params.
:param params:
:return:
'''
if 'id' not in params:
raise CommandExecutionError("Parameter ID is required.")
return type(params['id']) == int and [params['id']] \
or [int(dev) for dev in params['i... | Parse device(s) ID(s) from the common params.
:param params:
:return: | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L164-L175 | null | # -*- coding: utf-8 -*-
#
# Copyright 2015 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
saltstack/salt | salt/proxy/philips_hue.py | call_lights | python | def call_lights(*args, **kwargs):
'''
Get info about all available lamps.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
CLI Example:
.. code-block:: bash
salt '*' hue.lights
salt '*' hue.lights id=1
salt '*' hue.lights id... | Get info about all available lamps.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
CLI Example:
.. code-block:: bash
salt '*' hue.lights
salt '*' hue.lights id=1
salt '*' hue.lights id=1,2,3 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L186-L208 | [
"def _get_devices(params):\n '''\n Parse device(s) ID(s) from the common params.\n\n :param params:\n :return:\n '''\n if 'id' not in params:\n raise CommandExecutionError(\"Parameter ID is required.\")\n\n return type(params['id']) == int and [params['id']] \\\n or [int(dev) f... | # -*- coding: utf-8 -*-
#
# Copyright 2015 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
saltstack/salt | salt/proxy/philips_hue.py | call_switch | python | def call_switch(*args, **kwargs):
'''
Switch lamp ON/OFF.
If no particular state is passed,
then lamp will be switched to the opposite state.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
* **on**: True or False. Inverted current, if omitted
... | Switch lamp ON/OFF.
If no particular state is passed,
then lamp will be switched to the opposite state.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
* **on**: True or False. Inverted current, if omitted
CLI Example:
.. code-block:: bash
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L211-L241 | [
"def _set(lamp_id, state, method=\"state\"):\n '''\n Set state to the device by ID.\n\n :param lamp_id:\n :param state:\n :return:\n '''\n try:\n res = _query(lamp_id, state, action=method, method='PUT')\n except Exception as err:\n raise CommandExecutionError(err)\n\n res =... | # -*- coding: utf-8 -*-
#
# Copyright 2015 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
saltstack/salt | salt/proxy/philips_hue.py | call_blink | python | def call_blink(*args, **kwargs):
'''
Blink a lamp. If lamp is ON, then blink ON-OFF-ON, otherwise OFF-ON-OFF.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
* **pause**: Time in seconds. Can be less than 1, i.e. 0.7, 0.5 sec.
CLI Example:
.. c... | Blink a lamp. If lamp is ON, then blink ON-OFF-ON, otherwise OFF-ON-OFF.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
* **pause**: Time in seconds. Can be less than 1, i.e. 0.7, 0.5 sec.
CLI Example:
.. code-block:: bash
salt '*' hue.blink ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L244-L270 | [
"def _set(lamp_id, state, method=\"state\"):\n '''\n Set state to the device by ID.\n\n :param lamp_id:\n :param state:\n :return:\n '''\n try:\n res = _query(lamp_id, state, action=method, method='PUT')\n except Exception as err:\n raise CommandExecutionError(err)\n\n res =... | # -*- coding: utf-8 -*-
#
# Copyright 2015 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
saltstack/salt | salt/proxy/philips_hue.py | call_ping | python | def call_ping(*args, **kwargs):
'''
Ping the lamps by issuing a short inversion blink to all available devices.
CLI Example:
.. code-block:: bash
salt '*' hue.ping
'''
errors = dict()
for dev_id, dev_status in call_blink().items():
if not dev_status['result']:
... | Ping the lamps by issuing a short inversion blink to all available devices.
CLI Example:
.. code-block:: bash
salt '*' hue.ping | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L273-L288 | [
"def call_blink(*args, **kwargs):\n '''\n Blink a lamp. If lamp is ON, then blink ON-OFF-ON, otherwise OFF-ON-OFF.\n\n Options:\n\n * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.\n * **pause**: Time in seconds. Can be less than 1, i.e. 0.7, 0.5 sec.\n\n CLI Exam... | # -*- coding: utf-8 -*-
#
# Copyright 2015 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
saltstack/salt | salt/proxy/philips_hue.py | call_status | python | def call_status(*args, **kwargs):
'''
Return the status of the lamps.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
CLI Example:
.. code-block:: bash
salt '*' hue.status
salt '*' hue.status id=1
salt '*' hue.status id=1,2... | Return the status of the lamps.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
CLI Example:
.. code-block:: bash
salt '*' hue.status
salt '*' hue.status id=1
salt '*' hue.status id=1,2,3 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L291-L316 | [
"def _get_devices(params):\n '''\n Parse device(s) ID(s) from the common params.\n\n :param params:\n :return:\n '''\n if 'id' not in params:\n raise CommandExecutionError(\"Parameter ID is required.\")\n\n return type(params['id']) == int and [params['id']] \\\n or [int(dev) f... | # -*- coding: utf-8 -*-
#
# Copyright 2015 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
saltstack/salt | salt/proxy/philips_hue.py | call_rename | python | def call_rename(*args, **kwargs):
'''
Rename a device.
Options:
* **id**: Specifies a device ID. Only one device at a time.
* **title**: Title of the device.
CLI Example:
.. code-block:: bash
salt '*' hue.rename id=1 title='WC for cats'
'''
dev_id = _get_devices(kwargs)
... | Rename a device.
Options:
* **id**: Specifies a device ID. Only one device at a time.
* **title**: Title of the device.
CLI Example:
.. code-block:: bash
salt '*' hue.rename id=1 title='WC for cats' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L319-L341 | [
"def _set(lamp_id, state, method=\"state\"):\n '''\n Set state to the device by ID.\n\n :param lamp_id:\n :param state:\n :return:\n '''\n try:\n res = _query(lamp_id, state, action=method, method='PUT')\n except Exception as err:\n raise CommandExecutionError(err)\n\n res =... | # -*- coding: utf-8 -*-
#
# Copyright 2015 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
saltstack/salt | salt/proxy/philips_hue.py | call_alert | python | def call_alert(*args, **kwargs):
'''
Lamp alert
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
* **on**: Turns on or off an alert. Default is True.
CLI Example:
.. code-block:: bash
salt '*' hue.alert
salt '*' hue.alert id=1
... | Lamp alert
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
* **on**: Turns on or off an alert. Default is True.
CLI Example:
.. code-block:: bash
salt '*' hue.alert
salt '*' hue.alert id=1
salt '*' hue.alert id=1,2,3 on=false | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L344-L367 | [
"def _set(lamp_id, state, method=\"state\"):\n '''\n Set state to the device by ID.\n\n :param lamp_id:\n :param state:\n :return:\n '''\n try:\n res = _query(lamp_id, state, action=method, method='PUT')\n except Exception as err:\n raise CommandExecutionError(err)\n\n res =... | # -*- coding: utf-8 -*-
#
# Copyright 2015 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
saltstack/salt | salt/proxy/philips_hue.py | call_color | python | def call_color(*args, **kwargs):
'''
Set a color to the lamp.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
* **color**: Fixed color. Values are: red, green, blue, orange, pink, white,
yellow, daylight, purple. Default white.
* **t... | Set a color to the lamp.
Options:
* **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted.
* **color**: Fixed color. Values are: red, green, blue, orange, pink, white,
yellow, daylight, purple. Default white.
* **transition**: Transition 0~200.
Advanced:... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L396-L454 | [
"def _set(lamp_id, state, method=\"state\"):\n '''\n Set state to the device by ID.\n\n :param lamp_id:\n :param state:\n :return:\n '''\n try:\n res = _query(lamp_id, state, action=method, method='PUT')\n except Exception as err:\n raise CommandExecutionError(err)\n\n res =... | # -*- coding: utf-8 -*-
#
# Copyright 2015 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.