repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/modules/mac_pkgutil.py | install | def install(source, package_id):
'''
Install a .pkg from an URI or an absolute path.
:param str source: The path to a package.
:param str package_id: The package ID
:return: True if successful, otherwise False
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' pkgutil.... | python | def install(source, package_id):
'''
Install a .pkg from an URI or an absolute path.
:param str source: The path to a package.
:param str package_id: The package ID
:return: True if successful, otherwise False
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' pkgutil.... | [
"def",
"install",
"(",
"source",
",",
"package_id",
")",
":",
"if",
"is_installed",
"(",
"package_id",
")",
":",
"return",
"True",
"uri",
"=",
"urllib",
".",
"parse",
".",
"urlparse",
"(",
"source",
")",
"if",
"not",
"uri",
".",
"scheme",
"==",
"''",
... | Install a .pkg from an URI or an absolute path.
:param str source: The path to a package.
:param str package_id: The package ID
:return: True if successful, otherwise False
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' pkgutil.install source=/vagrant/build_essentials.pkg ... | [
"Install",
"a",
".",
"pkg",
"from",
"an",
"URI",
"or",
"an",
"absolute",
"path",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_pkgutil.py#L85-L112 | train |
saltstack/salt | salt/modules/mac_pkgutil.py | forget | def forget(package_id):
'''
.. versionadded:: 2016.3.0
Remove the receipt data about the specified package. Does not remove files.
.. warning::
DO NOT use this command to fix broken package design
:param str package_id: The name of the package to forget
:return: True if successful, o... | python | def forget(package_id):
'''
.. versionadded:: 2016.3.0
Remove the receipt data about the specified package. Does not remove files.
.. warning::
DO NOT use this command to fix broken package design
:param str package_id: The name of the package to forget
:return: True if successful, o... | [
"def",
"forget",
"(",
"package_id",
")",
":",
"cmd",
"=",
"'pkgutil --forget {0}'",
".",
"format",
"(",
"package_id",
")",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"execute_return_success",
"(",
"cmd",
")",
"return",
"not",
"is_installed",
"(",
"package_id... | .. versionadded:: 2016.3.0
Remove the receipt data about the specified package. Does not remove files.
.. warning::
DO NOT use this command to fix broken package design
:param str package_id: The name of the package to forget
:return: True if successful, otherwise False
:rtype: bool
... | [
"..",
"versionadded",
"::",
"2016",
".",
"3",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_pkgutil.py#L115-L137 | train |
saltstack/salt | salt/modules/marathon.py | apps | def apps():
'''
Return a list of the currently installed app ids.
CLI Example:
.. code-block:: bash
salt marathon-minion-id marathon.apps
'''
response = salt.utils.http.query(
"{0}/v2/apps".format(_base_url()),
decode_type='json',
decode=True,
)
return ... | python | def apps():
'''
Return a list of the currently installed app ids.
CLI Example:
.. code-block:: bash
salt marathon-minion-id marathon.apps
'''
response = salt.utils.http.query(
"{0}/v2/apps".format(_base_url()),
decode_type='json',
decode=True,
)
return ... | [
"def",
"apps",
"(",
")",
":",
"response",
"=",
"salt",
".",
"utils",
".",
"http",
".",
"query",
"(",
"\"{0}/v2/apps\"",
".",
"format",
"(",
"_base_url",
"(",
")",
")",
",",
"decode_type",
"=",
"'json'",
",",
"decode",
"=",
"True",
",",
")",
"return",... | Return a list of the currently installed app ids.
CLI Example:
.. code-block:: bash
salt marathon-minion-id marathon.apps | [
"Return",
"a",
"list",
"of",
"the",
"currently",
"installed",
"app",
"ids",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/marathon.py#L55-L70 | train |
saltstack/salt | salt/modules/marathon.py | update_app | def update_app(id, config):
'''
Update the specified app with the given configuration.
CLI Example:
.. code-block:: bash
salt marathon-minion-id marathon.update_app my-app '<config yaml>'
'''
if 'id' not in config:
config['id'] = id
config.pop('version', None)
# mirror... | python | def update_app(id, config):
'''
Update the specified app with the given configuration.
CLI Example:
.. code-block:: bash
salt marathon-minion-id marathon.update_app my-app '<config yaml>'
'''
if 'id' not in config:
config['id'] = id
config.pop('version', None)
# mirror... | [
"def",
"update_app",
"(",
"id",
",",
"config",
")",
":",
"if",
"'id'",
"not",
"in",
"config",
":",
"config",
"[",
"'id'",
"]",
"=",
"id",
"config",
".",
"pop",
"(",
"'version'",
",",
"None",
")",
"# mirror marathon-ui handling for uris deprecation (see",
"# ... | Update the specified app with the given configuration.
CLI Example:
.. code-block:: bash
salt marathon-minion-id marathon.update_app my-app '<config yaml>' | [
"Update",
"the",
"specified",
"app",
"with",
"the",
"given",
"configuration",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/marathon.py#L104-L141 | train |
saltstack/salt | salt/modules/marathon.py | rm_app | def rm_app(id):
'''
Remove the specified app from the server.
CLI Example:
.. code-block:: bash
salt marathon-minion-id marathon.rm_app my-app
'''
response = salt.utils.http.query(
"{0}/v2/apps/{1}".format(_base_url(), id),
method='DELETE',
decode_type='json',
... | python | def rm_app(id):
'''
Remove the specified app from the server.
CLI Example:
.. code-block:: bash
salt marathon-minion-id marathon.rm_app my-app
'''
response = salt.utils.http.query(
"{0}/v2/apps/{1}".format(_base_url(), id),
method='DELETE',
decode_type='json',
... | [
"def",
"rm_app",
"(",
"id",
")",
":",
"response",
"=",
"salt",
".",
"utils",
".",
"http",
".",
"query",
"(",
"\"{0}/v2/apps/{1}\"",
".",
"format",
"(",
"_base_url",
"(",
")",
",",
"id",
")",
",",
"method",
"=",
"'DELETE'",
",",
"decode_type",
"=",
"'... | Remove the specified app from the server.
CLI Example:
.. code-block:: bash
salt marathon-minion-id marathon.rm_app my-app | [
"Remove",
"the",
"specified",
"app",
"from",
"the",
"server",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/marathon.py#L144-L160 | train |
saltstack/salt | salt/modules/marathon.py | info | def info():
'''
Return configuration and status information about the marathon instance.
CLI Example:
.. code-block:: bash
salt marathon-minion-id marathon.info
'''
response = salt.utils.http.query(
"{0}/v2/info".format(_base_url()),
decode_type='json',
decode=... | python | def info():
'''
Return configuration and status information about the marathon instance.
CLI Example:
.. code-block:: bash
salt marathon-minion-id marathon.info
'''
response = salt.utils.http.query(
"{0}/v2/info".format(_base_url()),
decode_type='json',
decode=... | [
"def",
"info",
"(",
")",
":",
"response",
"=",
"salt",
".",
"utils",
".",
"http",
".",
"query",
"(",
"\"{0}/v2/info\"",
".",
"format",
"(",
"_base_url",
"(",
")",
")",
",",
"decode_type",
"=",
"'json'",
",",
"decode",
"=",
"True",
",",
")",
"return",... | Return configuration and status information about the marathon instance.
CLI Example:
.. code-block:: bash
salt marathon-minion-id marathon.info | [
"Return",
"configuration",
"and",
"status",
"information",
"about",
"the",
"marathon",
"instance",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/marathon.py#L163-L178 | train |
saltstack/salt | salt/modules/marathon.py | restart_app | def restart_app(id, restart=False, force=True):
'''
Restart the current server configuration for the specified app.
:param restart: Restart the app
:param force: Override the current deployment
CLI Example:
.. code-block:: bash
salt marathon-minion-id marathon.restart_app my-app
... | python | def restart_app(id, restart=False, force=True):
'''
Restart the current server configuration for the specified app.
:param restart: Restart the app
:param force: Override the current deployment
CLI Example:
.. code-block:: bash
salt marathon-minion-id marathon.restart_app my-app
... | [
"def",
"restart_app",
"(",
"id",
",",
"restart",
"=",
"False",
",",
"force",
"=",
"True",
")",
":",
"ret",
"=",
"{",
"'restarted'",
":",
"None",
"}",
"if",
"not",
"restart",
":",
"ret",
"[",
"'restarted'",
"]",
"=",
"False",
"return",
"ret",
"try",
... | Restart the current server configuration for the specified app.
:param restart: Restart the app
:param force: Override the current deployment
CLI Example:
.. code-block:: bash
salt marathon-minion-id marathon.restart_app my-app
By default, this will only check if the app exists in marat... | [
"Restart",
"the",
"current",
"server",
"configuration",
"for",
"the",
"specified",
"app",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/marathon.py#L181-L233 | train |
saltstack/salt | salt/modules/win_dns_client.py | get_dns_servers | def get_dns_servers(interface='Local Area Connection'):
'''
Return a list of the configured DNS servers of the specified interface
CLI Example:
.. code-block:: bash
salt '*' win_dns_client.get_dns_servers 'Local Area Connection'
'''
# remove any escape characters
interface = inter... | python | def get_dns_servers(interface='Local Area Connection'):
'''
Return a list of the configured DNS servers of the specified interface
CLI Example:
.. code-block:: bash
salt '*' win_dns_client.get_dns_servers 'Local Area Connection'
'''
# remove any escape characters
interface = inter... | [
"def",
"get_dns_servers",
"(",
"interface",
"=",
"'Local Area Connection'",
")",
":",
"# remove any escape characters",
"interface",
"=",
"interface",
".",
"split",
"(",
"'\\\\'",
")",
"interface",
"=",
"''",
".",
"join",
"(",
"interface",
")",
"with",
"salt",
"... | Return a list of the configured DNS servers of the specified interface
CLI Example:
.. code-block:: bash
salt '*' win_dns_client.get_dns_servers 'Local Area Connection' | [
"Return",
"a",
"list",
"of",
"the",
"configured",
"DNS",
"servers",
"of",
"the",
"specified",
"interface"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dns_client.py#L30-L54 | train |
saltstack/salt | salt/modules/win_dns_client.py | rm_dns | def rm_dns(ip, interface='Local Area Connection'):
'''
Remove the DNS server from the network interface
CLI Example:
.. code-block:: bash
salt '*' win_dns_client.rm_dns <ip> <interface>
'''
cmd = ['netsh', 'interface', 'ip', 'delete', 'dns', interface, ip, 'validate=no']
return __... | python | def rm_dns(ip, interface='Local Area Connection'):
'''
Remove the DNS server from the network interface
CLI Example:
.. code-block:: bash
salt '*' win_dns_client.rm_dns <ip> <interface>
'''
cmd = ['netsh', 'interface', 'ip', 'delete', 'dns', interface, ip, 'validate=no']
return __... | [
"def",
"rm_dns",
"(",
"ip",
",",
"interface",
"=",
"'Local Area Connection'",
")",
":",
"cmd",
"=",
"[",
"'netsh'",
",",
"'interface'",
",",
"'ip'",
",",
"'delete'",
",",
"'dns'",
",",
"interface",
",",
"ip",
",",
"'validate=no'",
"]",
"return",
"__salt__"... | Remove the DNS server from the network interface
CLI Example:
.. code-block:: bash
salt '*' win_dns_client.rm_dns <ip> <interface> | [
"Remove",
"the",
"DNS",
"server",
"from",
"the",
"network",
"interface"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dns_client.py#L57-L68 | train |
saltstack/salt | salt/modules/win_dns_client.py | add_dns | def add_dns(ip, interface='Local Area Connection', index=1):
'''
Add the DNS server to the network interface
(index starts from 1)
Note: if the interface DNS is configured by DHCP, all the DNS servers will
be removed from the interface and the requested DNS will be the only one
CLI Example:
... | python | def add_dns(ip, interface='Local Area Connection', index=1):
'''
Add the DNS server to the network interface
(index starts from 1)
Note: if the interface DNS is configured by DHCP, all the DNS servers will
be removed from the interface and the requested DNS will be the only one
CLI Example:
... | [
"def",
"add_dns",
"(",
"ip",
",",
"interface",
"=",
"'Local Area Connection'",
",",
"index",
"=",
"1",
")",
":",
"servers",
"=",
"get_dns_servers",
"(",
"interface",
")",
"# Return False if could not find the interface",
"if",
"servers",
"is",
"False",
":",
"retur... | Add the DNS server to the network interface
(index starts from 1)
Note: if the interface DNS is configured by DHCP, all the DNS servers will
be removed from the interface and the requested DNS will be the only one
CLI Example:
.. code-block:: bash
salt '*' win_dns_client.add_dns <ip> <in... | [
"Add",
"the",
"DNS",
"server",
"to",
"the",
"network",
"interface",
"(",
"index",
"starts",
"from",
"1",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dns_client.py#L71-L105 | train |
saltstack/salt | salt/modules/win_dns_client.py | get_dns_config | def get_dns_config(interface='Local Area Connection'):
'''
Get the type of DNS configuration (dhcp / static)
CLI Example:
.. code-block:: bash
salt '*' win_dns_client.get_dns_config 'Local Area Connection'
'''
# remove any escape characters
interface = interface.split('\\')
in... | python | def get_dns_config(interface='Local Area Connection'):
'''
Get the type of DNS configuration (dhcp / static)
CLI Example:
.. code-block:: bash
salt '*' win_dns_client.get_dns_config 'Local Area Connection'
'''
# remove any escape characters
interface = interface.split('\\')
in... | [
"def",
"get_dns_config",
"(",
"interface",
"=",
"'Local Area Connection'",
")",
":",
"# remove any escape characters",
"interface",
"=",
"interface",
".",
"split",
"(",
"'\\\\'",
")",
"interface",
"=",
"''",
".",
"join",
"(",
"interface",
")",
"with",
"salt",
".... | Get the type of DNS configuration (dhcp / static)
CLI Example:
.. code-block:: bash
salt '*' win_dns_client.get_dns_config 'Local Area Connection' | [
"Get",
"the",
"type",
"of",
"DNS",
"configuration",
"(",
"dhcp",
"/",
"static",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dns_client.py#L122-L140 | train |
saltstack/salt | salt/states/bower.py | installed | def installed(name,
dir,
pkgs=None,
user=None,
env=None):
'''
Verify that the given package is installed and is at the correct version
(if specified).
.. code-block:: yaml
underscore:
bower.installed:
- dir: /path/to... | python | def installed(name,
dir,
pkgs=None,
user=None,
env=None):
'''
Verify that the given package is installed and is at the correct version
(if specified).
.. code-block:: yaml
underscore:
bower.installed:
- dir: /path/to... | [
"def",
"installed",
"(",
"name",
",",
"dir",
",",
"pkgs",
"=",
"None",
",",
"user",
"=",
"None",
",",
"env",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
",",
"'changes'... | Verify that the given package is installed and is at the correct version
(if specified).
.. code-block:: yaml
underscore:
bower.installed:
- dir: /path/to/project
- user: someuser
jquery#2.0:
bower.installed:
- dir: /path/to/project
... | [
"Verify",
"that",
"the",
"given",
"package",
"is",
"installed",
"and",
"is",
"at",
"the",
"correct",
"version",
"(",
"if",
"specified",
")",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/bower.py#L49-L190 | train |
saltstack/salt | salt/states/bower.py | bootstrap | def bootstrap(name, user=None):
'''
Bootstraps a frontend distribution.
Will execute 'bower install' on the specified directory.
user
The user to run Bower with
'''
ret = {'name': name, 'result': None, 'comment': '', 'changes': {}}
if __opts__['test']:
ret['result'] = Non... | python | def bootstrap(name, user=None):
'''
Bootstraps a frontend distribution.
Will execute 'bower install' on the specified directory.
user
The user to run Bower with
'''
ret = {'name': name, 'result': None, 'comment': '', 'changes': {}}
if __opts__['test']:
ret['result'] = Non... | [
"def",
"bootstrap",
"(",
"name",
",",
"user",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
"}",
"if",
"__opts__",
"[",
"'test'",
"]",
":... | Bootstraps a frontend distribution.
Will execute 'bower install' on the specified directory.
user
The user to run Bower with | [
"Bootstraps",
"a",
"frontend",
"distribution",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/bower.py#L239-L273 | train |
saltstack/salt | salt/states/bower.py | pruned | def pruned(name, user=None, env=None):
'''
.. versionadded:: 2017.7.0
Cleans up local bower_components directory.
Will execute 'bower prune' on the specified directory (param: name)
user
The user to run Bower with
'''
ret = {'name': name, 'result': None, 'comment': '', 'changes':... | python | def pruned(name, user=None, env=None):
'''
.. versionadded:: 2017.7.0
Cleans up local bower_components directory.
Will execute 'bower prune' on the specified directory (param: name)
user
The user to run Bower with
'''
ret = {'name': name, 'result': None, 'comment': '', 'changes':... | [
"def",
"pruned",
"(",
"name",
",",
"user",
"=",
"None",
",",
"env",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
"}",
"if",
"__opts__",
... | .. versionadded:: 2017.7.0
Cleans up local bower_components directory.
Will execute 'bower prune' on the specified directory (param: name)
user
The user to run Bower with | [
"..",
"versionadded",
"::",
"2017",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/bower.py#L276-L310 | train |
saltstack/salt | salt/states/nfs_export.py | present | def present(name,
clients=None,
hosts=None,
options=None,
exports='/etc/exports'):
'''
Ensure that the named export is present with the given options
name
The export path to configure
clients
A list of hosts and the options applied to the... | python | def present(name,
clients=None,
hosts=None,
options=None,
exports='/etc/exports'):
'''
Ensure that the named export is present with the given options
name
The export path to configure
clients
A list of hosts and the options applied to the... | [
"def",
"present",
"(",
"name",
",",
"clients",
"=",
"None",
",",
"hosts",
"=",
"None",
",",
"options",
"=",
"None",
",",
"exports",
"=",
"'/etc/exports'",
")",
":",
"path",
"=",
"name",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
... | Ensure that the named export is present with the given options
name
The export path to configure
clients
A list of hosts and the options applied to them.
This option may not be used in combination with
the 'hosts' or 'options' shortcuts.
.. code-block:: yaml
- cli... | [
"Ensure",
"that",
"the",
"named",
"export",
"is",
"present",
"with",
"the",
"given",
"options"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/nfs_export.py#L79-L180 | train |
saltstack/salt | salt/states/nfs_export.py | absent | def absent(name, exports='/etc/exports'):
'''
Ensure that the named path is not exported
name
The export path to remove
'''
path = name
ret = {'name': name,
'changes': {},
'result': None,
'comment': ''}
old = __salt__['nfs3.list_exports'](exports)
... | python | def absent(name, exports='/etc/exports'):
'''
Ensure that the named path is not exported
name
The export path to remove
'''
path = name
ret = {'name': name,
'changes': {},
'result': None,
'comment': ''}
old = __salt__['nfs3.list_exports'](exports)
... | [
"def",
"absent",
"(",
"name",
",",
"exports",
"=",
"'/etc/exports'",
")",
":",
"path",
"=",
"name",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
"}",
"old",
"=",... | Ensure that the named path is not exported
name
The export path to remove | [
"Ensure",
"that",
"the",
"named",
"path",
"is",
"not",
"exported"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/nfs_export.py#L183-L218 | train |
saltstack/salt | salt/utils/slack.py | query | def query(function,
api_key=None,
args=None,
method='GET',
header_dict=None,
data=None,
opts=None):
'''
Slack object method function to construct and execute on the API URL.
:param api_key: The Slack api key.
:param function: The Slack ... | python | def query(function,
api_key=None,
args=None,
method='GET',
header_dict=None,
data=None,
opts=None):
'''
Slack object method function to construct and execute on the API URL.
:param api_key: The Slack api key.
:param function: The Slack ... | [
"def",
"query",
"(",
"function",
",",
"api_key",
"=",
"None",
",",
"args",
"=",
"None",
",",
"method",
"=",
"'GET'",
",",
"header_dict",
"=",
"None",
",",
"data",
"=",
"None",
",",
"opts",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'message'",
":",
... | Slack object method function to construct and execute on the API URL.
:param api_key: The Slack api key.
:param function: The Slack api function to perform.
:param method: The HTTP method, e.g. GET or POST.
:param data: The data to be sent for POST method.
:return: The... | [
"Slack",
"object",
"method",
"function",
"to",
"construct",
"and",
"execute",
"on",
"the",
"API",
"URL",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/slack.py#L32-L131 | train |
saltstack/salt | salt/beacons/pkg.py | validate | def validate(config):
'''
Validate the beacon configuration
'''
# Configuration for pkg beacon should be a list
if not isinstance(config, list):
return False, ('Configuration for pkg beacon must be a list.')
# Configuration for pkg beacon should contain pkgs
pkgs_found = False
p... | python | def validate(config):
'''
Validate the beacon configuration
'''
# Configuration for pkg beacon should be a list
if not isinstance(config, list):
return False, ('Configuration for pkg beacon must be a list.')
# Configuration for pkg beacon should contain pkgs
pkgs_found = False
p... | [
"def",
"validate",
"(",
"config",
")",
":",
"# Configuration for pkg beacon should be a list",
"if",
"not",
"isinstance",
"(",
"config",
",",
"list",
")",
":",
"return",
"False",
",",
"(",
"'Configuration for pkg beacon must be a list.'",
")",
"# Configuration for pkg bea... | Validate the beacon configuration | [
"Validate",
"the",
"beacon",
"configuration"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/pkg.py#L25-L44 | train |
saltstack/salt | salt/beacons/pkg.py | beacon | def beacon(config):
'''
Check if installed packages are the latest versions
and fire an event for those that have upgrades.
.. code-block:: yaml
beacons:
pkg:
- pkgs:
- zsh
- apache2
- refresh: True
'''
ret = []
_re... | python | def beacon(config):
'''
Check if installed packages are the latest versions
and fire an event for those that have upgrades.
.. code-block:: yaml
beacons:
pkg:
- pkgs:
- zsh
- apache2
- refresh: True
'''
ret = []
_re... | [
"def",
"beacon",
"(",
"config",
")",
":",
"ret",
"=",
"[",
"]",
"_refresh",
"=",
"False",
"pkgs",
"=",
"[",
"]",
"for",
"config_item",
"in",
"config",
":",
"if",
"'pkgs'",
"in",
"config_item",
":",
"pkgs",
"+=",
"config_item",
"[",
"'pkgs'",
"]",
"if... | Check if installed packages are the latest versions
and fire an event for those that have upgrades.
.. code-block:: yaml
beacons:
pkg:
- pkgs:
- zsh
- apache2
- refresh: True | [
"Check",
"if",
"installed",
"packages",
"are",
"the",
"latest",
"versions",
"and",
"fire",
"an",
"event",
"for",
"those",
"that",
"have",
"upgrades",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/pkg.py#L47-L79 | train |
saltstack/salt | salt/states/logrotate.py | set_ | def set_(name, key, value, setting=None, conf_file=_DEFAULT_CONF):
'''
Set a new value for a specific configuration line.
:param str key: The command or block to configure.
:param str value: The command value or command of the block specified by the key parameter.
:param str setting: The command va... | python | def set_(name, key, value, setting=None, conf_file=_DEFAULT_CONF):
'''
Set a new value for a specific configuration line.
:param str key: The command or block to configure.
:param str value: The command value or command of the block specified by the key parameter.
:param str setting: The command va... | [
"def",
"set_",
"(",
"name",
",",
"key",
",",
"value",
",",
"setting",
"=",
"None",
",",
"conf_file",
"=",
"_DEFAULT_CONF",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"dict",
"(",
")",
",",
"'comment'",
":",
"six",
".",... | Set a new value for a specific configuration line.
:param str key: The command or block to configure.
:param str value: The command value or command of the block specified by the key parameter.
:param str setting: The command value for the command specified by the value parameter.
:param str conf_file:... | [
"Set",
"a",
"new",
"value",
"for",
"a",
"specific",
"configuration",
"line",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/logrotate.py#L51-L131 | train |
saltstack/salt | salt/fileserver/__init__.py | _unlock_cache | def _unlock_cache(w_lock):
'''
Unlock a FS file/dir based lock
'''
if not os.path.exists(w_lock):
return
try:
if os.path.isdir(w_lock):
os.rmdir(w_lock)
elif os.path.isfile(w_lock):
os.unlink(w_lock)
except (OSError, IOError) as exc:
log.tr... | python | def _unlock_cache(w_lock):
'''
Unlock a FS file/dir based lock
'''
if not os.path.exists(w_lock):
return
try:
if os.path.isdir(w_lock):
os.rmdir(w_lock)
elif os.path.isfile(w_lock):
os.unlink(w_lock)
except (OSError, IOError) as exc:
log.tr... | [
"def",
"_unlock_cache",
"(",
"w_lock",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"w_lock",
")",
":",
"return",
"try",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"w_lock",
")",
":",
"os",
".",
"rmdir",
"(",
"w_lock",
")",... | Unlock a FS file/dir based lock | [
"Unlock",
"a",
"FS",
"file",
"/",
"dir",
"based",
"lock"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L39-L51 | train |
saltstack/salt | salt/fileserver/__init__.py | wait_lock | def wait_lock(lk_fn, dest, wait_timeout=0):
'''
If the write lock is there, check to see if the file is actually being
written. If there is no change in the file size after a short sleep,
remove the lock and move forward.
'''
if not os.path.exists(lk_fn):
return False
if not os.path.... | python | def wait_lock(lk_fn, dest, wait_timeout=0):
'''
If the write lock is there, check to see if the file is actually being
written. If there is no change in the file size after a short sleep,
remove the lock and move forward.
'''
if not os.path.exists(lk_fn):
return False
if not os.path.... | [
"def",
"wait_lock",
"(",
"lk_fn",
",",
"dest",
",",
"wait_timeout",
"=",
"0",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"lk_fn",
")",
":",
"return",
"False",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"dest",
")",
":"... | If the write lock is there, check to see if the file is actually being
written. If there is no change in the file size after a short sleep,
remove the lock and move forward. | [
"If",
"the",
"write",
"lock",
"is",
"there",
"check",
"to",
"see",
"if",
"the",
"file",
"is",
"actually",
"being",
"written",
".",
"If",
"there",
"is",
"no",
"change",
"in",
"the",
"file",
"size",
"after",
"a",
"short",
"sleep",
"remove",
"the",
"lock"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L66-L109 | train |
saltstack/salt | salt/fileserver/__init__.py | check_file_list_cache | def check_file_list_cache(opts, form, list_cache, w_lock):
'''
Checks the cache file to see if there is a new enough file list cache, and
returns the match (if found, along with booleans used by the fileserver
backend to determine if the cache needs to be refreshed/written).
'''
refresh_cache = ... | python | def check_file_list_cache(opts, form, list_cache, w_lock):
'''
Checks the cache file to see if there is a new enough file list cache, and
returns the match (if found, along with booleans used by the fileserver
backend to determine if the cache needs to be refreshed/written).
'''
refresh_cache = ... | [
"def",
"check_file_list_cache",
"(",
"opts",
",",
"form",
",",
"list_cache",
",",
"w_lock",
")",
":",
"refresh_cache",
"=",
"False",
"save_cache",
"=",
"True",
"serial",
"=",
"salt",
".",
"payload",
".",
"Serial",
"(",
"opts",
")",
"wait_lock",
"(",
"w_loc... | Checks the cache file to see if there is a new enough file list cache, and
returns the match (if found, along with booleans used by the fileserver
backend to determine if the cache needs to be refreshed/written). | [
"Checks",
"the",
"cache",
"file",
"to",
"see",
"if",
"there",
"is",
"a",
"new",
"enough",
"file",
"list",
"cache",
"and",
"returns",
"the",
"match",
"(",
"if",
"found",
"along",
"with",
"booleans",
"used",
"by",
"the",
"fileserver",
"backend",
"to",
"det... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L112-L173 | train |
saltstack/salt | salt/fileserver/__init__.py | write_file_list_cache | def write_file_list_cache(opts, data, list_cache, w_lock):
'''
Checks the cache file to see if there is a new enough file list cache, and
returns the match (if found, along with booleans used by the fileserver
backend to determine if the cache needs to be refreshed/written).
'''
serial = salt.pa... | python | def write_file_list_cache(opts, data, list_cache, w_lock):
'''
Checks the cache file to see if there is a new enough file list cache, and
returns the match (if found, along with booleans used by the fileserver
backend to determine if the cache needs to be refreshed/written).
'''
serial = salt.pa... | [
"def",
"write_file_list_cache",
"(",
"opts",
",",
"data",
",",
"list_cache",
",",
"w_lock",
")",
":",
"serial",
"=",
"salt",
".",
"payload",
".",
"Serial",
"(",
"opts",
")",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"list_cache",
"... | Checks the cache file to see if there is a new enough file list cache, and
returns the match (if found, along with booleans used by the fileserver
backend to determine if the cache needs to be refreshed/written). | [
"Checks",
"the",
"cache",
"file",
"to",
"see",
"if",
"there",
"is",
"a",
"new",
"enough",
"file",
"list",
"cache",
"and",
"returns",
"the",
"match",
"(",
"if",
"found",
"along",
"with",
"booleans",
"used",
"by",
"the",
"fileserver",
"backend",
"to",
"det... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L176-L186 | train |
saltstack/salt | salt/fileserver/__init__.py | check_env_cache | def check_env_cache(opts, env_cache):
'''
Returns cached env names, if present. Otherwise returns None.
'''
if not os.path.isfile(env_cache):
return None
try:
with salt.utils.files.fopen(env_cache, 'rb') as fp_:
log.trace('Returning env cache data from %s', env_cache)
... | python | def check_env_cache(opts, env_cache):
'''
Returns cached env names, if present. Otherwise returns None.
'''
if not os.path.isfile(env_cache):
return None
try:
with salt.utils.files.fopen(env_cache, 'rb') as fp_:
log.trace('Returning env cache data from %s', env_cache)
... | [
"def",
"check_env_cache",
"(",
"opts",
",",
"env_cache",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"env_cache",
")",
":",
"return",
"None",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"env_cache",
",... | Returns cached env names, if present. Otherwise returns None. | [
"Returns",
"cached",
"env",
"names",
"if",
"present",
".",
"Otherwise",
"returns",
"None",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L189-L202 | train |
saltstack/salt | salt/fileserver/__init__.py | generate_mtime_map | def generate_mtime_map(opts, path_map):
'''
Generate a dict of filename -> mtime
'''
file_map = {}
for saltenv, path_list in six.iteritems(path_map):
for path in path_list:
for directory, _, filenames in salt.utils.path.os_walk(path):
for item in filenames:
... | python | def generate_mtime_map(opts, path_map):
'''
Generate a dict of filename -> mtime
'''
file_map = {}
for saltenv, path_list in six.iteritems(path_map):
for path in path_list:
for directory, _, filenames in salt.utils.path.os_walk(path):
for item in filenames:
... | [
"def",
"generate_mtime_map",
"(",
"opts",
",",
"path_map",
")",
":",
"file_map",
"=",
"{",
"}",
"for",
"saltenv",
",",
"path_list",
"in",
"six",
".",
"iteritems",
"(",
"path_map",
")",
":",
"for",
"path",
"in",
"path_list",
":",
"for",
"directory",
",",
... | Generate a dict of filename -> mtime | [
"Generate",
"a",
"dict",
"of",
"filename",
"-",
">",
"mtime"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L205-L228 | train |
saltstack/salt | salt/fileserver/__init__.py | diff_mtime_map | def diff_mtime_map(map1, map2):
'''
Is there a change to the mtime map? return a boolean
'''
# check if the mtimes are the same
if sorted(map1) != sorted(map2):
return True
# map1 and map2 are guaranteed to have same keys,
# so compare mtimes
for filename, mtime in six.iteritems... | python | def diff_mtime_map(map1, map2):
'''
Is there a change to the mtime map? return a boolean
'''
# check if the mtimes are the same
if sorted(map1) != sorted(map2):
return True
# map1 and map2 are guaranteed to have same keys,
# so compare mtimes
for filename, mtime in six.iteritems... | [
"def",
"diff_mtime_map",
"(",
"map1",
",",
"map2",
")",
":",
"# check if the mtimes are the same",
"if",
"sorted",
"(",
"map1",
")",
"!=",
"sorted",
"(",
"map2",
")",
":",
"return",
"True",
"# map1 and map2 are guaranteed to have same keys,",
"# so compare mtimes",
"f... | Is there a change to the mtime map? return a boolean | [
"Is",
"there",
"a",
"change",
"to",
"the",
"mtime",
"map?",
"return",
"a",
"boolean"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L231-L246 | train |
saltstack/salt | salt/fileserver/__init__.py | reap_fileserver_cache_dir | def reap_fileserver_cache_dir(cache_base, find_func):
'''
Remove unused cache items assuming the cache directory follows a directory
convention:
cache_base -> saltenv -> relpath
'''
for saltenv in os.listdir(cache_base):
env_base = os.path.join(cache_base, saltenv)
for root, dir... | python | def reap_fileserver_cache_dir(cache_base, find_func):
'''
Remove unused cache items assuming the cache directory follows a directory
convention:
cache_base -> saltenv -> relpath
'''
for saltenv in os.listdir(cache_base):
env_base = os.path.join(cache_base, saltenv)
for root, dir... | [
"def",
"reap_fileserver_cache_dir",
"(",
"cache_base",
",",
"find_func",
")",
":",
"for",
"saltenv",
"in",
"os",
".",
"listdir",
"(",
"cache_base",
")",
":",
"env_base",
"=",
"os",
".",
"path",
".",
"join",
"(",
"cache_base",
",",
"saltenv",
")",
"for",
... | Remove unused cache items assuming the cache directory follows a directory
convention:
cache_base -> saltenv -> relpath | [
"Remove",
"unused",
"cache",
"items",
"assuming",
"the",
"cache",
"directory",
"follows",
"a",
"directory",
"convention",
":"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L249-L284 | train |
saltstack/salt | salt/fileserver/__init__.py | is_file_ignored | def is_file_ignored(opts, fname):
'''
If file_ignore_regex or file_ignore_glob were given in config,
compare the given file path against all of them and return True
on the first match.
'''
if opts['file_ignore_regex']:
for regex in opts['file_ignore_regex']:
if re.search(rege... | python | def is_file_ignored(opts, fname):
'''
If file_ignore_regex or file_ignore_glob were given in config,
compare the given file path against all of them and return True
on the first match.
'''
if opts['file_ignore_regex']:
for regex in opts['file_ignore_regex']:
if re.search(rege... | [
"def",
"is_file_ignored",
"(",
"opts",
",",
"fname",
")",
":",
"if",
"opts",
"[",
"'file_ignore_regex'",
"]",
":",
"for",
"regex",
"in",
"opts",
"[",
"'file_ignore_regex'",
"]",
":",
"if",
"re",
".",
"search",
"(",
"regex",
",",
"fname",
")",
":",
"log... | If file_ignore_regex or file_ignore_glob were given in config,
compare the given file path against all of them and return True
on the first match. | [
"If",
"file_ignore_regex",
"or",
"file_ignore_glob",
"were",
"given",
"in",
"config",
"compare",
"the",
"given",
"file",
"path",
"against",
"all",
"of",
"them",
"and",
"return",
"True",
"on",
"the",
"first",
"match",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L287-L310 | train |
saltstack/salt | salt/fileserver/__init__.py | clear_lock | def clear_lock(clear_func, role, remote=None, lock_type='update'):
'''
Function to allow non-fileserver functions to clear update locks
clear_func
A function reference. This function will be run (with the ``remote``
param as an argument) to clear the lock, and must return a 2-tuple of
... | python | def clear_lock(clear_func, role, remote=None, lock_type='update'):
'''
Function to allow non-fileserver functions to clear update locks
clear_func
A function reference. This function will be run (with the ``remote``
param as an argument) to clear the lock, and must return a 2-tuple of
... | [
"def",
"clear_lock",
"(",
"clear_func",
",",
"role",
",",
"remote",
"=",
"None",
",",
"lock_type",
"=",
"'update'",
")",
":",
"msg",
"=",
"'Clearing {0} lock for {1} remotes'",
".",
"format",
"(",
"lock_type",
",",
"role",
")",
"if",
"remote",
":",
"msg",
... | Function to allow non-fileserver functions to clear update locks
clear_func
A function reference. This function will be run (with the ``remote``
param as an argument) to clear the lock, and must return a 2-tuple of
lists, one containing messages describing successfully cleared locks,
... | [
"Function",
"to",
"allow",
"non",
"-",
"fileserver",
"functions",
"to",
"clear",
"update",
"locks"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L313-L340 | train |
saltstack/salt | salt/fileserver/__init__.py | Fileserver.backends | def backends(self, back=None):
'''
Return the backend list
'''
if not back:
back = self.opts['fileserver_backend']
else:
if not isinstance(back, list):
try:
back = back.split(',')
except AttributeError:
... | python | def backends(self, back=None):
'''
Return the backend list
'''
if not back:
back = self.opts['fileserver_backend']
else:
if not isinstance(back, list):
try:
back = back.split(',')
except AttributeError:
... | [
"def",
"backends",
"(",
"self",
",",
"back",
"=",
"None",
")",
":",
"if",
"not",
"back",
":",
"back",
"=",
"self",
".",
"opts",
"[",
"'fileserver_backend'",
"]",
"else",
":",
"if",
"not",
"isinstance",
"(",
"back",
",",
"list",
")",
":",
"try",
":"... | Return the backend list | [
"Return",
"the",
"backend",
"list"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L353-L401 | train |
saltstack/salt | salt/fileserver/__init__.py | Fileserver.clear_cache | def clear_cache(self, back=None):
'''
Clear the cache of all of the fileserver backends that support the
clear_cache function or the named backend(s) only.
'''
back = self.backends(back)
cleared = []
errors = []
for fsb in back:
fstr = '{0}.cle... | python | def clear_cache(self, back=None):
'''
Clear the cache of all of the fileserver backends that support the
clear_cache function or the named backend(s) only.
'''
back = self.backends(back)
cleared = []
errors = []
for fsb in back:
fstr = '{0}.cle... | [
"def",
"clear_cache",
"(",
"self",
",",
"back",
"=",
"None",
")",
":",
"back",
"=",
"self",
".",
"backends",
"(",
"back",
")",
"cleared",
"=",
"[",
"]",
"errors",
"=",
"[",
"]",
"for",
"fsb",
"in",
"back",
":",
"fstr",
"=",
"'{0}.clear_cache'",
"."... | Clear the cache of all of the fileserver backends that support the
clear_cache function or the named backend(s) only. | [
"Clear",
"the",
"cache",
"of",
"all",
"of",
"the",
"fileserver",
"backends",
"that",
"support",
"the",
"clear_cache",
"function",
"or",
"the",
"named",
"backend",
"(",
"s",
")",
"only",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L418-L438 | train |
saltstack/salt | salt/fileserver/__init__.py | Fileserver.lock | def lock(self, back=None, remote=None):
'''
``remote`` can either be a dictionary containing repo configuration
information, or a pattern. If the latter, then remotes for which the URL
matches the pattern will be locked.
'''
back = self.backends(back)
locked = []
... | python | def lock(self, back=None, remote=None):
'''
``remote`` can either be a dictionary containing repo configuration
information, or a pattern. If the latter, then remotes for which the URL
matches the pattern will be locked.
'''
back = self.backends(back)
locked = []
... | [
"def",
"lock",
"(",
"self",
",",
"back",
"=",
"None",
",",
"remote",
"=",
"None",
")",
":",
"back",
"=",
"self",
".",
"backends",
"(",
"back",
")",
"locked",
"=",
"[",
"]",
"errors",
"=",
"[",
"]",
"for",
"fsb",
"in",
"back",
":",
"fstr",
"=",
... | ``remote`` can either be a dictionary containing repo configuration
information, or a pattern. If the latter, then remotes for which the URL
matches the pattern will be locked. | [
"remote",
"can",
"either",
"be",
"a",
"dictionary",
"containing",
"repo",
"configuration",
"information",
"or",
"a",
"pattern",
".",
"If",
"the",
"latter",
"then",
"remotes",
"for",
"which",
"the",
"URL",
"matches",
"the",
"pattern",
"will",
"be",
"locked",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L440-L466 | train |
saltstack/salt | salt/fileserver/__init__.py | Fileserver.clear_lock | def clear_lock(self, back=None, remote=None):
'''
Clear the update lock for the enabled fileserver backends
back
Only clear the update lock for the specified backend(s). The
default is to clear the lock for all enabled backends
remote
If specified, t... | python | def clear_lock(self, back=None, remote=None):
'''
Clear the update lock for the enabled fileserver backends
back
Only clear the update lock for the specified backend(s). The
default is to clear the lock for all enabled backends
remote
If specified, t... | [
"def",
"clear_lock",
"(",
"self",
",",
"back",
"=",
"None",
",",
"remote",
"=",
"None",
")",
":",
"back",
"=",
"self",
".",
"backends",
"(",
"back",
")",
"cleared",
"=",
"[",
"]",
"errors",
"=",
"[",
"]",
"for",
"fsb",
"in",
"back",
":",
"fstr",
... | Clear the update lock for the enabled fileserver backends
back
Only clear the update lock for the specified backend(s). The
default is to clear the lock for all enabled backends
remote
If specified, then any remotes which contain the passed string will
h... | [
"Clear",
"the",
"update",
"lock",
"for",
"the",
"enabled",
"fileserver",
"backends"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L468-L491 | train |
saltstack/salt | salt/fileserver/__init__.py | Fileserver.update | def update(self, back=None):
'''
Update all of the enabled fileserver backends which support the update
function, or
'''
back = self.backends(back)
for fsb in back:
fstr = '{0}.update'.format(fsb)
if fstr in self.servers:
log.debug(... | python | def update(self, back=None):
'''
Update all of the enabled fileserver backends which support the update
function, or
'''
back = self.backends(back)
for fsb in back:
fstr = '{0}.update'.format(fsb)
if fstr in self.servers:
log.debug(... | [
"def",
"update",
"(",
"self",
",",
"back",
"=",
"None",
")",
":",
"back",
"=",
"self",
".",
"backends",
"(",
"back",
")",
"for",
"fsb",
"in",
"back",
":",
"fstr",
"=",
"'{0}.update'",
".",
"format",
"(",
"fsb",
")",
"if",
"fstr",
"in",
"self",
".... | Update all of the enabled fileserver backends which support the update
function, or | [
"Update",
"all",
"of",
"the",
"enabled",
"fileserver",
"backends",
"which",
"support",
"the",
"update",
"function",
"or"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L493-L503 | train |
saltstack/salt | salt/fileserver/__init__.py | Fileserver.update_intervals | def update_intervals(self, back=None):
'''
Return the update intervals for all of the enabled fileserver backends
which support variable update intervals.
'''
back = self.backends(back)
ret = {}
for fsb in back:
fstr = '{0}.update_intervals'.format(fsb... | python | def update_intervals(self, back=None):
'''
Return the update intervals for all of the enabled fileserver backends
which support variable update intervals.
'''
back = self.backends(back)
ret = {}
for fsb in back:
fstr = '{0}.update_intervals'.format(fsb... | [
"def",
"update_intervals",
"(",
"self",
",",
"back",
"=",
"None",
")",
":",
"back",
"=",
"self",
".",
"backends",
"(",
"back",
")",
"ret",
"=",
"{",
"}",
"for",
"fsb",
"in",
"back",
":",
"fstr",
"=",
"'{0}.update_intervals'",
".",
"format",
"(",
"fsb... | Return the update intervals for all of the enabled fileserver backends
which support variable update intervals. | [
"Return",
"the",
"update",
"intervals",
"for",
"all",
"of",
"the",
"enabled",
"fileserver",
"backends",
"which",
"support",
"variable",
"update",
"intervals",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L505-L516 | train |
saltstack/salt | salt/fileserver/__init__.py | Fileserver.envs | def envs(self, back=None, sources=False):
'''
Return the environments for the named backend or all backends
'''
back = self.backends(back)
ret = set()
if sources:
ret = {}
for fsb in back:
fstr = '{0}.envs'.format(fsb)
kwargs = ... | python | def envs(self, back=None, sources=False):
'''
Return the environments for the named backend or all backends
'''
back = self.backends(back)
ret = set()
if sources:
ret = {}
for fsb in back:
fstr = '{0}.envs'.format(fsb)
kwargs = ... | [
"def",
"envs",
"(",
"self",
",",
"back",
"=",
"None",
",",
"sources",
"=",
"False",
")",
":",
"back",
"=",
"self",
".",
"backends",
"(",
"back",
")",
"ret",
"=",
"set",
"(",
")",
"if",
"sources",
":",
"ret",
"=",
"{",
"}",
"for",
"fsb",
"in",
... | Return the environments for the named backend or all backends | [
"Return",
"the",
"environments",
"for",
"the",
"named",
"backend",
"or",
"all",
"backends"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L518-L538 | train |
saltstack/salt | salt/fileserver/__init__.py | Fileserver.file_envs | def file_envs(self, load=None):
'''
Return environments for all backends for requests from fileclient
'''
if load is None:
load = {}
load.pop('cmd', None)
return self.envs(**load) | python | def file_envs(self, load=None):
'''
Return environments for all backends for requests from fileclient
'''
if load is None:
load = {}
load.pop('cmd', None)
return self.envs(**load) | [
"def",
"file_envs",
"(",
"self",
",",
"load",
"=",
"None",
")",
":",
"if",
"load",
"is",
"None",
":",
"load",
"=",
"{",
"}",
"load",
".",
"pop",
"(",
"'cmd'",
",",
"None",
")",
"return",
"self",
".",
"envs",
"(",
"*",
"*",
"load",
")"
] | Return environments for all backends for requests from fileclient | [
"Return",
"environments",
"for",
"all",
"backends",
"for",
"requests",
"from",
"fileclient"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L540-L547 | train |
saltstack/salt | salt/fileserver/__init__.py | Fileserver.init | def init(self, back=None):
'''
Initialize the backend, only do so if the fs supports an init function
'''
back = self.backends(back)
for fsb in back:
fstr = '{0}.init'.format(fsb)
if fstr in self.servers:
self.servers[fstr]() | python | def init(self, back=None):
'''
Initialize the backend, only do so if the fs supports an init function
'''
back = self.backends(back)
for fsb in back:
fstr = '{0}.init'.format(fsb)
if fstr in self.servers:
self.servers[fstr]() | [
"def",
"init",
"(",
"self",
",",
"back",
"=",
"None",
")",
":",
"back",
"=",
"self",
".",
"backends",
"(",
"back",
")",
"for",
"fsb",
"in",
"back",
":",
"fstr",
"=",
"'{0}.init'",
".",
"format",
"(",
"fsb",
")",
"if",
"fstr",
"in",
"self",
".",
... | Initialize the backend, only do so if the fs supports an init function | [
"Initialize",
"the",
"backend",
"only",
"do",
"so",
"if",
"the",
"fs",
"supports",
"an",
"init",
"function"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L549-L557 | train |
saltstack/salt | salt/fileserver/__init__.py | Fileserver._find_file | def _find_file(self, load):
'''
Convenience function for calls made using the RemoteClient
'''
path = load.get('path')
if not path:
return {'path': '',
'rel': ''}
tgt_env = load.get('saltenv', 'base')
return self.find_file(path, tgt... | python | def _find_file(self, load):
'''
Convenience function for calls made using the RemoteClient
'''
path = load.get('path')
if not path:
return {'path': '',
'rel': ''}
tgt_env = load.get('saltenv', 'base')
return self.find_file(path, tgt... | [
"def",
"_find_file",
"(",
"self",
",",
"load",
")",
":",
"path",
"=",
"load",
".",
"get",
"(",
"'path'",
")",
"if",
"not",
"path",
":",
"return",
"{",
"'path'",
":",
"''",
",",
"'rel'",
":",
"''",
"}",
"tgt_env",
"=",
"load",
".",
"get",
"(",
"... | Convenience function for calls made using the RemoteClient | [
"Convenience",
"function",
"for",
"calls",
"made",
"using",
"the",
"RemoteClient"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L559-L568 | train |
saltstack/salt | salt/fileserver/__init__.py | Fileserver.file_find | def file_find(self, load):
'''
Convenience function for calls made using the LocalClient
'''
path = load.get('path')
if not path:
return {'path': '',
'rel': ''}
tgt_env = load.get('saltenv', 'base')
return self.find_file(path, tgt_e... | python | def file_find(self, load):
'''
Convenience function for calls made using the LocalClient
'''
path = load.get('path')
if not path:
return {'path': '',
'rel': ''}
tgt_env = load.get('saltenv', 'base')
return self.find_file(path, tgt_e... | [
"def",
"file_find",
"(",
"self",
",",
"load",
")",
":",
"path",
"=",
"load",
".",
"get",
"(",
"'path'",
")",
"if",
"not",
"path",
":",
"return",
"{",
"'path'",
":",
"''",
",",
"'rel'",
":",
"''",
"}",
"tgt_env",
"=",
"load",
".",
"get",
"(",
"'... | Convenience function for calls made using the LocalClient | [
"Convenience",
"function",
"for",
"calls",
"made",
"using",
"the",
"LocalClient"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L570-L579 | train |
saltstack/salt | salt/fileserver/__init__.py | Fileserver.find_file | def find_file(self, path, saltenv, back=None):
'''
Find the path and return the fnd structure, this structure is passed
to other backend interfaces.
'''
path = salt.utils.stringutils.to_unicode(path)
saltenv = salt.utils.stringutils.to_unicode(saltenv)
back = self... | python | def find_file(self, path, saltenv, back=None):
'''
Find the path and return the fnd structure, this structure is passed
to other backend interfaces.
'''
path = salt.utils.stringutils.to_unicode(path)
saltenv = salt.utils.stringutils.to_unicode(saltenv)
back = self... | [
"def",
"find_file",
"(",
"self",
",",
"path",
",",
"saltenv",
",",
"back",
"=",
"None",
")",
":",
"path",
"=",
"salt",
".",
"utils",
".",
"stringutils",
".",
"to_unicode",
"(",
"path",
")",
"saltenv",
"=",
"salt",
".",
"utils",
".",
"stringutils",
".... | Find the path and return the fnd structure, this structure is passed
to other backend interfaces. | [
"Find",
"the",
"path",
"and",
"return",
"the",
"fnd",
"structure",
"this",
"structure",
"is",
"passed",
"to",
"other",
"backend",
"interfaces",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L581-L627 | train |
saltstack/salt | salt/fileserver/__init__.py | Fileserver.serve_file | def serve_file(self, load):
'''
Serve up a chunk of a file
'''
ret = {'data': '',
'dest': ''}
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if 'path' not in load or 'loc' not in load or 'saltenv' not in... | python | def serve_file(self, load):
'''
Serve up a chunk of a file
'''
ret = {'data': '',
'dest': ''}
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if 'path' not in load or 'loc' not in load or 'saltenv' not in... | [
"def",
"serve_file",
"(",
"self",
",",
"load",
")",
":",
"ret",
"=",
"{",
"'data'",
":",
"''",
",",
"'dest'",
":",
"''",
"}",
"if",
"'env'",
"in",
"load",
":",
"# \"env\" is not supported; Use \"saltenv\".",
"load",
".",
"pop",
"(",
"'env'",
")",
"if",
... | Serve up a chunk of a file | [
"Serve",
"up",
"a",
"chunk",
"of",
"a",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L629-L651 | train |
saltstack/salt | salt/fileserver/__init__.py | Fileserver.__file_hash_and_stat | def __file_hash_and_stat(self, load):
'''
Common code for hashing and stating files
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if 'path' not in load or 'saltenv' not in load:
return '', None
if not i... | python | def __file_hash_and_stat(self, load):
'''
Common code for hashing and stating files
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if 'path' not in load or 'saltenv' not in load:
return '', None
if not i... | [
"def",
"__file_hash_and_stat",
"(",
"self",
",",
"load",
")",
":",
"if",
"'env'",
"in",
"load",
":",
"# \"env\" is not supported; Use \"saltenv\".",
"load",
".",
"pop",
"(",
"'env'",
")",
"if",
"'path'",
"not",
"in",
"load",
"or",
"'saltenv'",
"not",
"in",
"... | Common code for hashing and stating files | [
"Common",
"code",
"for",
"hashing",
"and",
"stating",
"files"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L653-L674 | train |
saltstack/salt | salt/fileserver/__init__.py | Fileserver.clear_file_list_cache | def clear_file_list_cache(self, load):
'''
Deletes the file_lists cache files
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
saltenv = load.get('saltenv', [])
if saltenv is not None:
if not isinstance(sa... | python | def clear_file_list_cache(self, load):
'''
Deletes the file_lists cache files
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
saltenv = load.get('saltenv', [])
if saltenv is not None:
if not isinstance(sa... | [
"def",
"clear_file_list_cache",
"(",
"self",
",",
"load",
")",
":",
"if",
"'env'",
"in",
"load",
":",
"# \"env\" is not supported; Use \"saltenv\".",
"load",
".",
"pop",
"(",
"'env'",
")",
"saltenv",
"=",
"load",
".",
"get",
"(",
"'saltenv'",
",",
"[",
"]",
... | Deletes the file_lists cache files | [
"Deletes",
"the",
"file_lists",
"cache",
"files"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L694-L769 | train |
saltstack/salt | salt/fileserver/__init__.py | Fileserver.file_list | def file_list(self, load):
'''
Return a list of files from the dominant environment
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
ret = set()
if 'saltenv' not in load:
return []
if not isinstanc... | python | def file_list(self, load):
'''
Return a list of files from the dominant environment
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
ret = set()
if 'saltenv' not in load:
return []
if not isinstanc... | [
"def",
"file_list",
"(",
"self",
",",
"load",
")",
":",
"if",
"'env'",
"in",
"load",
":",
"# \"env\" is not supported; Use \"saltenv\".",
"load",
".",
"pop",
"(",
"'env'",
")",
"ret",
"=",
"set",
"(",
")",
"if",
"'saltenv'",
"not",
"in",
"load",
":",
"re... | Return a list of files from the dominant environment | [
"Return",
"a",
"list",
"of",
"files",
"from",
"the",
"dominant",
"environment"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L772-L794 | train |
saltstack/salt | salt/fileserver/__init__.py | Fileserver.symlink_list | def symlink_list(self, load):
'''
Return a list of symlinked files and dirs
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
ret = {}
if 'saltenv' not in load:
return {}
if not isinstance(load['sal... | python | def symlink_list(self, load):
'''
Return a list of symlinked files and dirs
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
ret = {}
if 'saltenv' not in load:
return {}
if not isinstance(load['sal... | [
"def",
"symlink_list",
"(",
"self",
",",
"load",
")",
":",
"if",
"'env'",
"in",
"load",
":",
"# \"env\" is not supported; Use \"saltenv\".",
"load",
".",
"pop",
"(",
"'env'",
")",
"ret",
"=",
"{",
"}",
"if",
"'saltenv'",
"not",
"in",
"load",
":",
"return",... | Return a list of symlinked files and dirs | [
"Return",
"a",
"list",
"of",
"symlinked",
"files",
"and",
"dirs"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L847-L871 | train |
saltstack/salt | salt/fileserver/__init__.py | FSChan.send | def send(self, load, tries=None, timeout=None, raw=False): # pylint: disable=unused-argument
'''
Emulate the channel send method, the tries and timeout are not used
'''
if 'cmd' not in load:
log.error('Malformed request, no cmd: %s', load)
return {}
cmd =... | python | def send(self, load, tries=None, timeout=None, raw=False): # pylint: disable=unused-argument
'''
Emulate the channel send method, the tries and timeout are not used
'''
if 'cmd' not in load:
log.error('Malformed request, no cmd: %s', load)
return {}
cmd =... | [
"def",
"send",
"(",
"self",
",",
"load",
",",
"tries",
"=",
"None",
",",
"timeout",
"=",
"None",
",",
"raw",
"=",
"False",
")",
":",
"# pylint: disable=unused-argument",
"if",
"'cmd'",
"not",
"in",
"load",
":",
"log",
".",
"error",
"(",
"'Malformed reque... | Emulate the channel send method, the tries and timeout are not used | [
"Emulate",
"the",
"channel",
"send",
"method",
"the",
"tries",
"and",
"timeout",
"are",
"not",
"used"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L893-L906 | train |
saltstack/salt | salt/renderers/dson.py | render | def render(dson_input, saltenv='base', sls='', **kwargs):
'''
Accepts DSON data as a string or as a file object and runs it through the
JSON parser.
:rtype: A Python data structure
'''
if not isinstance(dson_input, six.string_types):
dson_input = dson_input.read()
log.debug('DSON i... | python | def render(dson_input, saltenv='base', sls='', **kwargs):
'''
Accepts DSON data as a string or as a file object and runs it through the
JSON parser.
:rtype: A Python data structure
'''
if not isinstance(dson_input, six.string_types):
dson_input = dson_input.read()
log.debug('DSON i... | [
"def",
"render",
"(",
"dson_input",
",",
"saltenv",
"=",
"'base'",
",",
"sls",
"=",
"''",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"dson_input",
",",
"six",
".",
"string_types",
")",
":",
"dson_input",
"=",
"dson_input",
".",
... | Accepts DSON data as a string or as a file object and runs it through the
JSON parser.
:rtype: A Python data structure | [
"Accepts",
"DSON",
"data",
"as",
"a",
"string",
"or",
"as",
"a",
"file",
"object",
"and",
"runs",
"it",
"through",
"the",
"JSON",
"parser",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/renderers/dson.py#L37-L53 | train |
saltstack/salt | salt/roster/scan.py | targets | def targets(tgt, tgt_type='glob', **kwargs):
'''
Return the targets from the flat yaml file, checks opts for location but
defaults to /etc/salt/roster
'''
rmatcher = RosterMatcher(tgt, tgt_type)
return rmatcher.targets() | python | def targets(tgt, tgt_type='glob', **kwargs):
'''
Return the targets from the flat yaml file, checks opts for location but
defaults to /etc/salt/roster
'''
rmatcher = RosterMatcher(tgt, tgt_type)
return rmatcher.targets() | [
"def",
"targets",
"(",
"tgt",
",",
"tgt_type",
"=",
"'glob'",
",",
"*",
"*",
"kwargs",
")",
":",
"rmatcher",
"=",
"RosterMatcher",
"(",
"tgt",
",",
"tgt_type",
")",
"return",
"rmatcher",
".",
"targets",
"(",
")"
] | Return the targets from the flat yaml file, checks opts for location but
defaults to /etc/salt/roster | [
"Return",
"the",
"targets",
"from",
"the",
"flat",
"yaml",
"file",
"checks",
"opts",
"for",
"location",
"but",
"defaults",
"to",
"/",
"etc",
"/",
"salt",
"/",
"roster"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/scan.py#L23-L29 | train |
saltstack/salt | salt/roster/scan.py | RosterMatcher.targets | def targets(self):
'''
Return ip addrs based on netmask, sitting in the "glob" spot because
it is the default
'''
addrs = ()
ret = {}
ports = __opts__['ssh_scan_ports']
if not isinstance(ports, list):
# Comma-separate list of integers
... | python | def targets(self):
'''
Return ip addrs based on netmask, sitting in the "glob" spot because
it is the default
'''
addrs = ()
ret = {}
ports = __opts__['ssh_scan_ports']
if not isinstance(ports, list):
# Comma-separate list of integers
... | [
"def",
"targets",
"(",
"self",
")",
":",
"addrs",
"=",
"(",
")",
"ret",
"=",
"{",
"}",
"ports",
"=",
"__opts__",
"[",
"'ssh_scan_ports'",
"]",
"if",
"not",
"isinstance",
"(",
"ports",
",",
"list",
")",
":",
"# Comma-separate list of integers",
"ports",
"... | Return ip addrs based on netmask, sitting in the "glob" spot because
it is the default | [
"Return",
"ip",
"addrs",
"based",
"on",
"netmask",
"sitting",
"in",
"the",
"glob",
"spot",
"because",
"it",
"is",
"the",
"default"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/scan.py#L40-L73 | train |
saltstack/salt | salt/modules/jsonnet.py | evaluate | def evaluate(contents, jsonnet_library_paths=None):
'''
Evaluate a jsonnet input string.
contents
Raw jsonnet string to evaluate.
jsonnet_library_paths
List of jsonnet library paths.
'''
if not jsonnet_library_paths:
jsonnet_library_paths = __salt__['config.option'](
... | python | def evaluate(contents, jsonnet_library_paths=None):
'''
Evaluate a jsonnet input string.
contents
Raw jsonnet string to evaluate.
jsonnet_library_paths
List of jsonnet library paths.
'''
if not jsonnet_library_paths:
jsonnet_library_paths = __salt__['config.option'](
... | [
"def",
"evaluate",
"(",
"contents",
",",
"jsonnet_library_paths",
"=",
"None",
")",
":",
"if",
"not",
"jsonnet_library_paths",
":",
"jsonnet_library_paths",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"'jsonnet.library_paths'",
",",
"[",
"'.'",
"]",
")",
... | Evaluate a jsonnet input string.
contents
Raw jsonnet string to evaluate.
jsonnet_library_paths
List of jsonnet library paths. | [
"Evaluate",
"a",
"jsonnet",
"input",
"string",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jsonnet.py#L71-L90 | train |
saltstack/salt | salt/modules/solaris_fmadm.py | _parse_fmdump | def _parse_fmdump(output):
'''
Parses fmdump output
'''
result = []
output = output.split("\n")
# extract header
header = [field for field in output[0].lower().split(" ") if field]
del output[0]
# parse entries
for entry in output:
entry = [item for item in entry.split(... | python | def _parse_fmdump(output):
'''
Parses fmdump output
'''
result = []
output = output.split("\n")
# extract header
header = [field for field in output[0].lower().split(" ") if field]
del output[0]
# parse entries
for entry in output:
entry = [item for item in entry.split(... | [
"def",
"_parse_fmdump",
"(",
"output",
")",
":",
"result",
"=",
"[",
"]",
"output",
"=",
"output",
".",
"split",
"(",
"\"\\n\"",
")",
"# extract header",
"header",
"=",
"[",
"field",
"for",
"field",
"in",
"output",
"[",
"0",
"]",
".",
"lower",
"(",
"... | Parses fmdump output | [
"Parses",
"fmdump",
"output"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_fmadm.py#L63-L86 | train |
saltstack/salt | salt/modules/solaris_fmadm.py | _parse_fmdump_verbose | def _parse_fmdump_verbose(output):
'''
Parses fmdump verbose output
'''
result = []
output = output.split("\n")
fault = []
verbose_fault = {}
for line in output:
if line.startswith('TIME'):
fault.append(line)
if verbose_fault:
result.appen... | python | def _parse_fmdump_verbose(output):
'''
Parses fmdump verbose output
'''
result = []
output = output.split("\n")
fault = []
verbose_fault = {}
for line in output:
if line.startswith('TIME'):
fault.append(line)
if verbose_fault:
result.appen... | [
"def",
"_parse_fmdump_verbose",
"(",
"output",
")",
":",
"result",
"=",
"[",
"]",
"output",
"=",
"output",
".",
"split",
"(",
"\"\\n\"",
")",
"fault",
"=",
"[",
"]",
"verbose_fault",
"=",
"{",
"}",
"for",
"line",
"in",
"output",
":",
"if",
"line",
".... | Parses fmdump verbose output | [
"Parses",
"fmdump",
"verbose",
"output"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_fmadm.py#L89-L120 | train |
saltstack/salt | salt/modules/solaris_fmadm.py | _parse_fmadm_config | def _parse_fmadm_config(output):
'''
Parsbb fmdump/fmadm output
'''
result = []
output = output.split("\n")
# extract header
header = [field for field in output[0].lower().split(" ") if field]
del output[0]
# parse entries
for entry in output:
entry = [item for item in ... | python | def _parse_fmadm_config(output):
'''
Parsbb fmdump/fmadm output
'''
result = []
output = output.split("\n")
# extract header
header = [field for field in output[0].lower().split(" ") if field]
del output[0]
# parse entries
for entry in output:
entry = [item for item in ... | [
"def",
"_parse_fmadm_config",
"(",
"output",
")",
":",
"result",
"=",
"[",
"]",
"output",
"=",
"output",
".",
"split",
"(",
"\"\\n\"",
")",
"# extract header",
"header",
"=",
"[",
"field",
"for",
"field",
"in",
"output",
"[",
"0",
"]",
".",
"lower",
"(... | Parsbb fmdump/fmadm output | [
"Parsbb",
"fmdump",
"/",
"fmadm",
"output"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_fmadm.py#L123-L154 | train |
saltstack/salt | salt/modules/solaris_fmadm.py | _fmadm_action_fmri | def _fmadm_action_fmri(action, fmri):
'''
Internal function for fmadm.repqired, fmadm.replaced, fmadm.flush
'''
ret = {}
fmadm = _check_fmadm()
cmd = '{cmd} {action} {fmri}'.format(
cmd=fmadm,
action=action,
fmri=fmri
)
res = __salt__['cmd.run_all'](cmd)
retco... | python | def _fmadm_action_fmri(action, fmri):
'''
Internal function for fmadm.repqired, fmadm.replaced, fmadm.flush
'''
ret = {}
fmadm = _check_fmadm()
cmd = '{cmd} {action} {fmri}'.format(
cmd=fmadm,
action=action,
fmri=fmri
)
res = __salt__['cmd.run_all'](cmd)
retco... | [
"def",
"_fmadm_action_fmri",
"(",
"action",
",",
"fmri",
")",
":",
"ret",
"=",
"{",
"}",
"fmadm",
"=",
"_check_fmadm",
"(",
")",
"cmd",
"=",
"'{cmd} {action} {fmri}'",
".",
"format",
"(",
"cmd",
"=",
"fmadm",
",",
"action",
"=",
"action",
",",
"fmri",
... | Internal function for fmadm.repqired, fmadm.replaced, fmadm.flush | [
"Internal",
"function",
"for",
"fmadm",
".",
"repqired",
"fmadm",
".",
"replaced",
"fmadm",
".",
"flush"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_fmadm.py#L157-L176 | train |
saltstack/salt | salt/modules/solaris_fmadm.py | _parse_fmadm_faulty | def _parse_fmadm_faulty(output):
'''
Parse fmadm faulty output
'''
def _merge_data(summary, fault):
result = {}
uuid = summary['event-id']
del summary['event-id']
result[uuid] = OrderedDict()
result[uuid]['summary'] = summary
result[uuid]['fault'] = fault... | python | def _parse_fmadm_faulty(output):
'''
Parse fmadm faulty output
'''
def _merge_data(summary, fault):
result = {}
uuid = summary['event-id']
del summary['event-id']
result[uuid] = OrderedDict()
result[uuid]['summary'] = summary
result[uuid]['fault'] = fault... | [
"def",
"_parse_fmadm_faulty",
"(",
"output",
")",
":",
"def",
"_merge_data",
"(",
"summary",
",",
"fault",
")",
":",
"result",
"=",
"{",
"}",
"uuid",
"=",
"summary",
"[",
"'event-id'",
"]",
"del",
"summary",
"[",
"'event-id'",
"]",
"result",
"[",
"uuid",... | Parse fmadm faulty output | [
"Parse",
"fmadm",
"faulty",
"output"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_fmadm.py#L179-L246 | train |
saltstack/salt | salt/modules/solaris_fmadm.py | list_records | def list_records(after=None, before=None):
'''
Display fault management logs
after : string
filter events after time, see man fmdump for format
before : string
filter events before time, see man fmdump for format
CLI Example:
.. code-block:: bash
salt '*' fmadm.list
... | python | def list_records(after=None, before=None):
'''
Display fault management logs
after : string
filter events after time, see man fmdump for format
before : string
filter events before time, see man fmdump for format
CLI Example:
.. code-block:: bash
salt '*' fmadm.list
... | [
"def",
"list_records",
"(",
"after",
"=",
"None",
",",
"before",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"fmdump",
"=",
"_check_fmdump",
"(",
")",
"cmd",
"=",
"'{cmd}{after}{before}'",
".",
"format",
"(",
"cmd",
"=",
"fmdump",
",",
"after",
"=",
... | Display fault management logs
after : string
filter events after time, see man fmdump for format
before : string
filter events before time, see man fmdump for format
CLI Example:
.. code-block:: bash
salt '*' fmadm.list | [
"Display",
"fault",
"management",
"logs"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_fmadm.py#L249-L280 | train |
saltstack/salt | salt/modules/solaris_fmadm.py | show | def show(uuid):
'''
Display log details
uuid: string
uuid of fault
CLI Example:
.. code-block:: bash
salt '*' fmadm.show 11b4070f-4358-62fa-9e1e-998f485977e1
'''
ret = {}
fmdump = _check_fmdump()
cmd = '{cmd} -u {uuid} -V'.format(
cmd=fmdump,
uuid=... | python | def show(uuid):
'''
Display log details
uuid: string
uuid of fault
CLI Example:
.. code-block:: bash
salt '*' fmadm.show 11b4070f-4358-62fa-9e1e-998f485977e1
'''
ret = {}
fmdump = _check_fmdump()
cmd = '{cmd} -u {uuid} -V'.format(
cmd=fmdump,
uuid=... | [
"def",
"show",
"(",
"uuid",
")",
":",
"ret",
"=",
"{",
"}",
"fmdump",
"=",
"_check_fmdump",
"(",
")",
"cmd",
"=",
"'{cmd} -u {uuid} -V'",
".",
"format",
"(",
"cmd",
"=",
"fmdump",
",",
"uuid",
"=",
"uuid",
")",
"res",
"=",
"__salt__",
"[",
"'cmd.run_... | Display log details
uuid: string
uuid of fault
CLI Example:
.. code-block:: bash
salt '*' fmadm.show 11b4070f-4358-62fa-9e1e-998f485977e1 | [
"Display",
"log",
"details"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_fmadm.py#L283-L310 | train |
saltstack/salt | salt/modules/solaris_fmadm.py | config | def config():
'''
Display fault manager configuration
CLI Example:
.. code-block:: bash
salt '*' fmadm.config
'''
ret = {}
fmadm = _check_fmadm()
cmd = '{cmd} config'.format(
cmd=fmadm
)
res = __salt__['cmd.run_all'](cmd)
retcode = res['retcode']
result... | python | def config():
'''
Display fault manager configuration
CLI Example:
.. code-block:: bash
salt '*' fmadm.config
'''
ret = {}
fmadm = _check_fmadm()
cmd = '{cmd} config'.format(
cmd=fmadm
)
res = __salt__['cmd.run_all'](cmd)
retcode = res['retcode']
result... | [
"def",
"config",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"fmadm",
"=",
"_check_fmadm",
"(",
")",
"cmd",
"=",
"'{cmd} config'",
".",
"format",
"(",
"cmd",
"=",
"fmadm",
")",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
")",
"retcode",
... | Display fault manager configuration
CLI Example:
.. code-block:: bash
salt '*' fmadm.config | [
"Display",
"fault",
"manager",
"configuration"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_fmadm.py#L313-L336 | train |
saltstack/salt | salt/modules/solaris_fmadm.py | load | def load(path):
'''
Load specified fault manager module
path: string
path of fault manager module
CLI Example:
.. code-block:: bash
salt '*' fmadm.load /module/path
'''
ret = {}
fmadm = _check_fmadm()
cmd = '{cmd} load {path}'.format(
cmd=fmadm,
pa... | python | def load(path):
'''
Load specified fault manager module
path: string
path of fault manager module
CLI Example:
.. code-block:: bash
salt '*' fmadm.load /module/path
'''
ret = {}
fmadm = _check_fmadm()
cmd = '{cmd} load {path}'.format(
cmd=fmadm,
pa... | [
"def",
"load",
"(",
"path",
")",
":",
"ret",
"=",
"{",
"}",
"fmadm",
"=",
"_check_fmadm",
"(",
")",
"cmd",
"=",
"'{cmd} load {path}'",
".",
"format",
"(",
"cmd",
"=",
"fmadm",
",",
"path",
"=",
"path",
")",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'... | Load specified fault manager module
path: string
path of fault manager module
CLI Example:
.. code-block:: bash
salt '*' fmadm.load /module/path | [
"Load",
"specified",
"fault",
"manager",
"module"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_fmadm.py#L339-L366 | train |
saltstack/salt | salt/modules/solaris_fmadm.py | unload | def unload(module):
'''
Unload specified fault manager module
module: string
module to unload
CLI Example:
.. code-block:: bash
salt '*' fmadm.unload software-response
'''
ret = {}
fmadm = _check_fmadm()
cmd = '{cmd} unload {module}'.format(
cmd=fmadm,
... | python | def unload(module):
'''
Unload specified fault manager module
module: string
module to unload
CLI Example:
.. code-block:: bash
salt '*' fmadm.unload software-response
'''
ret = {}
fmadm = _check_fmadm()
cmd = '{cmd} unload {module}'.format(
cmd=fmadm,
... | [
"def",
"unload",
"(",
"module",
")",
":",
"ret",
"=",
"{",
"}",
"fmadm",
"=",
"_check_fmadm",
"(",
")",
"cmd",
"=",
"'{cmd} unload {module}'",
".",
"format",
"(",
"cmd",
"=",
"fmadm",
",",
"module",
"=",
"module",
")",
"res",
"=",
"__salt__",
"[",
"'... | Unload specified fault manager module
module: string
module to unload
CLI Example:
.. code-block:: bash
salt '*' fmadm.unload software-response | [
"Unload",
"specified",
"fault",
"manager",
"module"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_fmadm.py#L369-L396 | train |
saltstack/salt | salt/modules/solaris_fmadm.py | reset | def reset(module, serd=None):
'''
Reset module or sub-component
module: string
module to unload
serd : string
serd sub module
CLI Example:
.. code-block:: bash
salt '*' fmadm.reset software-response
'''
ret = {}
fmadm = _check_fmadm()
cmd = '{cmd} rese... | python | def reset(module, serd=None):
'''
Reset module or sub-component
module: string
module to unload
serd : string
serd sub module
CLI Example:
.. code-block:: bash
salt '*' fmadm.reset software-response
'''
ret = {}
fmadm = _check_fmadm()
cmd = '{cmd} rese... | [
"def",
"reset",
"(",
"module",
",",
"serd",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"fmadm",
"=",
"_check_fmadm",
"(",
")",
"cmd",
"=",
"'{cmd} reset {serd}{module}'",
".",
"format",
"(",
"cmd",
"=",
"fmadm",
",",
"serd",
"=",
"'-s {0} '",
".",
... | Reset module or sub-component
module: string
module to unload
serd : string
serd sub module
CLI Example:
.. code-block:: bash
salt '*' fmadm.reset software-response | [
"Reset",
"module",
"or",
"sub",
"-",
"component"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_fmadm.py#L399-L429 | train |
saltstack/salt | salt/modules/solaris_fmadm.py | faulty | def faulty():
'''
Display list of faulty resources
CLI Example:
.. code-block:: bash
salt '*' fmadm.faulty
'''
fmadm = _check_fmadm()
cmd = '{cmd} faulty'.format(
cmd=fmadm,
)
res = __salt__['cmd.run_all'](cmd)
result = {}
if res['stdout'] == '':
re... | python | def faulty():
'''
Display list of faulty resources
CLI Example:
.. code-block:: bash
salt '*' fmadm.faulty
'''
fmadm = _check_fmadm()
cmd = '{cmd} faulty'.format(
cmd=fmadm,
)
res = __salt__['cmd.run_all'](cmd)
result = {}
if res['stdout'] == '':
re... | [
"def",
"faulty",
"(",
")",
":",
"fmadm",
"=",
"_check_fmadm",
"(",
")",
"cmd",
"=",
"'{cmd} faulty'",
".",
"format",
"(",
"cmd",
"=",
"fmadm",
",",
")",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
")",
"result",
"=",
"{",
"}",
"i... | Display list of faulty resources
CLI Example:
.. code-block:: bash
salt '*' fmadm.faulty | [
"Display",
"list",
"of",
"faulty",
"resources"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_fmadm.py#L496-L517 | train |
saltstack/salt | salt/modules/parted_partition.py | _validate_device | def _validate_device(device):
'''
Ensure the device name supplied is valid in a manner similar to the
`exists` function, but raise errors on invalid input rather than return
False.
This function only validates a block device, it does not check if the block
device is a drive or a partition or a ... | python | def _validate_device(device):
'''
Ensure the device name supplied is valid in a manner similar to the
`exists` function, but raise errors on invalid input rather than return
False.
This function only validates a block device, it does not check if the block
device is a drive or a partition or a ... | [
"def",
"_validate_device",
"(",
"device",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"device",
")",
":",
"dev",
"=",
"os",
".",
"stat",
"(",
"device",
")",
".",
"st_mode",
"if",
"stat",
".",
"S_ISBLK",
"(",
"dev",
")",
":",
"return",
... | Ensure the device name supplied is valid in a manner similar to the
`exists` function, but raise errors on invalid input rather than return
False.
This function only validates a block device, it does not check if the block
device is a drive or a partition or a filesystem, etc. | [
"Ensure",
"the",
"device",
"name",
"supplied",
"is",
"valid",
"in",
"a",
"manner",
"similar",
"to",
"the",
"exists",
"function",
"but",
"raise",
"errors",
"on",
"invalid",
"input",
"rather",
"than",
"return",
"False",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L80-L97 | train |
saltstack/salt | salt/modules/parted_partition.py | _validate_partition_boundary | def _validate_partition_boundary(boundary):
'''
Ensure valid partition boundaries are supplied.
'''
boundary = six.text_type(boundary)
match = re.search(r'^([\d.]+)(\D*)$', boundary)
if match:
unit = match.group(2)
if not unit or unit in VALID_UNITS:
return
raise ... | python | def _validate_partition_boundary(boundary):
'''
Ensure valid partition boundaries are supplied.
'''
boundary = six.text_type(boundary)
match = re.search(r'^([\d.]+)(\D*)$', boundary)
if match:
unit = match.group(2)
if not unit or unit in VALID_UNITS:
return
raise ... | [
"def",
"_validate_partition_boundary",
"(",
"boundary",
")",
":",
"boundary",
"=",
"six",
".",
"text_type",
"(",
"boundary",
")",
"match",
"=",
"re",
".",
"search",
"(",
"r'^([\\d.]+)(\\D*)$'",
",",
"boundary",
")",
"if",
"match",
":",
"unit",
"=",
"match",
... | Ensure valid partition boundaries are supplied. | [
"Ensure",
"valid",
"partition",
"boundaries",
"are",
"supplied",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L100-L112 | train |
saltstack/salt | salt/modules/parted_partition.py | probe | def probe(*devices):
'''
Ask the kernel to update its local partition data. When no args are
specified all block devices are tried.
Caution: Generally only works on devices with no mounted partitions and
may take a long time to return if specified devices are in use.
CLI Examples:
.. code... | python | def probe(*devices):
'''
Ask the kernel to update its local partition data. When no args are
specified all block devices are tried.
Caution: Generally only works on devices with no mounted partitions and
may take a long time to return if specified devices are in use.
CLI Examples:
.. code... | [
"def",
"probe",
"(",
"*",
"devices",
")",
":",
"for",
"device",
"in",
"devices",
":",
"_validate_device",
"(",
"device",
")",
"cmd",
"=",
"'partprobe -- {0}'",
".",
"format",
"(",
"\" \"",
".",
"join",
"(",
"devices",
")",
")",
"out",
"=",
"__salt__",
... | Ask the kernel to update its local partition data. When no args are
specified all block devices are tried.
Caution: Generally only works on devices with no mounted partitions and
may take a long time to return if specified devices are in use.
CLI Examples:
.. code-block:: bash
salt '*' p... | [
"Ask",
"the",
"kernel",
"to",
"update",
"its",
"local",
"partition",
"data",
".",
"When",
"no",
"args",
"are",
"specified",
"all",
"block",
"devices",
"are",
"tried",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L115-L136 | train |
saltstack/salt | salt/modules/parted_partition.py | list_ | def list_(device, unit=None):
'''
Prints partition information of given <device>
CLI Examples:
.. code-block:: bash
salt '*' partition.list /dev/sda
salt '*' partition.list /dev/sda unit=s
salt '*' partition.list /dev/sda unit=kB
'''
_validate_device(device)
if un... | python | def list_(device, unit=None):
'''
Prints partition information of given <device>
CLI Examples:
.. code-block:: bash
salt '*' partition.list /dev/sda
salt '*' partition.list /dev/sda unit=s
salt '*' partition.list /dev/sda unit=kB
'''
_validate_device(device)
if un... | [
"def",
"list_",
"(",
"device",
",",
"unit",
"=",
"None",
")",
":",
"_validate_device",
"(",
"device",
")",
"if",
"unit",
":",
"if",
"unit",
"not",
"in",
"VALID_UNITS",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid unit passed to partition.part_list'",
")... | Prints partition information of given <device>
CLI Examples:
.. code-block:: bash
salt '*' partition.list /dev/sda
salt '*' partition.list /dev/sda unit=s
salt '*' partition.list /dev/sda unit=kB | [
"Prints",
"partition",
"information",
"of",
"given",
"<device",
">"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L139-L213 | train |
saltstack/salt | salt/modules/parted_partition.py | align_check | def align_check(device, part_type, partition):
'''
Check if partition satisfies the alignment constraint of part_type.
Type must be "minimal" or "optimal".
CLI Example:
.. code-block:: bash
salt '*' partition.align_check /dev/sda minimal 1
'''
_validate_device(device)
if part... | python | def align_check(device, part_type, partition):
'''
Check if partition satisfies the alignment constraint of part_type.
Type must be "minimal" or "optimal".
CLI Example:
.. code-block:: bash
salt '*' partition.align_check /dev/sda minimal 1
'''
_validate_device(device)
if part... | [
"def",
"align_check",
"(",
"device",
",",
"part_type",
",",
"partition",
")",
":",
"_validate_device",
"(",
"device",
")",
"if",
"part_type",
"not",
"in",
"set",
"(",
"[",
"'minimal'",
",",
"'optimal'",
"]",
")",
":",
"raise",
"CommandExecutionError",
"(",
... | Check if partition satisfies the alignment constraint of part_type.
Type must be "minimal" or "optimal".
CLI Example:
.. code-block:: bash
salt '*' partition.align_check /dev/sda minimal 1 | [
"Check",
"if",
"partition",
"satisfies",
"the",
"alignment",
"constraint",
"of",
"part_type",
".",
"Type",
"must",
"be",
"minimal",
"or",
"optimal",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L216-L245 | train |
saltstack/salt | salt/modules/parted_partition.py | cp | def cp(device, from_minor, to_minor): # pylint: disable=C0103
'''
Copies the file system on the partition <from-minor> to partition
<to-minor>, deleting the original contents of the destination
partition.
CLI Example:
.. code-block:: bash
salt '*' partition.cp /dev/sda 2 3
'''
... | python | def cp(device, from_minor, to_minor): # pylint: disable=C0103
'''
Copies the file system on the partition <from-minor> to partition
<to-minor>, deleting the original contents of the destination
partition.
CLI Example:
.. code-block:: bash
salt '*' partition.cp /dev/sda 2 3
'''
... | [
"def",
"cp",
"(",
"device",
",",
"from_minor",
",",
"to_minor",
")",
":",
"# pylint: disable=C0103",
"_validate_device",
"(",
"device",
")",
"try",
":",
"int",
"(",
"from_minor",
")",
"int",
"(",
"to_minor",
")",
"except",
"Exception",
":",
"raise",
"Command... | Copies the file system on the partition <from-minor> to partition
<to-minor>, deleting the original contents of the destination
partition.
CLI Example:
.. code-block:: bash
salt '*' partition.cp /dev/sda 2 3 | [
"Copies",
"the",
"file",
"system",
"on",
"the",
"partition",
"<from",
"-",
"minor",
">",
"to",
"partition",
"<to",
"-",
"minor",
">",
"deleting",
"the",
"original",
"contents",
"of",
"the",
"destination",
"partition",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L272-L296 | train |
saltstack/salt | salt/modules/parted_partition.py | set_id | def set_id(device, minor, system_id):
'''
Sets the system ID for the partition. Some typical values are::
b: FAT32 (vfat)
7: HPFS/NTFS
82: Linux Swap
83: Linux
8e: Linux LVM
fd: Linux RAID Auto
CLI Example:
.. code-block:: bash
salt '*' parti... | python | def set_id(device, minor, system_id):
'''
Sets the system ID for the partition. Some typical values are::
b: FAT32 (vfat)
7: HPFS/NTFS
82: Linux Swap
83: Linux
8e: Linux LVM
fd: Linux RAID Auto
CLI Example:
.. code-block:: bash
salt '*' parti... | [
"def",
"set_id",
"(",
"device",
",",
"minor",
",",
"system_id",
")",
":",
"_validate_device",
"(",
"device",
")",
"try",
":",
"int",
"(",
"minor",
")",
"except",
"Exception",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid minor number passed to partition.se... | Sets the system ID for the partition. Some typical values are::
b: FAT32 (vfat)
7: HPFS/NTFS
82: Linux Swap
83: Linux
8e: Linux LVM
fd: Linux RAID Auto
CLI Example:
.. code-block:: bash
salt '*' partition.set_id /dev/sda 1 83 | [
"Sets",
"the",
"system",
"ID",
"for",
"the",
"partition",
".",
"Some",
"typical",
"values",
"are",
"::"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L330-L363 | train |
saltstack/salt | salt/modules/parted_partition.py | system_types | def system_types():
'''
List the system types that are supported by the installed version of sfdisk
CLI Example:
.. code-block:: bash
salt '*' partition.system_types
'''
ret = {}
for line in __salt__['cmd.run']('sfdisk -T').splitlines():
if not line:
continue
... | python | def system_types():
'''
List the system types that are supported by the installed version of sfdisk
CLI Example:
.. code-block:: bash
salt '*' partition.system_types
'''
ret = {}
for line in __salt__['cmd.run']('sfdisk -T').splitlines():
if not line:
continue
... | [
"def",
"system_types",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"for",
"line",
"in",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'sfdisk -T'",
")",
".",
"splitlines",
"(",
")",
":",
"if",
"not",
"line",
":",
"continue",
"if",
"line",
".",
"startswith",
"(",... | List the system types that are supported by the installed version of sfdisk
CLI Example:
.. code-block:: bash
salt '*' partition.system_types | [
"List",
"the",
"system",
"types",
"that",
"are",
"supported",
"by",
"the",
"installed",
"version",
"of",
"sfdisk"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L366-L384 | train |
saltstack/salt | salt/modules/parted_partition.py | mkfs | def mkfs(device, fs_type):
'''
Makes a file system <fs_type> on partition <device>, destroying all data
that resides on that partition. <fs_type> must be one of "ext2", "fat32",
"fat16", "linux-swap" or "reiserfs" (if libreiserfs is installed)
CLI Example:
.. code-block:: bash
salt '*... | python | def mkfs(device, fs_type):
'''
Makes a file system <fs_type> on partition <device>, destroying all data
that resides on that partition. <fs_type> must be one of "ext2", "fat32",
"fat16", "linux-swap" or "reiserfs" (if libreiserfs is installed)
CLI Example:
.. code-block:: bash
salt '*... | [
"def",
"mkfs",
"(",
"device",
",",
"fs_type",
")",
":",
"_validate_device",
"(",
"device",
")",
"if",
"not",
"_is_fstype",
"(",
"fs_type",
")",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid fs_type passed to partition.mkfs'",
")",
"if",
"fs_type",
"==",
... | Makes a file system <fs_type> on partition <device>, destroying all data
that resides on that partition. <fs_type> must be one of "ext2", "fat32",
"fat16", "linux-swap" or "reiserfs" (if libreiserfs is installed)
CLI Example:
.. code-block:: bash
salt '*' partition.mkfs /dev/sda2 fat32 | [
"Makes",
"a",
"file",
"system",
"<fs_type",
">",
"on",
"partition",
"<device",
">",
"destroying",
"all",
"data",
"that",
"resides",
"on",
"that",
"partition",
".",
"<fs_type",
">",
"must",
"be",
"one",
"of",
"ext2",
"fat32",
"fat16",
"linux",
"-",
"swap",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L397-L426 | train |
saltstack/salt | salt/modules/parted_partition.py | mklabel | def mklabel(device, label_type):
'''
Create a new disklabel (partition table) of label_type.
Type should be one of "aix", "amiga", "bsd", "dvh", "gpt", "loop", "mac",
"msdos", "pc98", or "sun".
CLI Example:
.. code-block:: bash
salt '*' partition.mklabel /dev/sda msdos
'''
if... | python | def mklabel(device, label_type):
'''
Create a new disklabel (partition table) of label_type.
Type should be one of "aix", "amiga", "bsd", "dvh", "gpt", "loop", "mac",
"msdos", "pc98", or "sun".
CLI Example:
.. code-block:: bash
salt '*' partition.mklabel /dev/sda msdos
'''
if... | [
"def",
"mklabel",
"(",
"device",
",",
"label_type",
")",
":",
"if",
"label_type",
"not",
"in",
"set",
"(",
"[",
"'aix'",
",",
"'amiga'",
",",
"'bsd'",
",",
"'dvh'",
",",
"'gpt'",
",",
"'loop'",
",",
"'mac'",
",",
"'msdos'",
",",
"'pc98'",
",",
"'sun'... | Create a new disklabel (partition table) of label_type.
Type should be one of "aix", "amiga", "bsd", "dvh", "gpt", "loop", "mac",
"msdos", "pc98", or "sun".
CLI Example:
.. code-block:: bash
salt '*' partition.mklabel /dev/sda msdos | [
"Create",
"a",
"new",
"disklabel",
"(",
"partition",
"table",
")",
"of",
"label_type",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L429-L451 | train |
saltstack/salt | salt/modules/parted_partition.py | mkpart | def mkpart(device, part_type, fs_type=None, start=None, end=None):
'''
Make a part_type partition for filesystem fs_type, beginning at start and
ending at end (by default in megabytes). part_type should be one of
"primary", "logical", or "extended".
CLI Examples:
.. code-block:: bash
... | python | def mkpart(device, part_type, fs_type=None, start=None, end=None):
'''
Make a part_type partition for filesystem fs_type, beginning at start and
ending at end (by default in megabytes). part_type should be one of
"primary", "logical", or "extended".
CLI Examples:
.. code-block:: bash
... | [
"def",
"mkpart",
"(",
"device",
",",
"part_type",
",",
"fs_type",
"=",
"None",
",",
"start",
"=",
"None",
",",
"end",
"=",
"None",
")",
":",
"if",
"part_type",
"not",
"in",
"set",
"(",
"[",
"'primary'",
",",
"'logical'",
",",
"'extended'",
"]",
")",
... | Make a part_type partition for filesystem fs_type, beginning at start and
ending at end (by default in megabytes). part_type should be one of
"primary", "logical", or "extended".
CLI Examples:
.. code-block:: bash
salt '*' partition.mkpart /dev/sda primary fs_type=fat32 start=0 end=639
... | [
"Make",
"a",
"part_type",
"partition",
"for",
"filesystem",
"fs_type",
"beginning",
"at",
"start",
"and",
"ending",
"at",
"end",
"(",
"by",
"default",
"in",
"megabytes",
")",
".",
"part_type",
"should",
"be",
"one",
"of",
"primary",
"logical",
"or",
"extende... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L454-L493 | train |
saltstack/salt | salt/modules/parted_partition.py | mkpartfs | def mkpartfs(device, part_type, fs_type, start, end):
'''
Make a <part_type> partition with a new filesystem of <fs_type>, beginning
at <start> and ending at <end> (by default in megabytes).
<part_type> should be one of "primary", "logical", or "extended". <fs_type>
must be one of "ext2", "fat32", ... | python | def mkpartfs(device, part_type, fs_type, start, end):
'''
Make a <part_type> partition with a new filesystem of <fs_type>, beginning
at <start> and ending at <end> (by default in megabytes).
<part_type> should be one of "primary", "logical", or "extended". <fs_type>
must be one of "ext2", "fat32", ... | [
"def",
"mkpartfs",
"(",
"device",
",",
"part_type",
",",
"fs_type",
",",
"start",
",",
"end",
")",
":",
"_validate_device",
"(",
"device",
")",
"if",
"part_type",
"not",
"in",
"set",
"(",
"[",
"'primary'",
",",
"'logical'",
",",
"'extended'",
"]",
")",
... | Make a <part_type> partition with a new filesystem of <fs_type>, beginning
at <start> and ending at <end> (by default in megabytes).
<part_type> should be one of "primary", "logical", or "extended". <fs_type>
must be one of "ext2", "fat32", "fat16", "linux-swap" or "reiserfs" (if
libreiserfs is install... | [
"Make",
"a",
"<part_type",
">",
"partition",
"with",
"a",
"new",
"filesystem",
"of",
"<fs_type",
">",
"beginning",
"at",
"<start",
">",
"and",
"ending",
"at",
"<end",
">",
"(",
"by",
"default",
"in",
"megabytes",
")",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L496-L530 | train |
saltstack/salt | salt/modules/parted_partition.py | name | def name(device, partition, name):
'''
Set the name of partition to name. This option works only on Mac, PC98, and
GPT disklabels. The name can be placed in quotes, if necessary.
CLI Example:
.. code-block:: bash
salt '*' partition.name /dev/sda 1 'My Documents'
'''
_validate_devi... | python | def name(device, partition, name):
'''
Set the name of partition to name. This option works only on Mac, PC98, and
GPT disklabels. The name can be placed in quotes, if necessary.
CLI Example:
.. code-block:: bash
salt '*' partition.name /dev/sda 1 'My Documents'
'''
_validate_devi... | [
"def",
"name",
"(",
"device",
",",
"partition",
",",
"name",
")",
":",
"_validate_device",
"(",
"device",
")",
"try",
":",
"int",
"(",
"partition",
")",
"except",
"Exception",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid partition passed to partition.name... | Set the name of partition to name. This option works only on Mac, PC98, and
GPT disklabels. The name can be placed in quotes, if necessary.
CLI Example:
.. code-block:: bash
salt '*' partition.name /dev/sda 1 'My Documents' | [
"Set",
"the",
"name",
"of",
"partition",
"to",
"name",
".",
"This",
"option",
"works",
"only",
"on",
"Mac",
"PC98",
"and",
"GPT",
"disklabels",
".",
"The",
"name",
"can",
"be",
"placed",
"in",
"quotes",
"if",
"necessary",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L533-L562 | train |
saltstack/salt | salt/modules/parted_partition.py | rescue | def rescue(device, start, end):
'''
Rescue a lost partition that was located somewhere between start and end.
If a partition is found, parted will ask if you want to create an
entry for it in the partition table.
CLI Example:
.. code-block:: bash
salt '*' partition.rescue /dev/sda 0 8... | python | def rescue(device, start, end):
'''
Rescue a lost partition that was located somewhere between start and end.
If a partition is found, parted will ask if you want to create an
entry for it in the partition table.
CLI Example:
.. code-block:: bash
salt '*' partition.rescue /dev/sda 0 8... | [
"def",
"rescue",
"(",
"device",
",",
"start",
",",
"end",
")",
":",
"_validate_device",
"(",
"device",
")",
"_validate_partition_boundary",
"(",
"start",
")",
"_validate_partition_boundary",
"(",
"end",
")",
"cmd",
"=",
"'parted -m -s {0} rescue {1} {2}'",
".",
"f... | Rescue a lost partition that was located somewhere between start and end.
If a partition is found, parted will ask if you want to create an
entry for it in the partition table.
CLI Example:
.. code-block:: bash
salt '*' partition.rescue /dev/sda 0 8056 | [
"Rescue",
"a",
"lost",
"partition",
"that",
"was",
"located",
"somewhere",
"between",
"start",
"and",
"end",
".",
"If",
"a",
"partition",
"is",
"found",
"parted",
"will",
"ask",
"if",
"you",
"want",
"to",
"create",
"an",
"entry",
"for",
"it",
"in",
"the"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L565-L583 | train |
saltstack/salt | salt/modules/parted_partition.py | resize | def resize(device, minor, start, end):
'''
Resizes the partition with number <minor>.
The partition will start <start> from the beginning of the disk, and end
<end> from the beginning of the disk. resize never changes the minor number.
Extended partitions can be resized, so long as the new extended... | python | def resize(device, minor, start, end):
'''
Resizes the partition with number <minor>.
The partition will start <start> from the beginning of the disk, and end
<end> from the beginning of the disk. resize never changes the minor number.
Extended partitions can be resized, so long as the new extended... | [
"def",
"resize",
"(",
"device",
",",
"minor",
",",
"start",
",",
"end",
")",
":",
"_validate_device",
"(",
"device",
")",
"try",
":",
"int",
"(",
"minor",
")",
"except",
"Exception",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid minor number passed to ... | Resizes the partition with number <minor>.
The partition will start <start> from the beginning of the disk, and end
<end> from the beginning of the disk. resize never changes the minor number.
Extended partitions can be resized, so long as the new extended partition
completely contains all logical part... | [
"Resizes",
"the",
"partition",
"with",
"number",
"<minor",
">",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L586-L618 | train |
saltstack/salt | salt/modules/parted_partition.py | rm | def rm(device, minor): # pylint: disable=C0103
'''
Removes the partition with number <minor>.
CLI Example:
.. code-block:: bash
salt '*' partition.rm /dev/sda 5
'''
_validate_device(device)
try:
int(minor)
except Exception:
raise CommandExecutionError(
... | python | def rm(device, minor): # pylint: disable=C0103
'''
Removes the partition with number <minor>.
CLI Example:
.. code-block:: bash
salt '*' partition.rm /dev/sda 5
'''
_validate_device(device)
try:
int(minor)
except Exception:
raise CommandExecutionError(
... | [
"def",
"rm",
"(",
"device",
",",
"minor",
")",
":",
"# pylint: disable=C0103",
"_validate_device",
"(",
"device",
")",
"try",
":",
"int",
"(",
"minor",
")",
"except",
"Exception",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid minor number passed to partition... | Removes the partition with number <minor>.
CLI Example:
.. code-block:: bash
salt '*' partition.rm /dev/sda 5 | [
"Removes",
"the",
"partition",
"with",
"number",
"<minor",
">",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L621-L642 | train |
saltstack/salt | salt/modules/parted_partition.py | set_ | def set_(device, minor, flag, state):
'''
Changes a flag on the partition with number <minor>.
A flag can be either "on" or "off" (make sure to use proper quoting, see
:ref:`YAML Idiosyncrasies <yaml-idiosyncrasies>`). Some or all of these
flags will be available, depending on what disk label you a... | python | def set_(device, minor, flag, state):
'''
Changes a flag on the partition with number <minor>.
A flag can be either "on" or "off" (make sure to use proper quoting, see
:ref:`YAML Idiosyncrasies <yaml-idiosyncrasies>`). Some or all of these
flags will be available, depending on what disk label you a... | [
"def",
"set_",
"(",
"device",
",",
"minor",
",",
"flag",
",",
"state",
")",
":",
"_validate_device",
"(",
"device",
")",
"try",
":",
"int",
"(",
"minor",
")",
"except",
"Exception",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid minor number passed to p... | Changes a flag on the partition with number <minor>.
A flag can be either "on" or "off" (make sure to use proper quoting, see
:ref:`YAML Idiosyncrasies <yaml-idiosyncrasies>`). Some or all of these
flags will be available, depending on what disk label you are using.
Valid flags are:
* boot
... | [
"Changes",
"a",
"flag",
"on",
"the",
"partition",
"with",
"number",
"<minor",
">",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L645-L697 | train |
saltstack/salt | salt/modules/parted_partition.py | toggle | def toggle(device, partition, flag):
'''
Toggle the state of <flag> on <partition>. Valid flags are the same as
the set command.
CLI Example:
.. code-block:: bash
salt '*' partition.toggle /dev/sda 1 boot
'''
_validate_device(device)
try:
int(partition)
except... | python | def toggle(device, partition, flag):
'''
Toggle the state of <flag> on <partition>. Valid flags are the same as
the set command.
CLI Example:
.. code-block:: bash
salt '*' partition.toggle /dev/sda 1 boot
'''
_validate_device(device)
try:
int(partition)
except... | [
"def",
"toggle",
"(",
"device",
",",
"partition",
",",
"flag",
")",
":",
"_validate_device",
"(",
"device",
")",
"try",
":",
"int",
"(",
"partition",
")",
"except",
"Exception",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid partition number passed to parti... | Toggle the state of <flag> on <partition>. Valid flags are the same as
the set command.
CLI Example:
.. code-block:: bash
salt '*' partition.toggle /dev/sda 1 boot | [
"Toggle",
"the",
"state",
"of",
"<flag",
">",
"on",
"<partition",
">",
".",
"Valid",
"flags",
"are",
"the",
"same",
"as",
"the",
"set",
"command",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L700-L725 | train |
saltstack/salt | salt/modules/parted_partition.py | disk_set | def disk_set(device, flag, state):
'''
Changes a flag on selected device.
A flag can be either "on" or "off" (make sure to use proper
quoting, see :ref:`YAML Idiosyncrasies
<yaml-idiosyncrasies>`). Some or all of these flags will be
available, depending on what disk label you are using.
Va... | python | def disk_set(device, flag, state):
'''
Changes a flag on selected device.
A flag can be either "on" or "off" (make sure to use proper
quoting, see :ref:`YAML Idiosyncrasies
<yaml-idiosyncrasies>`). Some or all of these flags will be
available, depending on what disk label you are using.
Va... | [
"def",
"disk_set",
"(",
"device",
",",
"flag",
",",
"state",
")",
":",
"_validate_device",
"(",
"device",
")",
"if",
"flag",
"not",
"in",
"VALID_DISK_FLAGS",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid flag passed to partition.disk_set'",
")",
"if",
"sta... | Changes a flag on selected device.
A flag can be either "on" or "off" (make sure to use proper
quoting, see :ref:`YAML Idiosyncrasies
<yaml-idiosyncrasies>`). Some or all of these flags will be
available, depending on what disk label you are using.
Valid flags are:
* cylinder_alignment
... | [
"Changes",
"a",
"flag",
"on",
"selected",
"device",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L728-L758 | train |
saltstack/salt | salt/modules/parted_partition.py | disk_toggle | def disk_toggle(device, flag):
'''
Toggle the state of <flag> on <device>. Valid flags are the same
as the disk_set command.
CLI Example:
.. code-block:: bash
salt '*' partition.disk_toggle /dev/sda pmbr_boot
'''
_validate_device(device)
if flag not in VALID_DISK_FLAGS:
... | python | def disk_toggle(device, flag):
'''
Toggle the state of <flag> on <device>. Valid flags are the same
as the disk_set command.
CLI Example:
.. code-block:: bash
salt '*' partition.disk_toggle /dev/sda pmbr_boot
'''
_validate_device(device)
if flag not in VALID_DISK_FLAGS:
... | [
"def",
"disk_toggle",
"(",
"device",
",",
"flag",
")",
":",
"_validate_device",
"(",
"device",
")",
"if",
"flag",
"not",
"in",
"VALID_DISK_FLAGS",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid flag passed to partition.disk_toggle'",
")",
"cmd",
"=",
"[",
"... | Toggle the state of <flag> on <device>. Valid flags are the same
as the disk_set command.
CLI Example:
.. code-block:: bash
salt '*' partition.disk_toggle /dev/sda pmbr_boot | [
"Toggle",
"the",
"state",
"of",
"<flag",
">",
"on",
"<device",
">",
".",
"Valid",
"flags",
"are",
"the",
"same",
"as",
"the",
"disk_set",
"command",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L761-L779 | train |
saltstack/salt | salt/modules/parted_partition.py | exists | def exists(device=''):
'''
Check to see if the partition exists
CLI Example:
.. code-block:: bash
salt '*' partition.exists /dev/sdb1
'''
if os.path.exists(device):
dev = os.stat(device).st_mode
if stat.S_ISBLK(dev):
return True
return False | python | def exists(device=''):
'''
Check to see if the partition exists
CLI Example:
.. code-block:: bash
salt '*' partition.exists /dev/sdb1
'''
if os.path.exists(device):
dev = os.stat(device).st_mode
if stat.S_ISBLK(dev):
return True
return False | [
"def",
"exists",
"(",
"device",
"=",
"''",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"device",
")",
":",
"dev",
"=",
"os",
".",
"stat",
"(",
"device",
")",
".",
"st_mode",
"if",
"stat",
".",
"S_ISBLK",
"(",
"dev",
")",
":",
"return... | Check to see if the partition exists
CLI Example:
.. code-block:: bash
salt '*' partition.exists /dev/sdb1 | [
"Check",
"to",
"see",
"if",
"the",
"partition",
"exists"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L782-L798 | train |
saltstack/salt | salt/modules/freezer.py | _paths | def _paths(name=None):
'''
Return the full path for the packages and repository freezer
files.
'''
name = 'freezer' if not name else name
states_path = _states_path()
return (
os.path.join(states_path, '{}-pkgs.yml'.format(name)),
os.path.join(states_path, '{}-reps.yml'.form... | python | def _paths(name=None):
'''
Return the full path for the packages and repository freezer
files.
'''
name = 'freezer' if not name else name
states_path = _states_path()
return (
os.path.join(states_path, '{}-pkgs.yml'.format(name)),
os.path.join(states_path, '{}-reps.yml'.form... | [
"def",
"_paths",
"(",
"name",
"=",
"None",
")",
":",
"name",
"=",
"'freezer'",
"if",
"not",
"name",
"else",
"name",
"states_path",
"=",
"_states_path",
"(",
")",
"return",
"(",
"os",
".",
"path",
".",
"join",
"(",
"states_path",
",",
"'{}-pkgs.yml'",
"... | Return the full path for the packages and repository freezer
files. | [
"Return",
"the",
"full",
"path",
"for",
"the",
"packages",
"and",
"repository",
"freezer",
"files",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freezer.py#L65-L76 | train |
saltstack/salt | salt/modules/freezer.py | status | def status(name=None):
'''
Return True if there is already a frozen state.
A frozen state is merely a list of packages (including the
version) in a specific time. This information can be used to
compare with the current list of packages, and revert the
installation of some extra packages that a... | python | def status(name=None):
'''
Return True if there is already a frozen state.
A frozen state is merely a list of packages (including the
version) in a specific time. This information can be used to
compare with the current list of packages, and revert the
installation of some extra packages that a... | [
"def",
"status",
"(",
"name",
"=",
"None",
")",
":",
"name",
"=",
"'freezer'",
"if",
"not",
"name",
"else",
"name",
"return",
"all",
"(",
"os",
".",
"path",
".",
"isfile",
"(",
"i",
")",
"for",
"i",
"in",
"_paths",
"(",
"name",
")",
")"
] | Return True if there is already a frozen state.
A frozen state is merely a list of packages (including the
version) in a specific time. This information can be used to
compare with the current list of packages, and revert the
installation of some extra packages that are in the system.
name
... | [
"Return",
"True",
"if",
"there",
"is",
"already",
"a",
"frozen",
"state",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freezer.py#L79-L100 | train |
saltstack/salt | salt/modules/freezer.py | list_ | def list_():
'''
Return the list of frozen states.
CLI Example:
.. code-block:: bash
salt '*' freezer.list
'''
ret = []
states_path = _states_path()
if not os.path.isdir(states_path):
return ret
for state in os.listdir(states_path):
if state.endswith(('-p... | python | def list_():
'''
Return the list of frozen states.
CLI Example:
.. code-block:: bash
salt '*' freezer.list
'''
ret = []
states_path = _states_path()
if not os.path.isdir(states_path):
return ret
for state in os.listdir(states_path):
if state.endswith(('-p... | [
"def",
"list_",
"(",
")",
":",
"ret",
"=",
"[",
"]",
"states_path",
"=",
"_states_path",
"(",
")",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"states_path",
")",
":",
"return",
"ret",
"for",
"state",
"in",
"os",
".",
"listdir",
"(",
"states... | Return the list of frozen states.
CLI Example:
.. code-block:: bash
salt '*' freezer.list | [
"Return",
"the",
"list",
"of",
"frozen",
"states",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freezer.py#L103-L123 | train |
saltstack/salt | salt/modules/freezer.py | freeze | def freeze(name=None, force=False, **kwargs):
'''
Save the list of package and repos in a freeze file.
As this module is build on top of the pkg module, the user can
send extra attributes to the underlying pkg module via kwargs.
This function will call ``pkg.list_pkgs`` and ``pkg.list_repos``,
... | python | def freeze(name=None, force=False, **kwargs):
'''
Save the list of package and repos in a freeze file.
As this module is build on top of the pkg module, the user can
send extra attributes to the underlying pkg module via kwargs.
This function will call ``pkg.list_pkgs`` and ``pkg.list_repos``,
... | [
"def",
"freeze",
"(",
"name",
"=",
"None",
",",
"force",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"states_path",
"=",
"_states_path",
"(",
")",
"try",
":",
"os",
".",
"makedirs",
"(",
"states_path",
")",
"except",
"OSError",
"as",
"e",
":",
... | Save the list of package and repos in a freeze file.
As this module is build on top of the pkg module, the user can
send extra attributes to the underlying pkg module via kwargs.
This function will call ``pkg.list_pkgs`` and ``pkg.list_repos``,
and any additional arguments will be passed through to tho... | [
"Save",
"the",
"list",
"of",
"package",
"and",
"repos",
"in",
"a",
"freeze",
"file",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freezer.py#L126-L169 | train |
saltstack/salt | salt/modules/freezer.py | restore | def restore(name=None, **kwargs):
'''
Make sure that the system contains the packages and repos from a
frozen state.
Read the list of packages and repositories from the freeze file,
and compare it with the current list of packages and repos. If
there is any difference, all the missing packages ... | python | def restore(name=None, **kwargs):
'''
Make sure that the system contains the packages and repos from a
frozen state.
Read the list of packages and repositories from the freeze file,
and compare it with the current list of packages and repos. If
there is any difference, all the missing packages ... | [
"def",
"restore",
"(",
"name",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"status",
"(",
"name",
")",
":",
"raise",
"CommandExecutionError",
"(",
"'Frozen state not found.'",
")",
"frozen_pkgs",
"=",
"{",
"}",
"frozen_repos",
"=",
"{",
... | Make sure that the system contains the packages and repos from a
frozen state.
Read the list of packages and repositories from the freeze file,
and compare it with the current list of packages and repos. If
there is any difference, all the missing packages are repos will
be installed, and all the e... | [
"Make",
"sure",
"that",
"the",
"system",
"contains",
"the",
"packages",
"and",
"repos",
"from",
"a",
"frozen",
"state",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freezer.py#L172-L294 | train |
saltstack/salt | salt/modules/rabbitmq.py | _get_rabbitmq_plugin | def _get_rabbitmq_plugin():
'''
Returns the rabbitmq-plugin command path if we're running an OS that
doesn't put it in the standard /usr/bin or /usr/local/bin
This works by taking the rabbitmq-server version and looking for where it
seems to be hidden in /usr/lib.
'''
global RABBITMQ_PLUGINS... | python | def _get_rabbitmq_plugin():
'''
Returns the rabbitmq-plugin command path if we're running an OS that
doesn't put it in the standard /usr/bin or /usr/local/bin
This works by taking the rabbitmq-server version and looking for where it
seems to be hidden in /usr/lib.
'''
global RABBITMQ_PLUGINS... | [
"def",
"_get_rabbitmq_plugin",
"(",
")",
":",
"global",
"RABBITMQ_PLUGINS",
"if",
"RABBITMQ_PLUGINS",
"is",
"None",
":",
"version",
"=",
"__salt__",
"[",
"'pkg.version'",
"]",
"(",
"'rabbitmq-server'",
")",
".",
"split",
"(",
"'-'",
")",
"[",
"0",
"]",
"RABB... | Returns the rabbitmq-plugin command path if we're running an OS that
doesn't put it in the standard /usr/bin or /usr/local/bin
This works by taking the rabbitmq-server version and looking for where it
seems to be hidden in /usr/lib. | [
"Returns",
"the",
"rabbitmq",
"-",
"plugin",
"command",
"path",
"if",
"we",
"re",
"running",
"an",
"OS",
"that",
"doesn",
"t",
"put",
"it",
"in",
"the",
"standard",
"/",
"usr",
"/",
"bin",
"or",
"/",
"usr",
"/",
"local",
"/",
"bin",
"This",
"works",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L115-L129 | train |
saltstack/salt | salt/modules/rabbitmq.py | _safe_output | def _safe_output(line):
'''
Looks for rabbitmqctl warning, or general formatting, strings that aren't
intended to be parsed as output.
Returns a boolean whether the line can be parsed as rabbitmqctl output.
'''
return not any([
line.startswith('Listing') and line.endswith('...'),
... | python | def _safe_output(line):
'''
Looks for rabbitmqctl warning, or general formatting, strings that aren't
intended to be parsed as output.
Returns a boolean whether the line can be parsed as rabbitmqctl output.
'''
return not any([
line.startswith('Listing') and line.endswith('...'),
... | [
"def",
"_safe_output",
"(",
"line",
")",
":",
"return",
"not",
"any",
"(",
"[",
"line",
".",
"startswith",
"(",
"'Listing'",
")",
"and",
"line",
".",
"endswith",
"(",
"'...'",
")",
",",
"line",
".",
"startswith",
"(",
"'Listing'",
")",
"and",
"'\\t'",
... | Looks for rabbitmqctl warning, or general formatting, strings that aren't
intended to be parsed as output.
Returns a boolean whether the line can be parsed as rabbitmqctl output. | [
"Looks",
"for",
"rabbitmqctl",
"warning",
"or",
"general",
"formatting",
"strings",
"that",
"aren",
"t",
"intended",
"to",
"be",
"parsed",
"as",
"output",
".",
"Returns",
"a",
"boolean",
"whether",
"the",
"line",
"can",
"be",
"parsed",
"as",
"rabbitmqctl",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L132-L143 | train |
saltstack/salt | salt/modules/rabbitmq.py | _output_to_dict | def _output_to_dict(cmdoutput, values_mapper=None):
'''
Convert rabbitmqctl output to a dict of data
cmdoutput: string output of rabbitmqctl commands
values_mapper: function object to process the values part of each line
'''
if isinstance(cmdoutput, dict):
if cmdoutput['retcode'] != 0 or... | python | def _output_to_dict(cmdoutput, values_mapper=None):
'''
Convert rabbitmqctl output to a dict of data
cmdoutput: string output of rabbitmqctl commands
values_mapper: function object to process the values part of each line
'''
if isinstance(cmdoutput, dict):
if cmdoutput['retcode'] != 0 or... | [
"def",
"_output_to_dict",
"(",
"cmdoutput",
",",
"values_mapper",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"cmdoutput",
",",
"dict",
")",
":",
"if",
"cmdoutput",
"[",
"'retcode'",
"]",
"!=",
"0",
"or",
"cmdoutput",
"[",
"'stderr'",
"]",
":",
"rais... | Convert rabbitmqctl output to a dict of data
cmdoutput: string output of rabbitmqctl commands
values_mapper: function object to process the values part of each line | [
"Convert",
"rabbitmqctl",
"output",
"to",
"a",
"dict",
"of",
"data",
"cmdoutput",
":",
"string",
"output",
"of",
"rabbitmqctl",
"commands",
"values_mapper",
":",
"function",
"object",
"to",
"process",
"the",
"values",
"part",
"of",
"each",
"line"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L156-L190 | train |
saltstack/salt | salt/modules/rabbitmq.py | _output_to_list | def _output_to_list(cmdoutput):
'''
Convert rabbitmqctl output to a list of strings (assuming whitespace-delimited output).
Ignores output lines that shouldn't be parsed, like warnings.
cmdoutput: string output of rabbitmqctl commands
'''
return [item for line in cmdoutput.splitlines() if _safe_... | python | def _output_to_list(cmdoutput):
'''
Convert rabbitmqctl output to a list of strings (assuming whitespace-delimited output).
Ignores output lines that shouldn't be parsed, like warnings.
cmdoutput: string output of rabbitmqctl commands
'''
return [item for line in cmdoutput.splitlines() if _safe_... | [
"def",
"_output_to_list",
"(",
"cmdoutput",
")",
":",
"return",
"[",
"item",
"for",
"line",
"in",
"cmdoutput",
".",
"splitlines",
"(",
")",
"if",
"_safe_output",
"(",
"line",
")",
"for",
"item",
"in",
"line",
".",
"split",
"(",
")",
"]"
] | Convert rabbitmqctl output to a list of strings (assuming whitespace-delimited output).
Ignores output lines that shouldn't be parsed, like warnings.
cmdoutput: string output of rabbitmqctl commands | [
"Convert",
"rabbitmqctl",
"output",
"to",
"a",
"list",
"of",
"strings",
"(",
"assuming",
"whitespace",
"-",
"delimited",
"output",
")",
".",
"Ignores",
"output",
"lines",
"that",
"shouldn",
"t",
"be",
"parsed",
"like",
"warnings",
".",
"cmdoutput",
":",
"str... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L193-L199 | train |
saltstack/salt | salt/modules/rabbitmq.py | list_users | def list_users(runas=None):
'''
Return a list of users based off of rabbitmqctl user_list.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_users
'''
# Windows runas currently requires a password.
# Due to this, don't use a default value for
# runas in Windows.
if ... | python | def list_users(runas=None):
'''
Return a list of users based off of rabbitmqctl user_list.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_users
'''
# Windows runas currently requires a password.
# Due to this, don't use a default value for
# runas in Windows.
if ... | [
"def",
"list_users",
"(",
"runas",
"=",
"None",
")",
":",
"# Windows runas currently requires a password.",
"# Due to this, don't use a default value for",
"# runas in Windows.",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_... | Return a list of users based off of rabbitmqctl user_list.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_users | [
"Return",
"a",
"list",
"of",
"users",
"based",
"off",
"of",
"rabbitmqctl",
"user_list",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L211-L235 | train |
saltstack/salt | salt/modules/rabbitmq.py | list_vhosts | def list_vhosts(runas=None):
'''
Return a list of vhost based on rabbitmqctl list_vhosts.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_vhosts
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
res = __salt__['cmd.r... | python | def list_vhosts(runas=None):
'''
Return a list of vhost based on rabbitmqctl list_vhosts.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_vhosts
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
res = __salt__['cmd.r... | [
"def",
"list_vhosts",
"(",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
"user",
".",
"get_user",
"(",
")... | Return a list of vhost based on rabbitmqctl list_vhosts.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_vhosts | [
"Return",
"a",
"list",
"of",
"vhost",
"based",
"on",
"rabbitmqctl",
"list_vhosts",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L238-L256 | train |
saltstack/salt | salt/modules/rabbitmq.py | user_exists | def user_exists(name, runas=None):
'''
Return whether the user exists based on rabbitmqctl list_users.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.user_exists rabbit_user
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
... | python | def user_exists(name, runas=None):
'''
Return whether the user exists based on rabbitmqctl list_users.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.user_exists rabbit_user
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
... | [
"def",
"user_exists",
"(",
"name",
",",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
"user",
".",
"get_u... | Return whether the user exists based on rabbitmqctl list_users.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.user_exists rabbit_user | [
"Return",
"whether",
"the",
"user",
"exists",
"based",
"on",
"rabbitmqctl",
"list_users",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L259-L271 | train |
saltstack/salt | salt/modules/rabbitmq.py | vhost_exists | def vhost_exists(name, runas=None):
'''
Return whether the vhost exists based on rabbitmqctl list_vhosts.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.vhost_exists rabbit_host
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_use... | python | def vhost_exists(name, runas=None):
'''
Return whether the vhost exists based on rabbitmqctl list_vhosts.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.vhost_exists rabbit_host
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_use... | [
"def",
"vhost_exists",
"(",
"name",
",",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
"user",
".",
"get_... | Return whether the vhost exists based on rabbitmqctl list_vhosts.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.vhost_exists rabbit_host | [
"Return",
"whether",
"the",
"vhost",
"exists",
"based",
"on",
"rabbitmqctl",
"list_vhosts",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L274-L286 | train |
saltstack/salt | salt/modules/rabbitmq.py | add_user | def add_user(name, password=None, runas=None):
'''
Add a rabbitMQ user via rabbitmqctl user_add <user> <password>
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.add_user rabbit_user password
'''
clear_pw = False
if password is None:
# Generate a random, temporary pas... | python | def add_user(name, password=None, runas=None):
'''
Add a rabbitMQ user via rabbitmqctl user_add <user> <password>
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.add_user rabbit_user password
'''
clear_pw = False
if password is None:
# Generate a random, temporary pas... | [
"def",
"add_user",
"(",
"name",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"clear_pw",
"=",
"False",
"if",
"password",
"is",
"None",
":",
"# Generate a random, temporary password. RabbitMQ requires one.",
"clear_pw",
"=",
"True",
"password"... | Add a rabbitMQ user via rabbitmqctl user_add <user> <password>
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.add_user rabbit_user password | [
"Add",
"a",
"rabbitMQ",
"user",
"via",
"rabbitmqctl",
"user_add",
"<user",
">",
"<password",
">"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L289-L343 | train |
saltstack/salt | salt/modules/rabbitmq.py | delete_user | def delete_user(name, runas=None):
'''
Deletes a user via rabbitmqctl delete_user.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.delete_user rabbit_user
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
res = __salt__['... | python | def delete_user(name, runas=None):
'''
Deletes a user via rabbitmqctl delete_user.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.delete_user rabbit_user
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
res = __salt__['... | [
"def",
"delete_user",
"(",
"name",
",",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
"user",
".",
"get_u... | Deletes a user via rabbitmqctl delete_user.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.delete_user rabbit_user | [
"Deletes",
"a",
"user",
"via",
"rabbitmqctl",
"delete_user",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L346-L365 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.