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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
32,800 | saltstack/salt | salt/modules/ps.py | disk_partition_usage | def disk_partition_usage(all=False):
'''
Return a list of disk partitions plus the mount point, filesystem and usage
statistics.
CLI Example:
.. code-block:: bash
salt '*' ps.disk_partition_usage
'''
result = disk_partitions(all)
for partition in result:
partition.upda... | python | def disk_partition_usage(all=False):
'''
Return a list of disk partitions plus the mount point, filesystem and usage
statistics.
CLI Example:
.. code-block:: bash
salt '*' ps.disk_partition_usage
'''
result = disk_partitions(all)
for partition in result:
partition.upda... | [
"def",
"disk_partition_usage",
"(",
"all",
"=",
"False",
")",
":",
"result",
"=",
"disk_partitions",
"(",
"all",
")",
"for",
"partition",
"in",
"result",
":",
"partition",
".",
"update",
"(",
"disk_usage",
"(",
"partition",
"[",
"'mountpoint'",
"]",
")",
"... | Return a list of disk partitions plus the mount point, filesystem and usage
statistics.
CLI Example:
.. code-block:: bash
salt '*' ps.disk_partition_usage | [
"Return",
"a",
"list",
"of",
"disk",
"partitions",
"plus",
"the",
"mount",
"point",
"filesystem",
"and",
"usage",
"statistics",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L494-L508 |
32,801 | saltstack/salt | salt/modules/ps.py | total_physical_memory | def total_physical_memory():
'''
Return the total number of bytes of physical memory.
CLI Example:
.. code-block:: bash
salt '*' ps.total_physical_memory
'''
if psutil.version_info < (0, 6, 0):
msg = 'virtual_memory is only available in psutil 0.6.0 or greater'
raise C... | python | def total_physical_memory():
'''
Return the total number of bytes of physical memory.
CLI Example:
.. code-block:: bash
salt '*' ps.total_physical_memory
'''
if psutil.version_info < (0, 6, 0):
msg = 'virtual_memory is only available in psutil 0.6.0 or greater'
raise C... | [
"def",
"total_physical_memory",
"(",
")",
":",
"if",
"psutil",
".",
"version_info",
"<",
"(",
"0",
",",
"6",
",",
"0",
")",
":",
"msg",
"=",
"'virtual_memory is only available in psutil 0.6.0 or greater'",
"raise",
"CommandExecutionError",
"(",
"msg",
")",
"try",
... | Return the total number of bytes of physical memory.
CLI Example:
.. code-block:: bash
salt '*' ps.total_physical_memory | [
"Return",
"the",
"total",
"number",
"of",
"bytes",
"of",
"physical",
"memory",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L511-L529 |
32,802 | saltstack/salt | salt/modules/ps.py | boot_time | def boot_time(time_format=None):
'''
Return the boot time in number of seconds since the epoch began.
CLI Example:
time_format
Optionally specify a `strftime`_ format string. Use
``time_format='%c'`` to get a nicely-formatted locale specific date and
time (i.e. ``Fri May 2 19:... | python | def boot_time(time_format=None):
'''
Return the boot time in number of seconds since the epoch began.
CLI Example:
time_format
Optionally specify a `strftime`_ format string. Use
``time_format='%c'`` to get a nicely-formatted locale specific date and
time (i.e. ``Fri May 2 19:... | [
"def",
"boot_time",
"(",
"time_format",
"=",
"None",
")",
":",
"try",
":",
"b_time",
"=",
"int",
"(",
"psutil",
".",
"boot_time",
"(",
")",
")",
"except",
"AttributeError",
":",
"# get_boot_time() has been removed in newer psutil versions, and has",
"# been replaced b... | Return the boot time in number of seconds since the epoch began.
CLI Example:
time_format
Optionally specify a `strftime`_ format string. Use
``time_format='%c'`` to get a nicely-formatted locale specific date and
time (i.e. ``Fri May 2 19:08:32 2014``).
.. _strftime: https:/... | [
"Return",
"the",
"boot",
"time",
"in",
"number",
"of",
"seconds",
"since",
"the",
"epoch",
"began",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L550-L582 |
32,803 | saltstack/salt | salt/modules/ps.py | get_users | def get_users():
'''
Return logged-in users.
CLI Example:
.. code-block:: bash
salt '*' ps.get_users
'''
try:
recs = psutil.users()
return [dict(x._asdict()) for x in recs]
except AttributeError:
# get_users is only present in psutil > v0.5.0
# try ... | python | def get_users():
'''
Return logged-in users.
CLI Example:
.. code-block:: bash
salt '*' ps.get_users
'''
try:
recs = psutil.users()
return [dict(x._asdict()) for x in recs]
except AttributeError:
# get_users is only present in psutil > v0.5.0
# try ... | [
"def",
"get_users",
"(",
")",
":",
"try",
":",
"recs",
"=",
"psutil",
".",
"users",
"(",
")",
"return",
"[",
"dict",
"(",
"x",
".",
"_asdict",
"(",
")",
")",
"for",
"x",
"in",
"recs",
"]",
"except",
"AttributeError",
":",
"# get_users is only present i... | Return logged-in users.
CLI Example:
.. code-block:: bash
salt '*' ps.get_users | [
"Return",
"logged",
"-",
"in",
"users",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L629-L660 |
32,804 | saltstack/salt | salt/modules/ps.py | lsof | def lsof(name):
'''
Retrieve the lsof information of the given process name.
CLI Example:
.. code-block:: bash
salt '*' ps.lsof apache2
'''
sanitize_name = six.text_type(name)
lsof_infos = __salt__['cmd.run']("lsof -c " + sanitize_name)
ret = []
ret.extend([sanitize_name, ... | python | def lsof(name):
'''
Retrieve the lsof information of the given process name.
CLI Example:
.. code-block:: bash
salt '*' ps.lsof apache2
'''
sanitize_name = six.text_type(name)
lsof_infos = __salt__['cmd.run']("lsof -c " + sanitize_name)
ret = []
ret.extend([sanitize_name, ... | [
"def",
"lsof",
"(",
"name",
")",
":",
"sanitize_name",
"=",
"six",
".",
"text_type",
"(",
"name",
")",
"lsof_infos",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"\"lsof -c \"",
"+",
"sanitize_name",
")",
"ret",
"=",
"[",
"]",
"ret",
".",
"extend",
"("... | Retrieve the lsof information of the given process name.
CLI Example:
.. code-block:: bash
salt '*' ps.lsof apache2 | [
"Retrieve",
"the",
"lsof",
"information",
"of",
"the",
"given",
"process",
"name",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L663-L677 |
32,805 | saltstack/salt | salt/modules/ps.py | netstat | def netstat(name):
'''
Retrieve the netstat information of the given process name.
CLI Example:
.. code-block:: bash
salt '*' ps.netstat apache2
'''
sanitize_name = six.text_type(name)
netstat_infos = __salt__['cmd.run']("netstat -nap")
found_infos = []
ret = []
for in... | python | def netstat(name):
'''
Retrieve the netstat information of the given process name.
CLI Example:
.. code-block:: bash
salt '*' ps.netstat apache2
'''
sanitize_name = six.text_type(name)
netstat_infos = __salt__['cmd.run']("netstat -nap")
found_infos = []
ret = []
for in... | [
"def",
"netstat",
"(",
"name",
")",
":",
"sanitize_name",
"=",
"six",
".",
"text_type",
"(",
"name",
")",
"netstat_infos",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"\"netstat -nap\"",
")",
"found_infos",
"=",
"[",
"]",
"ret",
"=",
"[",
"]",
"for",
... | Retrieve the netstat information of the given process name.
CLI Example:
.. code-block:: bash
salt '*' ps.netstat apache2 | [
"Retrieve",
"the",
"netstat",
"information",
"of",
"the",
"given",
"process",
"name",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L681-L699 |
32,806 | saltstack/salt | salt/modules/ps.py | ss | def ss(name):
'''
Retrieve the ss information of the given process name.
CLI Example:
.. code-block:: bash
salt '*' ps.ss apache2
.. versionadded:: 2016.11.6
'''
sanitize_name = six.text_type(name)
ss_infos = __salt__['cmd.run']("ss -neap")
found_infos = []
ret = []
... | python | def ss(name):
'''
Retrieve the ss information of the given process name.
CLI Example:
.. code-block:: bash
salt '*' ps.ss apache2
.. versionadded:: 2016.11.6
'''
sanitize_name = six.text_type(name)
ss_infos = __salt__['cmd.run']("ss -neap")
found_infos = []
ret = []
... | [
"def",
"ss",
"(",
"name",
")",
":",
"sanitize_name",
"=",
"six",
".",
"text_type",
"(",
"name",
")",
"ss_infos",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"\"ss -neap\"",
")",
"found_infos",
"=",
"[",
"]",
"ret",
"=",
"[",
"]",
"for",
"info",
"in"... | Retrieve the ss information of the given process name.
CLI Example:
.. code-block:: bash
salt '*' ps.ss apache2
.. versionadded:: 2016.11.6 | [
"Retrieve",
"the",
"ss",
"information",
"of",
"the",
"given",
"process",
"name",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L703-L724 |
32,807 | saltstack/salt | salt/states/pagerduty_service.py | absent | def absent(profile='pagerduty', subdomain=None, api_key=None, **kwargs):
'''
Ensure a pagerduty service does not exist.
Name can be the service name or pagerduty service id.
'''
r = __salt__['pagerduty_util.resource_absent']('services',
['name', 'id... | python | def absent(profile='pagerduty', subdomain=None, api_key=None, **kwargs):
'''
Ensure a pagerduty service does not exist.
Name can be the service name or pagerduty service id.
'''
r = __salt__['pagerduty_util.resource_absent']('services',
['name', 'id... | [
"def",
"absent",
"(",
"profile",
"=",
"'pagerduty'",
",",
"subdomain",
"=",
"None",
",",
"api_key",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"r",
"=",
"__salt__",
"[",
"'pagerduty_util.resource_absent'",
"]",
"(",
"'services'",
",",
"[",
"'name'",
... | Ensure a pagerduty service does not exist.
Name can be the service name or pagerduty service id. | [
"Ensure",
"a",
"pagerduty",
"service",
"does",
"not",
"exist",
".",
"Name",
"can",
"be",
"the",
"service",
"name",
"or",
"pagerduty",
"service",
"id",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pagerduty_service.py#L87-L98 |
32,808 | saltstack/salt | salt/modules/baredoc.py | modules_and_args | def modules_and_args(modules=True, states=False, names_only=False):
'''
Walk the Salt install tree and return a dictionary or a list
of the functions therein as well as their arguments.
:param modules: Walk the modules directory if True
:param states: Walk the states directory if True
:param na... | python | def modules_and_args(modules=True, states=False, names_only=False):
'''
Walk the Salt install tree and return a dictionary or a list
of the functions therein as well as their arguments.
:param modules: Walk the modules directory if True
:param states: Walk the states directory if True
:param na... | [
"def",
"modules_and_args",
"(",
"modules",
"=",
"True",
",",
"states",
"=",
"False",
",",
"names_only",
"=",
"False",
")",
":",
"dirs",
"=",
"[",
"]",
"module_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"realpath",
"(",... | Walk the Salt install tree and return a dictionary or a list
of the functions therein as well as their arguments.
:param modules: Walk the modules directory if True
:param states: Walk the states directory if True
:param names_only: Return only a list of the callable functions instead of a dictionary w... | [
"Walk",
"the",
"Salt",
"install",
"tree",
"and",
"return",
"a",
"dictionary",
"or",
"a",
"list",
"of",
"the",
"functions",
"therein",
"as",
"well",
"as",
"their",
"arguments",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/baredoc.py#L96-L151 |
32,809 | saltstack/salt | salt/modules/win_dsc.py | get_config | def get_config():
'''
Get the current DSC Configuration
Returns:
dict: A dictionary representing the DSC Configuration on the machine
Raises:
CommandExecutionError: On failure
CLI Example:
.. code-block:: bash
salt '*' dsc.get_config
'''
cmd = 'Get-DscConfigu... | python | def get_config():
'''
Get the current DSC Configuration
Returns:
dict: A dictionary representing the DSC Configuration on the machine
Raises:
CommandExecutionError: On failure
CLI Example:
.. code-block:: bash
salt '*' dsc.get_config
'''
cmd = 'Get-DscConfigu... | [
"def",
"get_config",
"(",
")",
":",
"cmd",
"=",
"'Get-DscConfiguration | Select-Object * -ExcludeProperty Cim*'",
"try",
":",
"raw_config",
"=",
"_pshell",
"(",
"cmd",
",",
"ignore_retcode",
"=",
"True",
")",
"except",
"CommandExecutionError",
"as",
"exc",
":",
"if"... | Get the current DSC Configuration
Returns:
dict: A dictionary representing the DSC Configuration on the machine
Raises:
CommandExecutionError: On failure
CLI Example:
.. code-block:: bash
salt '*' dsc.get_config | [
"Get",
"the",
"current",
"DSC",
"Configuration"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dsc.py#L411-L448 |
32,810 | saltstack/salt | salt/modules/win_dsc.py | remove_config | def remove_config(reset=False):
'''
Remove the current DSC Configuration. Removes current, pending, and previous
dsc configurations.
.. versionadded:: 2017.7.5
Args:
reset (bool):
Attempts to reset the DSC configuration by removing the following
from ``C:\\Windows\\... | python | def remove_config(reset=False):
'''
Remove the current DSC Configuration. Removes current, pending, and previous
dsc configurations.
.. versionadded:: 2017.7.5
Args:
reset (bool):
Attempts to reset the DSC configuration by removing the following
from ``C:\\Windows\\... | [
"def",
"remove_config",
"(",
"reset",
"=",
"False",
")",
":",
"# Stopping a running config (not likely to occur)",
"cmd",
"=",
"'Stop-DscConfiguration'",
"log",
".",
"info",
"(",
"'DSC: Stopping Running Configuration'",
")",
"try",
":",
"_pshell",
"(",
"cmd",
")",
"ex... | Remove the current DSC Configuration. Removes current, pending, and previous
dsc configurations.
.. versionadded:: 2017.7.5
Args:
reset (bool):
Attempts to reset the DSC configuration by removing the following
from ``C:\\Windows\\System32\\Configuration``:
- Fi... | [
"Remove",
"the",
"current",
"DSC",
"Configuration",
".",
"Removes",
"current",
"pending",
"and",
"previous",
"dsc",
"configurations",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dsc.py#L451-L532 |
32,811 | saltstack/salt | salt/modules/win_dsc.py | restore_config | def restore_config():
'''
Reapplies the previous configuration.
.. versionadded:: 2017.7.5
.. note::
The current configuration will be come the previous configuration. If
run a second time back-to-back it is like toggling between two configs.
Returns:
bool: True if success... | python | def restore_config():
'''
Reapplies the previous configuration.
.. versionadded:: 2017.7.5
.. note::
The current configuration will be come the previous configuration. If
run a second time back-to-back it is like toggling between two configs.
Returns:
bool: True if success... | [
"def",
"restore_config",
"(",
")",
":",
"cmd",
"=",
"'Restore-DscConfiguration'",
"try",
":",
"_pshell",
"(",
"cmd",
",",
"ignore_retcode",
"=",
"True",
")",
"except",
"CommandExecutionError",
"as",
"exc",
":",
"if",
"'A previous configuration does not exist'",
"in"... | Reapplies the previous configuration.
.. versionadded:: 2017.7.5
.. note::
The current configuration will be come the previous configuration. If
run a second time back-to-back it is like toggling between two configs.
Returns:
bool: True if successfully restored
Raises:
... | [
"Reapplies",
"the",
"previous",
"configuration",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dsc.py#L535-L564 |
32,812 | saltstack/salt | salt/modules/win_dsc.py | get_config_status | def get_config_status():
'''
Get the status of the current DSC Configuration
Returns:
dict: A dictionary representing the status of the current DSC
Configuration on the machine
CLI Example:
.. code-block:: bash
salt '*' dsc.get_config_status
'''
cmd = 'Get-Dsc... | python | def get_config_status():
'''
Get the status of the current DSC Configuration
Returns:
dict: A dictionary representing the status of the current DSC
Configuration on the machine
CLI Example:
.. code-block:: bash
salt '*' dsc.get_config_status
'''
cmd = 'Get-Dsc... | [
"def",
"get_config_status",
"(",
")",
":",
"cmd",
"=",
"'Get-DscConfigurationStatus | '",
"'Select-Object -Property HostName, Status, MetaData, '",
"'@{Name=\"StartDate\";Expression={Get-Date ($_.StartDate) -Format g}}, '",
"'Type, Mode, RebootRequested, NumberofResources'",
"try",
":",
"r... | Get the status of the current DSC Configuration
Returns:
dict: A dictionary representing the status of the current DSC
Configuration on the machine
CLI Example:
.. code-block:: bash
salt '*' dsc.get_config_status | [
"Get",
"the",
"status",
"of",
"the",
"current",
"DSC",
"Configuration"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dsc.py#L589-L612 |
32,813 | saltstack/salt | salt/modules/sensors.py | sense | def sense(chip, fahrenheit=False):
'''
Gather lm-sensors data from a given chip
To determine the chip to query, use the 'sensors' command
and see the leading line in the block.
Example:
/usr/bin/sensors
coretemp-isa-0000
Adapter: ISA adapter
Physical id 0: +56.0°C (high = +87.0... | python | def sense(chip, fahrenheit=False):
'''
Gather lm-sensors data from a given chip
To determine the chip to query, use the 'sensors' command
and see the leading line in the block.
Example:
/usr/bin/sensors
coretemp-isa-0000
Adapter: ISA adapter
Physical id 0: +56.0°C (high = +87.0... | [
"def",
"sense",
"(",
"chip",
",",
"fahrenheit",
"=",
"False",
")",
":",
"extra_args",
"=",
"''",
"if",
"fahrenheit",
"is",
"True",
":",
"extra_args",
"=",
"'-f'",
"sensors",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'/usr/bin/sensors {0} {1}'",
".",
"f... | Gather lm-sensors data from a given chip
To determine the chip to query, use the 'sensors' command
and see the leading line in the block.
Example:
/usr/bin/sensors
coretemp-isa-0000
Adapter: ISA adapter
Physical id 0: +56.0°C (high = +87.0°C, crit = +105.0°C)
Core 0: +52.0°... | [
"Gather",
"lm",
"-",
"sensors",
"data",
"from",
"a",
"given",
"chip"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sensors.py#L25-L55 |
32,814 | saltstack/salt | salt/states/influxdb_retention_policy.py | convert_duration | def convert_duration(duration):
'''
Convert the a duration string into XXhYYmZZs format
duration
Duration to convert
Returns: duration_string
String representation of duration in XXhYYmZZs format
'''
# durations must be specified in days, weeks or hours
if duration.endswi... | python | def convert_duration(duration):
'''
Convert the a duration string into XXhYYmZZs format
duration
Duration to convert
Returns: duration_string
String representation of duration in XXhYYmZZs format
'''
# durations must be specified in days, weeks or hours
if duration.endswi... | [
"def",
"convert_duration",
"(",
"duration",
")",
":",
"# durations must be specified in days, weeks or hours",
"if",
"duration",
".",
"endswith",
"(",
"'h'",
")",
":",
"hours",
"=",
"int",
"(",
"duration",
".",
"split",
"(",
"'h'",
")",
")",
"elif",
"duration",
... | Convert the a duration string into XXhYYmZZs format
duration
Duration to convert
Returns: duration_string
String representation of duration in XXhYYmZZs format | [
"Convert",
"the",
"a",
"duration",
"string",
"into",
"XXhYYmZZs",
"format"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/influxdb_retention_policy.py#L24-L49 |
32,815 | saltstack/salt | salt/states/influxdb_retention_policy.py | present | def present(name, database, duration="7d",
replication=1, default=False,
**client_args):
'''
Ensure that given retention policy is present.
name
Name of the retention policy to create.
database
Database to create retention policy on.
'''
ret = {'name': n... | python | def present(name, database, duration="7d",
replication=1, default=False,
**client_args):
'''
Ensure that given retention policy is present.
name
Name of the retention policy to create.
database
Database to create retention policy on.
'''
ret = {'name': n... | [
"def",
"present",
"(",
"name",
",",
"database",
",",
"duration",
"=",
"\"7d\"",
",",
"replication",
"=",
"1",
",",
"default",
"=",
"False",
",",
"*",
"*",
"client_args",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
... | Ensure that given retention policy is present.
name
Name of the retention policy to create.
database
Database to create retention policy on. | [
"Ensure",
"that",
"given",
"retention",
"policy",
"is",
"present",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/influxdb_retention_policy.py#L52-L126 |
32,816 | saltstack/salt | salt/modules/event.py | fire_master | def fire_master(data, tag, preload=None, timeout=60):
'''
Fire an event off up to the master server
CLI Example:
.. code-block:: bash
salt '*' event.fire_master '{"data":"my event data"}' 'tag'
'''
if (__opts__.get('local', None) or __opts__.get('file_client', None) == 'local') and no... | python | def fire_master(data, tag, preload=None, timeout=60):
'''
Fire an event off up to the master server
CLI Example:
.. code-block:: bash
salt '*' event.fire_master '{"data":"my event data"}' 'tag'
'''
if (__opts__.get('local', None) or __opts__.get('file_client', None) == 'local') and no... | [
"def",
"fire_master",
"(",
"data",
",",
"tag",
",",
"preload",
"=",
"None",
",",
"timeout",
"=",
"60",
")",
":",
"if",
"(",
"__opts__",
".",
"get",
"(",
"'local'",
",",
"None",
")",
"or",
"__opts__",
".",
"get",
"(",
"'file_client'",
",",
"None",
"... | Fire an event off up to the master server
CLI Example:
.. code-block:: bash
salt '*' event.fire_master '{"data":"my event data"}' 'tag' | [
"Fire",
"an",
"event",
"off",
"up",
"to",
"the",
"master",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/event.py#L34-L98 |
32,817 | saltstack/salt | salt/modules/event.py | fire | def fire(data, tag, timeout=None):
'''
Fire an event on the local minion event bus. Data must be formed as a dict.
CLI Example:
.. code-block:: bash
salt '*' event.fire '{"data":"my event data"}' 'tag'
'''
if timeout is None:
timeout = 60000
else:
timeout = timeout... | python | def fire(data, tag, timeout=None):
'''
Fire an event on the local minion event bus. Data must be formed as a dict.
CLI Example:
.. code-block:: bash
salt '*' event.fire '{"data":"my event data"}' 'tag'
'''
if timeout is None:
timeout = 60000
else:
timeout = timeout... | [
"def",
"fire",
"(",
"data",
",",
"tag",
",",
"timeout",
"=",
"None",
")",
":",
"if",
"timeout",
"is",
"None",
":",
"timeout",
"=",
"60000",
"else",
":",
"timeout",
"=",
"timeout",
"*",
"1000",
"try",
":",
"event",
"=",
"salt",
".",
"utils",
".",
... | Fire an event on the local minion event bus. Data must be formed as a dict.
CLI Example:
.. code-block:: bash
salt '*' event.fire '{"data":"my event data"}' 'tag' | [
"Fire",
"an",
"event",
"on",
"the",
"local",
"minion",
"event",
"bus",
".",
"Data",
"must",
"be",
"formed",
"as",
"a",
"dict",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/event.py#L101-L128 |
32,818 | saltstack/salt | salt/states/postgres_cluster.py | absent | def absent(version,
name):
'''
Ensure that the named cluster is absent
version
Version of the postgresql server of the cluster to remove
name
The name of the cluster to remove
.. versionadded:: 2015.XX
'''
ret = {'name': name,
'changes': {},
... | python | def absent(version,
name):
'''
Ensure that the named cluster is absent
version
Version of the postgresql server of the cluster to remove
name
The name of the cluster to remove
.. versionadded:: 2015.XX
'''
ret = {'name': name,
'changes': {},
... | [
"def",
"absent",
"(",
"version",
",",
"name",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"#check if cluster exists and remove it",
"if",
"__salt__",
"... | Ensure that the named cluster is absent
version
Version of the postgresql server of the cluster to remove
name
The name of the cluster to remove
.. versionadded:: 2015.XX | [
"Ensure",
"that",
"the",
"named",
"cluster",
"is",
"absent"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/postgres_cluster.py#L117-L151 |
32,819 | saltstack/salt | salt/returners/splunk.py | _send_splunk | def _send_splunk(event, index_override=None, sourcetype_override=None):
'''
Send the results to Splunk.
Requires the Splunk HTTP Event Collector running on port 8088.
This is available on Splunk Enterprise version 6.3 or higher.
'''
# Get Splunk Options
opts = _get_options()
log.info(st... | python | def _send_splunk(event, index_override=None, sourcetype_override=None):
'''
Send the results to Splunk.
Requires the Splunk HTTP Event Collector running on port 8088.
This is available on Splunk Enterprise version 6.3 or higher.
'''
# Get Splunk Options
opts = _get_options()
log.info(st... | [
"def",
"_send_splunk",
"(",
"event",
",",
"index_override",
"=",
"None",
",",
"sourcetype_override",
"=",
"None",
")",
":",
"# Get Splunk Options",
"opts",
"=",
"_get_options",
"(",
")",
"log",
".",
"info",
"(",
"str",
"(",
"'Options: %s'",
")",
",",
"# futu... | Send the results to Splunk.
Requires the Splunk HTTP Event Collector running on port 8088.
This is available on Splunk Enterprise version 6.3 or higher. | [
"Send",
"the",
"results",
"to",
"Splunk",
".",
"Requires",
"the",
"Splunk",
"HTTP",
"Event",
"Collector",
"running",
"on",
"port",
"8088",
".",
"This",
"is",
"available",
"on",
"Splunk",
"Enterprise",
"version",
"6",
".",
"3",
"or",
"higher",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/splunk.py#L70-L104 |
32,820 | saltstack/salt | salt/states/serverdensity_device.py | _get_salt_params | def _get_salt_params():
'''
Try to get all sort of parameters for Server Density server info.
NOTE: Missing publicDNS and publicIPs parameters. There might be way of
getting them with salt-cloud.
'''
all_stats = __salt__['status.all_status']()
all_grains = __salt__['grains.items']()
par... | python | def _get_salt_params():
'''
Try to get all sort of parameters for Server Density server info.
NOTE: Missing publicDNS and publicIPs parameters. There might be way of
getting them with salt-cloud.
'''
all_stats = __salt__['status.all_status']()
all_grains = __salt__['grains.items']()
par... | [
"def",
"_get_salt_params",
"(",
")",
":",
"all_stats",
"=",
"__salt__",
"[",
"'status.all_status'",
"]",
"(",
")",
"all_grains",
"=",
"__salt__",
"[",
"'grains.items'",
"]",
"(",
")",
"params",
"=",
"{",
"}",
"try",
":",
"params",
"[",
"'name'",
"]",
"="... | Try to get all sort of parameters for Server Density server info.
NOTE: Missing publicDNS and publicIPs parameters. There might be way of
getting them with salt-cloud. | [
"Try",
"to",
"get",
"all",
"sort",
"of",
"parameters",
"for",
"Server",
"Density",
"server",
"info",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/serverdensity_device.py#L69-L95 |
32,821 | saltstack/salt | salt/states/serverdensity_device.py | monitored | def monitored(name, group=None, salt_name=True, salt_params=True, agent_version=1, **params):
'''
Device is monitored with Server Density.
name
Device name in Server Density.
salt_name
If ``True`` (default), takes the name from the ``id`` grain. If
``False``, the provided name ... | python | def monitored(name, group=None, salt_name=True, salt_params=True, agent_version=1, **params):
'''
Device is monitored with Server Density.
name
Device name in Server Density.
salt_name
If ``True`` (default), takes the name from the ``id`` grain. If
``False``, the provided name ... | [
"def",
"monitored",
"(",
"name",
",",
"group",
"=",
"None",
",",
"salt_name",
"=",
"True",
",",
"salt_params",
"=",
"True",
",",
"agent_version",
"=",
"1",
",",
"*",
"*",
"params",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
... | Device is monitored with Server Density.
name
Device name in Server Density.
salt_name
If ``True`` (default), takes the name from the ``id`` grain. If
``False``, the provided name is used.
group
Group name under with device will appear in Server Density dashboard.
... | [
"Device",
"is",
"monitored",
"with",
"Server",
"Density",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/serverdensity_device.py#L98-L215 |
32,822 | saltstack/salt | salt/queues/sqlite_queue.py | _conn | def _conn(queue):
'''
Return an sqlite connection
'''
queue_dir = __opts__['sqlite_queue_dir']
db = os.path.join(queue_dir, '{0}.db'.format(queue))
log.debug('Connecting to: %s', db)
con = sqlite3.connect(db)
tables = _list_tables(con)
if queue not in tables:
_create_table(c... | python | def _conn(queue):
'''
Return an sqlite connection
'''
queue_dir = __opts__['sqlite_queue_dir']
db = os.path.join(queue_dir, '{0}.db'.format(queue))
log.debug('Connecting to: %s', db)
con = sqlite3.connect(db)
tables = _list_tables(con)
if queue not in tables:
_create_table(c... | [
"def",
"_conn",
"(",
"queue",
")",
":",
"queue_dir",
"=",
"__opts__",
"[",
"'sqlite_queue_dir'",
"]",
"db",
"=",
"os",
".",
"path",
".",
"join",
"(",
"queue_dir",
",",
"'{0}.db'",
".",
"format",
"(",
"queue",
")",
")",
"log",
".",
"debug",
"(",
"'Con... | Return an sqlite connection | [
"Return",
"an",
"sqlite",
"connection"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/queues/sqlite_queue.py#L40-L52 |
32,823 | saltstack/salt | salt/queues/sqlite_queue.py | _list_items | def _list_items(queue):
'''
Private function to list contents of a queue
'''
con = _conn(queue)
with con:
cur = con.cursor()
cmd = 'SELECT name FROM {0}'.format(queue)
log.debug('SQL Query: %s', cmd)
cur.execute(cmd)
contents = cur.fetchall()
return conten... | python | def _list_items(queue):
'''
Private function to list contents of a queue
'''
con = _conn(queue)
with con:
cur = con.cursor()
cmd = 'SELECT name FROM {0}'.format(queue)
log.debug('SQL Query: %s', cmd)
cur.execute(cmd)
contents = cur.fetchall()
return conten... | [
"def",
"_list_items",
"(",
"queue",
")",
":",
"con",
"=",
"_conn",
"(",
"queue",
")",
"with",
"con",
":",
"cur",
"=",
"con",
".",
"cursor",
"(",
")",
"cmd",
"=",
"'SELECT name FROM {0}'",
".",
"format",
"(",
"queue",
")",
"log",
".",
"debug",
"(",
... | Private function to list contents of a queue | [
"Private",
"function",
"to",
"list",
"contents",
"of",
"a",
"queue"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/queues/sqlite_queue.py#L75-L86 |
32,824 | saltstack/salt | salt/queues/sqlite_queue.py | _list_queues | def _list_queues():
'''
Return a list of sqlite databases in the queue_dir
'''
queue_dir = __opts__['sqlite_queue_dir']
files = os.path.join(queue_dir, '*.db')
paths = glob.glob(files)
queues = [os.path.splitext(os.path.basename(item))[0] for item in paths]
return queues | python | def _list_queues():
'''
Return a list of sqlite databases in the queue_dir
'''
queue_dir = __opts__['sqlite_queue_dir']
files = os.path.join(queue_dir, '*.db')
paths = glob.glob(files)
queues = [os.path.splitext(os.path.basename(item))[0] for item in paths]
return queues | [
"def",
"_list_queues",
"(",
")",
":",
"queue_dir",
"=",
"__opts__",
"[",
"'sqlite_queue_dir'",
"]",
"files",
"=",
"os",
".",
"path",
".",
"join",
"(",
"queue_dir",
",",
"'*.db'",
")",
"paths",
"=",
"glob",
".",
"glob",
"(",
"files",
")",
"queues",
"=",... | Return a list of sqlite databases in the queue_dir | [
"Return",
"a",
"list",
"of",
"sqlite",
"databases",
"in",
"the",
"queue_dir"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/queues/sqlite_queue.py#L89-L98 |
32,825 | saltstack/salt | salt/queues/sqlite_queue.py | list_items | def list_items(queue):
'''
List contents of a queue
'''
itemstuple = _list_items(queue)
items = [item[0] for item in itemstuple]
return items | python | def list_items(queue):
'''
List contents of a queue
'''
itemstuple = _list_items(queue)
items = [item[0] for item in itemstuple]
return items | [
"def",
"list_items",
"(",
"queue",
")",
":",
"itemstuple",
"=",
"_list_items",
"(",
"queue",
")",
"items",
"=",
"[",
"item",
"[",
"0",
"]",
"for",
"item",
"in",
"itemstuple",
"]",
"return",
"items"
] | List contents of a queue | [
"List",
"contents",
"of",
"a",
"queue"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/queues/sqlite_queue.py#L109-L115 |
32,826 | saltstack/salt | salt/modules/boto_sns.py | get_all_topics | def get_all_topics(region=None, key=None, keyid=None, profile=None):
'''
Returns a list of the all topics..
CLI example::
salt myminion boto_sns.get_all_topics
'''
cache_key = _cache_get_key()
try:
return __context__[cache_key]
except KeyError:
pass
conn = _get... | python | def get_all_topics(region=None, key=None, keyid=None, profile=None):
'''
Returns a list of the all topics..
CLI example::
salt myminion boto_sns.get_all_topics
'''
cache_key = _cache_get_key()
try:
return __context__[cache_key]
except KeyError:
pass
conn = _get... | [
"def",
"get_all_topics",
"(",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"cache_key",
"=",
"_cache_get_key",
"(",
")",
"try",
":",
"return",
"__context__",
"[",
"cache_key",
"]",
"e... | Returns a list of the all topics..
CLI example::
salt myminion boto_sns.get_all_topics | [
"Returns",
"a",
"list",
"of",
"the",
"all",
"topics",
".."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_sns.py#L78-L99 |
32,827 | saltstack/salt | salt/modules/boto_sns.py | get_all_subscriptions_by_topic | def get_all_subscriptions_by_topic(name, region=None, key=None, keyid=None, profile=None):
'''
Get list of all subscriptions to a specific topic.
CLI example to delete a topic::
salt myminion boto_sns.get_all_subscriptions_by_topic mytopic region=us-east-1
'''
cache_key = _subscriptions_ca... | python | def get_all_subscriptions_by_topic(name, region=None, key=None, keyid=None, profile=None):
'''
Get list of all subscriptions to a specific topic.
CLI example to delete a topic::
salt myminion boto_sns.get_all_subscriptions_by_topic mytopic region=us-east-1
'''
cache_key = _subscriptions_ca... | [
"def",
"get_all_subscriptions_by_topic",
"(",
"name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"cache_key",
"=",
"_subscriptions_cache_key",
"(",
"name",
")",
"try",
":",
"return... | Get list of all subscriptions to a specific topic.
CLI example to delete a topic::
salt myminion boto_sns.get_all_subscriptions_by_topic mytopic region=us-east-1 | [
"Get",
"list",
"of",
"all",
"subscriptions",
"to",
"a",
"specific",
"topic",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_sns.py#L148-L165 |
32,828 | saltstack/salt | salt/modules/boto_sns.py | get_arn | def get_arn(name, region=None, key=None, keyid=None, profile=None):
'''
Returns the full ARN for a given topic name.
CLI example::
salt myminion boto_sns.get_arn mytopic
'''
if name.startswith('arn:aws:sns:'):
return name
account_id = __salt__['boto_iam.get_account_id'](
... | python | def get_arn(name, region=None, key=None, keyid=None, profile=None):
'''
Returns the full ARN for a given topic name.
CLI example::
salt myminion boto_sns.get_arn mytopic
'''
if name.startswith('arn:aws:sns:'):
return name
account_id = __salt__['boto_iam.get_account_id'](
... | [
"def",
"get_arn",
"(",
"name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"if",
"name",
".",
"startswith",
"(",
"'arn:aws:sns:'",
")",
":",
"return",
"name",
"account_id",
"=... | Returns the full ARN for a given topic name.
CLI example::
salt myminion boto_sns.get_arn mytopic | [
"Returns",
"the",
"full",
"ARN",
"for",
"a",
"given",
"topic",
"name",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_sns.py#L214-L229 |
32,829 | saltstack/salt | salt/utils/asynchronous.py | current_ioloop | def current_ioloop(io_loop):
'''
A context manager that will set the current ioloop to io_loop for the context
'''
orig_loop = tornado.ioloop.IOLoop.current()
io_loop.make_current()
try:
yield
finally:
orig_loop.make_current() | python | def current_ioloop(io_loop):
'''
A context manager that will set the current ioloop to io_loop for the context
'''
orig_loop = tornado.ioloop.IOLoop.current()
io_loop.make_current()
try:
yield
finally:
orig_loop.make_current() | [
"def",
"current_ioloop",
"(",
"io_loop",
")",
":",
"orig_loop",
"=",
"tornado",
".",
"ioloop",
".",
"IOLoop",
".",
"current",
"(",
")",
"io_loop",
".",
"make_current",
"(",
")",
"try",
":",
"yield",
"finally",
":",
"orig_loop",
".",
"make_current",
"(",
... | A context manager that will set the current ioloop to io_loop for the context | [
"A",
"context",
"manager",
"that",
"will",
"set",
"the",
"current",
"ioloop",
"to",
"io_loop",
"for",
"the",
"context"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/asynchronous.py#L15-L24 |
32,830 | saltstack/salt | salt/modules/saltutil.py | _get_top_file_envs | def _get_top_file_envs():
'''
Get all environments from the top file
'''
try:
return __context__['saltutil._top_file_envs']
except KeyError:
try:
st_ = salt.state.HighState(__opts__,
initial_pillar=__pillar__)
top = st_.g... | python | def _get_top_file_envs():
'''
Get all environments from the top file
'''
try:
return __context__['saltutil._top_file_envs']
except KeyError:
try:
st_ = salt.state.HighState(__opts__,
initial_pillar=__pillar__)
top = st_.g... | [
"def",
"_get_top_file_envs",
"(",
")",
":",
"try",
":",
"return",
"__context__",
"[",
"'saltutil._top_file_envs'",
"]",
"except",
"KeyError",
":",
"try",
":",
"st_",
"=",
"salt",
".",
"state",
".",
"HighState",
"(",
"__opts__",
",",
"initial_pillar",
"=",
"_... | Get all environments from the top file | [
"Get",
"all",
"environments",
"from",
"the",
"top",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L78-L98 |
32,831 | saltstack/salt | salt/modules/saltutil.py | _sync | def _sync(form, saltenv=None, extmod_whitelist=None, extmod_blacklist=None):
'''
Sync the given directory in the given environment
'''
if saltenv is None:
saltenv = _get_top_file_envs()
if isinstance(saltenv, six.string_types):
saltenv = saltenv.split(',')
ret, touched = salt.uti... | python | def _sync(form, saltenv=None, extmod_whitelist=None, extmod_blacklist=None):
'''
Sync the given directory in the given environment
'''
if saltenv is None:
saltenv = _get_top_file_envs()
if isinstance(saltenv, six.string_types):
saltenv = saltenv.split(',')
ret, touched = salt.uti... | [
"def",
"_sync",
"(",
"form",
",",
"saltenv",
"=",
"None",
",",
"extmod_whitelist",
"=",
"None",
",",
"extmod_blacklist",
"=",
"None",
")",
":",
"if",
"saltenv",
"is",
"None",
":",
"saltenv",
"=",
"_get_top_file_envs",
"(",
")",
"if",
"isinstance",
"(",
"... | Sync the given directory in the given environment | [
"Sync",
"the",
"given",
"directory",
"in",
"the",
"given",
"environment"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L101-L123 |
32,832 | saltstack/salt | salt/modules/saltutil.py | refresh_pillar | def refresh_pillar(**kwargs):
'''
Signal the minion to refresh the pillar data.
.. versionchanged:: Neon
The ``async`` argument has been added. The default value is True.
CLI Example:
.. code-block:: bash
salt '*' saltutil.refresh_pillar
salt '*' saltutil.refresh_pillar a... | python | def refresh_pillar(**kwargs):
'''
Signal the minion to refresh the pillar data.
.. versionchanged:: Neon
The ``async`` argument has been added. The default value is True.
CLI Example:
.. code-block:: bash
salt '*' saltutil.refresh_pillar
salt '*' saltutil.refresh_pillar a... | [
"def",
"refresh_pillar",
"(",
"*",
"*",
"kwargs",
")",
":",
"asynchronous",
"=",
"bool",
"(",
"kwargs",
".",
"get",
"(",
"'async'",
",",
"True",
")",
")",
"try",
":",
"if",
"asynchronous",
":",
"# If we're going to block, first setup a listener",
"ret",
"=",
... | Signal the minion to refresh the pillar data.
.. versionchanged:: Neon
The ``async`` argument has been added. The default value is True.
CLI Example:
.. code-block:: bash
salt '*' saltutil.refresh_pillar
salt '*' saltutil.refresh_pillar async=False | [
"Signal",
"the",
"minion",
"to",
"refresh",
"the",
"pillar",
"data",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1073-L1104 |
32,833 | saltstack/salt | salt/modules/saltutil.py | clear_cache | def clear_cache(days=-1):
'''
Forcibly removes all caches on a minion.
.. versionadded:: 2014.7.0
WARNING: The safest way to clear a minion cache is by first stopping
the minion and then deleting the cache files before restarting it.
CLI Example:
.. code-block:: bash
salt '*' sa... | python | def clear_cache(days=-1):
'''
Forcibly removes all caches on a minion.
.. versionadded:: 2014.7.0
WARNING: The safest way to clear a minion cache is by first stopping
the minion and then deleting the cache files before restarting it.
CLI Example:
.. code-block:: bash
salt '*' sa... | [
"def",
"clear_cache",
"(",
"days",
"=",
"-",
"1",
")",
":",
"threshold",
"=",
"time",
".",
"time",
"(",
")",
"-",
"days",
"*",
"24",
"*",
"60",
"*",
"60",
"for",
"root",
",",
"dirs",
",",
"files",
"in",
"salt",
".",
"utils",
".",
"files",
".",
... | Forcibly removes all caches on a minion.
.. versionadded:: 2014.7.0
WARNING: The safest way to clear a minion cache is by first stopping
the minion and then deleting the cache files before restarting it.
CLI Example:
.. code-block:: bash
salt '*' saltutil.clear_cache days=7 | [
"Forcibly",
"removes",
"all",
"caches",
"on",
"a",
"minion",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1175-L1204 |
32,834 | saltstack/salt | salt/modules/saltutil.py | clear_job_cache | def clear_job_cache(hours=24):
'''
Forcibly removes job cache folders and files on a minion.
.. versionadded:: 2018.3.0
WARNING: The safest way to clear a minion cache is by first stopping
the minion and then deleting the cache files before restarting it.
CLI Example:
.. code-block:: bas... | python | def clear_job_cache(hours=24):
'''
Forcibly removes job cache folders and files on a minion.
.. versionadded:: 2018.3.0
WARNING: The safest way to clear a minion cache is by first stopping
the minion and then deleting the cache files before restarting it.
CLI Example:
.. code-block:: bas... | [
"def",
"clear_job_cache",
"(",
"hours",
"=",
"24",
")",
":",
"threshold",
"=",
"time",
".",
"time",
"(",
")",
"-",
"hours",
"*",
"60",
"*",
"60",
"for",
"root",
",",
"dirs",
",",
"files",
"in",
"salt",
".",
"utils",
".",
"files",
".",
"safe_walk",
... | Forcibly removes job cache folders and files on a minion.
.. versionadded:: 2018.3.0
WARNING: The safest way to clear a minion cache is by first stopping
the minion and then deleting the cache files before restarting it.
CLI Example:
.. code-block:: bash
salt '*' saltutil.clear_job_cach... | [
"Forcibly",
"removes",
"job",
"cache",
"folders",
"and",
"files",
"on",
"a",
"minion",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1207-L1234 |
32,835 | saltstack/salt | salt/modules/saltutil.py | find_cached_job | def find_cached_job(jid):
'''
Return the data for a specific cached job id. Note this only works if
cache_jobs has previously been set to True on the minion.
CLI Example:
.. code-block:: bash
salt '*' saltutil.find_cached_job <job id>
'''
serial = salt.payload.Serial(__opts__)
... | python | def find_cached_job(jid):
'''
Return the data for a specific cached job id. Note this only works if
cache_jobs has previously been set to True on the minion.
CLI Example:
.. code-block:: bash
salt '*' saltutil.find_cached_job <job id>
'''
serial = salt.payload.Serial(__opts__)
... | [
"def",
"find_cached_job",
"(",
"jid",
")",
":",
"serial",
"=",
"salt",
".",
"payload",
".",
"Serial",
"(",
"__opts__",
")",
"proc_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"__opts__",
"[",
"'cachedir'",
"]",
",",
"'minion_jobs'",
")",
"job_dir",
... | Return the data for a specific cached job id. Note this only works if
cache_jobs has previously been set to True on the minion.
CLI Example:
.. code-block:: bash
salt '*' saltutil.find_cached_job <job id> | [
"Return",
"the",
"data",
"for",
"a",
"specific",
"cached",
"job",
"id",
".",
"Note",
"this",
"only",
"works",
"if",
"cache_jobs",
"has",
"previously",
"been",
"set",
"to",
"True",
"on",
"the",
"minion",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1289-L1322 |
32,836 | saltstack/salt | salt/modules/saltutil.py | signal_job | def signal_job(jid, sig):
'''
Sends a signal to the named salt job's process
CLI Example:
.. code-block:: bash
salt '*' saltutil.signal_job <job id> 15
'''
if HAS_PSUTIL is False:
log.warning('saltutil.signal job called, but psutil is not installed. '
'Inst... | python | def signal_job(jid, sig):
'''
Sends a signal to the named salt job's process
CLI Example:
.. code-block:: bash
salt '*' saltutil.signal_job <job id> 15
'''
if HAS_PSUTIL is False:
log.warning('saltutil.signal job called, but psutil is not installed. '
'Inst... | [
"def",
"signal_job",
"(",
"jid",
",",
"sig",
")",
":",
"if",
"HAS_PSUTIL",
"is",
"False",
":",
"log",
".",
"warning",
"(",
"'saltutil.signal job called, but psutil is not installed. '",
"'Install psutil to ensure more reliable and accurate PID '",
"'management.'",
")",
"for... | Sends a signal to the named salt job's process
CLI Example:
.. code-block:: bash
salt '*' saltutil.signal_job <job id> 15 | [
"Sends",
"a",
"signal",
"to",
"the",
"named",
"salt",
"job",
"s",
"process"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1325-L1360 |
32,837 | saltstack/salt | salt/modules/saltutil.py | regen_keys | def regen_keys():
'''
Used to regenerate the minion keys.
CLI Example:
.. code-block:: bash
salt '*' saltutil.regen_keys
'''
for fn_ in os.listdir(__opts__['pki_dir']):
path = os.path.join(__opts__['pki_dir'], fn_)
try:
os.remove(path)
except os.err... | python | def regen_keys():
'''
Used to regenerate the minion keys.
CLI Example:
.. code-block:: bash
salt '*' saltutil.regen_keys
'''
for fn_ in os.listdir(__opts__['pki_dir']):
path = os.path.join(__opts__['pki_dir'], fn_)
try:
os.remove(path)
except os.err... | [
"def",
"regen_keys",
"(",
")",
":",
"for",
"fn_",
"in",
"os",
".",
"listdir",
"(",
"__opts__",
"[",
"'pki_dir'",
"]",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"__opts__",
"[",
"'pki_dir'",
"]",
",",
"fn_",
")",
"try",
":",
"os"... | Used to regenerate the minion keys.
CLI Example:
.. code-block:: bash
salt '*' saltutil.regen_keys | [
"Used",
"to",
"regenerate",
"the",
"minion",
"keys",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1425-L1444 |
32,838 | saltstack/salt | salt/modules/saltutil.py | revoke_auth | def revoke_auth(preserve_minion_cache=False):
'''
The minion sends a request to the master to revoke its own key.
Note that the minion session will be revoked and the minion may
not be able to return the result of this command back to the master.
If the 'preserve_minion_cache' flag is set to True, ... | python | def revoke_auth(preserve_minion_cache=False):
'''
The minion sends a request to the master to revoke its own key.
Note that the minion session will be revoked and the minion may
not be able to return the result of this command back to the master.
If the 'preserve_minion_cache' flag is set to True, ... | [
"def",
"revoke_auth",
"(",
"preserve_minion_cache",
"=",
"False",
")",
":",
"masters",
"=",
"list",
"(",
")",
"ret",
"=",
"True",
"if",
"'master_uri_list'",
"in",
"__opts__",
":",
"for",
"master_uri",
"in",
"__opts__",
"[",
"'master_uri_list'",
"]",
":",
"ma... | The minion sends a request to the master to revoke its own key.
Note that the minion session will be revoked and the minion may
not be able to return the result of this command back to the master.
If the 'preserve_minion_cache' flag is set to True, the master
cache for this minion will not be removed.
... | [
"The",
"minion",
"sends",
"a",
"request",
"to",
"the",
"master",
"to",
"revoke",
"its",
"own",
"key",
".",
"Note",
"that",
"the",
"minion",
"session",
"will",
"be",
"revoked",
"and",
"the",
"minion",
"may",
"not",
"be",
"able",
"to",
"return",
"the",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1447-L1483 |
32,839 | saltstack/salt | salt/modules/saltutil.py | runner | def runner(name, arg=None, kwarg=None, full_return=False, saltenv='base', jid=None, asynchronous=False, **kwargs):
'''
Execute a runner function. This function must be run on the master,
either by targeting a minion running on a master or by using
salt-call on a master.
.. versionadded:: 2014.7.0
... | python | def runner(name, arg=None, kwarg=None, full_return=False, saltenv='base', jid=None, asynchronous=False, **kwargs):
'''
Execute a runner function. This function must be run on the master,
either by targeting a minion running on a master or by using
salt-call on a master.
.. versionadded:: 2014.7.0
... | [
"def",
"runner",
"(",
"name",
",",
"arg",
"=",
"None",
",",
"kwarg",
"=",
"None",
",",
"full_return",
"=",
"False",
",",
"saltenv",
"=",
"'base'",
",",
"jid",
"=",
"None",
",",
"asynchronous",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
... | Execute a runner function. This function must be run on the master,
either by targeting a minion running on a master or by using
salt-call on a master.
.. versionadded:: 2014.7.0
name
The name of the function to run
kwargs
Any keyword arguments to pass to the runner function
... | [
"Execute",
"a",
"runner",
"function",
".",
"This",
"function",
"must",
"be",
"run",
"on",
"the",
"master",
"either",
"by",
"targeting",
"a",
"minion",
"running",
"on",
"a",
"master",
"or",
"by",
"using",
"salt",
"-",
"call",
"on",
"a",
"master",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1625-L1697 |
32,840 | saltstack/salt | salt/modules/saltutil.py | wheel | def wheel(name, *args, **kwargs):
'''
Execute a wheel module and function. This function must be run against a
minion that is local to the master.
.. versionadded:: 2014.7.0
name
The name of the function to run
args
Any positional arguments to pass to the wheel function. A com... | python | def wheel(name, *args, **kwargs):
'''
Execute a wheel module and function. This function must be run against a
minion that is local to the master.
.. versionadded:: 2014.7.0
name
The name of the function to run
args
Any positional arguments to pass to the wheel function. A com... | [
"def",
"wheel",
"(",
"name",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"jid",
"=",
"kwargs",
".",
"pop",
"(",
"'__orchestration_jid__'",
",",
"None",
")",
"saltenv",
"=",
"kwargs",
".",
"pop",
"(",
"'__env__'",
",",
"'base'",
")",
"if",
... | Execute a wheel module and function. This function must be run against a
minion that is local to the master.
.. versionadded:: 2014.7.0
name
The name of the function to run
args
Any positional arguments to pass to the wheel function. A common example
of this would be the ``mat... | [
"Execute",
"a",
"wheel",
"module",
"and",
"function",
".",
"This",
"function",
"must",
"be",
"run",
"against",
"a",
"minion",
"that",
"is",
"local",
"to",
"the",
"master",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1700-L1794 |
32,841 | saltstack/salt | salt/modules/saltutil.py | mmodule | def mmodule(saltenv, fun, *args, **kwargs):
'''
Loads minion modules from an environment so that they can be used in pillars
for that environment
CLI Example:
.. code-block:: bash
salt '*' saltutil.mmodule base test.ping
'''
mminion = _MMinion(saltenv)
return mminion.functions... | python | def mmodule(saltenv, fun, *args, **kwargs):
'''
Loads minion modules from an environment so that they can be used in pillars
for that environment
CLI Example:
.. code-block:: bash
salt '*' saltutil.mmodule base test.ping
'''
mminion = _MMinion(saltenv)
return mminion.functions... | [
"def",
"mmodule",
"(",
"saltenv",
",",
"fun",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"mminion",
"=",
"_MMinion",
"(",
"saltenv",
")",
"return",
"mminion",
".",
"functions",
"[",
"fun",
"]",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
... | Loads minion modules from an environment so that they can be used in pillars
for that environment
CLI Example:
.. code-block:: bash
salt '*' saltutil.mmodule base test.ping | [
"Loads",
"minion",
"modules",
"from",
"an",
"environment",
"so",
"that",
"they",
"can",
"be",
"used",
"in",
"pillars",
"for",
"that",
"environment"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1830-L1842 |
32,842 | saltstack/salt | salt/modules/zenoss.py | _session | def _session():
'''
Create a session to be used when connecting to Zenoss.
'''
config = __salt__['config.option']('zenoss')
session = requests.session()
session.auth = (config.get('username'), config.get('password'))
session.verify = False
session.headers.update({'Content-type': 'applic... | python | def _session():
'''
Create a session to be used when connecting to Zenoss.
'''
config = __salt__['config.option']('zenoss')
session = requests.session()
session.auth = (config.get('username'), config.get('password'))
session.verify = False
session.headers.update({'Content-type': 'applic... | [
"def",
"_session",
"(",
")",
":",
"config",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"'zenoss'",
")",
"session",
"=",
"requests",
".",
"session",
"(",
")",
"session",
".",
"auth",
"=",
"(",
"config",
".",
"get",
"(",
"'username'",
")",
",",
... | Create a session to be used when connecting to Zenoss. | [
"Create",
"a",
"session",
"to",
"be",
"used",
"when",
"connecting",
"to",
"Zenoss",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zenoss.py#L68-L78 |
32,843 | saltstack/salt | salt/modules/zenoss.py | _router_request | def _router_request(router, method, data=None):
'''
Make a request to the Zenoss API router
'''
if router not in ROUTERS:
return False
req_data = salt.utils.json.dumps([dict(
action=router,
method=method,
data=data,
type='rpc',
tid=1)])
config = ... | python | def _router_request(router, method, data=None):
'''
Make a request to the Zenoss API router
'''
if router not in ROUTERS:
return False
req_data = salt.utils.json.dumps([dict(
action=router,
method=method,
data=data,
type='rpc',
tid=1)])
config = ... | [
"def",
"_router_request",
"(",
"router",
",",
"method",
",",
"data",
"=",
"None",
")",
":",
"if",
"router",
"not",
"in",
"ROUTERS",
":",
"return",
"False",
"req_data",
"=",
"salt",
".",
"utils",
".",
"json",
".",
"dumps",
"(",
"[",
"dict",
"(",
"acti... | Make a request to the Zenoss API router | [
"Make",
"a",
"request",
"to",
"the",
"Zenoss",
"API",
"router"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zenoss.py#L81-L107 |
32,844 | saltstack/salt | salt/modules/zenoss.py | find_device | def find_device(device=None):
'''
Find a device in Zenoss. If device not found, returns None.
Parameters:
device: (Optional) Will use the grain 'fqdn' by default
CLI Example:
salt '*' zenoss.find_device
'''
data = [{'uid': '/zport/dmd/Devices', 'params': {}, 'limit': N... | python | def find_device(device=None):
'''
Find a device in Zenoss. If device not found, returns None.
Parameters:
device: (Optional) Will use the grain 'fqdn' by default
CLI Example:
salt '*' zenoss.find_device
'''
data = [{'uid': '/zport/dmd/Devices', 'params': {}, 'limit': N... | [
"def",
"find_device",
"(",
"device",
"=",
"None",
")",
":",
"data",
"=",
"[",
"{",
"'uid'",
":",
"'/zport/dmd/Devices'",
",",
"'params'",
":",
"{",
"}",
",",
"'limit'",
":",
"None",
"}",
"]",
"all_devices",
"=",
"_router_request",
"(",
"'DeviceRouter'",
... | Find a device in Zenoss. If device not found, returns None.
Parameters:
device: (Optional) Will use the grain 'fqdn' by default
CLI Example:
salt '*' zenoss.find_device | [
"Find",
"a",
"device",
"in",
"Zenoss",
".",
"If",
"device",
"not",
"found",
"returns",
"None",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zenoss.py#L118-L139 |
32,845 | saltstack/salt | salt/modules/zenoss.py | add_device | def add_device(device=None, device_class=None, collector='localhost', prod_state=1000):
'''
A function to connect to a zenoss server and add a new device entry.
Parameters:
device: (Optional) Will use the grain 'fqdn' by default.
device_class: (Optional) The device class to use. I... | python | def add_device(device=None, device_class=None, collector='localhost', prod_state=1000):
'''
A function to connect to a zenoss server and add a new device entry.
Parameters:
device: (Optional) Will use the grain 'fqdn' by default.
device_class: (Optional) The device class to use. I... | [
"def",
"add_device",
"(",
"device",
"=",
"None",
",",
"device_class",
"=",
"None",
",",
"collector",
"=",
"'localhost'",
",",
"prod_state",
"=",
"1000",
")",
":",
"if",
"not",
"device",
":",
"device",
"=",
"__salt__",
"[",
"'grains.get'",
"]",
"(",
"'fqd... | A function to connect to a zenoss server and add a new device entry.
Parameters:
device: (Optional) Will use the grain 'fqdn' by default.
device_class: (Optional) The device class to use. If none, will determine based on kernel grain.
collector: (Optional) The collector to us... | [
"A",
"function",
"to",
"connect",
"to",
"a",
"zenoss",
"server",
"and",
"add",
"a",
"new",
"device",
"entry",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zenoss.py#L161-L183 |
32,846 | saltstack/salt | salt/modules/zenoss.py | set_prod_state | def set_prod_state(prod_state, device=None):
'''
A function to set the prod_state in zenoss.
Parameters:
prod_state: (Required) Integer value of the state
device: (Optional) Will use the grain 'fqdn' by default.
CLI Example:
salt zenoss.set_prod_state 1000 hostname
... | python | def set_prod_state(prod_state, device=None):
'''
A function to set the prod_state in zenoss.
Parameters:
prod_state: (Required) Integer value of the state
device: (Optional) Will use the grain 'fqdn' by default.
CLI Example:
salt zenoss.set_prod_state 1000 hostname
... | [
"def",
"set_prod_state",
"(",
"prod_state",
",",
"device",
"=",
"None",
")",
":",
"if",
"not",
"device",
":",
"device",
"=",
"__salt__",
"[",
"'grains.get'",
"]",
"(",
"'fqdn'",
")",
"device_object",
"=",
"find_device",
"(",
"device",
")",
"if",
"not",
"... | A function to set the prod_state in zenoss.
Parameters:
prod_state: (Required) Integer value of the state
device: (Optional) Will use the grain 'fqdn' by default.
CLI Example:
salt zenoss.set_prod_state 1000 hostname | [
"A",
"function",
"to",
"set",
"the",
"prod_state",
"in",
"zenoss",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zenoss.py#L186-L208 |
32,847 | saltstack/salt | salt/modules/restartcheck.py | _valid_deleted_file | def _valid_deleted_file(path):
'''
Filters file path against unwanted directories and decides whether file is marked as deleted.
Returns:
True if file is desired deleted file, else False.
Args:
path: A string - path to file
'''
ret = False
if path.endswith(' (deleted)'):
... | python | def _valid_deleted_file(path):
'''
Filters file path against unwanted directories and decides whether file is marked as deleted.
Returns:
True if file is desired deleted file, else False.
Args:
path: A string - path to file
'''
ret = False
if path.endswith(' (deleted)'):
... | [
"def",
"_valid_deleted_file",
"(",
"path",
")",
":",
"ret",
"=",
"False",
"if",
"path",
".",
"endswith",
"(",
"' (deleted)'",
")",
":",
"ret",
"=",
"True",
"if",
"re",
".",
"compile",
"(",
"r\"\\(path inode=[0-9]+\\)$\"",
")",
".",
"search",
"(",
"path",
... | Filters file path against unwanted directories and decides whether file is marked as deleted.
Returns:
True if file is desired deleted file, else False.
Args:
path: A string - path to file | [
"Filters",
"file",
"path",
"against",
"unwanted",
"directories",
"and",
"decides",
"whether",
"file",
"is",
"marked",
"as",
"deleted",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/restartcheck.py#L93-L112 |
32,848 | saltstack/salt | salt/modules/restartcheck.py | _format_output | def _format_output(kernel_restart, packages, verbose, restartable, nonrestartable, restartservicecommands,
restartinitcommands):
'''
Formats the output of the restartcheck module.
Returns:
String - formatted output.
Args:
kernel_restart: indicates that newer kernel i... | python | def _format_output(kernel_restart, packages, verbose, restartable, nonrestartable, restartservicecommands,
restartinitcommands):
'''
Formats the output of the restartcheck module.
Returns:
String - formatted output.
Args:
kernel_restart: indicates that newer kernel i... | [
"def",
"_format_output",
"(",
"kernel_restart",
",",
"packages",
",",
"verbose",
",",
"restartable",
",",
"nonrestartable",
",",
"restartservicecommands",
",",
"restartinitcommands",
")",
":",
"if",
"not",
"verbose",
":",
"packages",
"=",
"restartable",
"+",
"nonr... | Formats the output of the restartcheck module.
Returns:
String - formatted output.
Args:
kernel_restart: indicates that newer kernel is instaled
packages: list of packages that should be restarted
verbose: enables extensive output
restartable: list of restartable packag... | [
"Formats",
"the",
"output",
"of",
"the",
"restartcheck",
"module",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/restartcheck.py#L185-L240 |
32,849 | saltstack/salt | salt/modules/restartcheck.py | _file_changed_nilrt | def _file_changed_nilrt(full_filepath):
'''
Detect whether a file changed in an NILinuxRT system using md5sum and timestamp
files from a state directory.
Returns:
- False if md5sum/timestamp state files don't exist
- True/False depending if ``base_filename`` got modified/touch... | python | def _file_changed_nilrt(full_filepath):
'''
Detect whether a file changed in an NILinuxRT system using md5sum and timestamp
files from a state directory.
Returns:
- False if md5sum/timestamp state files don't exist
- True/False depending if ``base_filename`` got modified/touch... | [
"def",
"_file_changed_nilrt",
"(",
"full_filepath",
")",
":",
"rs_state_dir",
"=",
"\"/var/lib/salt/restartcheck_state\"",
"base_filename",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"full_filepath",
")",
"timestamp_file",
"=",
"os",
".",
"path",
".",
"join",
"... | Detect whether a file changed in an NILinuxRT system using md5sum and timestamp
files from a state directory.
Returns:
- False if md5sum/timestamp state files don't exist
- True/False depending if ``base_filename`` got modified/touched | [
"Detect",
"whether",
"a",
"file",
"changed",
"in",
"an",
"NILinuxRT",
"system",
"using",
"md5sum",
"and",
"timestamp",
"files",
"from",
"a",
"state",
"directory",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/restartcheck.py#L360-L384 |
32,850 | saltstack/salt | salt/modules/restartcheck.py | _sysapi_changed_nilrt | def _sysapi_changed_nilrt():
'''
Besides the normal Linux kernel driver interfaces, NILinuxRT-supported hardware features an
extensible, plugin-based device enumeration and configuration interface named "System API".
When an installed package is extending the API it is very hard to know all repercurssio... | python | def _sysapi_changed_nilrt():
'''
Besides the normal Linux kernel driver interfaces, NILinuxRT-supported hardware features an
extensible, plugin-based device enumeration and configuration interface named "System API".
When an installed package is extending the API it is very hard to know all repercurssio... | [
"def",
"_sysapi_changed_nilrt",
"(",
")",
":",
"nisysapi_path",
"=",
"'/usr/local/natinst/share/nisysapi.ini'",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"nisysapi_path",
")",
"and",
"_file_changed_nilrt",
"(",
"nisysapi_path",
")",
":",
"return",
"True",
"restar... | Besides the normal Linux kernel driver interfaces, NILinuxRT-supported hardware features an
extensible, plugin-based device enumeration and configuration interface named "System API".
When an installed package is extending the API it is very hard to know all repercurssions and
actions to be taken, so reboot... | [
"Besides",
"the",
"normal",
"Linux",
"kernel",
"driver",
"interfaces",
"NILinuxRT",
"-",
"supported",
"hardware",
"features",
"an",
"extensible",
"plugin",
"-",
"based",
"device",
"enumeration",
"and",
"configuration",
"interface",
"named",
"System",
"API",
".",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/restartcheck.py#L402-L438 |
32,851 | saltstack/salt | salt/states/pbm.py | default_storage_policy_assigned | def default_storage_policy_assigned(name, policy, datastore):
'''
Assigns a default storage policy to a datastore
policy
Name of storage policy
datastore
Name of datastore
'''
log.info('Running state %s for policy \'%s\', datastore \'%s\'.',
name, policy, datastore... | python | def default_storage_policy_assigned(name, policy, datastore):
'''
Assigns a default storage policy to a datastore
policy
Name of storage policy
datastore
Name of datastore
'''
log.info('Running state %s for policy \'%s\', datastore \'%s\'.',
name, policy, datastore... | [
"def",
"default_storage_policy_assigned",
"(",
"name",
",",
"policy",
",",
"datastore",
")",
":",
"log",
".",
"info",
"(",
"'Running state %s for policy \\'%s\\', datastore \\'%s\\'.'",
",",
"name",
",",
"policy",
",",
"datastore",
")",
"changes",
"=",
"{",
"}",
"... | Assigns a default storage policy to a datastore
policy
Name of storage policy
datastore
Name of datastore | [
"Assigns",
"a",
"default",
"storage",
"policy",
"to",
"a",
"datastore"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pbm.py#L441-L500 |
32,852 | saltstack/salt | salt/modules/cloud.py | _get_client | def _get_client():
'''
Return a cloud client
'''
client = salt.cloud.CloudClient(
os.path.join(os.path.dirname(__opts__['conf_file']), 'cloud'),
pillars=copy.deepcopy(__pillar__.get('cloud', {}))
)
return client | python | def _get_client():
'''
Return a cloud client
'''
client = salt.cloud.CloudClient(
os.path.join(os.path.dirname(__opts__['conf_file']), 'cloud'),
pillars=copy.deepcopy(__pillar__.get('cloud', {}))
)
return client | [
"def",
"_get_client",
"(",
")",
":",
"client",
"=",
"salt",
".",
"cloud",
".",
"CloudClient",
"(",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__opts__",
"[",
"'conf_file'",
"]",
")",
",",
"'cloud'",
")",
",",
"pil... | Return a cloud client | [
"Return",
"a",
"cloud",
"client"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L41-L49 |
32,853 | saltstack/salt | salt/modules/cloud.py | has_instance | def has_instance(name, provider=None):
'''
Return true if the instance is found on a provider
CLI Example:
.. code-block:: bash
salt minionname cloud.has_instance myinstance
'''
data = get_instance(name, provider)
if data is None:
return False
return True | python | def has_instance(name, provider=None):
'''
Return true if the instance is found on a provider
CLI Example:
.. code-block:: bash
salt minionname cloud.has_instance myinstance
'''
data = get_instance(name, provider)
if data is None:
return False
return True | [
"def",
"has_instance",
"(",
"name",
",",
"provider",
"=",
"None",
")",
":",
"data",
"=",
"get_instance",
"(",
"name",
",",
"provider",
")",
"if",
"data",
"is",
"None",
":",
"return",
"False",
"return",
"True"
] | Return true if the instance is found on a provider
CLI Example:
.. code-block:: bash
salt minionname cloud.has_instance myinstance | [
"Return",
"true",
"if",
"the",
"instance",
"is",
"found",
"on",
"a",
"provider"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L140-L153 |
32,854 | saltstack/salt | salt/modules/cloud.py | get_instance | def get_instance(name, provider=None):
'''
Return details on an instance.
Similar to the cloud action show_instance
but returns only the instance details.
CLI Example:
.. code-block:: bash
salt minionname cloud.get_instance myinstance
SLS Example:
.. code-block:: bash
... | python | def get_instance(name, provider=None):
'''
Return details on an instance.
Similar to the cloud action show_instance
but returns only the instance details.
CLI Example:
.. code-block:: bash
salt minionname cloud.get_instance myinstance
SLS Example:
.. code-block:: bash
... | [
"def",
"get_instance",
"(",
"name",
",",
"provider",
"=",
"None",
")",
":",
"data",
"=",
"action",
"(",
"fun",
"=",
"'show_instance'",
",",
"names",
"=",
"[",
"name",
"]",
",",
"provider",
"=",
"provider",
")",
"info",
"=",
"salt",
".",
"utils",
".",... | Return details on an instance.
Similar to the cloud action show_instance
but returns only the instance details.
CLI Example:
.. code-block:: bash
salt minionname cloud.get_instance myinstance
SLS Example:
.. code-block:: bash
{{ salt['cloud.get_instance']('myinstance')['ma... | [
"Return",
"details",
"on",
"an",
"instance",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L156-L183 |
32,855 | saltstack/salt | salt/modules/cloud.py | profile_ | def profile_(profile, names, vm_overrides=None, opts=None, **kwargs):
'''
Spin up an instance using Salt Cloud
CLI Example:
.. code-block:: bash
salt minionname cloud.profile my-gce-config myinstance
'''
client = _get_client()
if isinstance(opts, dict):
client.opts.update(... | python | def profile_(profile, names, vm_overrides=None, opts=None, **kwargs):
'''
Spin up an instance using Salt Cloud
CLI Example:
.. code-block:: bash
salt minionname cloud.profile my-gce-config myinstance
'''
client = _get_client()
if isinstance(opts, dict):
client.opts.update(... | [
"def",
"profile_",
"(",
"profile",
",",
"names",
",",
"vm_overrides",
"=",
"None",
",",
"opts",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"client",
"=",
"_get_client",
"(",
")",
"if",
"isinstance",
"(",
"opts",
",",
"dict",
")",
":",
"client",
... | Spin up an instance using Salt Cloud
CLI Example:
.. code-block:: bash
salt minionname cloud.profile my-gce-config myinstance | [
"Spin",
"up",
"an",
"instance",
"using",
"Salt",
"Cloud"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L186-L200 |
32,856 | saltstack/salt | salt/modules/cloud.py | volume_list | def volume_list(provider):
'''
List block storage volumes
CLI Example:
.. code-block:: bash
salt minionname cloud.volume_list my-nova
'''
client = _get_client()
info = client.extra_action(action='volume_list', provider=provider, names='name')
return info['name'] | python | def volume_list(provider):
'''
List block storage volumes
CLI Example:
.. code-block:: bash
salt minionname cloud.volume_list my-nova
'''
client = _get_client()
info = client.extra_action(action='volume_list', provider=provider, names='name')
return info['name'] | [
"def",
"volume_list",
"(",
"provider",
")",
":",
"client",
"=",
"_get_client",
"(",
")",
"info",
"=",
"client",
".",
"extra_action",
"(",
"action",
"=",
"'volume_list'",
",",
"provider",
"=",
"provider",
",",
"names",
"=",
"'name'",
")",
"return",
"info",
... | List block storage volumes
CLI Example:
.. code-block:: bash
salt minionname cloud.volume_list my-nova | [
"List",
"block",
"storage",
"volumes"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L292-L305 |
32,857 | saltstack/salt | salt/modules/cloud.py | volume_attach | def volume_attach(provider, names, **kwargs):
'''
Attach volume to a server
CLI Example:
.. code-block:: bash
salt minionname cloud.volume_attach my-nova myblock server_name=myserver device='/dev/xvdf'
'''
client = _get_client()
info = client.extra_action(provider=provider, names... | python | def volume_attach(provider, names, **kwargs):
'''
Attach volume to a server
CLI Example:
.. code-block:: bash
salt minionname cloud.volume_attach my-nova myblock server_name=myserver device='/dev/xvdf'
'''
client = _get_client()
info = client.extra_action(provider=provider, names... | [
"def",
"volume_attach",
"(",
"provider",
",",
"names",
",",
"*",
"*",
"kwargs",
")",
":",
"client",
"=",
"_get_client",
"(",
")",
"info",
"=",
"client",
".",
"extra_action",
"(",
"provider",
"=",
"provider",
",",
"names",
"=",
"names",
",",
"action",
"... | Attach volume to a server
CLI Example:
.. code-block:: bash
salt minionname cloud.volume_attach my-nova myblock server_name=myserver device='/dev/xvdf' | [
"Attach",
"volume",
"to",
"a",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L340-L353 |
32,858 | saltstack/salt | salt/modules/cloud.py | network_list | def network_list(provider):
'''
List private networks
CLI Example:
.. code-block:: bash
salt minionname cloud.network_list my-nova
'''
client = _get_client()
return client.extra_action(action='network_list', provider=provider, names='names') | python | def network_list(provider):
'''
List private networks
CLI Example:
.. code-block:: bash
salt minionname cloud.network_list my-nova
'''
client = _get_client()
return client.extra_action(action='network_list', provider=provider, names='names') | [
"def",
"network_list",
"(",
"provider",
")",
":",
"client",
"=",
"_get_client",
"(",
")",
"return",
"client",
".",
"extra_action",
"(",
"action",
"=",
"'network_list'",
",",
"provider",
"=",
"provider",
",",
"names",
"=",
"'names'",
")"
] | List private networks
CLI Example:
.. code-block:: bash
salt minionname cloud.network_list my-nova | [
"List",
"private",
"networks"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L372-L384 |
32,859 | saltstack/salt | salt/modules/cloud.py | network_create | def network_create(provider, names, **kwargs):
'''
Create private network
CLI Example:
.. code-block:: bash
salt minionname cloud.network_create my-nova names=['salt'] cidr='192.168.100.0/24'
'''
client = _get_client()
return client.extra_action(provider=provider, names=names, ac... | python | def network_create(provider, names, **kwargs):
'''
Create private network
CLI Example:
.. code-block:: bash
salt minionname cloud.network_create my-nova names=['salt'] cidr='192.168.100.0/24'
'''
client = _get_client()
return client.extra_action(provider=provider, names=names, ac... | [
"def",
"network_create",
"(",
"provider",
",",
"names",
",",
"*",
"*",
"kwargs",
")",
":",
"client",
"=",
"_get_client",
"(",
")",
"return",
"client",
".",
"extra_action",
"(",
"provider",
"=",
"provider",
",",
"names",
"=",
"names",
",",
"action",
"=",
... | Create private network
CLI Example:
.. code-block:: bash
salt minionname cloud.network_create my-nova names=['salt'] cidr='192.168.100.0/24' | [
"Create",
"private",
"network"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L387-L399 |
32,860 | saltstack/salt | salt/modules/cloud.py | virtual_interface_list | def virtual_interface_list(provider, names, **kwargs):
'''
List virtual interfaces on a server
CLI Example:
.. code-block:: bash
salt minionname cloud.virtual_interface_list my-nova names=['salt-master']
'''
client = _get_client()
return client.extra_action(provider=provider, nam... | python | def virtual_interface_list(provider, names, **kwargs):
'''
List virtual interfaces on a server
CLI Example:
.. code-block:: bash
salt minionname cloud.virtual_interface_list my-nova names=['salt-master']
'''
client = _get_client()
return client.extra_action(provider=provider, nam... | [
"def",
"virtual_interface_list",
"(",
"provider",
",",
"names",
",",
"*",
"*",
"kwargs",
")",
":",
"client",
"=",
"_get_client",
"(",
")",
"return",
"client",
".",
"extra_action",
"(",
"provider",
"=",
"provider",
",",
"names",
"=",
"names",
",",
"action",... | List virtual interfaces on a server
CLI Example:
.. code-block:: bash
salt minionname cloud.virtual_interface_list my-nova names=['salt-master'] | [
"List",
"virtual",
"interfaces",
"on",
"a",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L402-L414 |
32,861 | saltstack/salt | salt/modules/cloud.py | virtual_interface_create | def virtual_interface_create(provider, names, **kwargs):
'''
Attach private interfaces to a server
CLI Example:
.. code-block:: bash
salt minionname cloud.virtual_interface_create my-nova names=['salt-master'] net_name='salt'
'''
client = _get_client()
return client.extra_action(... | python | def virtual_interface_create(provider, names, **kwargs):
'''
Attach private interfaces to a server
CLI Example:
.. code-block:: bash
salt minionname cloud.virtual_interface_create my-nova names=['salt-master'] net_name='salt'
'''
client = _get_client()
return client.extra_action(... | [
"def",
"virtual_interface_create",
"(",
"provider",
",",
"names",
",",
"*",
"*",
"kwargs",
")",
":",
"client",
"=",
"_get_client",
"(",
")",
"return",
"client",
".",
"extra_action",
"(",
"provider",
"=",
"provider",
",",
"names",
"=",
"names",
",",
"action... | Attach private interfaces to a server
CLI Example:
.. code-block:: bash
salt minionname cloud.virtual_interface_create my-nova names=['salt-master'] net_name='salt' | [
"Attach",
"private",
"interfaces",
"to",
"a",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L417-L429 |
32,862 | saltstack/salt | salt/modules/netbsd_sysctl.py | get | def get(name):
'''
Return a single sysctl parameter for this minion
CLI Example:
.. code-block:: bash
salt '*' sysctl.get hw.physmem
'''
cmd = 'sysctl -n {0}'.format(name)
out = __salt__['cmd.run'](cmd, python_shell=False)
return out | python | def get(name):
'''
Return a single sysctl parameter for this minion
CLI Example:
.. code-block:: bash
salt '*' sysctl.get hw.physmem
'''
cmd = 'sysctl -n {0}'.format(name)
out = __salt__['cmd.run'](cmd, python_shell=False)
return out | [
"def",
"get",
"(",
"name",
")",
":",
"cmd",
"=",
"'sysctl -n {0}'",
".",
"format",
"(",
"name",
")",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
",",
"python_shell",
"=",
"False",
")",
"return",
"out"
] | Return a single sysctl parameter for this minion
CLI Example:
.. code-block:: bash
salt '*' sysctl.get hw.physmem | [
"Return",
"a",
"single",
"sysctl",
"parameter",
"for",
"this",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbsd_sysctl.py#L69-L81 |
32,863 | saltstack/salt | salt/states/pushover.py | post_message | def post_message(name,
user=None,
device=None,
message=None,
title=None,
priority=None,
expire=None,
retry=None,
sound=None,
api_version=1,
token=None... | python | def post_message(name,
user=None,
device=None,
message=None,
title=None,
priority=None,
expire=None,
retry=None,
sound=None,
api_version=1,
token=None... | [
"def",
"post_message",
"(",
"name",
",",
"user",
"=",
"None",
",",
"device",
"=",
"None",
",",
"message",
"=",
"None",
",",
"title",
"=",
"None",
",",
"priority",
"=",
"None",
",",
"expire",
"=",
"None",
",",
"retry",
"=",
"None",
",",
"sound",
"="... | Send a message to a PushOver channel.
.. code-block:: yaml
pushover-message:
pushover.post_message:
- user: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- title: Salt Returner
- device: phone
- priority: -1
... | [
"Send",
"a",
"message",
"to",
"a",
"PushOver",
"channel",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pushover.py#L42-L137 |
32,864 | saltstack/salt | salt/modules/dig.py | check_ip | def check_ip(addr):
'''
Check if address is a valid IP. returns True if valid, otherwise False.
CLI Example:
.. code-block:: bash
salt ns1 dig.check_ip 127.0.0.1
salt ns1 dig.check_ip 1111:2222:3333:4444:5555:6666:7777:8888
'''
try:
addr = addr.rsplit('/', 1)
exce... | python | def check_ip(addr):
'''
Check if address is a valid IP. returns True if valid, otherwise False.
CLI Example:
.. code-block:: bash
salt ns1 dig.check_ip 127.0.0.1
salt ns1 dig.check_ip 1111:2222:3333:4444:5555:6666:7777:8888
'''
try:
addr = addr.rsplit('/', 1)
exce... | [
"def",
"check_ip",
"(",
"addr",
")",
":",
"try",
":",
"addr",
"=",
"addr",
".",
"rsplit",
"(",
"'/'",
",",
"1",
")",
"except",
"AttributeError",
":",
"# Non-string passed",
"return",
"False",
"if",
"salt",
".",
"utils",
".",
"network",
".",
"is_ipv4",
... | Check if address is a valid IP. returns True if valid, otherwise False.
CLI Example:
.. code-block:: bash
salt ns1 dig.check_ip 127.0.0.1
salt ns1 dig.check_ip 1111:2222:3333:4444:5555:6666:7777:8888 | [
"Check",
"if",
"address",
"is",
"a",
"valid",
"IP",
".",
"returns",
"True",
"if",
"valid",
"otherwise",
"False",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dig.py#L32-L72 |
32,865 | saltstack/salt | salt/modules/dig.py | AAAA | def AAAA(host, nameserver=None):
'''
Return the AAAA record for ``host``.
Always returns a list.
CLI Example:
.. code-block:: bash
salt ns1 dig.AAAA www.google.com
'''
dig = ['dig', '+short', six.text_type(host), 'AAAA']
if nameserver is not None:
dig.append('@{0}'.f... | python | def AAAA(host, nameserver=None):
'''
Return the AAAA record for ``host``.
Always returns a list.
CLI Example:
.. code-block:: bash
salt ns1 dig.AAAA www.google.com
'''
dig = ['dig', '+short', six.text_type(host), 'AAAA']
if nameserver is not None:
dig.append('@{0}'.f... | [
"def",
"AAAA",
"(",
"host",
",",
"nameserver",
"=",
"None",
")",
":",
"dig",
"=",
"[",
"'dig'",
",",
"'+short'",
",",
"six",
".",
"text_type",
"(",
"host",
")",
",",
"'AAAA'",
"]",
"if",
"nameserver",
"is",
"not",
"None",
":",
"dig",
".",
"append",... | Return the AAAA record for ``host``.
Always returns a list.
CLI Example:
.. code-block:: bash
salt ns1 dig.AAAA www.google.com | [
"Return",
"the",
"AAAA",
"record",
"for",
"host",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dig.py#L105-L132 |
32,866 | saltstack/salt | salt/modules/dig.py | SPF | def SPF(domain, record='SPF', nameserver=None):
'''
Return the allowed IPv4 ranges in the SPF record for ``domain``.
If record is ``SPF`` and the SPF record is empty, the TXT record will be
searched automatically. If you know the domain uses TXT and not SPF,
specifying that will save a lookup.
... | python | def SPF(domain, record='SPF', nameserver=None):
'''
Return the allowed IPv4 ranges in the SPF record for ``domain``.
If record is ``SPF`` and the SPF record is empty, the TXT record will be
searched automatically. If you know the domain uses TXT and not SPF,
specifying that will save a lookup.
... | [
"def",
"SPF",
"(",
"domain",
",",
"record",
"=",
"'SPF'",
",",
"nameserver",
"=",
"None",
")",
":",
"spf_re",
"=",
"re",
".",
"compile",
"(",
"r'(?:\\+|~)?(ip[46]|include):(.+)'",
")",
"cmd",
"=",
"[",
"'dig'",
",",
"'+short'",
",",
"six",
".",
"text_typ... | Return the allowed IPv4 ranges in the SPF record for ``domain``.
If record is ``SPF`` and the SPF record is empty, the TXT record will be
searched automatically. If you know the domain uses TXT and not SPF,
specifying that will save a lookup.
CLI Example:
.. code-block:: bash
salt ns1 di... | [
"Return",
"the",
"allowed",
"IPv4",
"ranges",
"in",
"the",
"SPF",
"record",
"for",
"domain",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dig.py#L171-L223 |
32,867 | saltstack/salt | salt/modules/dig.py | TXT | def TXT(host, nameserver=None):
'''
Return the TXT record for ``host``.
Always returns a list.
CLI Example:
.. code-block:: bash
salt ns1 dig.TXT google.com
'''
dig = ['dig', '+short', six.text_type(host), 'TXT']
if nameserver is not None:
dig.append('@{0}'.format(na... | python | def TXT(host, nameserver=None):
'''
Return the TXT record for ``host``.
Always returns a list.
CLI Example:
.. code-block:: bash
salt ns1 dig.TXT google.com
'''
dig = ['dig', '+short', six.text_type(host), 'TXT']
if nameserver is not None:
dig.append('@{0}'.format(na... | [
"def",
"TXT",
"(",
"host",
",",
"nameserver",
"=",
"None",
")",
":",
"dig",
"=",
"[",
"'dig'",
",",
"'+short'",
",",
"six",
".",
"text_type",
"(",
"host",
")",
",",
"'TXT'",
"]",
"if",
"nameserver",
"is",
"not",
"None",
":",
"dig",
".",
"append",
... | Return the TXT record for ``host``.
Always returns a list.
CLI Example:
.. code-block:: bash
salt ns1 dig.TXT google.com | [
"Return",
"the",
"TXT",
"record",
"for",
"host",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dig.py#L267-L293 |
32,868 | saltstack/salt | salt/states/augeas.py | _workout_filename | def _workout_filename(filename):
'''
Recursively workout the file name from an augeas change
'''
if os.path.isfile(filename) or filename == '/':
if filename == '/':
filename = None
return filename
else:
return _workout_filename(os.path.dirname(filename)) | python | def _workout_filename(filename):
'''
Recursively workout the file name from an augeas change
'''
if os.path.isfile(filename) or filename == '/':
if filename == '/':
filename = None
return filename
else:
return _workout_filename(os.path.dirname(filename)) | [
"def",
"_workout_filename",
"(",
"filename",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"filename",
")",
"or",
"filename",
"==",
"'/'",
":",
"if",
"filename",
"==",
"'/'",
":",
"filename",
"=",
"None",
"return",
"filename",
"else",
":",
"re... | Recursively workout the file name from an augeas change | [
"Recursively",
"workout",
"the",
"file",
"name",
"from",
"an",
"augeas",
"change"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/augeas.py#L53-L62 |
32,869 | saltstack/salt | salt/states/augeas.py | _check_filepath | def _check_filepath(changes):
'''
Ensure all changes are fully qualified and affect only one file.
This ensures that the diff output works and a state change is not
incorrectly reported.
'''
filename = None
for change_ in changes:
try:
cmd, arg = change_.split(' ', 1)
... | python | def _check_filepath(changes):
'''
Ensure all changes are fully qualified and affect only one file.
This ensures that the diff output works and a state change is not
incorrectly reported.
'''
filename = None
for change_ in changes:
try:
cmd, arg = change_.split(' ', 1)
... | [
"def",
"_check_filepath",
"(",
"changes",
")",
":",
"filename",
"=",
"None",
"for",
"change_",
"in",
"changes",
":",
"try",
":",
"cmd",
",",
"arg",
"=",
"change_",
".",
"split",
"(",
"' '",
",",
"1",
")",
"if",
"cmd",
"not",
"in",
"METHOD_MAP",
":",
... | Ensure all changes are fully qualified and affect only one file.
This ensures that the diff output works and a state change is not
incorrectly reported. | [
"Ensure",
"all",
"changes",
"are",
"fully",
"qualified",
"and",
"affect",
"only",
"one",
"file",
".",
"This",
"ensures",
"that",
"the",
"diff",
"output",
"works",
"and",
"a",
"state",
"change",
"is",
"not",
"incorrectly",
"reported",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/augeas.py#L65-L110 |
32,870 | saltstack/salt | salt/modules/redismod.py | bgrewriteaof | def bgrewriteaof(host=None, port=None, db=None, password=None):
'''
Asynchronously rewrite the append-only file
CLI Example:
.. code-block:: bash
salt '*' redis.bgrewriteaof
'''
server = _connect(host, port, db, password)
return server.bgrewriteaof() | python | def bgrewriteaof(host=None, port=None, db=None, password=None):
'''
Asynchronously rewrite the append-only file
CLI Example:
.. code-block:: bash
salt '*' redis.bgrewriteaof
'''
server = _connect(host, port, db, password)
return server.bgrewriteaof() | [
"def",
"bgrewriteaof",
"(",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"server",
"."... | Asynchronously rewrite the append-only file
CLI Example:
.. code-block:: bash
salt '*' redis.bgrewriteaof | [
"Asynchronously",
"rewrite",
"the",
"append",
"-",
"only",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L75-L86 |
32,871 | saltstack/salt | salt/modules/redismod.py | bgsave | def bgsave(host=None, port=None, db=None, password=None):
'''
Asynchronously save the dataset to disk
CLI Example:
.. code-block:: bash
salt '*' redis.bgsave
'''
server = _connect(host, port, db, password)
return server.bgsave() | python | def bgsave(host=None, port=None, db=None, password=None):
'''
Asynchronously save the dataset to disk
CLI Example:
.. code-block:: bash
salt '*' redis.bgsave
'''
server = _connect(host, port, db, password)
return server.bgsave() | [
"def",
"bgsave",
"(",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"server",
".",
"b... | Asynchronously save the dataset to disk
CLI Example:
.. code-block:: bash
salt '*' redis.bgsave | [
"Asynchronously",
"save",
"the",
"dataset",
"to",
"disk"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L89-L100 |
32,872 | saltstack/salt | salt/modules/redismod.py | config_get | def config_get(pattern='*', host=None, port=None, db=None, password=None):
'''
Get redis server configuration values
CLI Example:
.. code-block:: bash
salt '*' redis.config_get
salt '*' redis.config_get port
'''
server = _connect(host, port, db, password)
return server.con... | python | def config_get(pattern='*', host=None, port=None, db=None, password=None):
'''
Get redis server configuration values
CLI Example:
.. code-block:: bash
salt '*' redis.config_get
salt '*' redis.config_get port
'''
server = _connect(host, port, db, password)
return server.con... | [
"def",
"config_get",
"(",
"pattern",
"=",
"'*'",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
... | Get redis server configuration values
CLI Example:
.. code-block:: bash
salt '*' redis.config_get
salt '*' redis.config_get port | [
"Get",
"redis",
"server",
"configuration",
"values"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L103-L115 |
32,873 | saltstack/salt | salt/modules/redismod.py | config_set | def config_set(name, value, host=None, port=None, db=None, password=None):
'''
Set redis server configuration values
CLI Example:
.. code-block:: bash
salt '*' redis.config_set masterauth luv_kittens
'''
server = _connect(host, port, db, password)
return server.config_set(name, va... | python | def config_set(name, value, host=None, port=None, db=None, password=None):
'''
Set redis server configuration values
CLI Example:
.. code-block:: bash
salt '*' redis.config_set masterauth luv_kittens
'''
server = _connect(host, port, db, password)
return server.config_set(name, va... | [
"def",
"config_set",
"(",
"name",
",",
"value",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
"... | Set redis server configuration values
CLI Example:
.. code-block:: bash
salt '*' redis.config_set masterauth luv_kittens | [
"Set",
"redis",
"server",
"configuration",
"values"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L118-L129 |
32,874 | saltstack/salt | salt/modules/redismod.py | dbsize | def dbsize(host=None, port=None, db=None, password=None):
'''
Return the number of keys in the selected database
CLI Example:
.. code-block:: bash
salt '*' redis.dbsize
'''
server = _connect(host, port, db, password)
return server.dbsize() | python | def dbsize(host=None, port=None, db=None, password=None):
'''
Return the number of keys in the selected database
CLI Example:
.. code-block:: bash
salt '*' redis.dbsize
'''
server = _connect(host, port, db, password)
return server.dbsize() | [
"def",
"dbsize",
"(",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"server",
".",
"d... | Return the number of keys in the selected database
CLI Example:
.. code-block:: bash
salt '*' redis.dbsize | [
"Return",
"the",
"number",
"of",
"keys",
"in",
"the",
"selected",
"database"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L132-L143 |
32,875 | saltstack/salt | salt/modules/redismod.py | delete | def delete(*keys, **connection_args):
'''
Deletes the keys from redis, returns number of keys deleted
CLI Example:
.. code-block:: bash
salt '*' redis.delete foo
'''
# Get connection args from keywords if set
conn_args = {}
for arg in ['host', 'port', 'db', 'password']:
... | python | def delete(*keys, **connection_args):
'''
Deletes the keys from redis, returns number of keys deleted
CLI Example:
.. code-block:: bash
salt '*' redis.delete foo
'''
# Get connection args from keywords if set
conn_args = {}
for arg in ['host', 'port', 'db', 'password']:
... | [
"def",
"delete",
"(",
"*",
"keys",
",",
"*",
"*",
"connection_args",
")",
":",
"# Get connection args from keywords if set",
"conn_args",
"=",
"{",
"}",
"for",
"arg",
"in",
"[",
"'host'",
",",
"'port'",
",",
"'db'",
",",
"'password'",
"]",
":",
"if",
"arg"... | Deletes the keys from redis, returns number of keys deleted
CLI Example:
.. code-block:: bash
salt '*' redis.delete foo | [
"Deletes",
"the",
"keys",
"from",
"redis",
"returns",
"number",
"of",
"keys",
"deleted"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L146-L163 |
32,876 | saltstack/salt | salt/modules/redismod.py | exists | def exists(key, host=None, port=None, db=None, password=None):
'''
Return true if the key exists in redis
CLI Example:
.. code-block:: bash
salt '*' redis.exists foo
'''
server = _connect(host, port, db, password)
return server.exists(key) | python | def exists(key, host=None, port=None, db=None, password=None):
'''
Return true if the key exists in redis
CLI Example:
.. code-block:: bash
salt '*' redis.exists foo
'''
server = _connect(host, port, db, password)
return server.exists(key) | [
"def",
"exists",
"(",
"key",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"serv... | Return true if the key exists in redis
CLI Example:
.. code-block:: bash
salt '*' redis.exists foo | [
"Return",
"true",
"if",
"the",
"key",
"exists",
"in",
"redis"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L166-L177 |
32,877 | saltstack/salt | salt/modules/redismod.py | expire | def expire(key, seconds, host=None, port=None, db=None, password=None):
'''
Set a keys time to live in seconds
CLI Example:
.. code-block:: bash
salt '*' redis.expire foo 300
'''
server = _connect(host, port, db, password)
return server.expire(key, seconds) | python | def expire(key, seconds, host=None, port=None, db=None, password=None):
'''
Set a keys time to live in seconds
CLI Example:
.. code-block:: bash
salt '*' redis.expire foo 300
'''
server = _connect(host, port, db, password)
return server.expire(key, seconds) | [
"def",
"expire",
"(",
"key",
",",
"seconds",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",... | Set a keys time to live in seconds
CLI Example:
.. code-block:: bash
salt '*' redis.expire foo 300 | [
"Set",
"a",
"keys",
"time",
"to",
"live",
"in",
"seconds"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L180-L191 |
32,878 | saltstack/salt | salt/modules/redismod.py | expireat | def expireat(key, timestamp, host=None, port=None, db=None, password=None):
'''
Set a keys expire at given UNIX time
CLI Example:
.. code-block:: bash
salt '*' redis.expireat foo 1400000000
'''
server = _connect(host, port, db, password)
return server.expireat(key, timestamp) | python | def expireat(key, timestamp, host=None, port=None, db=None, password=None):
'''
Set a keys expire at given UNIX time
CLI Example:
.. code-block:: bash
salt '*' redis.expireat foo 1400000000
'''
server = _connect(host, port, db, password)
return server.expireat(key, timestamp) | [
"def",
"expireat",
"(",
"key",
",",
"timestamp",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
... | Set a keys expire at given UNIX time
CLI Example:
.. code-block:: bash
salt '*' redis.expireat foo 1400000000 | [
"Set",
"a",
"keys",
"expire",
"at",
"given",
"UNIX",
"time"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L194-L205 |
32,879 | saltstack/salt | salt/modules/redismod.py | flushall | def flushall(host=None, port=None, db=None, password=None):
'''
Remove all keys from all databases
CLI Example:
.. code-block:: bash
salt '*' redis.flushall
'''
server = _connect(host, port, db, password)
return server.flushall() | python | def flushall(host=None, port=None, db=None, password=None):
'''
Remove all keys from all databases
CLI Example:
.. code-block:: bash
salt '*' redis.flushall
'''
server = _connect(host, port, db, password)
return server.flushall() | [
"def",
"flushall",
"(",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"server",
".",
... | Remove all keys from all databases
CLI Example:
.. code-block:: bash
salt '*' redis.flushall | [
"Remove",
"all",
"keys",
"from",
"all",
"databases"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L208-L219 |
32,880 | saltstack/salt | salt/modules/redismod.py | flushdb | def flushdb(host=None, port=None, db=None, password=None):
'''
Remove all keys from the selected database
CLI Example:
.. code-block:: bash
salt '*' redis.flushdb
'''
server = _connect(host, port, db, password)
return server.flushdb() | python | def flushdb(host=None, port=None, db=None, password=None):
'''
Remove all keys from the selected database
CLI Example:
.. code-block:: bash
salt '*' redis.flushdb
'''
server = _connect(host, port, db, password)
return server.flushdb() | [
"def",
"flushdb",
"(",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"server",
".",
"... | Remove all keys from the selected database
CLI Example:
.. code-block:: bash
salt '*' redis.flushdb | [
"Remove",
"all",
"keys",
"from",
"the",
"selected",
"database"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L222-L233 |
32,881 | saltstack/salt | salt/modules/redismod.py | get_key | def get_key(key, host=None, port=None, db=None, password=None):
'''
Get redis key value
CLI Example:
.. code-block:: bash
salt '*' redis.get_key foo
'''
server = _connect(host, port, db, password)
return server.get(key) | python | def get_key(key, host=None, port=None, db=None, password=None):
'''
Get redis key value
CLI Example:
.. code-block:: bash
salt '*' redis.get_key foo
'''
server = _connect(host, port, db, password)
return server.get(key) | [
"def",
"get_key",
"(",
"key",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"ser... | Get redis key value
CLI Example:
.. code-block:: bash
salt '*' redis.get_key foo | [
"Get",
"redis",
"key",
"value"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L236-L247 |
32,882 | saltstack/salt | salt/modules/redismod.py | hexists | def hexists(key, field, host=None, port=None, db=None, password=None):
'''
Determine if a hash fields exists.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' redis.hexists foo_hash bar_field
'''
server = _connect(host, port, db, password)
return server.h... | python | def hexists(key, field, host=None, port=None, db=None, password=None):
'''
Determine if a hash fields exists.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' redis.hexists foo_hash bar_field
'''
server = _connect(host, port, db, password)
return server.h... | [
"def",
"hexists",
"(",
"key",
",",
"field",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
... | Determine if a hash fields exists.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' redis.hexists foo_hash bar_field | [
"Determine",
"if",
"a",
"hash",
"fields",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L270-L283 |
32,883 | saltstack/salt | salt/modules/redismod.py | hgetall | def hgetall(key, host=None, port=None, db=None, password=None):
'''
Get all fields and values from a redis hash, returns dict
CLI Example:
.. code-block:: bash
salt '*' redis.hgetall foo_hash
'''
server = _connect(host, port, db, password)
return server.hgetall(key) | python | def hgetall(key, host=None, port=None, db=None, password=None):
'''
Get all fields and values from a redis hash, returns dict
CLI Example:
.. code-block:: bash
salt '*' redis.hgetall foo_hash
'''
server = _connect(host, port, db, password)
return server.hgetall(key) | [
"def",
"hgetall",
"(",
"key",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"ser... | Get all fields and values from a redis hash, returns dict
CLI Example:
.. code-block:: bash
salt '*' redis.hgetall foo_hash | [
"Get",
"all",
"fields",
"and",
"values",
"from",
"a",
"redis",
"hash",
"returns",
"dict"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L300-L311 |
32,884 | saltstack/salt | salt/modules/redismod.py | hlen | def hlen(key, host=None, port=None, db=None, password=None):
'''
Returns number of fields of a hash.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' redis.hlen foo_hash
'''
server = _connect(host, port, db, password)
return server.hlen(key) | python | def hlen(key, host=None, port=None, db=None, password=None):
'''
Returns number of fields of a hash.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' redis.hlen foo_hash
'''
server = _connect(host, port, db, password)
return server.hlen(key) | [
"def",
"hlen",
"(",
"key",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"server... | Returns number of fields of a hash.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' redis.hlen foo_hash | [
"Returns",
"number",
"of",
"fields",
"of",
"a",
"hash",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L346-L359 |
32,885 | saltstack/salt | salt/modules/redismod.py | hmget | def hmget(key, *fields, **options):
'''
Returns the values of all the given hash fields.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' redis.hmget foo_hash bar_field1 bar_field2
'''
host = options.get('host', None)
port = options.get('port', None)
... | python | def hmget(key, *fields, **options):
'''
Returns the values of all the given hash fields.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' redis.hmget foo_hash bar_field1 bar_field2
'''
host = options.get('host', None)
port = options.get('port', None)
... | [
"def",
"hmget",
"(",
"key",
",",
"*",
"fields",
",",
"*",
"*",
"options",
")",
":",
"host",
"=",
"options",
".",
"get",
"(",
"'host'",
",",
"None",
")",
"port",
"=",
"options",
".",
"get",
"(",
"'port'",
",",
"None",
")",
"database",
"=",
"option... | Returns the values of all the given hash fields.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' redis.hmget foo_hash bar_field1 bar_field2 | [
"Returns",
"the",
"values",
"of",
"all",
"the",
"given",
"hash",
"fields",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L362-L379 |
32,886 | saltstack/salt | salt/modules/redismod.py | hmset | def hmset(key, **fieldsvals):
'''
Sets multiple hash fields to multiple values.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' redis.hmset foo_hash bar_field1=bar_value1 bar_field2=bar_value2
'''
host = fieldsvals.pop('host', None)
port = fieldsvals.pop... | python | def hmset(key, **fieldsvals):
'''
Sets multiple hash fields to multiple values.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' redis.hmset foo_hash bar_field1=bar_value1 bar_field2=bar_value2
'''
host = fieldsvals.pop('host', None)
port = fieldsvals.pop... | [
"def",
"hmset",
"(",
"key",
",",
"*",
"*",
"fieldsvals",
")",
":",
"host",
"=",
"fieldsvals",
".",
"pop",
"(",
"'host'",
",",
"None",
")",
"port",
"=",
"fieldsvals",
".",
"pop",
"(",
"'port'",
",",
"None",
")",
"database",
"=",
"fieldsvals",
".",
"... | Sets multiple hash fields to multiple values.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' redis.hmset foo_hash bar_field1=bar_value1 bar_field2=bar_value2 | [
"Sets",
"multiple",
"hash",
"fields",
"to",
"multiple",
"values",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L382-L399 |
32,887 | saltstack/salt | salt/modules/redismod.py | hset | def hset(key, field, value, host=None, port=None, db=None, password=None):
'''
Set the value of a hash field.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' redis.hset foo_hash bar_field bar_value
'''
server = _connect(host, port, db, password)
return s... | python | def hset(key, field, value, host=None, port=None, db=None, password=None):
'''
Set the value of a hash field.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' redis.hset foo_hash bar_field bar_value
'''
server = _connect(host, port, db, password)
return s... | [
"def",
"hset",
"(",
"key",
",",
"field",
",",
"value",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"pas... | Set the value of a hash field.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' redis.hset foo_hash bar_field bar_value | [
"Set",
"the",
"value",
"of",
"a",
"hash",
"field",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L402-L415 |
32,888 | saltstack/salt | salt/modules/redismod.py | hvals | def hvals(key, host=None, port=None, db=None, password=None):
'''
Return all the values in a hash.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' redis.hvals foo_hash bar_field1 bar_value1
'''
server = _connect(host, port, db, password)
return server.hv... | python | def hvals(key, host=None, port=None, db=None, password=None):
'''
Return all the values in a hash.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' redis.hvals foo_hash bar_field1 bar_value1
'''
server = _connect(host, port, db, password)
return server.hv... | [
"def",
"hvals",
"(",
"key",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"serve... | Return all the values in a hash.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' redis.hvals foo_hash bar_field1 bar_value1 | [
"Return",
"all",
"the",
"values",
"in",
"a",
"hash",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L434-L447 |
32,889 | saltstack/salt | salt/modules/redismod.py | info | def info(host=None, port=None, db=None, password=None):
'''
Get information and statistics about the server
CLI Example:
.. code-block:: bash
salt '*' redis.info
'''
server = _connect(host, port, db, password)
return server.info() | python | def info(host=None, port=None, db=None, password=None):
'''
Get information and statistics about the server
CLI Example:
.. code-block:: bash
salt '*' redis.info
'''
server = _connect(host, port, db, password)
return server.info() | [
"def",
"info",
"(",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"server",
".",
"inf... | Get information and statistics about the server
CLI Example:
.. code-block:: bash
salt '*' redis.info | [
"Get",
"information",
"and",
"statistics",
"about",
"the",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L466-L477 |
32,890 | saltstack/salt | salt/modules/redismod.py | keys | def keys(pattern='*', host=None, port=None, db=None, password=None):
'''
Get redis keys, supports glob style patterns
CLI Example:
.. code-block:: bash
salt '*' redis.keys
salt '*' redis.keys test*
'''
server = _connect(host, port, db, password)
return server.keys(pattern) | python | def keys(pattern='*', host=None, port=None, db=None, password=None):
'''
Get redis keys, supports glob style patterns
CLI Example:
.. code-block:: bash
salt '*' redis.keys
salt '*' redis.keys test*
'''
server = _connect(host, port, db, password)
return server.keys(pattern) | [
"def",
"keys",
"(",
"pattern",
"=",
"'*'",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
... | Get redis keys, supports glob style patterns
CLI Example:
.. code-block:: bash
salt '*' redis.keys
salt '*' redis.keys test* | [
"Get",
"redis",
"keys",
"supports",
"glob",
"style",
"patterns"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L480-L492 |
32,891 | saltstack/salt | salt/modules/redismod.py | key_type | def key_type(key, host=None, port=None, db=None, password=None):
'''
Get redis key type
CLI Example:
.. code-block:: bash
salt '*' redis.type foo
'''
server = _connect(host, port, db, password)
return server.type(key) | python | def key_type(key, host=None, port=None, db=None, password=None):
'''
Get redis key type
CLI Example:
.. code-block:: bash
salt '*' redis.type foo
'''
server = _connect(host, port, db, password)
return server.type(key) | [
"def",
"key_type",
"(",
"key",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"se... | Get redis key type
CLI Example:
.. code-block:: bash
salt '*' redis.type foo | [
"Get",
"redis",
"key",
"type"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L495-L506 |
32,892 | saltstack/salt | salt/modules/redismod.py | lastsave | def lastsave(host=None, port=None, db=None, password=None):
'''
Get the UNIX time in seconds of the last successful save to disk
CLI Example:
.. code-block:: bash
salt '*' redis.lastsave
'''
# Use of %s to get the timestamp is not supported by Python. The reason it
# works is beca... | python | def lastsave(host=None, port=None, db=None, password=None):
'''
Get the UNIX time in seconds of the last successful save to disk
CLI Example:
.. code-block:: bash
salt '*' redis.lastsave
'''
# Use of %s to get the timestamp is not supported by Python. The reason it
# works is beca... | [
"def",
"lastsave",
"(",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"# Use of %s to get the timestamp is not supported by Python. The reason it",
"# works is because it's passed to the system strftime which ... | Get the UNIX time in seconds of the last successful save to disk
CLI Example:
.. code-block:: bash
salt '*' redis.lastsave | [
"Get",
"the",
"UNIX",
"time",
"in",
"seconds",
"of",
"the",
"last",
"successful",
"save",
"to",
"disk"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L509-L526 |
32,893 | saltstack/salt | salt/modules/redismod.py | llen | def llen(key, host=None, port=None, db=None, password=None):
'''
Get the length of a list in Redis
CLI Example:
.. code-block:: bash
salt '*' redis.llen foo_list
'''
server = _connect(host, port, db, password)
return server.llen(key) | python | def llen(key, host=None, port=None, db=None, password=None):
'''
Get the length of a list in Redis
CLI Example:
.. code-block:: bash
salt '*' redis.llen foo_list
'''
server = _connect(host, port, db, password)
return server.llen(key) | [
"def",
"llen",
"(",
"key",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"server... | Get the length of a list in Redis
CLI Example:
.. code-block:: bash
salt '*' redis.llen foo_list | [
"Get",
"the",
"length",
"of",
"a",
"list",
"in",
"Redis"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L529-L540 |
32,894 | saltstack/salt | salt/modules/redismod.py | ping | def ping(host=None, port=None, db=None, password=None):
'''
Ping the server, returns False on connection errors
CLI Example:
.. code-block:: bash
salt '*' redis.ping
'''
server = _connect(host, port, db, password)
try:
return server.ping()
except redis.ConnectionError:... | python | def ping(host=None, port=None, db=None, password=None):
'''
Ping the server, returns False on connection errors
CLI Example:
.. code-block:: bash
salt '*' redis.ping
'''
server = _connect(host, port, db, password)
try:
return server.ping()
except redis.ConnectionError:... | [
"def",
"ping",
"(",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"try",
":",
"return",
"server... | Ping the server, returns False on connection errors
CLI Example:
.. code-block:: bash
salt '*' redis.ping | [
"Ping",
"the",
"server",
"returns",
"False",
"on",
"connection",
"errors"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L557-L571 |
32,895 | saltstack/salt | salt/modules/redismod.py | save | def save(host=None, port=None, db=None, password=None):
'''
Synchronously save the dataset to disk
CLI Example:
.. code-block:: bash
salt '*' redis.save
'''
server = _connect(host, port, db, password)
return server.save() | python | def save(host=None, port=None, db=None, password=None):
'''
Synchronously save the dataset to disk
CLI Example:
.. code-block:: bash
salt '*' redis.save
'''
server = _connect(host, port, db, password)
return server.save() | [
"def",
"save",
"(",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"server",
".",
"sav... | Synchronously save the dataset to disk
CLI Example:
.. code-block:: bash
salt '*' redis.save | [
"Synchronously",
"save",
"the",
"dataset",
"to",
"disk"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L574-L585 |
32,896 | saltstack/salt | salt/modules/redismod.py | set_key | def set_key(key, value, host=None, port=None, db=None, password=None):
'''
Set redis key value
CLI Example:
.. code-block:: bash
salt '*' redis.set_key foo bar
'''
server = _connect(host, port, db, password)
return server.set(key, value) | python | def set_key(key, value, host=None, port=None, db=None, password=None):
'''
Set redis key value
CLI Example:
.. code-block:: bash
salt '*' redis.set_key foo bar
'''
server = _connect(host, port, db, password)
return server.set(key, value) | [
"def",
"set_key",
"(",
"key",
",",
"value",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
... | Set redis key value
CLI Example:
.. code-block:: bash
salt '*' redis.set_key foo bar | [
"Set",
"redis",
"key",
"value"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L588-L599 |
32,897 | saltstack/salt | salt/modules/redismod.py | shutdown | def shutdown(host=None, port=None, db=None, password=None):
'''
Synchronously save the dataset to disk and then shut down the server
CLI Example:
.. code-block:: bash
salt '*' redis.shutdown
'''
server = _connect(host, port, db, password)
try:
# Return false if unable to p... | python | def shutdown(host=None, port=None, db=None, password=None):
'''
Synchronously save the dataset to disk and then shut down the server
CLI Example:
.. code-block:: bash
salt '*' redis.shutdown
'''
server = _connect(host, port, db, password)
try:
# Return false if unable to p... | [
"def",
"shutdown",
"(",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"try",
":",
"# Return false... | Synchronously save the dataset to disk and then shut down the server
CLI Example:
.. code-block:: bash
salt '*' redis.shutdown | [
"Synchronously",
"save",
"the",
"dataset",
"to",
"disk",
"and",
"then",
"shut",
"down",
"the",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L602-L625 |
32,898 | saltstack/salt | salt/modules/redismod.py | slaveof | def slaveof(master_host=None, master_port=None, host=None, port=None, db=None,
password=None):
'''
Make the server a slave of another instance, or promote it as master
CLI Example:
.. code-block:: bash
# Become slave of redis-n01.example.com:6379
salt '*' redis.slaveof red... | python | def slaveof(master_host=None, master_port=None, host=None, port=None, db=None,
password=None):
'''
Make the server a slave of another instance, or promote it as master
CLI Example:
.. code-block:: bash
# Become slave of redis-n01.example.com:6379
salt '*' redis.slaveof red... | [
"def",
"slaveof",
"(",
"master_host",
"=",
"None",
",",
"master_port",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"if",
"master_host",
"and",
"not",
"master_port",
... | Make the server a slave of another instance, or promote it as master
CLI Example:
.. code-block:: bash
# Become slave of redis-n01.example.com:6379
salt '*' redis.slaveof redis-n01.example.com 6379
salt '*' redis.slaveof redis-n01.example.com
# Become master
salt '*' r... | [
"Make",
"the",
"server",
"a",
"slave",
"of",
"another",
"instance",
"or",
"promote",
"it",
"as",
"master"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L628-L646 |
32,899 | saltstack/salt | salt/modules/redismod.py | smembers | def smembers(key, host=None, port=None, db=None, password=None):
'''
Get members in a Redis set
CLI Example:
.. code-block:: bash
salt '*' redis.smembers foo_set
'''
server = _connect(host, port, db, password)
return list(server.smembers(key)) | python | def smembers(key, host=None, port=None, db=None, password=None):
'''
Get members in a Redis set
CLI Example:
.. code-block:: bash
salt '*' redis.smembers foo_set
'''
server = _connect(host, port, db, password)
return list(server.smembers(key)) | [
"def",
"smembers",
"(",
"key",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"li... | Get members in a Redis set
CLI Example:
.. code-block:: bash
salt '*' redis.smembers foo_set | [
"Get",
"members",
"in",
"a",
"Redis",
"set"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L649-L660 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.