id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
35,800 | saltstack/salt | salt/runners/cache.py | fetch | def fetch(bank, key, cachedir=None):
'''
Fetch data from a salt.cache bank.
CLI Example:
.. code-block:: bash
salt-run cache.fetch cloud/active/ec2/myec2 myminion cachedir=/var/cache/salt/
'''
if cachedir is None:
cachedir = __opts__['cachedir']
try:
cache = salt.... | python | def fetch(bank, key, cachedir=None):
'''
Fetch data from a salt.cache bank.
CLI Example:
.. code-block:: bash
salt-run cache.fetch cloud/active/ec2/myec2 myminion cachedir=/var/cache/salt/
'''
if cachedir is None:
cachedir = __opts__['cachedir']
try:
cache = salt.... | [
"def",
"fetch",
"(",
"bank",
",",
"key",
",",
"cachedir",
"=",
"None",
")",
":",
"if",
"cachedir",
"is",
"None",
":",
"cachedir",
"=",
"__opts__",
"[",
"'cachedir'",
"]",
"try",
":",
"cache",
"=",
"salt",
".",
"cache",
".",
"Cache",
"(",
"__opts__",
... | Fetch data from a salt.cache bank.
CLI Example:
.. code-block:: bash
salt-run cache.fetch cloud/active/ec2/myec2 myminion cachedir=/var/cache/salt/ | [
"Fetch",
"data",
"from",
"a",
"salt",
".",
"cache",
"bank",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/cache.py#L428-L445 |
35,801 | saltstack/salt | salt/queues/pgjsonb_queue.py | _conn | def _conn(commit=False):
'''
Return an postgres cursor
'''
defaults = {'host': 'localhost',
'user': 'salt',
'password': 'salt',
'dbname': 'salt',
'port': 5432}
conn_kwargs = {}
for key, value in defaults.items():
conn_kwarg... | python | def _conn(commit=False):
'''
Return an postgres cursor
'''
defaults = {'host': 'localhost',
'user': 'salt',
'password': 'salt',
'dbname': 'salt',
'port': 5432}
conn_kwargs = {}
for key, value in defaults.items():
conn_kwarg... | [
"def",
"_conn",
"(",
"commit",
"=",
"False",
")",
":",
"defaults",
"=",
"{",
"'host'",
":",
"'localhost'",
",",
"'user'",
":",
"'salt'",
",",
"'password'",
":",
"'salt'",
",",
"'dbname'",
":",
"'salt'",
",",
"'port'",
":",
"5432",
"}",
"conn_kwargs",
"... | Return an postgres cursor | [
"Return",
"an",
"postgres",
"cursor"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/queues/pgjsonb_queue.py#L72-L105 |
35,802 | saltstack/salt | salt/utils/process.py | daemonize | def daemonize(redirect_out=True):
'''
Daemonize a process
'''
# Avoid circular import
import salt.utils.crypt
try:
pid = os.fork()
if pid > 0:
# exit first parent
salt.utils.crypt.reinit_crypto()
os._exit(salt.defaults.exitcodes.EX_OK)
exce... | python | def daemonize(redirect_out=True):
'''
Daemonize a process
'''
# Avoid circular import
import salt.utils.crypt
try:
pid = os.fork()
if pid > 0:
# exit first parent
salt.utils.crypt.reinit_crypto()
os._exit(salt.defaults.exitcodes.EX_OK)
exce... | [
"def",
"daemonize",
"(",
"redirect_out",
"=",
"True",
")",
":",
"# Avoid circular import",
"import",
"salt",
".",
"utils",
".",
"crypt",
"try",
":",
"pid",
"=",
"os",
".",
"fork",
"(",
")",
"if",
"pid",
">",
"0",
":",
"# exit first parent",
"salt",
".",
... | Daemonize a process | [
"Daemonize",
"a",
"process"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/process.py#L63-L110 |
35,803 | saltstack/salt | salt/utils/process.py | daemonize_if | def daemonize_if(opts):
'''
Daemonize a module function process if multiprocessing is True and the
process is not being called by salt-call
'''
if 'salt-call' in sys.argv[0]:
return
if not opts.get('multiprocessing', True):
return
if sys.platform.startswith('win'):
re... | python | def daemonize_if(opts):
'''
Daemonize a module function process if multiprocessing is True and the
process is not being called by salt-call
'''
if 'salt-call' in sys.argv[0]:
return
if not opts.get('multiprocessing', True):
return
if sys.platform.startswith('win'):
re... | [
"def",
"daemonize_if",
"(",
"opts",
")",
":",
"if",
"'salt-call'",
"in",
"sys",
".",
"argv",
"[",
"0",
"]",
":",
"return",
"if",
"not",
"opts",
".",
"get",
"(",
"'multiprocessing'",
",",
"True",
")",
":",
"return",
"if",
"sys",
".",
"platform",
".",
... | Daemonize a module function process if multiprocessing is True and the
process is not being called by salt-call | [
"Daemonize",
"a",
"module",
"function",
"process",
"if",
"multiprocessing",
"is",
"True",
"and",
"the",
"process",
"is",
"not",
"being",
"called",
"by",
"salt",
"-",
"call"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/process.py#L113-L124 |
35,804 | saltstack/salt | salt/utils/process.py | notify_systemd | def notify_systemd():
'''
Notify systemd that this process has started
'''
try:
import systemd.daemon
except ImportError:
if salt.utils.path.which('systemd-notify') \
and systemd_notify_call('--booted'):
# Notify systemd synchronously
notify_so... | python | def notify_systemd():
'''
Notify systemd that this process has started
'''
try:
import systemd.daemon
except ImportError:
if salt.utils.path.which('systemd-notify') \
and systemd_notify_call('--booted'):
# Notify systemd synchronously
notify_so... | [
"def",
"notify_systemd",
"(",
")",
":",
"try",
":",
"import",
"systemd",
".",
"daemon",
"except",
"ImportError",
":",
"if",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"'systemd-notify'",
")",
"and",
"systemd_notify_call",
"(",
"'--booted'",
")",
... | Notify systemd that this process has started | [
"Notify",
"systemd",
"that",
"this",
"process",
"has",
"started"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/process.py#L134-L164 |
35,805 | saltstack/salt | salt/utils/process.py | set_pidfile | def set_pidfile(pidfile, user):
'''
Save the pidfile
'''
pdir = os.path.dirname(pidfile)
if not os.path.isdir(pdir) and pdir:
os.makedirs(pdir)
try:
with salt.utils.files.fopen(pidfile, 'w+') as ofile:
ofile.write(str(os.getpid())) # future lint: disable=blacklisted-... | python | def set_pidfile(pidfile, user):
'''
Save the pidfile
'''
pdir = os.path.dirname(pidfile)
if not os.path.isdir(pdir) and pdir:
os.makedirs(pdir)
try:
with salt.utils.files.fopen(pidfile, 'w+') as ofile:
ofile.write(str(os.getpid())) # future lint: disable=blacklisted-... | [
"def",
"set_pidfile",
"(",
"pidfile",
",",
"user",
")",
":",
"pdir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"pidfile",
")",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"pdir",
")",
"and",
"pdir",
":",
"os",
".",
"makedirs",
"(",
"pdi... | Save the pidfile | [
"Save",
"the",
"pidfile"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/process.py#L167-L215 |
35,806 | saltstack/salt | salt/utils/process.py | get_pidfile | def get_pidfile(pidfile):
'''
Return the pid from a pidfile as an integer
'''
try:
with salt.utils.files.fopen(pidfile) as pdf:
pid = pdf.read().strip()
return int(pid)
except (OSError, IOError, TypeError, ValueError):
return -1 | python | def get_pidfile(pidfile):
'''
Return the pid from a pidfile as an integer
'''
try:
with salt.utils.files.fopen(pidfile) as pdf:
pid = pdf.read().strip()
return int(pid)
except (OSError, IOError, TypeError, ValueError):
return -1 | [
"def",
"get_pidfile",
"(",
"pidfile",
")",
":",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"pidfile",
")",
"as",
"pdf",
":",
"pid",
"=",
"pdf",
".",
"read",
"(",
")",
".",
"strip",
"(",
")",
"return",
"int",
"(",
... | Return the pid from a pidfile as an integer | [
"Return",
"the",
"pid",
"from",
"a",
"pidfile",
"as",
"an",
"integer"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/process.py#L225-L234 |
35,807 | saltstack/salt | salt/utils/process.py | clean_proc | def clean_proc(proc, wait_for_kill=10):
'''
Generic method for cleaning up multiprocessing procs
'''
# NoneType and other fun stuff need not apply
if not proc:
return
try:
waited = 0
while proc.is_alive():
proc.terminate()
waited += 1
t... | python | def clean_proc(proc, wait_for_kill=10):
'''
Generic method for cleaning up multiprocessing procs
'''
# NoneType and other fun stuff need not apply
if not proc:
return
try:
waited = 0
while proc.is_alive():
proc.terminate()
waited += 1
t... | [
"def",
"clean_proc",
"(",
"proc",
",",
"wait_for_kill",
"=",
"10",
")",
":",
"# NoneType and other fun stuff need not apply",
"if",
"not",
"proc",
":",
"return",
"try",
":",
"waited",
"=",
"0",
"while",
"proc",
".",
"is_alive",
"(",
")",
":",
"proc",
".",
... | Generic method for cleaning up multiprocessing procs | [
"Generic",
"method",
"for",
"cleaning",
"up",
"multiprocessing",
"procs"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/process.py#L237-L257 |
35,808 | saltstack/salt | salt/utils/process.py | os_is_running | def os_is_running(pid):
'''
Use OS facilities to determine if a process is running
'''
if isinstance(pid, six.string_types):
pid = int(pid)
if HAS_PSUTIL:
return psutil.pid_exists(pid)
else:
try:
os.kill(pid, 0) # SIG 0 is the "are you alive?" signal
... | python | def os_is_running(pid):
'''
Use OS facilities to determine if a process is running
'''
if isinstance(pid, six.string_types):
pid = int(pid)
if HAS_PSUTIL:
return psutil.pid_exists(pid)
else:
try:
os.kill(pid, 0) # SIG 0 is the "are you alive?" signal
... | [
"def",
"os_is_running",
"(",
"pid",
")",
":",
"if",
"isinstance",
"(",
"pid",
",",
"six",
".",
"string_types",
")",
":",
"pid",
"=",
"int",
"(",
"pid",
")",
"if",
"HAS_PSUTIL",
":",
"return",
"psutil",
".",
"pid_exists",
"(",
"pid",
")",
"else",
":",... | Use OS facilities to determine if a process is running | [
"Use",
"OS",
"facilities",
"to",
"determine",
"if",
"a",
"process",
"is",
"running"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/process.py#L260-L273 |
35,809 | saltstack/salt | salt/utils/process.py | ProcessManager.add_process | def add_process(self, tgt, args=None, kwargs=None, name=None):
'''
Create a processes and args + kwargs
This will deterimine if it is a Process class, otherwise it assumes
it is a function
'''
if args is None:
args = []
if kwargs is None:
... | python | def add_process(self, tgt, args=None, kwargs=None, name=None):
'''
Create a processes and args + kwargs
This will deterimine if it is a Process class, otherwise it assumes
it is a function
'''
if args is None:
args = []
if kwargs is None:
... | [
"def",
"add_process",
"(",
"self",
",",
"tgt",
",",
"args",
"=",
"None",
",",
"kwargs",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"if",
"args",
"is",
"None",
":",
"args",
"=",
"[",
"]",
"if",
"kwargs",
"is",
"None",
":",
"kwargs",
"=",
"... | Create a processes and args + kwargs
This will deterimine if it is a Process class, otherwise it assumes
it is a function | [
"Create",
"a",
"processes",
"and",
"args",
"+",
"kwargs",
"This",
"will",
"deterimine",
"if",
"it",
"is",
"a",
"Process",
"class",
"otherwise",
"it",
"assumes",
"it",
"is",
"a",
"function"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/process.py#L366-L433 |
35,810 | saltstack/salt | salt/utils/process.py | ProcessManager.check_children | def check_children(self):
'''
Check the children once
'''
if self._restart_processes is True:
for pid, mapping in six.iteritems(self._process_map):
if not mapping['Process'].is_alive():
log.trace('Process restart of %s', pid)
... | python | def check_children(self):
'''
Check the children once
'''
if self._restart_processes is True:
for pid, mapping in six.iteritems(self._process_map):
if not mapping['Process'].is_alive():
log.trace('Process restart of %s', pid)
... | [
"def",
"check_children",
"(",
"self",
")",
":",
"if",
"self",
".",
"_restart_processes",
"is",
"True",
":",
"for",
"pid",
",",
"mapping",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"_process_map",
")",
":",
"if",
"not",
"mapping",
"[",
"'Process'",... | Check the children once | [
"Check",
"the",
"children",
"once"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/process.py#L524-L532 |
35,811 | saltstack/salt | salt/modules/victorops.py | _query | def _query(action=None,
routing_key=None,
args=None,
method='GET',
header_dict=None,
data=None):
'''
Make a web call to VictorOps
'''
api_key = __salt__['config.get']('victorops.api_key') or \
__salt__['config.get']('victorops:api_key')
... | python | def _query(action=None,
routing_key=None,
args=None,
method='GET',
header_dict=None,
data=None):
'''
Make a web call to VictorOps
'''
api_key = __salt__['config.get']('victorops.api_key') or \
__salt__['config.get']('victorops:api_key')
... | [
"def",
"_query",
"(",
"action",
"=",
"None",
",",
"routing_key",
"=",
"None",
",",
"args",
"=",
"None",
",",
"method",
"=",
"'GET'",
",",
"header_dict",
"=",
"None",
",",
"data",
"=",
"None",
")",
":",
"api_key",
"=",
"__salt__",
"[",
"'config.get'",
... | Make a web call to VictorOps | [
"Make",
"a",
"web",
"call",
"to",
"VictorOps"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/victorops.py#L41-L97 |
35,812 | saltstack/salt | salt/modules/victorops.py | create_event | def create_event(message_type=None, routing_key='everybody', **kwargs):
'''
Create an event in VictorOps. Designed for use in states.
The following parameters are required:
:param message_type: One of the following values: INFO, WARNING, ACKNOWLEDGEMENT, CRITICAL, RECOVERY.
The followi... | python | def create_event(message_type=None, routing_key='everybody', **kwargs):
'''
Create an event in VictorOps. Designed for use in states.
The following parameters are required:
:param message_type: One of the following values: INFO, WARNING, ACKNOWLEDGEMENT, CRITICAL, RECOVERY.
The followi... | [
"def",
"create_event",
"(",
"message_type",
"=",
"None",
",",
"routing_key",
"=",
"'everybody'",
",",
"*",
"*",
"kwargs",
")",
":",
"keyword_args",
"=",
"{",
"'entity_id'",
":",
"str",
",",
"'state_message'",
":",
"str",
",",
"'entity_is_host'",
":",
"bool",... | Create an event in VictorOps. Designed for use in states.
The following parameters are required:
:param message_type: One of the following values: INFO, WARNING, ACKNOWLEDGEMENT, CRITICAL, RECOVERY.
The following parameters are optional:
:param routing_key: The key for where m... | [
"Create",
"an",
"event",
"in",
"VictorOps",
".",
"Designed",
"for",
"use",
"in",
"states",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/victorops.py#L100-L211 |
35,813 | saltstack/salt | salt/states/telemetry_alert.py | present | def present(name, deployment_id, metric_name, alert_config, api_key=None, profile='telemetry'):
'''
Ensure the telemetry alert exists.
name
An optional description of the alarm (not currently supported by telemetry API)
deployment_id
Specifies the ID of the root deployment resource
... | python | def present(name, deployment_id, metric_name, alert_config, api_key=None, profile='telemetry'):
'''
Ensure the telemetry alert exists.
name
An optional description of the alarm (not currently supported by telemetry API)
deployment_id
Specifies the ID of the root deployment resource
... | [
"def",
"present",
"(",
"name",
",",
"deployment_id",
",",
"metric_name",
",",
"alert_config",
",",
"api_key",
"=",
"None",
",",
"profile",
"=",
"'telemetry'",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"metric_name",
",",
"'result'",
":",
"True",
",",
"'c... | Ensure the telemetry alert exists.
name
An optional description of the alarm (not currently supported by telemetry API)
deployment_id
Specifies the ID of the root deployment resource
(replica set cluster or sharded cluster) to which this alert definition is attached
metric_name
... | [
"Ensure",
"the",
"telemetry",
"alert",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/telemetry_alert.py#L40-L155 |
35,814 | saltstack/salt | salt/states/telemetry_alert.py | absent | def absent(name, deployment_id, metric_name, api_key=None, profile="telemetry"):
'''
Ensure the telemetry alert config is deleted
name
An optional description of the alarms (not currently supported by telemetry API)
deployment_id
Specifies the ID of the root deployment resource
... | python | def absent(name, deployment_id, metric_name, api_key=None, profile="telemetry"):
'''
Ensure the telemetry alert config is deleted
name
An optional description of the alarms (not currently supported by telemetry API)
deployment_id
Specifies the ID of the root deployment resource
... | [
"def",
"absent",
"(",
"name",
",",
"deployment_id",
",",
"metric_name",
",",
"api_key",
"=",
"None",
",",
"profile",
"=",
"\"telemetry\"",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"metric_name",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",... | Ensure the telemetry alert config is deleted
name
An optional description of the alarms (not currently supported by telemetry API)
deployment_id
Specifies the ID of the root deployment resource
(replica set cluster or sharded cluster) to which this alert definition is attached
met... | [
"Ensure",
"the",
"telemetry",
"alert",
"config",
"is",
"deleted"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/telemetry_alert.py#L158-L201 |
35,815 | saltstack/salt | salt/modules/mac_pkgutil.py | list_ | def list_():
'''
List the installed packages.
:return: A list of installed packages
:rtype: list
CLI Example:
.. code-block:: bash
salt '*' pkgutil.list
'''
cmd = 'pkgutil --pkgs'
ret = salt.utils.mac_utils.execute_return_result(cmd)
return ret.splitlines() | python | def list_():
'''
List the installed packages.
:return: A list of installed packages
:rtype: list
CLI Example:
.. code-block:: bash
salt '*' pkgutil.list
'''
cmd = 'pkgutil --pkgs'
ret = salt.utils.mac_utils.execute_return_result(cmd)
return ret.splitlines() | [
"def",
"list_",
"(",
")",
":",
"cmd",
"=",
"'pkgutil --pkgs'",
"ret",
"=",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"execute_return_result",
"(",
"cmd",
")",
"return",
"ret",
".",
"splitlines",
"(",
")"
] | List the installed packages.
:return: A list of installed packages
:rtype: list
CLI Example:
.. code-block:: bash
salt '*' pkgutil.list | [
"List",
"the",
"installed",
"packages",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_pkgutil.py#L39-L54 |
35,816 | saltstack/salt | salt/modules/mac_pkgutil.py | _install_from_path | def _install_from_path(path):
'''
Internal function to install a package from the given path
'''
if not os.path.exists(path):
msg = 'File not found: {0}'.format(path)
raise SaltInvocationError(msg)
cmd = 'installer -pkg "{0}" -target /'.format(path)
return salt.utils.mac_utils.e... | python | def _install_from_path(path):
'''
Internal function to install a package from the given path
'''
if not os.path.exists(path):
msg = 'File not found: {0}'.format(path)
raise SaltInvocationError(msg)
cmd = 'installer -pkg "{0}" -target /'.format(path)
return salt.utils.mac_utils.e... | [
"def",
"_install_from_path",
"(",
"path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"msg",
"=",
"'File not found: {0}'",
".",
"format",
"(",
"path",
")",
"raise",
"SaltInvocationError",
"(",
"msg",
")",
"cmd",
"=",
... | Internal function to install a package from the given path | [
"Internal",
"function",
"to",
"install",
"a",
"package",
"from",
"the",
"given",
"path"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_pkgutil.py#L73-L82 |
35,817 | 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 |
35,818 | 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 |
35,819 | 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 |
35,820 | 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 |
35,821 | 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 |
35,822 | 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 |
35,823 | 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 |
35,824 | 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 |
35,825 | 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 |
35,826 | 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 |
35,827 | 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 |
35,828 | 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 |
35,829 | 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 |
35,830 | 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 |
35,831 | 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 |
35,832 | 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 |
35,833 | 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 |
35,834 | 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 |
35,835 | 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 |
35,836 | 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 |
35,837 | 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 |
35,838 | 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 |
35,839 | 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 |
35,840 | 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 |
35,841 | 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 |
35,842 | 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 |
35,843 | 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 |
35,844 | 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 |
35,845 | 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 |
35,846 | 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 |
35,847 | 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 |
35,848 | 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 |
35,849 | 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 |
35,850 | 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 |
35,851 | 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 |
35,852 | 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 |
35,853 | 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 |
35,854 | 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 |
35,855 | 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 |
35,856 | 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 |
35,857 | 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 |
35,858 | 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 |
35,859 | 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 |
35,860 | 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 |
35,861 | 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 |
35,862 | 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 |
35,863 | 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 |
35,864 | 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 |
35,865 | 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 |
35,866 | 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 |
35,867 | 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 |
35,868 | 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 |
35,869 | 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 |
35,870 | 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 |
35,871 | 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 |
35,872 | 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 |
35,873 | 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 |
35,874 | 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 |
35,875 | 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 |
35,876 | 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 |
35,877 | 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 |
35,878 | 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 |
35,879 | 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 |
35,880 | 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 |
35,881 | 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 |
35,882 | saltstack/salt | salt/modules/rabbitmq.py | change_password | def change_password(name, password, runas=None):
'''
Changes a user's password.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.change_password rabbit_user password
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
if sal... | python | def change_password(name, password, runas=None):
'''
Changes a user's password.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.change_password rabbit_user password
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
if sal... | [
"def",
"change_password",
"(",
"name",
",",
"password",
",",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
... | Changes a user's password.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.change_password rabbit_user password | [
"Changes",
"a",
"user",
"s",
"password",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L368-L402 |
35,883 | saltstack/salt | salt/modules/rabbitmq.py | add_vhost | def add_vhost(vhost, runas=None):
'''
Adds a vhost via rabbitmqctl add_vhost.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq add_vhost '<vhost_name>'
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
res = __salt__['cmd.... | python | def add_vhost(vhost, runas=None):
'''
Adds a vhost via rabbitmqctl add_vhost.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq add_vhost '<vhost_name>'
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
res = __salt__['cmd.... | [
"def",
"add_vhost",
"(",
"vhost",
",",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
"user",
".",
"get_us... | Adds a vhost via rabbitmqctl add_vhost.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq add_vhost '<vhost_name>' | [
"Adds",
"a",
"vhost",
"via",
"rabbitmqctl",
"add_vhost",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L508-L527 |
35,884 | saltstack/salt | salt/modules/rabbitmq.py | set_permissions | def set_permissions(vhost, user, conf='.*', write='.*', read='.*', runas=None):
'''
Sets permissions for vhost via rabbitmqctl set_permissions
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.set_permissions myvhost myuser
'''
if runas is None and not salt.utils.platform.is_windows... | python | def set_permissions(vhost, user, conf='.*', write='.*', read='.*', runas=None):
'''
Sets permissions for vhost via rabbitmqctl set_permissions
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.set_permissions myvhost myuser
'''
if runas is None and not salt.utils.platform.is_windows... | [
"def",
"set_permissions",
"(",
"vhost",
",",
"user",
",",
"conf",
"=",
"'.*'",
",",
"write",
"=",
"'.*'",
",",
"read",
"=",
"'.*'",
",",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform... | Sets permissions for vhost via rabbitmqctl set_permissions
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.set_permissions myvhost myuser | [
"Sets",
"permissions",
"for",
"vhost",
"via",
"rabbitmqctl",
"set_permissions"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L551-L570 |
35,885 | saltstack/salt | salt/modules/rabbitmq.py | list_permissions | def list_permissions(vhost, runas=None):
'''
Lists permissions for vhost via rabbitmqctl list_permissions
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_permissions /myvhost
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_us... | python | def list_permissions(vhost, runas=None):
'''
Lists permissions for vhost via rabbitmqctl list_permissions
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_permissions /myvhost
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_us... | [
"def",
"list_permissions",
"(",
"vhost",
",",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
"user",
".",
... | Lists permissions for vhost via rabbitmqctl list_permissions
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_permissions /myvhost | [
"Lists",
"permissions",
"for",
"vhost",
"via",
"rabbitmqctl",
"list_permissions"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L573-L591 |
35,886 | saltstack/salt | salt/modules/rabbitmq.py | list_user_permissions | def list_user_permissions(name, runas=None):
'''
List permissions for a user via rabbitmqctl list_user_permissions
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_user_permissions user
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.u... | python | def list_user_permissions(name, runas=None):
'''
List permissions for a user via rabbitmqctl list_user_permissions
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_user_permissions user
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.u... | [
"def",
"list_user_permissions",
"(",
"name",
",",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
"user",
"."... | List permissions for a user via rabbitmqctl list_user_permissions
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_user_permissions user | [
"List",
"permissions",
"for",
"a",
"user",
"via",
"rabbitmqctl",
"list_user_permissions"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L594-L612 |
35,887 | saltstack/salt | salt/modules/rabbitmq.py | set_user_tags | def set_user_tags(name, tags, runas=None):
'''Add user tags via rabbitmqctl set_user_tags
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.set_user_tags myadmin administrator
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
... | python | def set_user_tags(name, tags, runas=None):
'''Add user tags via rabbitmqctl set_user_tags
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.set_user_tags myadmin administrator
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
... | [
"def",
"set_user_tags",
"(",
"name",
",",
"tags",
",",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
"use... | Add user tags via rabbitmqctl set_user_tags
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.set_user_tags myadmin administrator | [
"Add",
"user",
"tags",
"via",
"rabbitmqctl",
"set_user_tags"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L615-L636 |
35,888 | saltstack/salt | salt/modules/rabbitmq.py | join_cluster | def join_cluster(host, user='rabbit', ram_node=None, runas=None):
'''
Join a rabbit cluster
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.join_cluster rabbit.example.com rabbit
'''
cmd = [RABBITMQCTL, 'join_cluster']
if ram_node:
cmd.append('--ram')
cmd.append('{... | python | def join_cluster(host, user='rabbit', ram_node=None, runas=None):
'''
Join a rabbit cluster
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.join_cluster rabbit.example.com rabbit
'''
cmd = [RABBITMQCTL, 'join_cluster']
if ram_node:
cmd.append('--ram')
cmd.append('{... | [
"def",
"join_cluster",
"(",
"host",
",",
"user",
"=",
"'rabbit'",
",",
"ram_node",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"RABBITMQCTL",
",",
"'join_cluster'",
"]",
"if",
"ram_node",
":",
"cmd",
".",
"append",
"(",
"'--ram'"... | Join a rabbit cluster
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.join_cluster rabbit.example.com rabbit | [
"Join",
"a",
"rabbit",
"cluster"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L681-L702 |
35,889 | saltstack/salt | salt/modules/rabbitmq.py | list_policies | def list_policies(vhost="/", runas=None):
'''
Return a dictionary of policies nested by vhost and name
based on the data returned from rabbitmqctl list_policies.
Reference: http://www.rabbitmq.com/ha.html
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_policies
'''
r... | python | def list_policies(vhost="/", runas=None):
'''
Return a dictionary of policies nested by vhost and name
based on the data returned from rabbitmqctl list_policies.
Reference: http://www.rabbitmq.com/ha.html
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_policies
'''
r... | [
"def",
"list_policies",
"(",
"vhost",
"=",
"\"/\"",
",",
"runas",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",... | Return a dictionary of policies nested by vhost and name
based on the data returned from rabbitmqctl list_policies.
Reference: http://www.rabbitmq.com/ha.html
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.list_policies | [
"Return",
"a",
"dictionary",
"of",
"policies",
"nested",
"by",
"vhost",
"and",
"name",
"based",
"on",
"the",
"data",
"returned",
"from",
"rabbitmqctl",
"list_policies",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L830-L891 |
35,890 | saltstack/salt | salt/modules/rabbitmq.py | set_policy | def set_policy(vhost,
name,
pattern,
definition,
priority=None,
runas=None,
apply_to=None):
'''
Set a policy based on rabbitmqctl set_policy.
Reference: http://www.rabbitmq.com/ha.html
CLI Example:
.. code-b... | python | def set_policy(vhost,
name,
pattern,
definition,
priority=None,
runas=None,
apply_to=None):
'''
Set a policy based on rabbitmqctl set_policy.
Reference: http://www.rabbitmq.com/ha.html
CLI Example:
.. code-b... | [
"def",
"set_policy",
"(",
"vhost",
",",
"name",
",",
"pattern",
",",
"definition",
",",
"priority",
"=",
"None",
",",
"runas",
"=",
"None",
",",
"apply_to",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
... | Set a policy based on rabbitmqctl set_policy.
Reference: http://www.rabbitmq.com/ha.html
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.set_policy / HA '.*' '{"ha-mode":"all"}' | [
"Set",
"a",
"policy",
"based",
"on",
"rabbitmqctl",
"set_policy",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L894-L928 |
35,891 | saltstack/salt | salt/modules/rabbitmq.py | delete_policy | def delete_policy(vhost, name, runas=None):
'''
Delete a policy based on rabbitmqctl clear_policy.
Reference: http://www.rabbitmq.com/ha.html
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.delete_policy / HA
'''
if runas is None and not salt.utils.platform.is_windows():
... | python | def delete_policy(vhost, name, runas=None):
'''
Delete a policy based on rabbitmqctl clear_policy.
Reference: http://www.rabbitmq.com/ha.html
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.delete_policy / HA
'''
if runas is None and not salt.utils.platform.is_windows():
... | [
"def",
"delete_policy",
"(",
"vhost",
",",
"name",
",",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
"us... | Delete a policy based on rabbitmqctl clear_policy.
Reference: http://www.rabbitmq.com/ha.html
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.delete_policy / HA | [
"Delete",
"a",
"policy",
"based",
"on",
"rabbitmqctl",
"clear_policy",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L931-L951 |
35,892 | saltstack/salt | salt/modules/rabbitmq.py | policy_exists | def policy_exists(vhost, name, runas=None):
'''
Return whether the policy exists based on rabbitmqctl list_policies.
Reference: http://www.rabbitmq.com/ha.html
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.policy_exists / HA
'''
if runas is None and not salt.utils.platform.... | python | def policy_exists(vhost, name, runas=None):
'''
Return whether the policy exists based on rabbitmqctl list_policies.
Reference: http://www.rabbitmq.com/ha.html
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.policy_exists / HA
'''
if runas is None and not salt.utils.platform.... | [
"def",
"policy_exists",
"(",
"vhost",
",",
"name",
",",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
"us... | Return whether the policy exists based on rabbitmqctl list_policies.
Reference: http://www.rabbitmq.com/ha.html
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.policy_exists / HA | [
"Return",
"whether",
"the",
"policy",
"exists",
"based",
"on",
"rabbitmqctl",
"list_policies",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L954-L969 |
35,893 | saltstack/salt | salt/modules/rabbitmq.py | plugin_is_enabled | def plugin_is_enabled(name, runas=None):
'''
Return whether the plugin is enabled.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.plugin_is_enabled rabbitmq_plugin_name
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
r... | python | def plugin_is_enabled(name, runas=None):
'''
Return whether the plugin is enabled.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.plugin_is_enabled rabbitmq_plugin_name
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
r... | [
"def",
"plugin_is_enabled",
"(",
"name",
",",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
"user",
".",
... | Return whether the plugin is enabled.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.plugin_is_enabled rabbitmq_plugin_name | [
"Return",
"whether",
"the",
"plugin",
"is",
"enabled",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L1008-L1020 |
35,894 | saltstack/salt | salt/modules/rabbitmq.py | enable_plugin | def enable_plugin(name, runas=None):
'''
Enable a RabbitMQ plugin via the rabbitmq-plugins command.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.enable_plugin foo
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
cmd =... | python | def enable_plugin(name, runas=None):
'''
Enable a RabbitMQ plugin via the rabbitmq-plugins command.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.enable_plugin foo
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
cmd =... | [
"def",
"enable_plugin",
"(",
"name",
",",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
"user",
".",
"get... | Enable a RabbitMQ plugin via the rabbitmq-plugins command.
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.enable_plugin foo | [
"Enable",
"a",
"RabbitMQ",
"plugin",
"via",
"the",
"rabbitmq",
"-",
"plugins",
"command",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rabbitmq.py#L1023-L1037 |
35,895 | saltstack/salt | salt/modules/cyg.py | _check_cygwin_installed | def _check_cygwin_installed(cyg_arch='x86_64'):
'''
Return True or False if cygwin is installed.
Use the cygcheck executable to check install. It is installed as part of
the base package, and we use it to check packages
'''
path_to_cygcheck = os.sep.join(['C:',
... | python | def _check_cygwin_installed(cyg_arch='x86_64'):
'''
Return True or False if cygwin is installed.
Use the cygcheck executable to check install. It is installed as part of
the base package, and we use it to check packages
'''
path_to_cygcheck = os.sep.join(['C:',
... | [
"def",
"_check_cygwin_installed",
"(",
"cyg_arch",
"=",
"'x86_64'",
")",
":",
"path_to_cygcheck",
"=",
"os",
".",
"sep",
".",
"join",
"(",
"[",
"'C:'",
",",
"_get_cyg_dir",
"(",
"cyg_arch",
")",
",",
"'bin'",
",",
"'cygcheck.exe'",
"]",
")",
"LOG",
".",
... | Return True or False if cygwin is installed.
Use the cygcheck executable to check install. It is installed as part of
the base package, and we use it to check packages | [
"Return",
"True",
"or",
"False",
"if",
"cygwin",
"is",
"installed",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cyg.py#L64-L78 |
35,896 | saltstack/salt | salt/modules/cyg.py | _get_all_packages | def _get_all_packages(mirror=DEFAULT_MIRROR,
cyg_arch='x86_64'):
'''
Return the list of packages based on the mirror provided.
'''
if 'cyg.all_packages' not in __context__:
__context__['cyg.all_packages'] = {}
if mirror not in __context__['cyg.all_packages']:
__... | python | def _get_all_packages(mirror=DEFAULT_MIRROR,
cyg_arch='x86_64'):
'''
Return the list of packages based on the mirror provided.
'''
if 'cyg.all_packages' not in __context__:
__context__['cyg.all_packages'] = {}
if mirror not in __context__['cyg.all_packages']:
__... | [
"def",
"_get_all_packages",
"(",
"mirror",
"=",
"DEFAULT_MIRROR",
",",
"cyg_arch",
"=",
"'x86_64'",
")",
":",
"if",
"'cyg.all_packages'",
"not",
"in",
"__context__",
":",
"__context__",
"[",
"'cyg.all_packages'",
"]",
"=",
"{",
"}",
"if",
"mirror",
"not",
"in"... | Return the list of packages based on the mirror provided. | [
"Return",
"the",
"list",
"of",
"packages",
"based",
"on",
"the",
"mirror",
"provided",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cyg.py#L81-L103 |
35,897 | saltstack/salt | salt/modules/cyg.py | check_valid_package | def check_valid_package(package,
cyg_arch='x86_64',
mirrors=None):
'''
Check if the package is valid on the given mirrors.
Args:
package: The name of the package
cyg_arch: The cygwin architecture
mirrors: any mirrors to check
Retu... | python | def check_valid_package(package,
cyg_arch='x86_64',
mirrors=None):
'''
Check if the package is valid on the given mirrors.
Args:
package: The name of the package
cyg_arch: The cygwin architecture
mirrors: any mirrors to check
Retu... | [
"def",
"check_valid_package",
"(",
"package",
",",
"cyg_arch",
"=",
"'x86_64'",
",",
"mirrors",
"=",
"None",
")",
":",
"if",
"mirrors",
"is",
"None",
":",
"mirrors",
"=",
"[",
"{",
"DEFAULT_MIRROR",
":",
"DEFAULT_MIRROR_KEY",
"}",
"]",
"LOG",
".",
"debug",... | Check if the package is valid on the given mirrors.
Args:
package: The name of the package
cyg_arch: The cygwin architecture
mirrors: any mirrors to check
Returns (bool): True if Valid, otherwise False
CLI Example:
.. code-block:: bash
salt '*' cyg.check_valid_packag... | [
"Check",
"if",
"the",
"package",
"is",
"valid",
"on",
"the",
"given",
"mirrors",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cyg.py#L106-L134 |
35,898 | saltstack/salt | salt/modules/cyg.py | _run_silent_cygwin | def _run_silent_cygwin(cyg_arch='x86_64',
args=None,
mirrors=None):
'''
Retrieve the correct setup.exe.
Run it with the correct arguments to get the bare minimum cygwin
installation up and running.
'''
cyg_cache_dir = os.sep.join(['c:', 'cygcache'])... | python | def _run_silent_cygwin(cyg_arch='x86_64',
args=None,
mirrors=None):
'''
Retrieve the correct setup.exe.
Run it with the correct arguments to get the bare minimum cygwin
installation up and running.
'''
cyg_cache_dir = os.sep.join(['c:', 'cygcache'])... | [
"def",
"_run_silent_cygwin",
"(",
"cyg_arch",
"=",
"'x86_64'",
",",
"args",
"=",
"None",
",",
"mirrors",
"=",
"None",
")",
":",
"cyg_cache_dir",
"=",
"os",
".",
"sep",
".",
"join",
"(",
"[",
"'c:'",
",",
"'cygcache'",
"]",
")",
"cyg_setup",
"=",
"'setu... | Retrieve the correct setup.exe.
Run it with the correct arguments to get the bare minimum cygwin
installation up and running. | [
"Retrieve",
"the",
"correct",
"setup",
".",
"exe",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cyg.py#L137-L191 |
35,899 | saltstack/salt | salt/modules/cyg.py | _cygcheck | def _cygcheck(args, cyg_arch='x86_64'):
'''
Run the cygcheck executable.
'''
cmd = ' '.join([
os.sep.join(['c:', _get_cyg_dir(cyg_arch), 'bin', 'cygcheck']),
'-c', args])
ret = __salt__['cmd.run_all'](cmd)
if ret['retcode'] == 0:
return ret['stdout']
else:
r... | python | def _cygcheck(args, cyg_arch='x86_64'):
'''
Run the cygcheck executable.
'''
cmd = ' '.join([
os.sep.join(['c:', _get_cyg_dir(cyg_arch), 'bin', 'cygcheck']),
'-c', args])
ret = __salt__['cmd.run_all'](cmd)
if ret['retcode'] == 0:
return ret['stdout']
else:
r... | [
"def",
"_cygcheck",
"(",
"args",
",",
"cyg_arch",
"=",
"'x86_64'",
")",
":",
"cmd",
"=",
"' '",
".",
"join",
"(",
"[",
"os",
".",
"sep",
".",
"join",
"(",
"[",
"'c:'",
",",
"_get_cyg_dir",
"(",
"cyg_arch",
")",
",",
"'bin'",
",",
"'cygcheck'",
"]",... | Run the cygcheck executable. | [
"Run",
"the",
"cygcheck",
"executable",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cyg.py#L194-L207 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.