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/cli/salt.py
SaltCMD._progress_ret
python
def _progress_ret(self, progress, out): ''' Print progress events ''' import salt.output # Get the progress bar if not hasattr(self, 'progress_bar'): try: self.progress_bar = salt.output.get_progress(self.config, out, progress) exce...
Print progress events
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/salt.py#L350-L362
null
class SaltCMD(salt.utils.parsers.SaltCMDOptionParser): ''' The execution of a salt command happens here ''' def run(self): ''' Execute the salt command line ''' import salt.client self.parse_args() if self.config['log_level'] not in ('quiet', ): ...
saltstack/salt
salt/cli/salt.py
SaltCMD._output_ret
python
def _output_ret(self, ret, out, retcode=0): ''' Print the output from a single return to the terminal ''' import salt.output # Handle special case commands if self.config['fun'] == 'sys.doc' and not isinstance(ret, Exception): self._print_docs(ret) els...
Print the output from a single return to the terminal
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/salt.py#L364-L380
null
class SaltCMD(salt.utils.parsers.SaltCMDOptionParser): ''' The execution of a salt command happens here ''' def run(self): ''' Execute the salt command line ''' import salt.client self.parse_args() if self.config['log_level'] not in ('quiet', ): ...
saltstack/salt
salt/cli/salt.py
SaltCMD._format_ret
python
def _format_ret(self, full_ret): ''' Take the full return data and format it to simple output ''' ret = {} out = '' retcode = 0 for key, data in six.iteritems(full_ret): ret[key] = data['ret'] if 'out' in data: out = data['o...
Take the full return data and format it to simple output
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/salt.py#L382-L396
null
class SaltCMD(salt.utils.parsers.SaltCMDOptionParser): ''' The execution of a salt command happens here ''' def run(self): ''' Execute the salt command line ''' import salt.client self.parse_args() if self.config['log_level'] not in ('quiet', ): ...
saltstack/salt
salt/cli/salt.py
SaltCMD._get_retcode
python
def _get_retcode(self, ret): ''' Determine a retcode for a given return ''' retcode = 0 # if there is a dict with retcode, use that if isinstance(ret, dict) and ret.get('retcode', 0) != 0: if isinstance(ret.get('retcode', 0), dict): return max(...
Determine a retcode for a given return
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/salt.py#L398-L411
null
class SaltCMD(salt.utils.parsers.SaltCMDOptionParser): ''' The execution of a salt command happens here ''' def run(self): ''' Execute the salt command line ''' import salt.client self.parse_args() if self.config['log_level'] not in ('quiet', ): ...
saltstack/salt
salt/cli/salt.py
SaltCMD._print_docs
python
def _print_docs(self, ret): ''' Print out the docstrings for all of the functions on the minions ''' import salt.output docs = {} if not ret: self.exit(2, 'No minions found to gather docs from\n') if isinstance(ret, six.string_types): self....
Print out the docstrings for all of the functions on the minions
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/salt.py#L418-L443
null
class SaltCMD(salt.utils.parsers.SaltCMDOptionParser): ''' The execution of a salt command happens here ''' def run(self): ''' Execute the salt command line ''' import salt.client self.parse_args() if self.config['log_level'] not in ('quiet', ): ...
saltstack/salt
salt/utils/yamlencoding.py
yaml_dquote
python
def yaml_dquote(text): ''' Make text into a double-quoted YAML string with correct escaping for special characters. Includes the opening and closing double quote characters. ''' with io.StringIO() as ostream: yemitter = yaml.emitter.Emitter(ostream, width=six.MAXSIZE) yemitter.w...
Make text into a double-quoted YAML string with correct escaping for special characters. Includes the opening and closing double quote characters.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/yamlencoding.py#L19-L28
null
# -*- coding: utf-8 -*- ''' Functions for adding yaml encoding to the jinja context ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import io # Import 3rd-party libs import yaml # pylint: disable=blacklisted-import from salt.ext import six # Import salt libs from sa...
saltstack/salt
salt/utils/yamlencoding.py
yaml_squote
python
def yaml_squote(text): ''' Make text into a single-quoted YAML string with correct escaping for special characters. Includes the opening and closing single quote characters. ''' with io.StringIO() as ostream: yemitter = yaml.emitter.Emitter(ostream, width=six.MAXSIZE) yemitter.w...
Make text into a single-quoted YAML string with correct escaping for special characters. Includes the opening and closing single quote characters.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/yamlencoding.py#L32-L41
null
# -*- coding: utf-8 -*- ''' Functions for adding yaml encoding to the jinja context ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import io # Import 3rd-party libs import yaml # pylint: disable=blacklisted-import from salt.ext import six # Import salt libs from sa...
saltstack/salt
salt/utils/yamlencoding.py
yaml_encode
python
def yaml_encode(data): ''' A simple YAML encode that can take a single-element datatype and return a string representation. ''' yrepr = yaml.representer.SafeRepresenter() ynode = yrepr.represent_data(data) if not isinstance(ynode, yaml.ScalarNode): raise TypeError( "yaml_...
A simple YAML encode that can take a single-element datatype and return a string representation.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/yamlencoding.py#L45-L64
null
# -*- coding: utf-8 -*- ''' Functions for adding yaml encoding to the jinja context ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import io # Import 3rd-party libs import yaml # pylint: disable=blacklisted-import from salt.ext import six # Import salt libs from sa...
saltstack/salt
salt/renderers/nacl.py
_decrypt_object
python
def _decrypt_object(obj, **kwargs): ''' Recursively try to decrypt any object. If the object is a six.string_types (string or unicode), and it contains a valid NACLENC pretext, decrypt it, otherwise keep going until a string is found. ''' if salt.utils.stringio.is_readable(obj): return _...
Recursively try to decrypt any object. If the object is a six.string_types (string or unicode), and it contains a valid NACLENC pretext, decrypt it, otherwise keep going until a string is found.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/renderers/nacl.py#L71-L93
[ "def is_readable(obj):\n if six.PY2:\n return isinstance(obj, readable_types)\n else:\n return isinstance(obj, readable_types) and obj.readable()\n", "def _decrypt_object(obj, **kwargs):\n '''\n Recursively try to decrypt any object. If the object is a six.string_types\n (string or un...
# -*- coding: utf-8 -*- r''' Renderer that will decrypt NACL ciphers Any key in the SLS file can be an NACL cipher, and this renderer will decrypt it before passing it off to Salt. This allows you to safely store secrets in source control, in such a way that only your Salt master can decrypt them and distribute them o...
saltstack/salt
salt/pillar/mysql.py
ext_pillar
python
def ext_pillar(minion_id, pillar, *args, **kwargs): ''' Execute queries against MySQL, merge and return as a dict ''' return MySQLExtPillar().fetch(minion_id, pillar, *args, **kwargs)
Execute queries against MySQL, merge and return as a dict
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/mysql.py#L140-L147
null
# -*- coding: utf-8 -*- ''' Retrieve Pillar data by doing a MySQL query MariaDB provides Python support through the MySQL Python package. Therefore, you may use this module with both MySQL or MariaDB. This module is a concrete implementation of the sql_base ext_pillar for MySQL. :maturity: new :depends: python-mysql...
saltstack/salt
salt/pillar/mysql.py
MySQLExtPillar._get_options
python
def _get_options(self): ''' Returns options used for the MySQL connection. ''' defaults = {'host': 'localhost', 'user': 'salt', 'pass': 'salt', 'db': 'salt', 'port': 3306, 'ssl': {}} ...
Returns options used for the MySQL connection.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/mysql.py#L93-L111
null
class MySQLExtPillar(SqlBaseExtPillar): ''' This class receives and processes the database rows from MySQL. ''' @classmethod def _db_name(cls): return 'MySQL' @contextmanager def _get_cursor(self): ''' Yield a MySQL cursor ''' _options = self._get_op...
saltstack/salt
salt/pillar/mysql.py
MySQLExtPillar._get_cursor
python
def _get_cursor(self): ''' Yield a MySQL cursor ''' _options = self._get_options() conn = MySQLdb.connect(host=_options['host'], user=_options['user'], passwd=_options['pass'], db=_option...
Yield a MySQL cursor
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/mysql.py#L114-L130
null
class MySQLExtPillar(SqlBaseExtPillar): ''' This class receives and processes the database rows from MySQL. ''' @classmethod def _db_name(cls): return 'MySQL' def _get_options(self): ''' Returns options used for the MySQL connection. ''' defaults = {'host...
saltstack/salt
salt/pillar/mysql.py
MySQLExtPillar.extract_queries
python
def extract_queries(self, args, kwargs): ''' This function normalizes the config block into a set of queries we can use. The return is a list of consistently laid out dicts. ''' return super(MySQLExtPillar, self).extract_queries(args, kwargs)
This function normalizes the config block into a set of queries we can use. The return is a list of consistently laid out dicts.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/mysql.py#L132-L137
[ "def extract_queries(self, args, kwargs):\n '''\n This function normalizes the config block into a set of queries we\n can use. The return is a list of consistently laid out dicts.\n '''\n # Please note the function signature is NOT an error. Neither args, nor\n # kwargs should have asterisks. ...
class MySQLExtPillar(SqlBaseExtPillar): ''' This class receives and processes the database rows from MySQL. ''' @classmethod def _db_name(cls): return 'MySQL' def _get_options(self): ''' Returns options used for the MySQL connection. ''' defaults = {'host...
saltstack/salt
salt/client/ssh/wrapper/config.py
merge
python
def merge(value, default='', omit_opts=False, omit_master=False, omit_pillar=False): ''' Retrieves an option based on key, merging all matches. Same as ``option()`` except that it merges all matches, rather than taking the first match. CLI Example: .. c...
Retrieves an option based on key, merging all matches. Same as ``option()`` except that it merges all matches, rather than taking the first match. CLI Example: .. code-block:: bash salt '*' config.merge schedule
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/config.py#L134-L185
null
# -*- coding: utf-8 -*- ''' Return config information ''' # Import python libs from __future__ import absolute_import, print_function import re import os # Import salt libs import salt.utils.data import salt.utils.files import salt.syspaths as syspaths # Import 3rd-party libs from salt.ext import six # Set up the d...
saltstack/salt
salt/client/ssh/wrapper/config.py
get
python
def get(key, default=''): ''' .. versionadded: 0.14.0 Attempt to retrieve the named value from opts, pillar, grains of the master config, if the named value is not available return the passed default. The default return is an empty string. The value can also represent a value in a nested dict ...
.. versionadded: 0.14.0 Attempt to retrieve the named value from opts, pillar, grains of the master config, if the named value is not available return the passed default. The default return is an empty string. The value can also represent a value in a nested dict using a ":" delimiter for the dict...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/config.py#L188-L231
null
# -*- coding: utf-8 -*- ''' Return config information ''' # Import python libs from __future__ import absolute_import, print_function import re import os # Import salt libs import salt.utils.data import salt.utils.files import salt.syspaths as syspaths # Import 3rd-party libs from salt.ext import six # Set up the d...
saltstack/salt
salt/states/zabbix_action.py
present
python
def present(name, params, **kwargs): ''' Creates Zabbix Action object or if differs update it according defined parameters :param name: Zabbix Action name :param params: Definition of the Zabbix Action :param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's ...
Creates Zabbix Action object or if differs update it according defined parameters :param name: Zabbix Action name :param params: Definition of the Zabbix Action :param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring) :param _connection_password: Optio...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_action.py#L35-L151
null
# -*- coding: utf-8 -*- ''' .. versionadded:: 2017.7 Management of Zabbix Action object over Zabbix API. :codeauthor: Jakub Sliva <jakub.sliva@ultimum.io> ''' from __future__ import absolute_import from __future__ import unicode_literals import logging import json try: from salt.ext import six from salt.exce...
saltstack/salt
salt/modules/openbsdrcctl_service.py
available
python
def available(name): ''' Return True if the named service is available. CLI Example: .. code-block:: bash salt '*' service.available sshd ''' cmd = '{0} get {1}'.format(_cmd(), name) if __salt__['cmd.retcode'](cmd) == 2: return False return True
Return True if the named service is available. CLI Example: .. code-block:: bash salt '*' service.available sshd
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openbsdrcctl_service.py#L54-L67
null
# -*- coding: utf-8 -*- ''' The rcctl service module for OpenBSD ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import os # Import salt libs import salt.utils.path import salt.utils.decorators as decorators from salt.exceptions import CommandNotFoundError __func_ali...
saltstack/salt
salt/modules/openbsdrcctl_service.py
get_all
python
def get_all(): ''' Return all installed services. CLI Example: .. code-block:: bash salt '*' service.get_all ''' ret = [] service = _cmd() for svc in __salt__['cmd.run']('{0} ls all'.format(service)).splitlines(): ret.append(svc) return sorted(ret)
Return all installed services. CLI Example: .. code-block:: bash salt '*' service.get_all
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openbsdrcctl_service.py#L84-L98
null
# -*- coding: utf-8 -*- ''' The rcctl service module for OpenBSD ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import os # Import salt libs import salt.utils.path import salt.utils.decorators as decorators from salt.exceptions import CommandNotFoundError __func_ali...
saltstack/salt
salt/modules/openbsdrcctl_service.py
status
python
def status(name, sig=None): ''' Return the status for a service, returns a bool whether the service is running. CLI Example: .. code-block:: bash salt '*' service.status <service name> ''' if sig: return bool(__salt__['status.pid'](sig)) cmd = '{0} check {1}'.format(_...
Return the status for a service, returns a bool whether the service is running. CLI Example: .. code-block:: bash salt '*' service.status <service name>
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openbsdrcctl_service.py#L191-L206
null
# -*- coding: utf-8 -*- ''' The rcctl service module for OpenBSD ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import os # Import salt libs import salt.utils.path import salt.utils.decorators as decorators from salt.exceptions import CommandNotFoundError __func_ali...
saltstack/salt
salt/modules/openbsdrcctl_service.py
enable
python
def enable(name, **kwargs): ''' Enable the named service to start at boot. flags : None Set optional flags to run the service with. service.flags can be used to change the default flags. CLI Example: .. code-block:: bash salt '*' service.enable <service name> salt '*...
Enable the named service to start at boot. flags : None Set optional flags to run the service with. service.flags can be used to change the default flags. CLI Example: .. code-block:: bash salt '*' service.enable <service name> salt '*' service.enable <service name> flags=<f...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openbsdrcctl_service.py#L209-L235
[ "def _get_flags(**kwargs):\n '''\n Return the configured service flags.\n '''\n flags = kwargs.get('flags',\n __salt__['config.option']('service.flags',\n default=''))\n return flags\n" ]
# -*- coding: utf-8 -*- ''' The rcctl service module for OpenBSD ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import os # Import salt libs import salt.utils.path import salt.utils.decorators as decorators from salt.exceptions import CommandNotFoundError __func_ali...
saltstack/salt
salt/modules/openbsdrcctl_service.py
enabled
python
def enabled(name, **kwargs): ''' Return True if the named service is enabled at boot and the provided flags match the configured ones (if any). Return False otherwise. name Service name CLI Example: .. code-block:: bash salt '*' service.enabled <service name> salt '*'...
Return True if the named service is enabled at boot and the provided flags match the configured ones (if any). Return False otherwise. name Service name CLI Example: .. code-block:: bash salt '*' service.enabled <service name> salt '*' service.enabled <service name> flags=<fl...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openbsdrcctl_service.py#L266-L294
[ "def _get_flags(**kwargs):\n '''\n Return the configured service flags.\n '''\n flags = kwargs.get('flags',\n __salt__['config.option']('service.flags',\n default=''))\n return flags\n" ]
# -*- coding: utf-8 -*- ''' The rcctl service module for OpenBSD ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import os # Import salt libs import salt.utils.path import salt.utils.decorators as decorators from salt.exceptions import CommandNotFoundError __func_ali...
saltstack/salt
salt/states/netusers.py
_expand_users
python
def _expand_users(device_users, common_users): '''Creates a longer list of accepted users on the device.''' expected_users = deepcopy(common_users) expected_users.update(device_users) return expected_users
Creates a longer list of accepted users on the device.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netusers.py#L75-L82
null
# -*- coding: utf-8 -*- ''' Network Users ============= Manage the users configuration on network devices via the NAPALM proxy. :codeauthor: Mircea Ulinic <mircea@cloudflare.com> :maturity: new :depends: napalm :platform: unix Dependencies ------------ - :mod:`NAPALM proxy minion <salt.proxy.napalm>` - :mod:`...
saltstack/salt
salt/states/netusers.py
_check_users
python
def _check_users(users): '''Checks if the input dictionary of users is valid.''' messg = '' valid = True for user, user_details in six.iteritems(users): if not user_details: valid = False messg += 'Please provide details for username {user}.\n'.format(user=user) ...
Checks if the input dictionary of users is valid.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netusers.py#L85-L101
null
# -*- coding: utf-8 -*- ''' Network Users ============= Manage the users configuration on network devices via the NAPALM proxy. :codeauthor: Mircea Ulinic <mircea@cloudflare.com> :maturity: new :depends: napalm :platform: unix Dependencies ------------ - :mod:`NAPALM proxy minion <salt.proxy.napalm>` - :mod:`...
saltstack/salt
salt/states/netusers.py
_compute_diff
python
def _compute_diff(configured, expected): '''Computes the differences between the actual config and the expected config''' diff = { 'add': {}, 'update': {}, 'remove': {} } configured_users = set(configured.keys()) expected_users = set(expected.keys()) add_usernames = e...
Computes the differences between the actual config and the expected config
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netusers.py#L104-L141
null
# -*- coding: utf-8 -*- ''' Network Users ============= Manage the users configuration on network devices via the NAPALM proxy. :codeauthor: Mircea Ulinic <mircea@cloudflare.com> :maturity: new :depends: napalm :platform: unix Dependencies ------------ - :mod:`NAPALM proxy minion <salt.proxy.napalm>` - :mod:`...
saltstack/salt
salt/states/netusers.py
managed
python
def managed(name, users=None, defaults=None): ''' Manages the configuration of the users on the device, as specified in the state SLS file. Users not defined in that file will be remove whilst users not configured on the device, will be added. SLS Example: .. code-block:: yaml netusers_e...
Manages the configuration of the users on the device, as specified in the state SLS file. Users not defined in that file will be remove whilst users not configured on the device, will be added. SLS Example: .. code-block:: yaml netusers_example: netusers.managed: - us...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netusers.py#L169-L443
[ "def _set_users(users):\n\n '''Calls users.set_users.'''\n\n return __salt__['users.set_users'](users, commit=False)\n", "def _ordered_dict_to_dict(probes):\n\n '''.'''\n\n return loads(dumps(probes))\n", "def _compute_diff(configured, expected):\n\n '''Computes the differences between the actual...
# -*- coding: utf-8 -*- ''' Network Users ============= Manage the users configuration on network devices via the NAPALM proxy. :codeauthor: Mircea Ulinic <mircea@cloudflare.com> :maturity: new :depends: napalm :platform: unix Dependencies ------------ - :mod:`NAPALM proxy minion <salt.proxy.napalm>` - :mod:`...
saltstack/salt
salt/netapi/rest_cherrypy/tools/websockets.py
SynchronizingWebsocket.received_message
python
def received_message(self, message): ''' Checks if the client has sent a ready message. A ready message causes ``send()`` to be called on the ``parent end`` of the pipe. Clients need to ensure that the pipe assigned to ``self.pipe`` is the ``parent end`` of a pipe. ...
Checks if the client has sent a ready message. A ready message causes ``send()`` to be called on the ``parent end`` of the pipe. Clients need to ensure that the pipe assigned to ``self.pipe`` is the ``parent end`` of a pipe. This ensures completion of the underlying websocket c...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/tools/websockets.py#L45-L59
null
class SynchronizingWebsocket(WebSocket): ''' Class to handle requests sent to this websocket connection. Each instance of this class represents a Salt websocket connection. Waits to receive a ``ready`` message from the client. Calls send on it's end of the pipe to signal to the sender on receipt ...
saltstack/salt
salt/utils/text.py
cli_info
python
def cli_info(data, title='Info'): ''' Prints an info on CLI with the title. Useful for infos, general errors etc. :param data: :param title: :return: ''' wrapper = textwrap.TextWrapper() wrapper.initial_indent = ' ' * 4 wrapper.subsequent_indent = wrapper.initial_indent re...
Prints an info on CLI with the title. Useful for infos, general errors etc. :param data: :param title: :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/text.py#L9-L23
null
# coding=utf-8 ''' All text work utilities (formatting messages, layout etc). ''' from __future__ import absolute_import, unicode_literals, print_function import textwrap
saltstack/salt
salt/modules/pagerduty_util.py
get_users
python
def get_users(profile='pagerduty', subdomain=None, api_key=None): ''' List users belonging to this account CLI Example: salt myminion pagerduty.get_users ''' return _list_items( 'users', 'id', profile=profile, subdomain=subdomain, api_key=api_key, ...
List users belonging to this account CLI Example: salt myminion pagerduty.get_users
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L34-L49
[ "def _list_items(action, key, profile=None, subdomain=None, api_key=None):\n '''\n List items belonging to an API call.\n\n This method should be in utils.pagerduty.\n '''\n items = _query(\n profile=profile,\n subdomain=subdomain,\n api_key=api_key,\n action=action\n )...
# -*- coding: utf-8 -*- ''' Module for manageing PagerDuty resource :configuration: This module can be used by specifying the name of a configuration profile in the minion config, minion pillar, or master config. The default configuration profile name is 'pagerduty.' For example: .. code-block:: yam...
saltstack/salt
salt/modules/pagerduty_util.py
get_services
python
def get_services(profile='pagerduty', subdomain=None, api_key=None): ''' List services belonging to this account CLI Example: salt myminion pagerduty.get_services ''' return _list_items( 'services', 'id', profile=profile, subdomain=subdomain, api_ke...
List services belonging to this account CLI Example: salt myminion pagerduty.get_services
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L52-L67
[ "def _list_items(action, key, profile=None, subdomain=None, api_key=None):\n '''\n List items belonging to an API call.\n\n This method should be in utils.pagerduty.\n '''\n items = _query(\n profile=profile,\n subdomain=subdomain,\n api_key=api_key,\n action=action\n )...
# -*- coding: utf-8 -*- ''' Module for manageing PagerDuty resource :configuration: This module can be used by specifying the name of a configuration profile in the minion config, minion pillar, or master config. The default configuration profile name is 'pagerduty.' For example: .. code-block:: yam...
saltstack/salt
salt/modules/pagerduty_util.py
get_schedules
python
def get_schedules(profile='pagerduty', subdomain=None, api_key=None): ''' List schedules belonging to this account CLI Example: salt myminion pagerduty.get_schedules ''' return _list_items( 'schedules', 'id', profile=profile, subdomain=subdomain, ap...
List schedules belonging to this account CLI Example: salt myminion pagerduty.get_schedules
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L70-L85
[ "def _list_items(action, key, profile=None, subdomain=None, api_key=None):\n '''\n List items belonging to an API call.\n\n This method should be in utils.pagerduty.\n '''\n items = _query(\n profile=profile,\n subdomain=subdomain,\n api_key=api_key,\n action=action\n )...
# -*- coding: utf-8 -*- ''' Module for manageing PagerDuty resource :configuration: This module can be used by specifying the name of a configuration profile in the minion config, minion pillar, or master config. The default configuration profile name is 'pagerduty.' For example: .. code-block:: yam...
saltstack/salt
salt/modules/pagerduty_util.py
get_escalation_policies
python
def get_escalation_policies(profile='pagerduty', subdomain=None, api_key=None): ''' List escalation_policies belonging to this account CLI Example: salt myminion pagerduty.get_escalation_policies ''' return _list_items( 'escalation_policies', 'id', profile=profile,...
List escalation_policies belonging to this account CLI Example: salt myminion pagerduty.get_escalation_policies
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L88-L103
[ "def _list_items(action, key, profile=None, subdomain=None, api_key=None):\n '''\n List items belonging to an API call.\n\n This method should be in utils.pagerduty.\n '''\n items = _query(\n profile=profile,\n subdomain=subdomain,\n api_key=api_key,\n action=action\n )...
# -*- coding: utf-8 -*- ''' Module for manageing PagerDuty resource :configuration: This module can be used by specifying the name of a configuration profile in the minion config, minion pillar, or master config. The default configuration profile name is 'pagerduty.' For example: .. code-block:: yam...
saltstack/salt
salt/modules/pagerduty_util.py
_list_items
python
def _list_items(action, key, profile=None, subdomain=None, api_key=None): ''' List items belonging to an API call. This method should be in utils.pagerduty. ''' items = _query( profile=profile, subdomain=subdomain, api_key=api_key, action=action ) ret = {} ...
List items belonging to an API call. This method should be in utils.pagerduty.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L106-L121
[ "def _query(method='GET', profile=None, url=None, path='api/v1',\n action=None, api_key=None, service=None, params=None,\n data=None, subdomain=None, verify_ssl=True):\n '''\n Query the PagerDuty API.\n\n This method should be in utils.pagerduty.\n\n '''\n\n if profile:\n c...
# -*- coding: utf-8 -*- ''' Module for manageing PagerDuty resource :configuration: This module can be used by specifying the name of a configuration profile in the minion config, minion pillar, or master config. The default configuration profile name is 'pagerduty.' For example: .. code-block:: yam...
saltstack/salt
salt/modules/pagerduty_util.py
_query
python
def _query(method='GET', profile=None, url=None, path='api/v1', action=None, api_key=None, service=None, params=None, data=None, subdomain=None, verify_ssl=True): ''' Query the PagerDuty API. This method should be in utils.pagerduty. ''' if profile: creds = __salt__[...
Query the PagerDuty API. This method should be in utils.pagerduty.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L124-L196
[ "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 -*- ''' Module for manageing PagerDuty resource :configuration: This module can be used by specifying the name of a configuration profile in the minion config, minion pillar, or master config. The default configuration profile name is 'pagerduty.' For example: .. code-block:: yam...
saltstack/salt
salt/modules/pagerduty_util.py
get_resource
python
def get_resource(resource_name, key, identifier_fields, profile='pagerduty', subdomain=None, api_key=None): ''' Get any single pagerduty resource by key. We allow flexible lookup by any of a list of identifier_fields. So, for example, you can look up users by email address or name by calling: ...
Get any single pagerduty resource by key. We allow flexible lookup by any of a list of identifier_fields. So, for example, you can look up users by email address or name by calling: get_resource('users', key, ['name', 'email'], ...) This method is mainly used to translate state sls into pager...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L210-L252
[ "def _query(method='GET', profile=None, url=None, path='api/v1',\n action=None, api_key=None, service=None, params=None,\n data=None, subdomain=None, verify_ssl=True):\n '''\n Query the PagerDuty API.\n\n This method should be in utils.pagerduty.\n\n '''\n\n if profile:\n c...
# -*- coding: utf-8 -*- ''' Module for manageing PagerDuty resource :configuration: This module can be used by specifying the name of a configuration profile in the minion config, minion pillar, or master config. The default configuration profile name is 'pagerduty.' For example: .. code-block:: yam...
saltstack/salt
salt/modules/pagerduty_util.py
create_or_update_resource
python
def create_or_update_resource(resource_name, identifier_fields, data, diff=None, profile='pagerduty', subdomain=None, api_key=None): ''' create or update any pagerduty resource Helper method for present(). Determining if two resources are the same is different for different PD resource, so this method ...
create or update any pagerduty resource Helper method for present(). Determining if two resources are the same is different for different PD resource, so this method accepts a diff function. The diff function will be invoked as diff(state_information, object_returned_from_pagerduty), and should return ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L255-L309
[ "def _query(method='GET', profile=None, url=None, path='api/v1',\n action=None, api_key=None, service=None, params=None,\n data=None, subdomain=None, verify_ssl=True):\n '''\n Query the PagerDuty API.\n\n This method should be in utils.pagerduty.\n\n '''\n\n if profile:\n c...
# -*- coding: utf-8 -*- ''' Module for manageing PagerDuty resource :configuration: This module can be used by specifying the name of a configuration profile in the minion config, minion pillar, or master config. The default configuration profile name is 'pagerduty.' For example: .. code-block:: yam...
saltstack/salt
salt/modules/pagerduty_util.py
delete_resource
python
def delete_resource(resource_name, key, identifier_fields, profile='pagerduty', subdomain=None, api_key=None): ''' delete any pagerduty resource Helper method for absent() example: delete_resource("users", key, ["id","name","email"]) # delete by id or name or email ''' resource = ...
delete any pagerduty resource Helper method for absent() example: delete_resource("users", key, ["id","name","email"]) # delete by id or name or email
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L312-L331
[ "def _query(method='GET', profile=None, url=None, path='api/v1',\n action=None, api_key=None, service=None, params=None,\n data=None, subdomain=None, verify_ssl=True):\n '''\n Query the PagerDuty API.\n\n This method should be in utils.pagerduty.\n\n '''\n\n if profile:\n c...
# -*- coding: utf-8 -*- ''' Module for manageing PagerDuty resource :configuration: This module can be used by specifying the name of a configuration profile in the minion config, minion pillar, or master config. The default configuration profile name is 'pagerduty.' For example: .. code-block:: yam...
saltstack/salt
salt/modules/pagerduty_util.py
resource_present
python
def resource_present(resource, identifier_fields, diff=None, profile='pagerduty', subdomain=None, api_key=None, **kwargs): ''' Generic resource.present state method. Pagerduty state modules should be a thin wrapper over this method, with a custom diff function. This method calls create_or_update_reso...
Generic resource.present state method. Pagerduty state modules should be a thin wrapper over this method, with a custom diff function. This method calls create_or_update_resource() and formats the result as a salt state return value. example: resource_present("users", ["id","name","email"])
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L334-L368
[ "def create_or_update_resource(resource_name, identifier_fields, data, diff=None, profile='pagerduty', subdomain=None, api_key=None):\n '''\n create or update any pagerduty resource\n Helper method for present().\n\n Determining if two resources are the same is different for different PD resource, so th...
# -*- coding: utf-8 -*- ''' Module for manageing PagerDuty resource :configuration: This module can be used by specifying the name of a configuration profile in the minion config, minion pillar, or master config. The default configuration profile name is 'pagerduty.' For example: .. code-block:: yam...
saltstack/salt
salt/modules/pagerduty_util.py
resource_absent
python
def resource_absent(resource, identifier_fields, profile='pagerduty', subdomain=None, api_key=None, **kwargs): ''' Generic resource.absent state method. Pagerduty state modules should be a thin wrapper over this method, with a custom diff function. This method calls delete_resource() and formats the ...
Generic resource.absent state method. Pagerduty state modules should be a thin wrapper over this method, with a custom diff function. This method calls delete_resource() and formats the result as a salt state return value. example: resource_absent("users", ["id","name","email"])
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L371-L407
[ "def delete_resource(resource_name, key, identifier_fields, profile='pagerduty', subdomain=None, api_key=None):\n '''\n delete any pagerduty resource\n\n Helper method for absent()\n\n example:\n delete_resource(\"users\", key, [\"id\",\"name\",\"email\"]) # delete by id or name or email\n\n ...
# -*- coding: utf-8 -*- ''' Module for manageing PagerDuty resource :configuration: This module can be used by specifying the name of a configuration profile in the minion config, minion pillar, or master config. The default configuration profile name is 'pagerduty.' For example: .. code-block:: yam...
saltstack/salt
salt/states/nexus.py
downloaded
python
def downloaded(name, artifact, target_dir='/tmp', target_file=None): ''' Ensures that the artifact from nexus exists at given location. If it doesn't exist, then it will be downloaded. If it already exists then the checksum of existing file is checked against checksum in nexus. If it is different then t...
Ensures that the artifact from nexus exists at given location. If it doesn't exist, then it will be downloaded. If it already exists then the checksum of existing file is checked against checksum in nexus. If it is different then the step will fail. artifact Details of the artifact to be downloaded...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/nexus.py#L27-L110
[ "def __fetch_from_nexus(artifact, target_dir, target_file):\n nexus_url = artifact['nexus_url']\n repository = artifact['repository']\n group_id = artifact['group_id']\n artifact_id = artifact['artifact_id']\n packaging = artifact['packaging'] if 'packaging' in artifact else 'jar'\n classifier = a...
# -*- coding: utf-8 -*- ''' This state downloads artifacts from Nexus 3.x. .. versionadded:: 2018.3.0 ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import logging # Import Salt libs from salt.ext import six log = logging.getLogger(__name__) __virtualname__ = 'nex...
saltstack/salt
salt/modules/chronos.py
_jobs
python
def _jobs(): ''' Return the currently configured jobs. ''' response = salt.utils.http.query( "{0}/scheduler/jobs".format(_base_url()), decode_type='json', decode=True, ) jobs = {} for job in response['dict']: jobs[job.pop('name')] = job return jobs
Return the currently configured jobs.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/chronos.py#L37-L49
[ "def _base_url():\n '''\n Return the proxy configured base url.\n '''\n base_url = \"http://locahost:4400\"\n if 'proxy' in __opts__:\n base_url = __opts__['proxy'].get('base_url', base_url)\n return base_url\n" ]
# -*- coding: utf-8 -*- ''' Module providing a simple management interface to a chronos cluster. Currently this only works when run through a proxy minion. .. versionadded:: 2015.8.2 ''' from __future__ import absolute_import, print_function, unicode_literals import logging import salt.utils.http import salt.utils.j...
saltstack/salt
salt/modules/chronos.py
update_job
python
def update_job(name, config): ''' Update the specified job with the given configuration. CLI Example: .. code-block:: bash salt chronos-minion-id chronos.update_job my-job '<config yaml>' ''' if 'name' not in config: config['name'] = name data = salt.utils.json.dumps(confi...
Update the specified job with the given configuration. CLI Example: .. code-block:: bash salt chronos-minion-id chronos.update_job my-job '<config yaml>'
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/chronos.py#L96-L126
[ "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 -*- ''' Module providing a simple management interface to a chronos cluster. Currently this only works when run through a proxy minion. .. versionadded:: 2015.8.2 ''' from __future__ import absolute_import, print_function, unicode_literals import logging import salt.utils.http import salt.utils.j...
saltstack/salt
salt/modules/chronos.py
rm_job
python
def rm_job(name): ''' Remove the specified job from the server. CLI Example: .. code-block:: bash salt chronos-minion-id chronos.rm_job my-job ''' response = salt.utils.http.query( "{0}/scheduler/job/{1}".format(_base_url(), name), method='DELETE', ) return Tru...
Remove the specified job from the server. CLI Example: .. code-block:: bash salt chronos-minion-id chronos.rm_job my-job
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/chronos.py#L129-L143
[ "def _base_url():\n '''\n Return the proxy configured base url.\n '''\n base_url = \"http://locahost:4400\"\n if 'proxy' in __opts__:\n base_url = __opts__['proxy'].get('base_url', base_url)\n return base_url\n" ]
# -*- coding: utf-8 -*- ''' Module providing a simple management interface to a chronos cluster. Currently this only works when run through a proxy minion. .. versionadded:: 2015.8.2 ''' from __future__ import absolute_import, print_function, unicode_literals import logging import salt.utils.http import salt.utils.j...
saltstack/salt
salt/grains/iscsi.py
iscsi_iqn
python
def iscsi_iqn(): ''' Return iSCSI IQN ''' grains = {} grains['iscsi_iqn'] = False if salt.utils.platform.is_linux(): grains['iscsi_iqn'] = _linux_iqn() elif salt.utils.platform.is_windows(): grains['iscsi_iqn'] = _windows_iqn() elif salt.utils.platform.is_aix(): g...
Return iSCSI IQN
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/iscsi.py#L38-L50
[ "def _linux_iqn():\n '''\n Return iSCSI IQN from a Linux host.\n '''\n ret = []\n\n initiator = '/etc/iscsi/initiatorname.iscsi'\n try:\n with salt.utils.files.fopen(initiator, 'r') as _iscsi:\n for line in _iscsi:\n line = line.strip()\n if line.sta...
# -*- coding: utf-8 -*- ''' Grains for iSCSI Qualified Names (IQN). .. versionadded:: 2018.3.0 To enable these grains set `iscsi_grains: True`. .. code-block:: yaml iscsi_grains: True ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import errno import logging ...
saltstack/salt
salt/grains/iscsi.py
_linux_iqn
python
def _linux_iqn(): ''' Return iSCSI IQN from a Linux host. ''' ret = [] initiator = '/etc/iscsi/initiatorname.iscsi' try: with salt.utils.files.fopen(initiator, 'r') as _iscsi: for line in _iscsi: line = line.strip() if line.startswith('Initiat...
Return iSCSI IQN from a Linux host.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/iscsi.py#L53-L70
[ "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 -*- ''' Grains for iSCSI Qualified Names (IQN). .. versionadded:: 2018.3.0 To enable these grains set `iscsi_grains: True`. .. code-block:: yaml iscsi_grains: True ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import errno import logging ...
saltstack/salt
salt/grains/iscsi.py
_aix_iqn
python
def _aix_iqn(): ''' Return iSCSI IQN from an AIX host. ''' ret = [] aix_cmd = 'lsattr -E -l iscsi0 | grep initiator_name' aix_ret = salt.modules.cmdmod.run(aix_cmd) if aix_ret[0].isalpha(): try: ret.append(aix_ret.split()[1].rstrip()) except IndexError: ...
Return iSCSI IQN from an AIX host.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/iscsi.py#L73-L87
[ "def run(cmd,\n cwd=None,\n stdin=None,\n runas=None,\n group=None,\n shell=DEFAULT_SHELL,\n python_shell=None,\n env=None,\n clean_env=False,\n template=None,\n rstrip=True,\n umask=None,\n output_encoding=None,\n output_log...
# -*- coding: utf-8 -*- ''' Grains for iSCSI Qualified Names (IQN). .. versionadded:: 2018.3.0 To enable these grains set `iscsi_grains: True`. .. code-block:: yaml iscsi_grains: True ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import errno import logging ...
saltstack/salt
salt/grains/iscsi.py
_windows_iqn
python
def _windows_iqn(): ''' Return iSCSI IQN from a Windows host. ''' ret = [] wmic = salt.utils.path.which('wmic') if not wmic: return ret namespace = r'\\root\WMI' path = 'MSiSCSIInitiator_MethodClass' get = 'iSCSINodeName' cmd_ret = salt.modules.cmdmod.run_all( ...
Return iSCSI IQN from a Windows host.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/iscsi.py#L90-L114
[ "def run_all(cmd,\n cwd=None,\n stdin=None,\n runas=None,\n group=None,\n shell=DEFAULT_SHELL,\n python_shell=None,\n env=None,\n clean_env=False,\n template=None,\n rstrip=True,\n umask=None,\n ...
# -*- coding: utf-8 -*- ''' Grains for iSCSI Qualified Names (IQN). .. versionadded:: 2018.3.0 To enable these grains set `iscsi_grains: True`. .. code-block:: yaml iscsi_grains: True ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import errno import logging ...
saltstack/salt
salt/modules/ret.py
get_jid
python
def get_jid(returner, jid): ''' Return the information for a specified job id CLI Example: .. code-block:: bash salt '*' ret.get_jid redis 20421104181954700505 ''' returners = salt.loader.returners(__opts__, __salt__) return returners['{0}.get_jid'.format(returner)](jid)
Return the information for a specified job id CLI Example: .. code-block:: bash salt '*' ret.get_jid redis 20421104181954700505
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ret.py#L11-L22
null
# -*- coding: utf-8 -*- ''' Module to integrate with the returner system and retrieve data sent to a salt returner ''' from __future__ import absolute_import, unicode_literals, print_function # Import salt libs import salt.loader def get_fun(returner, fun): ''' Return info about last time fun was called on ...
saltstack/salt
salt/modules/ret.py
get_fun
python
def get_fun(returner, fun): ''' Return info about last time fun was called on each minion CLI Example: .. code-block:: bash salt '*' ret.get_fun mysql network.interfaces ''' returners = salt.loader.returners(__opts__, __salt__) return returners['{0}.get_fun'.format(returner)](fun)
Return info about last time fun was called on each minion CLI Example: .. code-block:: bash salt '*' ret.get_fun mysql network.interfaces
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ret.py#L25-L36
null
# -*- coding: utf-8 -*- ''' Module to integrate with the returner system and retrieve data sent to a salt returner ''' from __future__ import absolute_import, unicode_literals, print_function # Import salt libs import salt.loader def get_jid(returner, jid): ''' Return the information for a specified job id ...
saltstack/salt
salt/modules/ret.py
get_jids
python
def get_jids(returner): ''' Return a list of all job ids CLI Example: .. code-block:: bash salt '*' ret.get_jids mysql ''' returners = salt.loader.returners(__opts__, __salt__) return returners['{0}.get_jids'.format(returner)]()
Return a list of all job ids CLI Example: .. code-block:: bash salt '*' ret.get_jids mysql
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ret.py#L39-L50
null
# -*- coding: utf-8 -*- ''' Module to integrate with the returner system and retrieve data sent to a salt returner ''' from __future__ import absolute_import, unicode_literals, print_function # Import salt libs import salt.loader def get_jid(returner, jid): ''' Return the information for a specified job id ...
saltstack/salt
salt/modules/ret.py
get_minions
python
def get_minions(returner): ''' Return a list of all minions CLI Example: .. code-block:: bash salt '*' ret.get_minions mysql ''' returners = salt.loader.returners(__opts__, __salt__) return returners['{0}.get_minions'.format(returner)]()
Return a list of all minions CLI Example: .. code-block:: bash salt '*' ret.get_minions mysql
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ret.py#L53-L64
null
# -*- coding: utf-8 -*- ''' Module to integrate with the returner system and retrieve data sent to a salt returner ''' from __future__ import absolute_import, unicode_literals, print_function # Import salt libs import salt.loader def get_jid(returner, jid): ''' Return the information for a specified job id ...
saltstack/salt
salt/beacons/bonjour_announce.py
_enforce_txt_record_maxlen
python
def _enforce_txt_record_maxlen(key, value): ''' Enforces the TXT record maximum length of 255 characters. TXT record length includes key, value, and '='. :param str key: Key of the TXT record :param str value: Value of the TXT record :rtype: str :return: The value of the TXT record. It may...
Enforces the TXT record maximum length of 255 characters. TXT record length includes key, value, and '='. :param str key: Key of the TXT record :param str value: Value of the TXT record :rtype: str :return: The value of the TXT record. It may be truncated if it exceeds the maximum per...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/bonjour_announce.py#L73-L90
null
# -*- coding: utf-8 -*- ''' Beacon to announce via Bonjour (zeroconf) ''' # Import Python libs from __future__ import absolute_import import atexit import logging import select import time import salt.utils.stringutils from salt.ext import six from salt.ext.six.moves import map # Import 3rd Party libs try: impor...
saltstack/salt
salt/beacons/bonjour_announce.py
beacon
python
def beacon(config): ''' Broadcast values via zeroconf If the announced values are static, it is advised to set run_once: True (do not poll) on the beacon configuration. The following are required configuration settings: - ``servicetype`` - The service type to announce - ``port`` - The por...
Broadcast values via zeroconf If the announced values are static, it is advised to set run_once: True (do not poll) on the beacon configuration. The following are required configuration settings: - ``servicetype`` - The service type to announce - ``port`` - The port of the service to announce ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/bonjour_announce.py#L93-L247
null
# -*- coding: utf-8 -*- ''' Beacon to announce via Bonjour (zeroconf) ''' # Import Python libs from __future__ import absolute_import import atexit import logging import select import time import salt.utils.stringutils from salt.ext import six from salt.ext.six.moves import map # Import 3rd Party libs try: impor...
saltstack/salt
salt/modules/sysmod.py
doc
python
def doc(*args): ''' Return the docstrings for all modules. Optionally, specify a module or a function to narrow the selection. The strings are aggregated into a single document on the master for easy reading. Multiple modules/functions can be specified. CLI Example: .. code-block:: b...
Return the docstrings for all modules. Optionally, specify a module or a function to narrow the selection. The strings are aggregated into a single document on the master for easy reading. Multiple modules/functions can be specified. CLI Example: .. code-block:: bash salt '*' sys.do...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L38-L91
[ "def strip_rst(docs):\n '''\n Strip/replace reStructuredText directives in docstrings\n '''\n for func, docstring in six.iteritems(docs):\n log.debug('Stripping docstring for %s', func)\n if not docstring:\n continue\n docstring_new = docstring if six.PY3 else salt.utils....
# -*- coding: utf-8 -*- ''' The sys module provides information about the available functions on the minion ''' from __future__ import absolute_import, unicode_literals, print_function # Import python libs import fnmatch import logging # Import salt libs import salt.loader import salt.runner import salt.state import ...
saltstack/salt
salt/modules/sysmod.py
state_doc
python
def state_doc(*args): ''' Return the docstrings for all states. Optionally, specify a state or a function to narrow the selection. The strings are aggregated into a single document on the master for easy reading. Multiple states/functions can be specified. .. versionadded:: 2014.7.0 ...
Return the docstrings for all states. Optionally, specify a state or a function to narrow the selection. The strings are aggregated into a single document on the master for easy reading. Multiple states/functions can be specified. .. versionadded:: 2014.7.0 CLI Example: .. code-block:: ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L94-L161
[ "def strip_rst(docs):\n '''\n Strip/replace reStructuredText directives in docstrings\n '''\n for func, docstring in six.iteritems(docs):\n log.debug('Stripping docstring for %s', func)\n if not docstring:\n continue\n docstring_new = docstring if six.PY3 else salt.utils....
# -*- coding: utf-8 -*- ''' The sys module provides information about the available functions on the minion ''' from __future__ import absolute_import, unicode_literals, print_function # Import python libs import fnmatch import logging # Import salt libs import salt.loader import salt.runner import salt.state import ...
saltstack/salt
salt/modules/sysmod.py
runner_doc
python
def runner_doc(*args): ''' Return the docstrings for all runners. Optionally, specify a runner or a function to narrow the selection. The strings are aggregated into a single document on the master for easy reading. Multiple runners/functions can be specified. .. versionadded:: 2014.7.0 ...
Return the docstrings for all runners. Optionally, specify a runner or a function to narrow the selection. The strings are aggregated into a single document on the master for easy reading. Multiple runners/functions can be specified. .. versionadded:: 2014.7.0 CLI Example: .. code-block...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L164-L219
[ "def strip_rst(docs):\n '''\n Strip/replace reStructuredText directives in docstrings\n '''\n for func, docstring in six.iteritems(docs):\n log.debug('Stripping docstring for %s', func)\n if not docstring:\n continue\n docstring_new = docstring if six.PY3 else salt.utils....
# -*- coding: utf-8 -*- ''' The sys module provides information about the available functions on the minion ''' from __future__ import absolute_import, unicode_literals, print_function # Import python libs import fnmatch import logging # Import salt libs import salt.loader import salt.runner import salt.state import ...
saltstack/salt
salt/modules/sysmod.py
returner_doc
python
def returner_doc(*args): ''' Return the docstrings for all returners. Optionally, specify a returner or a function to narrow the selection. The strings are aggregated into a single document on the master for easy reading. Multiple returners/functions can be specified. .. versionadded:: 20...
Return the docstrings for all returners. Optionally, specify a returner or a function to narrow the selection. The strings are aggregated into a single document on the master for easy reading. Multiple returners/functions can be specified. .. versionadded:: 2014.7.0 CLI Example: .. code...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L222-L279
[ "def iterkeys(d, **kw):\n return d.iterkeys(**kw)\n", "def strip_rst(docs):\n '''\n Strip/replace reStructuredText directives in docstrings\n '''\n for func, docstring in six.iteritems(docs):\n log.debug('Stripping docstring for %s', func)\n if not docstring:\n continue\n ...
# -*- coding: utf-8 -*- ''' The sys module provides information about the available functions on the minion ''' from __future__ import absolute_import, unicode_literals, print_function # Import python libs import fnmatch import logging # Import salt libs import salt.loader import salt.runner import salt.state import ...
saltstack/salt
salt/modules/sysmod.py
renderer_doc
python
def renderer_doc(*args): ''' Return the docstrings for all renderers. Optionally, specify a renderer or a function to narrow the selection. The strings are aggregated into a single document on the master for easy reading. Multiple renderers can be specified. .. versionadded:: 2015.5.0 ...
Return the docstrings for all renderers. Optionally, specify a renderer or a function to narrow the selection. The strings are aggregated into a single document on the master for easy reading. Multiple renderers can be specified. .. versionadded:: 2015.5.0 CLI Example: .. code-block:: b...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L282-L325
[ "def iterkeys(d, **kw):\n return d.iterkeys(**kw)\n", "def strip_rst(docs):\n '''\n Strip/replace reStructuredText directives in docstrings\n '''\n for func, docstring in six.iteritems(docs):\n log.debug('Stripping docstring for %s', func)\n if not docstring:\n continue\n ...
# -*- coding: utf-8 -*- ''' The sys module provides information about the available functions on the minion ''' from __future__ import absolute_import, unicode_literals, print_function # Import python libs import fnmatch import logging # Import salt libs import salt.loader import salt.runner import salt.state import ...
saltstack/salt
salt/modules/sysmod.py
utils_doc
python
def utils_doc(*args): ''' .. versionadded:: Neon Return the docstrings for all utils modules. Optionally, specify a module or a function to narrow the selection. The strings are aggregated into a single document on the master for easy reading. Multiple modules/functions can be specified. ...
.. versionadded:: Neon Return the docstrings for all utils modules. Optionally, specify a module or a function to narrow the selection. The strings are aggregated into a single document on the master for easy reading. Multiple modules/functions can be specified. CLI Example: .. code-blo...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L328-L374
[ "def strip_rst(docs):\n '''\n Strip/replace reStructuredText directives in docstrings\n '''\n for func, docstring in six.iteritems(docs):\n log.debug('Stripping docstring for %s', func)\n if not docstring:\n continue\n docstring_new = docstring if six.PY3 else salt.utils....
# -*- coding: utf-8 -*- ''' The sys module provides information about the available functions on the minion ''' from __future__ import absolute_import, unicode_literals, print_function # Import python libs import fnmatch import logging # Import salt libs import salt.loader import salt.runner import salt.state import ...
saltstack/salt
salt/modules/sysmod.py
list_functions
python
def list_functions(*args, **kwargs): # pylint: disable=unused-argument ''' List the functions for all modules. Optionally, specify a module or modules from which to list. CLI Example: .. code-block:: bash salt '*' sys.list_functions salt '*' sys.list_functions sys salt '*...
List the functions for all modules. Optionally, specify a module or modules from which to list. CLI Example: .. code-block:: bash salt '*' sys.list_functions salt '*' sys.list_functions sys salt '*' sys.list_functions sys user Function names can be specified as globs. .....
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L377-L423
null
# -*- coding: utf-8 -*- ''' The sys module provides information about the available functions on the minion ''' from __future__ import absolute_import, unicode_literals, print_function # Import python libs import fnmatch import logging # Import salt libs import salt.loader import salt.runner import salt.state import ...
saltstack/salt
salt/modules/sysmod.py
list_modules
python
def list_modules(*args): ''' List the modules loaded on the minion .. versionadded:: 2015.5.0 CLI Example: .. code-block:: bash salt '*' sys.list_modules Module names can be specified as globs. .. code-block:: bash salt '*' sys.list_modules 's*' ''' modules = ...
List the modules loaded on the minion .. versionadded:: 2015.5.0 CLI Example: .. code-block:: bash salt '*' sys.list_modules Module names can be specified as globs. .. code-block:: bash salt '*' sys.list_modules 's*'
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L426-L460
null
# -*- coding: utf-8 -*- ''' The sys module provides information about the available functions on the minion ''' from __future__ import absolute_import, unicode_literals, print_function # Import python libs import fnmatch import logging # Import salt libs import salt.loader import salt.runner import salt.state import ...
saltstack/salt
salt/modules/sysmod.py
state_argspec
python
def state_argspec(module=''): ''' Return the argument specification of functions in Salt state modules. .. versionadded:: 2015.5.0 CLI Example: .. code-block:: bash salt '*' sys.state_argspec pkg.installed salt '*' sys.state_argspec file salt '*' sys.state_argspec ...
Return the argument specification of functions in Salt state modules. .. versionadded:: 2015.5.0 CLI Example: .. code-block:: bash salt '*' sys.state_argspec pkg.installed salt '*' sys.state_argspec file salt '*' sys.state_argspec State names can be specified as globs. ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L505-L528
[ "def argspec_report(functions, module=''):\n '''\n Pass in a functions dict as it is returned from the loader and return the\n argspec function signatures\n '''\n ret = {}\n if '*' in module or '.' in module:\n for fun in fnmatch.filter(functions, module):\n try:\n ...
# -*- coding: utf-8 -*- ''' The sys module provides information about the available functions on the minion ''' from __future__ import absolute_import, unicode_literals, print_function # Import python libs import fnmatch import logging # Import salt libs import salt.loader import salt.runner import salt.state import ...
saltstack/salt
salt/modules/sysmod.py
returner_argspec
python
def returner_argspec(module=''): ''' Return the argument specification of functions in Salt returner modules. .. versionadded:: 2015.5.0 CLI Example: .. code-block:: bash salt '*' sys.returner_argspec xmpp salt '*' sys.returner_argspec xmpp smtp salt '*' sys.returner_...
Return the argument specification of functions in Salt returner modules. .. versionadded:: 2015.5.0 CLI Example: .. code-block:: bash salt '*' sys.returner_argspec xmpp salt '*' sys.returner_argspec xmpp smtp salt '*' sys.returner_argspec Returner names can be specified ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L531-L554
[ "def argspec_report(functions, module=''):\n '''\n Pass in a functions dict as it is returned from the loader and return the\n argspec function signatures\n '''\n ret = {}\n if '*' in module or '.' in module:\n for fun in fnmatch.filter(functions, module):\n try:\n ...
# -*- coding: utf-8 -*- ''' The sys module provides information about the available functions on the minion ''' from __future__ import absolute_import, unicode_literals, print_function # Import python libs import fnmatch import logging # Import salt libs import salt.loader import salt.runner import salt.state import ...
saltstack/salt
salt/modules/sysmod.py
runner_argspec
python
def runner_argspec(module=''): ''' Return the argument specification of functions in Salt runner modules. .. versionadded:: 2015.5.0 CLI Example: .. code-block:: bash salt '*' sys.runner_argspec state salt '*' sys.runner_argspec http salt '*' sys.runner_argspec R...
Return the argument specification of functions in Salt runner modules. .. versionadded:: 2015.5.0 CLI Example: .. code-block:: bash salt '*' sys.runner_argspec state salt '*' sys.runner_argspec http salt '*' sys.runner_argspec Runner names can be specified as globs. ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L557-L579
[ "def argspec_report(functions, module=''):\n '''\n Pass in a functions dict as it is returned from the loader and return the\n argspec function signatures\n '''\n ret = {}\n if '*' in module or '.' in module:\n for fun in fnmatch.filter(functions, module):\n try:\n ...
# -*- coding: utf-8 -*- ''' The sys module provides information about the available functions on the minion ''' from __future__ import absolute_import, unicode_literals, print_function # Import python libs import fnmatch import logging # Import salt libs import salt.loader import salt.runner import salt.state import ...
saltstack/salt
salt/modules/sysmod.py
list_state_functions
python
def list_state_functions(*args, **kwargs): # pylint: disable=unused-argument ''' List the functions for all state modules. Optionally, specify a state module or modules from which to list. .. versionadded:: 2014.7.0 CLI Example: .. code-block:: bash salt '*' sys.list_state_functions...
List the functions for all state modules. Optionally, specify a state module or modules from which to list. .. versionadded:: 2014.7.0 CLI Example: .. code-block:: bash salt '*' sys.list_state_functions salt '*' sys.list_state_functions file salt '*' sys.list_state_functions ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L582-L632
null
# -*- coding: utf-8 -*- ''' The sys module provides information about the available functions on the minion ''' from __future__ import absolute_import, unicode_literals, print_function # Import python libs import fnmatch import logging # Import salt libs import salt.loader import salt.runner import salt.state import ...
saltstack/salt
salt/modules/sysmod.py
list_state_modules
python
def list_state_modules(*args): ''' List the modules loaded on the minion .. versionadded:: 2014.7.0 CLI Example: .. code-block:: bash salt '*' sys.list_state_modules State module names can be specified as globs. .. versionadded:: 2015.5.0 .. code-block:: bash salt...
List the modules loaded on the minion .. versionadded:: 2014.7.0 CLI Example: .. code-block:: bash salt '*' sys.list_state_modules State module names can be specified as globs. .. versionadded:: 2015.5.0 .. code-block:: bash salt '*' sys.list_state_modules 'mysql_*'
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L635-L674
null
# -*- coding: utf-8 -*- ''' The sys module provides information about the available functions on the minion ''' from __future__ import absolute_import, unicode_literals, print_function # Import python libs import fnmatch import logging # Import salt libs import salt.loader import salt.runner import salt.state import ...
saltstack/salt
salt/modules/sysmod.py
list_runners
python
def list_runners(*args): ''' List the runners loaded on the minion .. versionadded:: 2014.7.0 CLI Example: .. code-block:: bash salt '*' sys.list_runners Runner names can be specified as globs. .. versionadded:: 2015.5.0 .. code-block:: bash salt '*' sys.list_runn...
List the runners loaded on the minion .. versionadded:: 2014.7.0 CLI Example: .. code-block:: bash salt '*' sys.list_runners Runner names can be specified as globs. .. versionadded:: 2015.5.0 .. code-block:: bash salt '*' sys.list_runners 'm*'
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L677-L714
null
# -*- coding: utf-8 -*- ''' The sys module provides information about the available functions on the minion ''' from __future__ import absolute_import, unicode_literals, print_function # Import python libs import fnmatch import logging # Import salt libs import salt.loader import salt.runner import salt.state import ...
saltstack/salt
salt/modules/sysmod.py
list_runner_functions
python
def list_runner_functions(*args, **kwargs): # pylint: disable=unused-argument ''' List the functions for all runner modules. Optionally, specify a runner module or modules from which to list. .. versionadded:: 2014.7.0 CLI Example: .. code-block:: bash salt '*' sys.list_runner_funct...
List the functions for all runner modules. Optionally, specify a runner module or modules from which to list. .. versionadded:: 2014.7.0 CLI Example: .. code-block:: bash salt '*' sys.list_runner_functions salt '*' sys.list_runner_functions state salt '*' sys.list_runner_func...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L717-L760
null
# -*- coding: utf-8 -*- ''' The sys module provides information about the available functions on the minion ''' from __future__ import absolute_import, unicode_literals, print_function # Import python libs import fnmatch import logging # Import salt libs import salt.loader import salt.runner import salt.state import ...
saltstack/salt
salt/modules/sysmod.py
list_returners
python
def list_returners(*args): ''' List the returners loaded on the minion .. versionadded:: 2014.7.0 CLI Example: .. code-block:: bash salt '*' sys.list_returners Returner names can be specified as globs. .. versionadded:: 2015.5.0 .. code-block:: bash salt '*' sys.l...
List the returners loaded on the minion .. versionadded:: 2014.7.0 CLI Example: .. code-block:: bash salt '*' sys.list_returners Returner names can be specified as globs. .. versionadded:: 2015.5.0 .. code-block:: bash salt '*' sys.list_returners 's*'
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L763-L801
[ "def iterkeys(d, **kw):\n return d.iterkeys(**kw)\n" ]
# -*- coding: utf-8 -*- ''' The sys module provides information about the available functions on the minion ''' from __future__ import absolute_import, unicode_literals, print_function # Import python libs import fnmatch import logging # Import salt libs import salt.loader import salt.runner import salt.state import ...
saltstack/salt
salt/modules/sysmod.py
list_returner_functions
python
def list_returner_functions(*args, **kwargs): # pylint: disable=unused-argument ''' List the functions for all returner modules. Optionally, specify a returner module or modules from which to list. .. versionadded:: 2014.7.0 CLI Example: .. code-block:: bash salt '*' sys.list_return...
List the functions for all returner modules. Optionally, specify a returner module or modules from which to list. .. versionadded:: 2014.7.0 CLI Example: .. code-block:: bash salt '*' sys.list_returner_functions salt '*' sys.list_returner_functions mysql salt '*' sys.list_ret...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L804-L847
null
# -*- coding: utf-8 -*- ''' The sys module provides information about the available functions on the minion ''' from __future__ import absolute_import, unicode_literals, print_function # Import python libs import fnmatch import logging # Import salt libs import salt.loader import salt.runner import salt.state import ...
saltstack/salt
salt/modules/sysmod.py
list_renderers
python
def list_renderers(*args): ''' List the renderers loaded on the minion .. versionadded:: 2015.5.0 CLI Example: .. code-block:: bash salt '*' sys.list_renderers Render names can be specified as globs. .. code-block:: bash salt '*' sys.list_renderers 'yaml*' ''' ...
List the renderers loaded on the minion .. versionadded:: 2015.5.0 CLI Example: .. code-block:: bash salt '*' sys.list_renderers Render names can be specified as globs. .. code-block:: bash salt '*' sys.list_renderers 'yaml*'
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L850-L880
[ "def iterkeys(d, **kw):\n return d.iterkeys(**kw)\n" ]
# -*- coding: utf-8 -*- ''' The sys module provides information about the available functions on the minion ''' from __future__ import absolute_import, unicode_literals, print_function # Import python libs import fnmatch import logging # Import salt libs import salt.loader import salt.runner import salt.state import ...
saltstack/salt
salt/modules/sysmod.py
state_schema
python
def state_schema(module=''): ''' Return a JSON Schema for the given state function(s) .. versionadded:: 2016.3.0 CLI Example: .. code-block:: bash salt '*' sys.state_schema salt '*' sys.state_schema pkg.installed ''' specs = state_argspec(module) schemas = [] for...
Return a JSON Schema for the given state function(s) .. versionadded:: 2016.3.0 CLI Example: .. code-block:: bash salt '*' sys.state_schema salt '*' sys.state_schema pkg.installed
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L920-L939
[ "def state_argspec(module=''):\n '''\n Return the argument specification of functions in Salt state\n modules.\n\n .. versionadded:: 2015.5.0\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' sys.state_argspec pkg.installed\n salt '*' sys.state_argspec file\n salt '*' sys...
# -*- coding: utf-8 -*- ''' The sys module provides information about the available functions on the minion ''' from __future__ import absolute_import, unicode_literals, print_function # Import python libs import fnmatch import logging # Import salt libs import salt.loader import salt.runner import salt.state import ...
saltstack/salt
salt/modules/postgres.py
_find_pg_binary
python
def _find_pg_binary(util): ''' ... versionadded:: 2016.3.2 Helper function to locate various psql related binaries ''' pg_bin_dir = __salt__['config.option']('postgres.bins_dir') util_bin = salt.utils.path.which(util) if not util_bin: if pg_bin_dir: return salt.utils.pa...
... versionadded:: 2016.3.2 Helper function to locate various psql related binaries
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L159-L171
null
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...
saltstack/salt
salt/modules/postgres.py
_run_psql
python
def _run_psql(cmd, runas=None, password=None, host=None, port=None, user=None): ''' Helper function to call psql, because the password requirement makes this too much code to be repeated in each function below ''' kwargs = { 'reset_system_locale': False, 'clean_env': True, } ...
Helper function to call psql, because the password requirement makes this too much code to be repeated in each function below
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L174-L221
[ "def mkstemp(*args, **kwargs):\n '''\n Helper function which does exactly what ``tempfile.mkstemp()`` does but\n accepts another argument, ``close_fd``, which, by default, is true and closes\n the fd before returning the file path. Something commonly done throughout\n Salt's code.\n '''\n if 'p...
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...
saltstack/salt
salt/modules/postgres.py
_run_initdb
python
def _run_initdb(name, auth='password', user=None, password=None, encoding='UTF8', locale=None, runas=None, waldir=None, checksums=False): ''' Helper function to call initdb ''' if runas is None: if 'FreeBSD' in __grains__['os_family...
Helper function to call initdb
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L224-L288
null
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...
saltstack/salt
salt/modules/postgres.py
version
python
def version(user=None, host=None, port=None, maintenance_db=None, password=None, runas=None): ''' Return the version of a Postgres server. CLI Example: .. code-block:: bash salt '*' postgres.version ''' query = 'SELECT setting FROM pg_catalog.pg_settings ' \ 'W...
Return the version of a Postgres server. CLI Example: .. code-block:: bash salt '*' postgres.version
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L291-L316
[ "def split(orig, sep=None):\n '''\n Generator function for iterating through large strings, particularly useful\n as a replacement for str.splitlines().\n\n See http://stackoverflow.com/a/3865367\n '''\n exp = re.compile(r'\\s+' if sep is None else re.escape(sep))\n pos = 0\n length = len(or...
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...
saltstack/salt
salt/modules/postgres.py
_parsed_version
python
def _parsed_version(user=None, host=None, port=None, maintenance_db=None, password=None, runas=None): ''' Returns the server version properly parsed and int casted for internal use. If the Postgres server does not respond, None will be returned. ''' psql_version = version( ...
Returns the server version properly parsed and int casted for internal use. If the Postgres server does not respond, None will be returned.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L319-L341
[ "def version(user=None, host=None, port=None, maintenance_db=None,\n password=None, runas=None):\n '''\n Return the version of a Postgres server.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' postgres.version\n '''\n query = 'SELECT setting FROM pg_catalog.pg_settings ' ...
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...
saltstack/salt
salt/modules/postgres.py
_connection_defaults
python
def _connection_defaults(user=None, host=None, port=None, maintenance_db=None): ''' Returns a tuple of (user, host, port, db) with config, pillar, or default values assigned to missing values. ''' if not user: user = __salt__['config.option']('postgres.user') if not host: host = ...
Returns a tuple of (user, host, port, db) with config, pillar, or default values assigned to missing values.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L344-L358
null
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...
saltstack/salt
salt/modules/postgres.py
_psql_cmd
python
def _psql_cmd(*args, **kwargs): ''' Return string with fully composed psql command. Accepts optional keyword arguments: user, host, port and maintenance_db, as well as any number of positional arguments to be added to the end of the command. ''' (user, host, port, maintenance_db) = _connect...
Return string with fully composed psql command. Accepts optional keyword arguments: user, host, port and maintenance_db, as well as any number of positional arguments to be added to the end of the command.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L361-L390
[ "def _find_pg_binary(util):\n '''\n ... versionadded:: 2016.3.2\n\n Helper function to locate various psql related binaries\n '''\n pg_bin_dir = __salt__['config.option']('postgres.bins_dir')\n util_bin = salt.utils.path.which(util)\n if not util_bin:\n if pg_bin_dir:\n retur...
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...
saltstack/salt
salt/modules/postgres.py
psql_query
python
def psql_query(query, user=None, host=None, port=None, maintenance_db=None, password=None, runas=None, write=False): ''' Run an SQL-Query and return the results as a list. This command only supports SELECT statements. This limitation can be worked around with a query like this: WITH...
Run an SQL-Query and return the results as a list. This command only supports SELECT statements. This limitation can be worked around with a query like this: WITH updated AS (UPDATE pg_authid SET rolconnlimit = 2000 WHERE rolname = 'rolename' RETURNING rolconnlimit) SELECT * FROM updated; query ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L409-L486
[ "def to_str(s, encoding=None, errors='strict', normalize=False):\n '''\n Given str, bytes, bytearray, or unicode (py2), return str\n '''\n def _normalize(s):\n try:\n return unicodedata.normalize('NFC', s) if normalize else s\n except TypeError:\n return s\n\n if e...
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...
saltstack/salt
salt/modules/postgres.py
db_list
python
def db_list(user=None, host=None, port=None, maintenance_db=None, password=None, runas=None): ''' Return dictionary with information about databases of a Postgres server. CLI Example: .. code-block:: bash salt '*' postgres.db_list ''' ret = {} query = ( 'SELE...
Return dictionary with information about databases of a Postgres server. CLI Example: .. code-block:: bash salt '*' postgres.db_list
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L491-L522
[ "def psql_query(query, user=None, host=None, port=None, maintenance_db=None,\n password=None, runas=None, write=False):\n '''\n Run an SQL-Query and return the results as a list. This command\n only supports SELECT statements. This limitation can be worked around\n with a query like this:...
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...
saltstack/salt
salt/modules/postgres.py
db_exists
python
def db_exists(name, user=None, host=None, port=None, maintenance_db=None, password=None, runas=None): ''' Checks if a database exists on the Postgres server. CLI Example: .. code-block:: bash salt '*' postgres.db_exists 'dbname' ''' databases = db_list(user=user, host=h...
Checks if a database exists on the Postgres server. CLI Example: .. code-block:: bash salt '*' postgres.db_exists 'dbname'
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L525-L540
[ "def db_list(user=None, host=None, port=None, maintenance_db=None,\n password=None, runas=None):\n '''\n Return dictionary with information about databases of a Postgres server.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' postgres.db_list\n '''\n\n ret = {}\n\n quer...
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...
saltstack/salt
salt/modules/postgres.py
db_create
python
def db_create(name, user=None, host=None, port=None, maintenance_db=None, password=None, tablespace=None, encoding=None, lc_collate=None, lc_ctype=None, owner=None, t...
Adds a databases to the Postgres server. CLI Example: .. code-block:: bash salt '*' postgres.db_create 'dbname' salt '*' postgres.db_create 'dbname' template=template_postgis
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L553-L607
[ "def _psql_prepare_and_run(cmd,\n host=None,\n port=None,\n maintenance_db=None,\n password=None,\n runas=None,\n user=None):\n rcmd = _psql_cmd(\n host=hos...
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...
saltstack/salt
salt/modules/postgres.py
db_alter
python
def db_alter(name, user=None, host=None, port=None, maintenance_db=None, password=None, tablespace=None, owner=None, owner_recurse=False, runas=None): ''' Change tablespace or/and owner of database. CLI Example: .. code-block:: bash salt '*' postgres.db_alter dbname ...
Change tablespace or/and owner of database. CLI Example: .. code-block:: bash salt '*' postgres.db_alter dbname owner=otheruser
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L610-L651
null
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...
saltstack/salt
salt/modules/postgres.py
tablespace_list
python
def tablespace_list(user=None, host=None, port=None, maintenance_db=None, password=None, runas=None): ''' Return dictionary with information about tablespaces of a Postgres server. CLI Example: .. code-block:: bash salt '*' postgres.tablespace_list .. versionadded:: 2...
Return dictionary with information about tablespaces of a Postgres server. CLI Example: .. code-block:: bash salt '*' postgres.tablespace_list .. versionadded:: 2015.8.0
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L680-L711
null
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...
saltstack/salt
salt/modules/postgres.py
tablespace_exists
python
def tablespace_exists(name, user=None, host=None, port=None, maintenance_db=None, password=None, runas=None): ''' Checks if a tablespace exists on the Postgres server. CLI Example: .. code-block:: bash salt '*' postgres.tablespace_exists 'dbname' .. versionadded:: 2015.8.0 ...
Checks if a tablespace exists on the Postgres server. CLI Example: .. code-block:: bash salt '*' postgres.tablespace_exists 'dbname' .. versionadded:: 2015.8.0
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L714-L731
[ "def tablespace_list(user=None, host=None, port=None, maintenance_db=None,\n password=None, runas=None):\n '''\n Return dictionary with information about tablespaces of a Postgres server.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' postgres.tablespace_list\n\n .. ...
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...
saltstack/salt
salt/modules/postgres.py
tablespace_create
python
def tablespace_create(name, location, options=None, owner=None, user=None, host=None, port=None, maintenance_db=None, password=None, runas=None): ''' Adds a tablespace to the Postgres server. CLI Example: .. code-block:: bash salt '*' postgres.table...
Adds a tablespace to the Postgres server. CLI Example: .. code-block:: bash salt '*' postgres.tablespace_create tablespacename '/path/datadir' .. versionadded:: 2015.8.0
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L734-L767
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def _psql_prepare_and_run(cmd,\n host=None,\n port=None,\n maintenance_db=None,\n password=None,\n runas=None,\n ...
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...
saltstack/salt
salt/modules/postgres.py
tablespace_alter
python
def tablespace_alter(name, user=None, host=None, port=None, maintenance_db=None, password=None, new_name=None, new_owner=None, set_option=None, reset_option=None, runas=None): ''' Change tablespace name, owner, or options. CLI Example: .. code-block:: bash ...
Change tablespace name, owner, or options. CLI Example: .. code-block:: bash salt '*' postgres.tablespace_alter tsname new_owner=otheruser salt '*' postgres.tablespace_alter index_space new_name=fast_raid salt '*' postgres.tablespace_alter test set_option="{'seq_page_cost': '1.1'}" ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L770-L813
[ "def _psql_prepare_and_run(cmd,\n host=None,\n port=None,\n maintenance_db=None,\n password=None,\n runas=None,\n user=None):\n rcmd = _psql_cmd(\n host=hos...
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...
saltstack/salt
salt/modules/postgres.py
tablespace_remove
python
def tablespace_remove(name, user=None, host=None, port=None, maintenance_db=None, password=None, runas=None): ''' Removes a tablespace from the Postgres server. CLI Example: .. code-block:: bash salt '*' postgres.tablespace_remove tsname .. versionadded:: 2015.8.0 ...
Removes a tablespace from the Postgres server. CLI Example: .. code-block:: bash salt '*' postgres.tablespace_remove tsname .. versionadded:: 2015.8.0
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L816-L837
[ "def _psql_prepare_and_run(cmd,\n host=None,\n port=None,\n maintenance_db=None,\n password=None,\n runas=None,\n user=None):\n rcmd = _psql_cmd(\n host=hos...
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...
saltstack/salt
salt/modules/postgres.py
user_list
python
def user_list(user=None, host=None, port=None, maintenance_db=None, password=None, runas=None, return_password=False): ''' Return a dict with information about users of a Postgres server. Set return_password to True to get password hash in the result. CLI Example: .. code-block:: ba...
Return a dict with information about users of a Postgres server. Set return_password to True to get password hash in the result. CLI Example: .. code-block:: bash salt '*' postgres.user_list
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L842-L941
[ "def _parsed_version(user=None, host=None, port=None, maintenance_db=None,\n password=None, runas=None):\n '''\n Returns the server version properly parsed and int casted for internal use.\n\n If the Postgres server does not respond, None will be returned.\n '''\n\n psql_version = ...
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...
saltstack/salt
salt/modules/postgres.py
role_get
python
def role_get(name, user=None, host=None, port=None, maintenance_db=None, password=None, runas=None, return_password=False): ''' Return a dict with information about users of a Postgres server. Set return_password to True to get password hash in the result. CLI Example: .. code-block:...
Return a dict with information about users of a Postgres server. Set return_password to True to get password hash in the result. CLI Example: .. code-block:: bash salt '*' postgres.role_get postgres
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L944-L968
[ "def user_list(user=None, host=None, port=None, maintenance_db=None,\n password=None, runas=None, return_password=False):\n '''\n Return a dict with information about users of a Postgres server.\n\n Set return_password to True to get password hash in the result.\n\n CLI Example:\n\n .. c...
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...
saltstack/salt
salt/modules/postgres.py
user_exists
python
def user_exists(name, user=None, host=None, port=None, maintenance_db=None, password=None, runas=None): ''' Checks if a user exists on the Postgres server. CLI Example: .. code-block:: bash salt '*' postgres.user_exists 'username' ''' re...
Checks if a user exists on the Postgres server. CLI Example: .. code-block:: bash salt '*' postgres.user_exists 'username'
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L971-L992
[ "def role_get(name, user=None, host=None, port=None, maintenance_db=None,\n password=None, runas=None, return_password=False):\n '''\n Return a dict with information about users of a Postgres server.\n\n Set return_password to True to get password hash in the result.\n\n CLI Example:\n\n ...
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...
saltstack/salt
salt/modules/postgres.py
_maybe_encrypt_password
python
def _maybe_encrypt_password(role, password, encrypted=_DEFAULT_PASSWORDS_ENCRYPTION): ''' pgsql passwords are md5 hashes of the string: 'md5{password}{rolename}' ''' if password is not None: password = six.text_type(password) if encrypt...
pgsql passwords are md5 hashes of the string: 'md5{password}{rolename}'
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1015-L1026
null
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...
saltstack/salt
salt/modules/postgres.py
_role_create
python
def _role_create(name, user=None, host=None, port=None, maintenance_db=None, password=None, createdb=None, createroles=None, encrypted=None, superuser=None, ...
Creates a Postgres role. Users and Groups are both roles in postgres. However, users can login, groups cannot.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1119-L1170
[ "def user_exists(name,\n user=None, host=None, port=None, maintenance_db=None,\n password=None,\n runas=None):\n '''\n Checks if a user exists on the Postgres server.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' postgres.user_exists 'username...
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...
saltstack/salt
salt/modules/postgres.py
user_create
python
def user_create(username, user=None, host=None, port=None, maintenance_db=None, password=None, createdb=None, createroles=None, inherit=None, login=None, connli...
Creates a Postgres user. CLI Examples: .. code-block:: bash salt '*' postgres.user_create 'username' user='user' \\ host='hostname' port='port' password='password' \\ rolepassword='rolepassword' valid_until='valid_until'
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1173-L1220
[ "def _role_create(name,\n user=None,\n host=None,\n port=None,\n maintenance_db=None,\n password=None,\n createdb=None,\n createroles=None,\n encrypted=None,\n superuser=No...
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...
saltstack/salt
salt/modules/postgres.py
_role_update
python
def _role_update(name, user=None, host=None, port=None, maintenance_db=None, password=None, createdb=None, typ_='role', createroles=None, inherit=None, ...
Updates a postgres role.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1223-L1282
[ "def role_get(name, user=None, host=None, port=None, maintenance_db=None,\n password=None, runas=None, return_password=False):\n '''\n Return a dict with information about users of a Postgres server.\n\n Set return_password to True to get password hash in the result.\n\n CLI Example:\n\n ...
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...
saltstack/salt
salt/modules/postgres.py
_role_remove
python
def _role_remove(name, user=None, host=None, port=None, maintenance_db=None, password=None, runas=None): ''' Removes a role from the Postgres Server ''' # check if user exists if not user_exists(name, user, host, port, maintenance_db, password=password, runas...
Removes a role from the Postgres Server
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1335-L1359
[ "def user_exists(name,\n user=None, host=None, port=None, maintenance_db=None,\n password=None,\n runas=None):\n '''\n Checks if a user exists on the Postgres server.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' postgres.user_exists 'username...
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...
saltstack/salt
salt/modules/postgres.py
installed_extensions
python
def installed_extensions(user=None, host=None, port=None, maintenance_db=None, password=None, runas=None): ''' List installed postgresql extensions CLI Example: .. code-block:: ...
List installed postgresql extensions CLI Example: .. code-block:: bash salt '*' postgres.installed_extensions
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1393-L1421
[ "def psql_query(query, user=None, host=None, port=None, maintenance_db=None,\n password=None, runas=None, write=False):\n '''\n Run an SQL-Query and return the results as a list. This command\n only supports SELECT statements. This limitation can be worked around\n with a query like this:...
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...
saltstack/salt
salt/modules/postgres.py
get_available_extension
python
def get_available_extension(name, user=None, host=None, port=None, maintenance_db=None, password=None, runas=None): ''' Get info about an availa...
Get info about an available postgresql extension CLI Example: .. code-block:: bash salt '*' postgres.get_available_extension plpgsql
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1424-L1446
[ "def available_extensions(user=None,\n host=None,\n port=None,\n maintenance_db=None,\n password=None,\n runas=None):\n '''\n List available postgresql extensions\n\n CLI Example:\n\n ...
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...
saltstack/salt
salt/modules/postgres.py
get_installed_extension
python
def get_installed_extension(name, user=None, host=None, port=None, maintenance_db=None, password=None, runas=None): ''' Get info about an instal...
Get info about an installed postgresql extension CLI Example: .. code-block:: bash salt '*' postgres.get_installed_extension plpgsql
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1449-L1471
[ "def installed_extensions(user=None,\n host=None,\n port=None,\n maintenance_db=None,\n password=None,\n runas=None):\n '''\n List installed postgresql extensions\n\n CLI Example:\n\n ...
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...
saltstack/salt
salt/modules/postgres.py
is_available_extension
python
def is_available_extension(name, user=None, host=None, port=None, maintenance_db=None, password=None, runas=None): ''' Test if a specific extension is...
Test if a specific extension is available CLI Example: .. code-block:: bash salt '*' postgres.is_available_extension
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1474-L1502
[ "def available_extensions(user=None,\n host=None,\n port=None,\n maintenance_db=None,\n password=None,\n runas=None):\n '''\n List available postgresql extensions\n\n CLI Example:\n\n ...
# -*- coding: utf-8 -*- ''' Module to provide Postgres compatibility to salt. :configuration: In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:: postgres.host: 'localhost' postgres.port: '5432' ...