repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/cli/salt.py | SaltCMD._progress_ret | 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... | 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... | [
"def",
"_progress_ret",
"(",
"self",
",",
"progress",
",",
"out",
")",
":",
"import",
"salt",
".",
"output",
"# Get the progress bar",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'progress_bar'",
")",
":",
"try",
":",
"self",
".",
"progress_bar",
"=",
"salt... | Print progress events | [
"Print",
"progress",
"events"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/salt.py#L350-L362 | train |
saltstack/salt | salt/cli/salt.py | SaltCMD._output_ret | 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... | 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... | [
"def",
"_output_ret",
"(",
"self",
",",
"ret",
",",
"out",
",",
"retcode",
"=",
"0",
")",
":",
"import",
"salt",
".",
"output",
"# Handle special case commands",
"if",
"self",
".",
"config",
"[",
"'fun'",
"]",
"==",
"'sys.doc'",
"and",
"not",
"isinstance",... | Print the output from a single return to the terminal | [
"Print",
"the",
"output",
"from",
"a",
"single",
"return",
"to",
"the",
"terminal"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/salt.py#L364-L380 | train |
saltstack/salt | salt/cli/salt.py | SaltCMD._format_ret | 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... | 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... | [
"def",
"_format_ret",
"(",
"self",
",",
"full_ret",
")",
":",
"ret",
"=",
"{",
"}",
"out",
"=",
"''",
"retcode",
"=",
"0",
"for",
"key",
",",
"data",
"in",
"six",
".",
"iteritems",
"(",
"full_ret",
")",
":",
"ret",
"[",
"key",
"]",
"=",
"data",
... | Take the full return data and format it to simple output | [
"Take",
"the",
"full",
"return",
"data",
"and",
"format",
"it",
"to",
"simple",
"output"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/salt.py#L382-L396 | train |
saltstack/salt | salt/cli/salt.py | SaltCMD._get_retcode | 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(... | 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(... | [
"def",
"_get_retcode",
"(",
"self",
",",
"ret",
")",
":",
"retcode",
"=",
"0",
"# if there is a dict with retcode, use that",
"if",
"isinstance",
"(",
"ret",
",",
"dict",
")",
"and",
"ret",
".",
"get",
"(",
"'retcode'",
",",
"0",
")",
"!=",
"0",
":",
"if... | Determine a retcode for a given return | [
"Determine",
"a",
"retcode",
"for",
"a",
"given",
"return"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/salt.py#L398-L411 | train |
saltstack/salt | salt/cli/salt.py | SaltCMD._print_docs | 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.... | 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.... | [
"def",
"_print_docs",
"(",
"self",
",",
"ret",
")",
":",
"import",
"salt",
".",
"output",
"docs",
"=",
"{",
"}",
"if",
"not",
"ret",
":",
"self",
".",
"exit",
"(",
"2",
",",
"'No minions found to gather docs from\\n'",
")",
"if",
"isinstance",
"(",
"ret"... | Print out the docstrings for all of the functions on the minions | [
"Print",
"out",
"the",
"docstrings",
"for",
"all",
"of",
"the",
"functions",
"on",
"the",
"minions"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/salt.py#L418-L443 | train |
saltstack/salt | salt/utils/yamlencoding.py | yaml_dquote | 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... | 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... | [
"def",
"yaml_dquote",
"(",
"text",
")",
":",
"with",
"io",
".",
"StringIO",
"(",
")",
"as",
"ostream",
":",
"yemitter",
"=",
"yaml",
".",
"emitter",
".",
"Emitter",
"(",
"ostream",
",",
"width",
"=",
"six",
".",
"MAXSIZE",
")",
"yemitter",
".",
"writ... | Make text into a double-quoted YAML string with correct escaping
for special characters. Includes the opening and closing double
quote characters. | [
"Make",
"text",
"into",
"a",
"double",
"-",
"quoted",
"YAML",
"string",
"with",
"correct",
"escaping",
"for",
"special",
"characters",
".",
"Includes",
"the",
"opening",
"and",
"closing",
"double",
"quote",
"characters",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/yamlencoding.py#L19-L28 | train |
saltstack/salt | salt/utils/yamlencoding.py | yaml_squote | 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... | 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... | [
"def",
"yaml_squote",
"(",
"text",
")",
":",
"with",
"io",
".",
"StringIO",
"(",
")",
"as",
"ostream",
":",
"yemitter",
"=",
"yaml",
".",
"emitter",
".",
"Emitter",
"(",
"ostream",
",",
"width",
"=",
"six",
".",
"MAXSIZE",
")",
"yemitter",
".",
"writ... | Make text into a single-quoted YAML string with correct escaping
for special characters. Includes the opening and closing single
quote characters. | [
"Make",
"text",
"into",
"a",
"single",
"-",
"quoted",
"YAML",
"string",
"with",
"correct",
"escaping",
"for",
"special",
"characters",
".",
"Includes",
"the",
"opening",
"and",
"closing",
"single",
"quote",
"characters",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/yamlencoding.py#L32-L41 | train |
saltstack/salt | salt/utils/yamlencoding.py | yaml_encode | 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_... | 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_... | [
"def",
"yaml_encode",
"(",
"data",
")",
":",
"yrepr",
"=",
"yaml",
".",
"representer",
".",
"SafeRepresenter",
"(",
")",
"ynode",
"=",
"yrepr",
".",
"represent_data",
"(",
"data",
")",
"if",
"not",
"isinstance",
"(",
"ynode",
",",
"yaml",
".",
"ScalarNod... | A simple YAML encode that can take a single-element datatype and return
a string representation. | [
"A",
"simple",
"YAML",
"encode",
"that",
"can",
"take",
"a",
"single",
"-",
"element",
"datatype",
"and",
"return",
"a",
"string",
"representation",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/yamlencoding.py#L45-L64 | train |
saltstack/salt | salt/renderers/nacl.py | _decrypt_object | 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 _... | 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 _... | [
"def",
"_decrypt_object",
"(",
"obj",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"salt",
".",
"utils",
".",
"stringio",
".",
"is_readable",
"(",
"obj",
")",
":",
"return",
"_decrypt_object",
"(",
"obj",
".",
"getvalue",
"(",
")",
",",
"*",
"*",
"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. | [
"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... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/renderers/nacl.py#L71-L93 | train |
saltstack/salt | salt/pillar/mysql.py | ext_pillar | 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) | 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) | [
"def",
"ext_pillar",
"(",
"minion_id",
",",
"pillar",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"MySQLExtPillar",
"(",
")",
".",
"fetch",
"(",
"minion_id",
",",
"pillar",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | Execute queries against MySQL, merge and return as a dict | [
"Execute",
"queries",
"against",
"MySQL",
"merge",
"and",
"return",
"as",
"a",
"dict"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/mysql.py#L140-L147 | train |
saltstack/salt | salt/pillar/mysql.py | MySQLExtPillar._get_options | def _get_options(self):
'''
Returns options used for the MySQL connection.
'''
defaults = {'host': 'localhost',
'user': 'salt',
'pass': 'salt',
'db': 'salt',
'port': 3306,
'ssl': {}}
... | python | def _get_options(self):
'''
Returns options used for the MySQL connection.
'''
defaults = {'host': 'localhost',
'user': 'salt',
'pass': 'salt',
'db': 'salt',
'port': 3306,
'ssl': {}}
... | [
"def",
"_get_options",
"(",
"self",
")",
":",
"defaults",
"=",
"{",
"'host'",
":",
"'localhost'",
",",
"'user'",
":",
"'salt'",
",",
"'pass'",
":",
"'salt'",
",",
"'db'",
":",
"'salt'",
",",
"'port'",
":",
"3306",
",",
"'ssl'",
":",
"{",
"}",
"}",
... | Returns options used for the MySQL connection. | [
"Returns",
"options",
"used",
"for",
"the",
"MySQL",
"connection",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/mysql.py#L93-L111 | train |
saltstack/salt | salt/pillar/mysql.py | MySQLExtPillar._get_cursor | 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... | 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... | [
"def",
"_get_cursor",
"(",
"self",
")",
":",
"_options",
"=",
"self",
".",
"_get_options",
"(",
")",
"conn",
"=",
"MySQLdb",
".",
"connect",
"(",
"host",
"=",
"_options",
"[",
"'host'",
"]",
",",
"user",
"=",
"_options",
"[",
"'user'",
"]",
",",
"pas... | Yield a MySQL cursor | [
"Yield",
"a",
"MySQL",
"cursor"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/mysql.py#L114-L130 | train |
saltstack/salt | salt/pillar/mysql.py | MySQLExtPillar.extract_queries | 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) | 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) | [
"def",
"extract_queries",
"(",
"self",
",",
"args",
",",
"kwargs",
")",
":",
"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. | [
"This",
"function",
"normalizes",
"the",
"config",
"block",
"into",
"a",
"set",
"of",
"queries",
"we",
"can",
"use",
".",
"The",
"return",
"is",
"a",
"list",
"of",
"consistently",
"laid",
"out",
"dicts",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/mysql.py#L132-L137 | train |
saltstack/salt | salt/client/ssh/wrapper/config.py | merge | 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... | 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... | [
"def",
"merge",
"(",
"value",
",",
"default",
"=",
"''",
",",
"omit_opts",
"=",
"False",
",",
"omit_master",
"=",
"False",
",",
"omit_pillar",
"=",
"False",
")",
":",
"ret",
"=",
"None",
"if",
"not",
"omit_opts",
":",
"if",
"value",
"in",
"__opts__",
... | 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 | [
"Retrieves",
"an",
"option",
"based",
"on",
"key",
"merging",
"all",
"matches",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/config.py#L134-L185 | train |
saltstack/salt | salt/client/ssh/wrapper/config.py | get | 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 ... | 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 ... | [
"def",
"get",
"(",
"key",
",",
"default",
"=",
"''",
")",
":",
"ret",
"=",
"salt",
".",
"utils",
".",
"data",
".",
"traverse_dict_and_list",
"(",
"__opts__",
",",
"key",
",",
"'_|-'",
")",
"if",
"ret",
"!=",
"'_|-'",
":",
"return",
"ret",
"ret",
"=... | .. 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... | [
"..",
"versionadded",
":",
"0",
".",
"14",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/config.py#L188-L231 | train |
saltstack/salt | salt/states/zabbix_action.py | present | 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 ... | 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 ... | [
"def",
"present",
"(",
"name",
",",
"params",
",",
"*",
"*",
"kwargs",
")",
":",
"zabbix_id_mapper",
"=",
"__salt__",
"[",
"'zabbix.get_zabbix_id_mapper'",
"]",
"(",
")",
"dry_run",
"=",
"__opts__",
"[",
"'test'",
"]",
"ret",
"=",
"{",
"'name'",
":",
"na... | 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... | [
"Creates",
"Zabbix",
"Action",
"object",
"or",
"if",
"differs",
"update",
"it",
"according",
"defined",
"parameters"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_action.py#L35-L151 | train |
saltstack/salt | salt/modules/openbsdrcctl_service.py | available | 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 | 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 | [
"def",
"available",
"(",
"name",
")",
":",
"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 | [
"Return",
"True",
"if",
"the",
"named",
"service",
"is",
"available",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openbsdrcctl_service.py#L54-L67 | train |
saltstack/salt | salt/modules/openbsdrcctl_service.py | get_all | 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) | 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) | [
"def",
"get_all",
"(",
")",
":",
"ret",
"=",
"[",
"]",
"service",
"=",
"_cmd",
"(",
")",
"for",
"svc",
"in",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'{0} ls all'",
".",
"format",
"(",
"service",
")",
")",
".",
"splitlines",
"(",
")",
":",
"ret",
... | Return all installed services.
CLI Example:
.. code-block:: bash
salt '*' service.get_all | [
"Return",
"all",
"installed",
"services",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openbsdrcctl_service.py#L84-L98 | train |
saltstack/salt | salt/modules/openbsdrcctl_service.py | status | 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(_... | 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(_... | [
"def",
"status",
"(",
"name",
",",
"sig",
"=",
"None",
")",
":",
"if",
"sig",
":",
"return",
"bool",
"(",
"__salt__",
"[",
"'status.pid'",
"]",
"(",
"sig",
")",
")",
"cmd",
"=",
"'{0} check {1}'",
".",
"format",
"(",
"_cmd",
"(",
")",
",",
"name",
... | Return the status for a service, returns a bool whether the service is
running.
CLI Example:
.. code-block:: bash
salt '*' service.status <service name> | [
"Return",
"the",
"status",
"for",
"a",
"service",
"returns",
"a",
"bool",
"whether",
"the",
"service",
"is",
"running",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openbsdrcctl_service.py#L191-L206 | train |
saltstack/salt | salt/modules/openbsdrcctl_service.py | enable | 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 '*... | 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 '*... | [
"def",
"enable",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"stat_cmd",
"=",
"'{0} set {1} status on'",
".",
"format",
"(",
"_cmd",
"(",
")",
",",
"name",
")",
"stat_retcode",
"=",
"__salt__",
"[",
"'cmd.retcode'",
"]",
"(",
"stat_cmd",
")",
"flag_r... | 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... | [
"Enable",
"the",
"named",
"service",
"to",
"start",
"at",
"boot",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openbsdrcctl_service.py#L209-L235 | train |
saltstack/salt | salt/modules/openbsdrcctl_service.py | enabled | 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 '*'... | 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 '*'... | [
"def",
"enabled",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"cmd",
"=",
"'{0} get {1} status'",
".",
"format",
"(",
"_cmd",
"(",
")",
",",
"name",
")",
"if",
"not",
"__salt__",
"[",
"'cmd.retcode'",
"]",
"(",
"cmd",
")",
":",
"# also consider a s... | 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... | [
"Return",
"True",
"if",
"the",
"named",
"service",
"is",
"enabled",
"at",
"boot",
"and",
"the",
"provided",
"flags",
"match",
"the",
"configured",
"ones",
"(",
"if",
"any",
")",
".",
"Return",
"False",
"otherwise",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openbsdrcctl_service.py#L266-L294 | train |
saltstack/salt | salt/states/netusers.py | _expand_users | 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 | 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 | [
"def",
"_expand_users",
"(",
"device_users",
",",
"common_users",
")",
":",
"expected_users",
"=",
"deepcopy",
"(",
"common_users",
")",
"expected_users",
".",
"update",
"(",
"device_users",
")",
"return",
"expected_users"
] | Creates a longer list of accepted users on the device. | [
"Creates",
"a",
"longer",
"list",
"of",
"accepted",
"users",
"on",
"the",
"device",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netusers.py#L75-L82 | train |
saltstack/salt | salt/states/netusers.py | _check_users | 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)
... | 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)
... | [
"def",
"_check_users",
"(",
"users",
")",
":",
"messg",
"=",
"''",
"valid",
"=",
"True",
"for",
"user",
",",
"user_details",
"in",
"six",
".",
"iteritems",
"(",
"users",
")",
":",
"if",
"not",
"user_details",
":",
"valid",
"=",
"False",
"messg",
"+=",
... | Checks if the input dictionary of users is valid. | [
"Checks",
"if",
"the",
"input",
"dictionary",
"of",
"users",
"is",
"valid",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netusers.py#L85-L101 | train |
saltstack/salt | salt/states/netusers.py | _compute_diff | 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... | 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... | [
"def",
"_compute_diff",
"(",
"configured",
",",
"expected",
")",
":",
"diff",
"=",
"{",
"'add'",
":",
"{",
"}",
",",
"'update'",
":",
"{",
"}",
",",
"'remove'",
":",
"{",
"}",
"}",
"configured_users",
"=",
"set",
"(",
"configured",
".",
"keys",
"(",
... | Computes the differences between the actual config and the expected config | [
"Computes",
"the",
"differences",
"between",
"the",
"actual",
"config",
"and",
"the",
"expected",
"config"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netusers.py#L104-L141 | train |
saltstack/salt | salt/states/netusers.py | managed | 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... | 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... | [
"def",
"managed",
"(",
"name",
",",
"users",
"=",
"None",
",",
"defaults",
"=",
"None",
")",
":",
"result",
"=",
"False",
"comment",
"=",
"''",
"changes",
"=",
"{",
"}",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"changes",
",",... | 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... | [
"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",
"o... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netusers.py#L169-L443 | train |
saltstack/salt | salt/netapi/rest_cherrypy/tools/websockets.py | SynchronizingWebsocket.received_message | 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.
... | 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.
... | [
"def",
"received_message",
"(",
"self",
",",
"message",
")",
":",
"if",
"message",
".",
"data",
".",
"decode",
"(",
"'utf-8'",
")",
"==",
"'websocket client ready'",
":",
"self",
".",
"pipe",
".",
"send",
"(",
"message",
")",
"self",
".",
"send",
"(",
... | 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... | [
"Checks",
"if",
"the",
"client",
"has",
"sent",
"a",
"ready",
"message",
".",
"A",
"ready",
"message",
"causes",
"send",
"()",
"to",
"be",
"called",
"on",
"the",
"parent",
"end",
"of",
"the",
"pipe",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/tools/websockets.py#L45-L59 | train |
saltstack/salt | salt/utils/text.py | cli_info | 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... | 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... | [
"def",
"cli_info",
"(",
"data",
",",
"title",
"=",
"'Info'",
")",
":",
"wrapper",
"=",
"textwrap",
".",
"TextWrapper",
"(",
")",
"wrapper",
".",
"initial_indent",
"=",
"' '",
"*",
"4",
"wrapper",
".",
"subsequent_indent",
"=",
"wrapper",
".",
"initial_inde... | Prints an info on CLI with the title.
Useful for infos, general errors etc.
:param data:
:param title:
:return: | [
"Prints",
"an",
"info",
"on",
"CLI",
"with",
"the",
"title",
".",
"Useful",
"for",
"infos",
"general",
"errors",
"etc",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/text.py#L9-L23 | train |
saltstack/salt | salt/modules/pagerduty_util.py | get_users | 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,
... | 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,
... | [
"def",
"get_users",
"(",
"profile",
"=",
"'pagerduty'",
",",
"subdomain",
"=",
"None",
",",
"api_key",
"=",
"None",
")",
":",
"return",
"_list_items",
"(",
"'users'",
",",
"'id'",
",",
"profile",
"=",
"profile",
",",
"subdomain",
"=",
"subdomain",
",",
"... | List users belonging to this account
CLI Example:
salt myminion pagerduty.get_users | [
"List",
"users",
"belonging",
"to",
"this",
"account"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L34-L49 | train |
saltstack/salt | salt/modules/pagerduty_util.py | get_services | 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... | 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... | [
"def",
"get_services",
"(",
"profile",
"=",
"'pagerduty'",
",",
"subdomain",
"=",
"None",
",",
"api_key",
"=",
"None",
")",
":",
"return",
"_list_items",
"(",
"'services'",
",",
"'id'",
",",
"profile",
"=",
"profile",
",",
"subdomain",
"=",
"subdomain",
",... | List services belonging to this account
CLI Example:
salt myminion pagerduty.get_services | [
"List",
"services",
"belonging",
"to",
"this",
"account"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L52-L67 | train |
saltstack/salt | salt/modules/pagerduty_util.py | get_schedules | 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... | 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... | [
"def",
"get_schedules",
"(",
"profile",
"=",
"'pagerduty'",
",",
"subdomain",
"=",
"None",
",",
"api_key",
"=",
"None",
")",
":",
"return",
"_list_items",
"(",
"'schedules'",
",",
"'id'",
",",
"profile",
"=",
"profile",
",",
"subdomain",
"=",
"subdomain",
... | List schedules belonging to this account
CLI Example:
salt myminion pagerduty.get_schedules | [
"List",
"schedules",
"belonging",
"to",
"this",
"account"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L70-L85 | train |
saltstack/salt | salt/modules/pagerduty_util.py | get_escalation_policies | 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,... | 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,... | [
"def",
"get_escalation_policies",
"(",
"profile",
"=",
"'pagerduty'",
",",
"subdomain",
"=",
"None",
",",
"api_key",
"=",
"None",
")",
":",
"return",
"_list_items",
"(",
"'escalation_policies'",
",",
"'id'",
",",
"profile",
"=",
"profile",
",",
"subdomain",
"=... | List escalation_policies belonging to this account
CLI Example:
salt myminion pagerduty.get_escalation_policies | [
"List",
"escalation_policies",
"belonging",
"to",
"this",
"account"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L88-L103 | train |
saltstack/salt | salt/modules/pagerduty_util.py | _list_items | 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 = {}
... | 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 = {}
... | [
"def",
"_list_items",
"(",
"action",
",",
"key",
",",
"profile",
"=",
"None",
",",
"subdomain",
"=",
"None",
",",
"api_key",
"=",
"None",
")",
":",
"items",
"=",
"_query",
"(",
"profile",
"=",
"profile",
",",
"subdomain",
"=",
"subdomain",
",",
"api_ke... | List items belonging to an API call.
This method should be in utils.pagerduty. | [
"List",
"items",
"belonging",
"to",
"an",
"API",
"call",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L106-L121 | train |
saltstack/salt | salt/modules/pagerduty_util.py | _query | 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__[... | 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__[... | [
"def",
"_query",
"(",
"method",
"=",
"'GET'",
",",
"profile",
"=",
"None",
",",
"url",
"=",
"None",
",",
"path",
"=",
"'api/v1'",
",",
"action",
"=",
"None",
",",
"api_key",
"=",
"None",
",",
"service",
"=",
"None",
",",
"params",
"=",
"None",
",",... | Query the PagerDuty API.
This method should be in utils.pagerduty. | [
"Query",
"the",
"PagerDuty",
"API",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L124-L196 | train |
saltstack/salt | salt/modules/pagerduty_util.py | get_resource | 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:
... | 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:
... | [
"def",
"get_resource",
"(",
"resource_name",
",",
"key",
",",
"identifier_fields",
",",
"profile",
"=",
"'pagerduty'",
",",
"subdomain",
"=",
"None",
",",
"api_key",
"=",
"None",
")",
":",
"# cache the expensive 'get all resources' calls into __context__ so that we do the... | 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... | [
"Get",
"any",
"single",
"pagerduty",
"resource",
"by",
"key",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L210-L252 | train |
saltstack/salt | salt/modules/pagerduty_util.py | create_or_update_resource | 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 ... | 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 ... | [
"def",
"create_or_update_resource",
"(",
"resource_name",
",",
"identifier_fields",
",",
"data",
",",
"diff",
"=",
"None",
",",
"profile",
"=",
"'pagerduty'",
",",
"subdomain",
"=",
"None",
",",
"api_key",
"=",
"None",
")",
":",
"# try to locate the resource by an... | 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 ... | [
"create",
"or",
"update",
"any",
"pagerduty",
"resource",
"Helper",
"method",
"for",
"present",
"()",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L255-L309 | train |
saltstack/salt | salt/modules/pagerduty_util.py | delete_resource | 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 = ... | 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 = ... | [
"def",
"delete_resource",
"(",
"resource_name",
",",
"key",
",",
"identifier_fields",
",",
"profile",
"=",
"'pagerduty'",
",",
"subdomain",
"=",
"None",
",",
"api_key",
"=",
"None",
")",
":",
"resource",
"=",
"get_resource",
"(",
"resource_name",
",",
"key",
... | delete any pagerduty resource
Helper method for absent()
example:
delete_resource("users", key, ["id","name","email"]) # delete by id or name or email | [
"delete",
"any",
"pagerduty",
"resource"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L312-L331 | train |
saltstack/salt | salt/modules/pagerduty_util.py | resource_present | 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... | 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... | [
"def",
"resource_present",
"(",
"resource",
",",
"identifier_fields",
",",
"diff",
"=",
"None",
",",
"profile",
"=",
"'pagerduty'",
",",
"subdomain",
"=",
"None",
",",
"api_key",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
... | 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"]) | [
"Generic",
"resource",
".",
"present",
"state",
"method",
".",
"Pagerduty",
"state",
"modules",
"should",
"be",
"a",
"thin",
"wrapper",
"over",
"this",
"method",
"with",
"a",
"custom",
"diff",
"function",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L334-L368 | train |
saltstack/salt | salt/modules/pagerduty_util.py | resource_absent | 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 ... | 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 ... | [
"def",
"resource_absent",
"(",
"resource",
",",
"identifier_fields",
",",
"profile",
"=",
"'pagerduty'",
",",
"subdomain",
"=",
"None",
",",
"api_key",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"kwargs",
"[",
"'name'... | 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"]) | [
"Generic",
"resource",
".",
"absent",
"state",
"method",
".",
"Pagerduty",
"state",
"modules",
"should",
"be",
"a",
"thin",
"wrapper",
"over",
"this",
"method",
"with",
"a",
"custom",
"diff",
"function",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L371-L407 | train |
saltstack/salt | salt/states/nexus.py | downloaded | 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... | 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... | [
"def",
"downloaded",
"(",
"name",
",",
"artifact",
",",
"target_dir",
"=",
"'/tmp'",
",",
"target_file",
"=",
"None",
")",
":",
"log",
".",
"debug",
"(",
"\" ======================== STATE: nexus.downloaded (name: %s) \"",
",",
"name",
")",
"ret",
"=",
"{",
"'na... | 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... | [
"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",... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/nexus.py#L27-L110 | train |
saltstack/salt | salt/modules/chronos.py | _jobs | 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 | 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 | [
"def",
"_jobs",
"(",
")",
":",
"response",
"=",
"salt",
".",
"utils",
".",
"http",
".",
"query",
"(",
"\"{0}/scheduler/jobs\"",
".",
"format",
"(",
"_base_url",
"(",
")",
")",
",",
"decode_type",
"=",
"'json'",
",",
"decode",
"=",
"True",
",",
")",
"... | Return the currently configured jobs. | [
"Return",
"the",
"currently",
"configured",
"jobs",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/chronos.py#L37-L49 | train |
saltstack/salt | salt/modules/chronos.py | update_job | 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... | 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... | [
"def",
"update_job",
"(",
"name",
",",
"config",
")",
":",
"if",
"'name'",
"not",
"in",
"config",
":",
"config",
"[",
"'name'",
"]",
"=",
"name",
"data",
"=",
"salt",
".",
"utils",
".",
"json",
".",
"dumps",
"(",
"config",
")",
"try",
":",
"respons... | Update the specified job with the given configuration.
CLI Example:
.. code-block:: bash
salt chronos-minion-id chronos.update_job my-job '<config yaml>' | [
"Update",
"the",
"specified",
"job",
"with",
"the",
"given",
"configuration",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/chronos.py#L96-L126 | train |
saltstack/salt | salt/modules/chronos.py | rm_job | 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... | 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... | [
"def",
"rm_job",
"(",
"name",
")",
":",
"response",
"=",
"salt",
".",
"utils",
".",
"http",
".",
"query",
"(",
"\"{0}/scheduler/job/{1}\"",
".",
"format",
"(",
"_base_url",
"(",
")",
",",
"name",
")",
",",
"method",
"=",
"'DELETE'",
",",
")",
"return",... | Remove the specified job from the server.
CLI Example:
.. code-block:: bash
salt chronos-minion-id chronos.rm_job my-job | [
"Remove",
"the",
"specified",
"job",
"from",
"the",
"server",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/chronos.py#L129-L143 | train |
saltstack/salt | salt/grains/iscsi.py | iscsi_iqn | 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... | 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... | [
"def",
"iscsi_iqn",
"(",
")",
":",
"grains",
"=",
"{",
"}",
"grains",
"[",
"'iscsi_iqn'",
"]",
"=",
"False",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_linux",
"(",
")",
":",
"grains",
"[",
"'iscsi_iqn'",
"]",
"=",
"_linux_iqn",
"(",
")",
... | Return iSCSI IQN | [
"Return",
"iSCSI",
"IQN"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/iscsi.py#L38-L50 | train |
saltstack/salt | salt/grains/iscsi.py | _linux_iqn | 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... | 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... | [
"def",
"_linux_iqn",
"(",
")",
":",
"ret",
"=",
"[",
"]",
"initiator",
"=",
"'/etc/iscsi/initiatorname.iscsi'",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"initiator",
",",
"'r'",
")",
"as",
"_iscsi",
":",
"for",
"line",
... | Return iSCSI IQN from a Linux host. | [
"Return",
"iSCSI",
"IQN",
"from",
"a",
"Linux",
"host",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/iscsi.py#L53-L70 | train |
saltstack/salt | salt/grains/iscsi.py | _aix_iqn | 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:
... | 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:
... | [
"def",
"_aix_iqn",
"(",
")",
":",
"ret",
"=",
"[",
"]",
"aix_cmd",
"=",
"'lsattr -E -l iscsi0 | grep initiator_name'",
"aix_ret",
"=",
"salt",
".",
"modules",
".",
"cmdmod",
".",
"run",
"(",
"aix_cmd",
")",
"if",
"aix_ret",
"[",
"0",
"]",
".",
"isalpha",
... | Return iSCSI IQN from an AIX host. | [
"Return",
"iSCSI",
"IQN",
"from",
"an",
"AIX",
"host",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/iscsi.py#L73-L87 | train |
saltstack/salt | salt/grains/iscsi.py | _windows_iqn | 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(
... | 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(
... | [
"def",
"_windows_iqn",
"(",
")",
":",
"ret",
"=",
"[",
"]",
"wmic",
"=",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"'wmic'",
")",
"if",
"not",
"wmic",
":",
"return",
"ret",
"namespace",
"=",
"r'\\\\root\\WMI'",
"path",
"=",
"'MSiSCSIInitiat... | Return iSCSI IQN from a Windows host. | [
"Return",
"iSCSI",
"IQN",
"from",
"a",
"Windows",
"host",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/iscsi.py#L90-L114 | train |
saltstack/salt | salt/modules/ret.py | get_jid | 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) | 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) | [
"def",
"get_jid",
"(",
"returner",
",",
"jid",
")",
":",
"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 | [
"Return",
"the",
"information",
"for",
"a",
"specified",
"job",
"id"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ret.py#L11-L22 | train |
saltstack/salt | salt/modules/ret.py | get_fun | 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) | 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) | [
"def",
"get_fun",
"(",
"returner",
",",
"fun",
")",
":",
"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 | [
"Return",
"info",
"about",
"last",
"time",
"fun",
"was",
"called",
"on",
"each",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ret.py#L25-L36 | train |
saltstack/salt | salt/modules/ret.py | get_jids | 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)]() | 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)]() | [
"def",
"get_jids",
"(",
"returner",
")",
":",
"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 | [
"Return",
"a",
"list",
"of",
"all",
"job",
"ids"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ret.py#L39-L50 | train |
saltstack/salt | salt/modules/ret.py | get_minions | 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)]() | 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)]() | [
"def",
"get_minions",
"(",
"returner",
")",
":",
"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 | [
"Return",
"a",
"list",
"of",
"all",
"minions"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ret.py#L53-L64 | train |
saltstack/salt | salt/beacons/bonjour_announce.py | _enforce_txt_record_maxlen | 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... | 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... | [
"def",
"_enforce_txt_record_maxlen",
"(",
"key",
",",
"value",
")",
":",
"# Add 1 for '=' seperator between key and value",
"if",
"len",
"(",
"key",
")",
"+",
"len",
"(",
"value",
")",
"+",
"1",
">",
"255",
":",
"# 255 - 3 ('...') - 1 ('=') = 251",
"return",
"valu... | 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... | [
"Enforces",
"the",
"TXT",
"record",
"maximum",
"length",
"of",
"255",
"characters",
".",
"TXT",
"record",
"length",
"includes",
"key",
"value",
"and",
"=",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/bonjour_announce.py#L73-L90 | train |
saltstack/salt | salt/beacons/bonjour_announce.py | beacon | 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... | 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... | [
"def",
"beacon",
"(",
"config",
")",
":",
"ret",
"=",
"[",
"]",
"changes",
"=",
"{",
"}",
"txt",
"=",
"{",
"}",
"global",
"LAST_GRAINS",
"global",
"SD_REF",
"_config",
"=",
"{",
"}",
"list",
"(",
"map",
"(",
"_config",
".",
"update",
",",
"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 port of the service to announce
... | [
"Broadcast",
"values",
"via",
"zeroconf"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/bonjour_announce.py#L93-L247 | train |
saltstack/salt | salt/modules/sysmod.py | doc | 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... | 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... | [
"def",
"doc",
"(",
"*",
"args",
")",
":",
"docs",
"=",
"{",
"}",
"if",
"not",
"args",
":",
"for",
"fun",
"in",
"__salt__",
":",
"docs",
"[",
"fun",
"]",
"=",
"__salt__",
"[",
"fun",
"]",
".",
"__doc__",
"return",
"_strip_rst",
"(",
"docs",
")",
... | 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... | [
"Return",
"the",
"docstrings",
"for",
"all",
"modules",
".",
"Optionally",
"specify",
"a",
"module",
"or",
"a",
"function",
"to",
"narrow",
"the",
"selection",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L38-L91 | train |
saltstack/salt | salt/modules/sysmod.py | state_doc | 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
... | 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
... | [
"def",
"state_doc",
"(",
"*",
"args",
")",
":",
"st_",
"=",
"salt",
".",
"state",
".",
"State",
"(",
"__opts__",
")",
"docs",
"=",
"{",
"}",
"if",
"not",
"args",
":",
"for",
"fun",
"in",
"st_",
".",
"states",
":",
"state",
"=",
"fun",
".",
"spl... | 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:: ... | [
"Return",
"the",
"docstrings",
"for",
"all",
"states",
".",
"Optionally",
"specify",
"a",
"state",
"or",
"a",
"function",
"to",
"narrow",
"the",
"selection",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L94-L161 | train |
saltstack/salt | salt/modules/sysmod.py | runner_doc | 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
... | 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
... | [
"def",
"runner_doc",
"(",
"*",
"args",
")",
":",
"run_",
"=",
"salt",
".",
"runner",
".",
"Runner",
"(",
"__opts__",
")",
"docs",
"=",
"{",
"}",
"if",
"not",
"args",
":",
"for",
"fun",
"in",
"run_",
".",
"functions",
":",
"docs",
"[",
"fun",
"]",... | 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... | [
"Return",
"the",
"docstrings",
"for",
"all",
"runners",
".",
"Optionally",
"specify",
"a",
"runner",
"or",
"a",
"function",
"to",
"narrow",
"the",
"selection",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L164-L219 | train |
saltstack/salt | salt/modules/sysmod.py | returner_doc | 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... | 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... | [
"def",
"returner_doc",
"(",
"*",
"args",
")",
":",
"returners_",
"=",
"salt",
".",
"loader",
".",
"returners",
"(",
"__opts__",
",",
"[",
"]",
")",
"docs",
"=",
"{",
"}",
"if",
"not",
"args",
":",
"for",
"fun",
"in",
"returners_",
":",
"docs",
"[",... | 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... | [
"Return",
"the",
"docstrings",
"for",
"all",
"returners",
".",
"Optionally",
"specify",
"a",
"returner",
"or",
"a",
"function",
"to",
"narrow",
"the",
"selection",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L222-L279 | train |
saltstack/salt | salt/modules/sysmod.py | renderer_doc | 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
... | 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
... | [
"def",
"renderer_doc",
"(",
"*",
"args",
")",
":",
"renderers_",
"=",
"salt",
".",
"loader",
".",
"render",
"(",
"__opts__",
",",
"[",
"]",
")",
"docs",
"=",
"{",
"}",
"if",
"not",
"args",
":",
"for",
"func",
"in",
"six",
".",
"iterkeys",
"(",
"r... | 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... | [
"Return",
"the",
"docstrings",
"for",
"all",
"renderers",
".",
"Optionally",
"specify",
"a",
"renderer",
"or",
"a",
"function",
"to",
"narrow",
"the",
"selection",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L282-L325 | train |
saltstack/salt | salt/modules/sysmod.py | utils_doc | 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.
... | 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.
... | [
"def",
"utils_doc",
"(",
"*",
"args",
")",
":",
"docs",
"=",
"{",
"}",
"if",
"not",
"args",
":",
"for",
"fun",
"in",
"__utils__",
":",
"docs",
"[",
"fun",
"]",
"=",
"__utils__",
"[",
"fun",
"]",
".",
"__doc__",
"return",
"_strip_rst",
"(",
"docs",
... | .. 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... | [
"..",
"versionadded",
"::",
"Neon"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L328-L374 | train |
saltstack/salt | salt/modules/sysmod.py | list_functions | 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 '*... | 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 '*... | [
"def",
"list_functions",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"# ## NOTE: **kwargs is used here to prevent a traceback when garbage",
"# ## arguments are tacked on to the end.",
"if",
"not",
"args",
":",
"# We're being as... | 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.
..... | [
"List",
"the",
"functions",
"for",
"all",
"modules",
".",
"Optionally",
"specify",
"a",
"module",
"or",
"modules",
"from",
"which",
"to",
"list",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L377-L423 | train |
saltstack/salt | salt/modules/sysmod.py | list_modules | 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 = ... | 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 = ... | [
"def",
"list_modules",
"(",
"*",
"args",
")",
":",
"modules",
"=",
"set",
"(",
")",
"if",
"not",
"args",
":",
"for",
"func",
"in",
"__salt__",
":",
"modules",
".",
"add",
"(",
"func",
".",
"split",
"(",
"'.'",
")",
"[",
"0",
"]",
")",
"return",
... | 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*' | [
"List",
"the",
"modules",
"loaded",
"on",
"the",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L426-L460 | train |
saltstack/salt | salt/modules/sysmod.py | state_argspec | 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
... | 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
... | [
"def",
"state_argspec",
"(",
"module",
"=",
"''",
")",
":",
"st_",
"=",
"salt",
".",
"state",
".",
"State",
"(",
"__opts__",
")",
"return",
"salt",
".",
"utils",
".",
"args",
".",
"argspec_report",
"(",
"st_",
".",
"states",
",",
"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
State names can be specified as globs.
... | [
"Return",
"the",
"argument",
"specification",
"of",
"functions",
"in",
"Salt",
"state",
"modules",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L505-L528 | train |
saltstack/salt | salt/modules/sysmod.py | returner_argspec | 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_... | 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_... | [
"def",
"returner_argspec",
"(",
"module",
"=",
"''",
")",
":",
"returners_",
"=",
"salt",
".",
"loader",
".",
"returners",
"(",
"__opts__",
",",
"[",
"]",
")",
"return",
"salt",
".",
"utils",
".",
"args",
".",
"argspec_report",
"(",
"returners_",
",",
... | 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 ... | [
"Return",
"the",
"argument",
"specification",
"of",
"functions",
"in",
"Salt",
"returner",
"modules",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L531-L554 | train |
saltstack/salt | salt/modules/sysmod.py | runner_argspec | 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... | 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... | [
"def",
"runner_argspec",
"(",
"module",
"=",
"''",
")",
":",
"run_",
"=",
"salt",
".",
"runner",
".",
"Runner",
"(",
"__opts__",
")",
"return",
"salt",
".",
"utils",
".",
"args",
".",
"argspec_report",
"(",
"run_",
".",
"functions",
",",
"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
Runner names can be specified as globs.
... | [
"Return",
"the",
"argument",
"specification",
"of",
"functions",
"in",
"Salt",
"runner",
"modules",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L557-L579 | train |
saltstack/salt | salt/modules/sysmod.py | list_state_functions | 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... | 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... | [
"def",
"list_state_functions",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"# NOTE: **kwargs is used here to prevent a traceback when garbage",
"# arguments are tacked on to the end.",
"st_",
"=",
"salt",
".",
"state",
".",
... | 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 ... | [
"List",
"the",
"functions",
"for",
"all",
"state",
"modules",
".",
"Optionally",
"specify",
"a",
"state",
"module",
"or",
"modules",
"from",
"which",
"to",
"list",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L582-L632 | train |
saltstack/salt | salt/modules/sysmod.py | list_state_modules | 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... | 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... | [
"def",
"list_state_modules",
"(",
"*",
"args",
")",
":",
"st_",
"=",
"salt",
".",
"state",
".",
"State",
"(",
"__opts__",
")",
"modules",
"=",
"set",
"(",
")",
"if",
"not",
"args",
":",
"for",
"func",
"in",
"st_",
".",
"states",
":",
"log",
".",
... | 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_*' | [
"List",
"the",
"modules",
"loaded",
"on",
"the",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L635-L674 | train |
saltstack/salt | salt/modules/sysmod.py | list_runners | 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... | 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... | [
"def",
"list_runners",
"(",
"*",
"args",
")",
":",
"run_",
"=",
"salt",
".",
"runner",
".",
"Runner",
"(",
"__opts__",
")",
"runners",
"=",
"set",
"(",
")",
"if",
"not",
"args",
":",
"for",
"func",
"in",
"run_",
".",
"functions",
":",
"runners",
".... | 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*' | [
"List",
"the",
"runners",
"loaded",
"on",
"the",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L677-L714 | train |
saltstack/salt | salt/modules/sysmod.py | list_runner_functions | 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... | 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... | [
"def",
"list_runner_functions",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"# ## NOTE: **kwargs is used here to prevent a traceback when garbage",
"# ## arguments are tacked on to the end.",
"run_",
"=",
"salt",
".",
"runner",
... | 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... | [
"List",
"the",
"functions",
"for",
"all",
"runner",
"modules",
".",
"Optionally",
"specify",
"a",
"runner",
"module",
"or",
"modules",
"from",
"which",
"to",
"list",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L717-L760 | train |
saltstack/salt | salt/modules/sysmod.py | list_returners | 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... | 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... | [
"def",
"list_returners",
"(",
"*",
"args",
")",
":",
"returners_",
"=",
"salt",
".",
"loader",
".",
"returners",
"(",
"__opts__",
",",
"[",
"]",
")",
"returners",
"=",
"set",
"(",
")",
"if",
"not",
"args",
":",
"for",
"func",
"in",
"six",
".",
"ite... | 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*' | [
"List",
"the",
"returners",
"loaded",
"on",
"the",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L763-L801 | train |
saltstack/salt | salt/modules/sysmod.py | list_returner_functions | 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... | 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... | [
"def",
"list_returner_functions",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"# NOTE: **kwargs is used here to prevent a traceback when garbage",
"# arguments are tacked on to the end.",
"returners_",
"=",
"salt",
".",
"loader"... | 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... | [
"List",
"the",
"functions",
"for",
"all",
"returner",
"modules",
".",
"Optionally",
"specify",
"a",
"returner",
"module",
"or",
"modules",
"from",
"which",
"to",
"list",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L804-L847 | train |
saltstack/salt | salt/modules/sysmod.py | list_renderers | 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*'
'''
... | 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*'
'''
... | [
"def",
"list_renderers",
"(",
"*",
"args",
")",
":",
"renderers_",
"=",
"salt",
".",
"loader",
".",
"render",
"(",
"__opts__",
",",
"[",
"]",
")",
"renderers",
"=",
"set",
"(",
")",
"if",
"not",
"args",
":",
"for",
"rend",
"in",
"six",
".",
"iterke... | 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"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L850-L880 | train |
saltstack/salt | salt/modules/sysmod.py | state_schema | 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... | 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... | [
"def",
"state_schema",
"(",
"module",
"=",
"''",
")",
":",
"specs",
"=",
"state_argspec",
"(",
"module",
")",
"schemas",
"=",
"[",
"]",
"for",
"state_mod",
",",
"state_spec",
"in",
"specs",
".",
"items",
"(",
")",
":",
"schemas",
".",
"append",
"(",
... | 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 | [
"Return",
"a",
"JSON",
"Schema",
"for",
"the",
"given",
"state",
"function",
"(",
"s",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L920-L939 | train |
saltstack/salt | salt/modules/postgres.py | _find_pg_binary | 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... | 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... | [
"def",
"_find_pg_binary",
"(",
"util",
")",
":",
"pg_bin_dir",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"'postgres.bins_dir'",
")",
"util_bin",
"=",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"util",
")",
"if",
"not",
"util_bin",
":",
... | ... versionadded:: 2016.3.2
Helper function to locate various psql related binaries | [
"...",
"versionadded",
"::",
"2016",
".",
"3",
".",
"2"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L159-L171 | train |
saltstack/salt | salt/modules/postgres.py | _run_psql | 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,
}
... | 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,
}
... | [
"def",
"_run_psql",
"(",
"cmd",
",",
"runas",
"=",
"None",
",",
"password",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"user",
"=",
"None",
")",
":",
"kwargs",
"=",
"{",
"'reset_system_locale'",
":",
"False",
",",
"'clean_e... | Helper function to call psql, because the password requirement
makes this too much code to be repeated in each function below | [
"Helper",
"function",
"to",
"call",
"psql",
"because",
"the",
"password",
"requirement",
"makes",
"this",
"too",
"much",
"code",
"to",
"be",
"repeated",
"in",
"each",
"function",
"below"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L174-L221 | train |
saltstack/salt | salt/modules/postgres.py | _run_initdb | 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... | 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... | [
"def",
"_run_initdb",
"(",
"name",
",",
"auth",
"=",
"'password'",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"encoding",
"=",
"'UTF8'",
",",
"locale",
"=",
"None",
",",
"runas",
"=",
"None",
",",
"waldir",
"=",
"None",
",",
"checks... | Helper function to call initdb | [
"Helper",
"function",
"to",
"call",
"initdb"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L224-L288 | train |
saltstack/salt | salt/modules/postgres.py | version | 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... | 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... | [
"def",
"version",
"(",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"query",
"=",
"'SELECT setting FROM pg_catalog.pg_setting... | Return the version of a Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.version | [
"Return",
"the",
"version",
"of",
"a",
"Postgres",
"server",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L291-L316 | train |
saltstack/salt | salt/modules/postgres.py | _parsed_version | 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(
... | 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(
... | [
"def",
"_parsed_version",
"(",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"psql_version",
"=",
"version",
"(",
"user",
... | Returns the server version properly parsed and int casted for internal use.
If the Postgres server does not respond, None will be returned. | [
"Returns",
"the",
"server",
"version",
"properly",
"parsed",
"and",
"int",
"casted",
"for",
"internal",
"use",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L319-L341 | train |
saltstack/salt | salt/modules/postgres.py | _connection_defaults | 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 = ... | 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 = ... | [
"def",
"_connection_defaults",
"(",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
")",
":",
"if",
"not",
"user",
":",
"user",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"'postgres.use... | Returns a tuple of (user, host, port, db) with config, pillar, or default
values assigned to missing values. | [
"Returns",
"a",
"tuple",
"of",
"(",
"user",
"host",
"port",
"db",
")",
"with",
"config",
"pillar",
"or",
"default",
"values",
"assigned",
"to",
"missing",
"values",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L344-L358 | train |
saltstack/salt | salt/modules/postgres.py | _psql_cmd | 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... | 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... | [
"def",
"_psql_cmd",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"(",
"user",
",",
"host",
",",
"port",
",",
"maintenance_db",
")",
"=",
"_connection_defaults",
"(",
"kwargs",
".",
"get",
"(",
"'user'",
")",
",",
"kwargs",
".",
"get",
"(",
... | 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. | [
"Return",
"string",
"with",
"fully",
"composed",
"psql",
"command",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L361-L390 | train |
saltstack/salt | salt/modules/postgres.py | psql_query | 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... | 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... | [
"def",
"psql_query",
"(",
"query",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
",",
"write",
"=",
"False",
")",
":",
"ret... | 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
... | [
"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",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L409-L486 | train |
saltstack/salt | salt/modules/postgres.py | db_list | 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... | 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... | [
"def",
"db_list",
"(",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"query",
"=",
"(",
"'SELE... | Return dictionary with information about databases of a Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.db_list | [
"Return",
"dictionary",
"with",
"information",
"about",
"databases",
"of",
"a",
"Postgres",
"server",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L491-L522 | train |
saltstack/salt | salt/modules/postgres.py | db_exists | 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... | 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... | [
"def",
"db_exists",
"(",
"name",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"databases",
"=",
"db_list",
"(",
... | Checks if a database exists on the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.db_exists 'dbname' | [
"Checks",
"if",
"a",
"database",
"exists",
"on",
"the",
"Postgres",
"server",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L525-L540 | train |
saltstack/salt | salt/modules/postgres.py | db_create | 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... | 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... | [
"def",
"db_create",
"(",
"name",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"tablespace",
"=",
"None",
",",
"encoding",
"=",
"None",
",",
"lc_co... | 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 | [
"Adds",
"a",
"databases",
"to",
"the",
"Postgres",
"server",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L553-L607 | train |
saltstack/salt | salt/modules/postgres.py | db_alter | 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 ... | 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 ... | [
"def",
"db_alter",
"(",
"name",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"tablespace",
"=",
"None",
",",
"owner",
"=",
"None",
",",
"owner_rec... | Change tablespace or/and owner of database.
CLI Example:
.. code-block:: bash
salt '*' postgres.db_alter dbname owner=otheruser | [
"Change",
"tablespace",
"or",
"/",
"and",
"owner",
"of",
"database",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L610-L651 | train |
saltstack/salt | salt/modules/postgres.py | tablespace_list | 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... | 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... | [
"def",
"tablespace_list",
"(",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"query",
"=",
"(",
... | Return dictionary with information about tablespaces of a Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.tablespace_list
.. versionadded:: 2015.8.0 | [
"Return",
"dictionary",
"with",
"information",
"about",
"tablespaces",
"of",
"a",
"Postgres",
"server",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L680-L711 | train |
saltstack/salt | salt/modules/postgres.py | tablespace_exists | 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
... | 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
... | [
"def",
"tablespace_exists",
"(",
"name",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"tablespaces",
"=",
"tablespac... | 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",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L714-L731 | train |
saltstack/salt | salt/modules/postgres.py | tablespace_create | 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... | 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... | [
"def",
"tablespace_create",
"(",
"name",
",",
"location",
",",
"options",
"=",
"None",
",",
"owner",
"=",
"None",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
... | Adds a tablespace to the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.tablespace_create tablespacename '/path/datadir'
.. versionadded:: 2015.8.0 | [
"Adds",
"a",
"tablespace",
"to",
"the",
"Postgres",
"server",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L734-L767 | train |
saltstack/salt | salt/modules/postgres.py | tablespace_alter | 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
... | 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
... | [
"def",
"tablespace_alter",
"(",
"name",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"new_name",
"=",
"None",
",",
"new_owner",
"=",
"None",
",",
... | 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'}"
... | [
"Change",
"tablespace",
"name",
"owner",
"or",
"options",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L770-L813 | train |
saltstack/salt | salt/modules/postgres.py | tablespace_remove | 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
... | 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
... | [
"def",
"tablespace_remove",
"(",
"name",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"query",
"=",
"'DROP TABLESPAC... | 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",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L816-L837 | train |
saltstack/salt | salt/modules/postgres.py | user_list | 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... | 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... | [
"def",
"user_list",
"(",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
",",
"return_password",
"=",
"False",
")",
":",
"ret",
"=",... | 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 | [
"Return",
"a",
"dict",
"with",
"information",
"about",
"users",
"of",
"a",
"Postgres",
"server",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L842-L941 | train |
saltstack/salt | salt/modules/postgres.py | role_get | 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:... | 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:... | [
"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:: bash
salt '*' postgres.role_get postgres | [
"Return",
"a",
"dict",
"with",
"information",
"about",
"users",
"of",
"a",
"Postgres",
"server",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L944-L968 | train |
saltstack/salt | salt/modules/postgres.py | user_exists | 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... | 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... | [
"def",
"user_exists",
"(",
"name",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"return",
"bool",
"(",
"role_get",... | Checks if a user exists on the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.user_exists 'username' | [
"Checks",
"if",
"a",
"user",
"exists",
"on",
"the",
"Postgres",
"server",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L971-L992 | train |
saltstack/salt | salt/modules/postgres.py | _maybe_encrypt_password | 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... | 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... | [
"def",
"_maybe_encrypt_password",
"(",
"role",
",",
"password",
",",
"encrypted",
"=",
"_DEFAULT_PASSWORDS_ENCRYPTION",
")",
":",
"if",
"password",
"is",
"not",
"None",
":",
"password",
"=",
"six",
".",
"text_type",
"(",
"password",
")",
"if",
"encrypted",
"an... | pgsql passwords are md5 hashes of the string: 'md5{password}{rolename}' | [
"pgsql",
"passwords",
"are",
"md5",
"hashes",
"of",
"the",
"string",
":",
"md5",
"{",
"password",
"}",
"{",
"rolename",
"}"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1015-L1026 | train |
saltstack/salt | salt/modules/postgres.py | _role_create | def _role_create(name,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
createdb=None,
createroles=None,
encrypted=None,
superuser=None,
... | python | def _role_create(name,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
createdb=None,
createroles=None,
encrypted=None,
superuser=None,
... | [
"def",
"_role_create",
"(",
"name",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"createdb",
"=",
"None",
",",
"createroles",
"=",
"None",
",",
"e... | Creates a Postgres role. Users and Groups are both roles in postgres.
However, users can login, groups cannot. | [
"Creates",
"a",
"Postgres",
"role",
".",
"Users",
"and",
"Groups",
"are",
"both",
"roles",
"in",
"postgres",
".",
"However",
"users",
"can",
"login",
"groups",
"cannot",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1119-L1170 | train |
saltstack/salt | salt/modules/postgres.py | user_create | def user_create(username,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
createdb=None,
createroles=None,
inherit=None,
login=None,
connli... | 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... | [
"def",
"user_create",
"(",
"username",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"createdb",
"=",
"None",
",",
"createroles",
"=",
"None",
",",
... | 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' | [
"Creates",
"a",
"Postgres",
"user",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1173-L1220 | train |
saltstack/salt | salt/modules/postgres.py | _role_update | def _role_update(name,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
createdb=None,
typ_='role',
createroles=None,
inherit=None,
... | python | def _role_update(name,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
createdb=None,
typ_='role',
createroles=None,
inherit=None,
... | [
"def",
"_role_update",
"(",
"name",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"createdb",
"=",
"None",
",",
"typ_",
"=",
"'role'",
",",
"create... | Updates a postgres role. | [
"Updates",
"a",
"postgres",
"role",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1223-L1282 | train |
saltstack/salt | salt/modules/postgres.py | _role_remove | 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... | 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... | [
"def",
"_role_remove",
"(",
"name",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"# check if user exists",
"if",
"no... | Removes a role from the Postgres Server | [
"Removes",
"a",
"role",
"from",
"the",
"Postgres",
"Server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1335-L1359 | train |
saltstack/salt | salt/modules/postgres.py | installed_extensions | def installed_extensions(user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
runas=None):
'''
List installed postgresql extensions
CLI Example:
.. code-block:: ... | 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:: ... | [
"def",
"installed_extensions",
"(",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"exts",
"=",
"[",
"]",
"query",
"=",
... | List installed postgresql extensions
CLI Example:
.. code-block:: bash
salt '*' postgres.installed_extensions | [
"List",
"installed",
"postgresql",
"extensions"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1393-L1421 | train |
saltstack/salt | salt/modules/postgres.py | get_available_extension | def get_available_extension(name,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
runas=None):
'''
Get info about an availa... | python | def get_available_extension(name,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
runas=None):
'''
Get info about an availa... | [
"def",
"get_available_extension",
"(",
"name",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"return",
"available_exten... | Get info about an available postgresql extension
CLI Example:
.. code-block:: bash
salt '*' postgres.get_available_extension plpgsql | [
"Get",
"info",
"about",
"an",
"available",
"postgresql",
"extension"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1424-L1446 | train |
saltstack/salt | salt/modules/postgres.py | get_installed_extension | def get_installed_extension(name,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
runas=None):
'''
Get info about an instal... | python | def get_installed_extension(name,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
runas=None):
'''
Get info about an instal... | [
"def",
"get_installed_extension",
"(",
"name",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"return",
"installed_exten... | Get info about an installed postgresql extension
CLI Example:
.. code-block:: bash
salt '*' postgres.get_installed_extension plpgsql | [
"Get",
"info",
"about",
"an",
"installed",
"postgresql",
"extension"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1449-L1471 | train |
saltstack/salt | salt/modules/postgres.py | is_available_extension | def is_available_extension(name,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
runas=None):
'''
Test if a specific extension is... | 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... | [
"def",
"is_available_extension",
"(",
"name",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"exts",
"=",
"available_e... | Test if a specific extension is available
CLI Example:
.. code-block:: bash
salt '*' postgres.is_available_extension | [
"Test",
"if",
"a",
"specific",
"extension",
"is",
"available"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1474-L1502 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.