Code stringlengths 103 85.9k | Summary listlengths 0 94 |
|---|---|
Please provide a description of the function:def _dmi_parse(data, clean=True, fields=None):
'''
Structurize DMI records into a nice list
Optionally trash bogus entries and filter output
'''
dmi = []
# Detect & split Handle records
dmi_split = re.compile('(handle [0-9]x[0-9a-f]+[^\n]+)\n', r... | [] |
Please provide a description of the function:def _dmi_data(dmi_raw, clean, fields):
'''
Parse the raw DMIdecode output of a single handle
into a nice dict
'''
dmi_data = {}
key = None
key_data = [None, []]
for line in dmi_raw:
if re.match(r'\t[^\s]+', line):
# Finish... | [] |
Please provide a description of the function:def _dmi_cast(key, val, clean=True):
'''
Simple caster thingy for trying to fish out at least ints & lists from strings
'''
if clean and not _dmi_isclean(key, val):
return
elif not re.match(r'serial|part|asset|product', key, flags=re.IGNORECASE):
... | [] |
Please provide a description of the function:def _dmidecoder(args=None):
'''
Call DMIdecode
'''
dmidecoder = salt.utils.path.which_bin(['dmidecode', 'smbios'])
if not args:
out = salt.modules.cmdmod._run_quiet(dmidecoder)
else:
out = salt.modules.cmdmod._run_quiet('{0} {1}'.form... | [] |
Please provide a description of the function:def construct_mapping(self, node, deep=False):
'''
Build the mapping for YAML
'''
if not isinstance(node, MappingNode):
raise ConstructorError(
None,
None,
'expected a mapping node, b... | [] |
Please provide a description of the function:def construct_scalar(self, node):
'''
Verify integers and pass them in correctly is they are declared
as octal
'''
if node.tag == 'tag:yaml.org,2002:int':
if node.value == '0':
pass
elif node.val... | [] |
Please provide a description of the function:def ip_address(address):
try:
return IPv4Address(address)
except (AddressValueError, NetmaskValueError):
pass
try:
return IPv6Address(address)
except (AddressValueError, NetmaskValueError):
pass
raise ValueError('%r ... | [
"Take an IP string/int and return an object of the correct type.\n\n Args:\n address: A string or integer, the IP address. Either IPv4 or\n IPv6 addresses may be supplied; integers less than 2**32 will\n be considered to be IPv4 by default.\n\n Returns:\n An IPv4Address or IPv... |
Please provide a description of the function:def ip_network(address, strict=True):
try:
return IPv4Network(address, strict)
except (AddressValueError, NetmaskValueError):
pass
try:
return IPv6Network(address, strict)
except (AddressValueError, NetmaskValueError):
pa... | [
"Take an IP string/int and return an object of the correct type.\n\n Args:\n address: A string or integer, the IP network. Either IPv4 or\n IPv6 networks may be supplied; integers less than 2**32 will\n be considered to be IPv4 by default.\n\n Returns:\n An IPv4Network or IPv6... |
Please provide a description of the function:def _split_optional_netmask(address):
addr = str(address).split('/')
if len(addr) > 2:
raise AddressValueError("Only one '/' permitted in %r" % address)
return addr | [
"Helper to split the netmask and raise AddressValueError if needed"
] |
Please provide a description of the function:def _count_righthand_zero_bits(number, bits):
if number == 0:
return bits
for i in range(bits):
if (number >> i) & 1:
return i
# All bits of interest were zero, even if there are more in the number
return bits | [
"Count the number of zero bits on the right hand side.\n\n Args:\n number: an integer.\n bits: maximum number of bits to count.\n\n Returns:\n The number of zero bits on the right hand side of the number.\n\n "
] |
Please provide a description of the function:def _collapse_addresses_recursive(addresses):
while True:
last_addr = None
ret_array = []
optimized = False
for cur_addr in addresses:
if not ret_array:
last_addr = cur_addr
ret_array.appen... | [
"Loops through the addresses, collapsing concurrent netblocks.\n\n Example:\n\n ip1 = IPv4Network('192.0.2.0/26')\n ip2 = IPv4Network('192.0.2.64/26')\n ip3 = IPv4Network('192.0.2.128/26')\n ip4 = IPv4Network('192.0.2.192/26')\n\n _collapse_addresses_recursive([ip1, ip2, ip3, i... |
Please provide a description of the function:def collapse_addresses(addresses):
i = 0
addrs = []
ips = []
nets = []
# split IP addresses and networks
for ip in addresses:
if isinstance(ip, _BaseAddress):
if ips and ips[-1]._version != ip._version:
raise ... | [
"Collapse a list of IP objects.\n\n Example:\n collapse_addresses([IPv4Network('192.0.2.0/25'),\n IPv4Network('192.0.2.128/25')]) ->\n [IPv4Network('192.0.2.0/24')]\n\n Args:\n addresses: An iterator of IPv4Network or IPv6Network objects.\n\n ... |
Please provide a description of the function:def _prefix_from_ip_int(self, ip_int):
trailing_zeroes = _count_righthand_zero_bits(ip_int,
self._max_prefixlen)
prefixlen = self._max_prefixlen - trailing_zeroes
leading_ones = ip_int >> t... | [
"Return prefix length from the bitwise netmask.\n\n Args:\n ip_int: An integer, the netmask in expanded bitwise format\n\n Returns:\n An integer, the prefix length.\n\n Raises:\n ValueError: If the input intermingles zeroes & ones\n "
] |
Please provide a description of the function:def _prefix_from_prefix_string(self, prefixlen_str):
# int allows a leading +/- as well as surrounding whitespace,
# so we ensure that isn't the case
if not _BaseV4._DECIMAL_DIGITS.issuperset(prefixlen_str):
self._report_invalid_n... | [
"Return prefix length from a numeric string\n\n Args:\n prefixlen_str: The string to be converted\n\n Returns:\n An integer, the prefix length.\n\n Raises:\n NetmaskValueError: If the input is not a valid netmask\n "
] |
Please provide a description of the function:def _prefix_from_ip_string(self, ip_str):
# Parse the netmask/hostmask like an IP address.
try:
ip_int = self._ip_int_from_string(ip_str)
except AddressValueError:
self._report_invalid_netmask(ip_str)
# Try ma... | [
"Turn a netmask/hostmask string into a prefix length\n\n Args:\n ip_str: The netmask/hostmask to be converted\n\n Returns:\n An integer, the prefix length.\n\n Raises:\n NetmaskValueError: If the input is not a valid netmask/hostmask\n "
] |
Please provide a description of the function:def subnets(self, prefixlen_diff=1, new_prefix=None):
if self._prefixlen == self._max_prefixlen:
yield self
return
if new_prefix is not None:
if new_prefix < self._prefixlen:
raise ValueError('new ... | [
"The subnets which join to make the current subnet.\n\n In the case that self contains only one IP\n (self._prefixlen == 32 for IPv4 or self._prefixlen == 128\n for IPv6), yield an iterator with just ourself.\n\n Args:\n prefixlen_diff: An integer, the amount the prefix length... |
Please provide a description of the function:def supernet(self, prefixlen_diff=1, new_prefix=None):
if self._prefixlen == 0:
return self
if new_prefix is not None:
if new_prefix > self._prefixlen:
raise ValueError('new prefix must be shorter')
... | [
"The supernet containing the current network.\n\n Args:\n prefixlen_diff: An integer, the amount the prefix length of\n the network should be decreased by. For example, given a\n /24 network and a prefixlen_diff of 3, a supernet with a\n /21 netmask is retur... |
Please provide a description of the function:def _ip_int_from_string(self, ip_str):
if not ip_str:
raise AddressValueError('Address cannot be empty')
octets = ip_str.split('.')
if len(octets) != 4:
raise AddressValueError("Expected 4 octets in %r" % ip_str)
... | [
"Turn the given IP string into an integer for comparison.\n\n Args:\n ip_str: A string, the IP ip_str.\n\n Returns:\n The IP ip_str as an integer.\n\n Raises:\n AddressValueError: if ip_str isn't a valid IPv4 Address.\n\n "
] |
Please provide a description of the function:def _parse_octet(self, octet_str):
if not octet_str:
raise ValueError("Empty octet not permitted")
# Whitelist the characters, since int() allows a lot of bizarre stuff.
if not self._DECIMAL_DIGITS.issuperset(octet_str):
... | [
"Convert a decimal octet into an integer.\n\n Args:\n octet_str: A string, the number to parse.\n\n Returns:\n The octet as an integer.\n\n Raises:\n ValueError: if the octet isn't strictly a decimal from [0..255].\n\n "
] |
Please provide a description of the function:def _is_valid_netmask(self, netmask):
mask = netmask.split('.')
if len(mask) == 4:
try:
for x in mask:
if int(x) not in self._valid_mask_octets:
return False
except V... | [
"Verify that the netmask is valid.\n\n Args:\n netmask: A string, either a prefix or dotted decimal\n netmask.\n\n Returns:\n A boolean, True if the prefix represents a valid IPv4\n netmask.\n\n "
] |
Please provide a description of the function:def is_private(self):
return (self in IPv4Network('0.0.0.0/8') or
self in IPv4Network('10.0.0.0/8') or
self in IPv4Network('127.0.0.0/8') or
self in IPv4Network('169.254.0.0/16') or
self in IPv4... | [
"Test if this address is allocated for private networks.\n\n Returns:\n A boolean, True if the address is reserved per\n iana-ipv4-special-registry.\n\n "
] |
Please provide a description of the function:def _explode_shorthand_ip_string(self):
if isinstance(self, IPv6Network):
ip_str = str(self.network_address)
elif isinstance(self, IPv6Interface):
ip_str = str(self.ip)
else:
ip_str = str(self)
ip_... | [
"Expand a shortened IPv6 address.\n\n Args:\n ip_str: A string, the IPv6 address.\n\n Returns:\n A string, the expanded IPv6 address.\n\n "
] |
Please provide a description of the function:def is_reserved(self):
reserved_networks = [IPv6Network('::/8'), IPv6Network('100::/8'),
IPv6Network('200::/7'), IPv6Network('400::/6'),
IPv6Network('800::/5'), IPv6Network('1000::/4'),
... | [
"Test if the address is otherwise IETF reserved.\n\n Returns:\n A boolean, True if the address is within one of the\n reserved IPv6 Network ranges.\n\n "
] |
Please provide a description of the function:def is_private(self):
return (self in IPv6Network('::1/128') or
self in IPv6Network('::/128') or
self in IPv6Network('::ffff:0:0/96') or
self in IPv6Network('100::/64') or
self in IPv6Network('2... | [
"Test if this address is allocated for private networks.\n\n Returns:\n A boolean, True if the address is reserved per\n iana-ipv6-special-registry.\n\n "
] |
Please provide a description of the function:def hosts(self):
network = int(self.network_address)
broadcast = int(self.broadcast_address)
for x in long_range(1, broadcast - network + 1):
yield self._address_class(network + x) | [
"Generate Iterator over usable hosts in a network.\n\n This is like __iter__ except it doesn't return the\n Subnet-Router anycast address.\n\n "
] |
Please provide a description of the function:def _to_list(obj):
'''
Convert snetinfo object to list
'''
ret = {}
for attr in __attrs:
if hasattr(obj, attr):
ret[attr] = getattr(obj, attr)
return ret | [] |
Please provide a description of the function:def validate(config):
'''
Validate the beacon configuration
'''
VALID_ITEMS = [
'type', 'bytes_sent', 'bytes_recv', 'packets_sent',
'packets_recv', 'errin', 'errout', 'dropin',
'dropout'
]
# Configuration for load beacon shou... | [] |
Please provide a description of the function:def beacon(config):
'''
Emit the network statistics of this host.
Specify thresholds for each network stat
and only emit a beacon if any of them are
exceeded.
Emit beacon when any values are equal to
configured values.
.. code-block:: yaml
... | [] |
Please provide a description of the function:def status():
'''
Return apcaccess output
CLI Example:
.. code-block:: bash
salt '*' apcups.status
'''
ret = {}
apcaccess = _check_apcaccess()
res = __salt__['cmd.run_all'](apcaccess)
retcode = res['retcode']
if retcode != 0... | [] |
Please provide a description of the function:def status_load():
'''
Return load
CLI Example:
.. code-block:: bash
salt '*' apcups.status_load
'''
data = status()
if 'LOADPCT' in data:
load = data['LOADPCT'].split()
if load[1].lower() == 'percent':
retur... | [] |
Please provide a description of the function:def coredump_configured(name, enabled, dump_ip, host_vnic='vmk0', dump_port=6500):
'''
Ensures a host's core dump configuration.
name
Name of the state.
enabled
Sets whether or not ESXi core dump collection should be enabled.
This is... | [] |
Please provide a description of the function:def password_present(name, password):
'''
Ensures the given password is set on the ESXi host. Passwords cannot be obtained from
host, so if a password is set in this state, the ``vsphere.update_host_password``
function will always run (except when using test=... | [] |
Please provide a description of the function:def ntp_configured(name,
service_running,
ntp_servers=None,
service_policy=None,
service_restart=False,
update_datetime=False):
'''
Ensures a host's NTP server configuratio... | [] |
Please provide a description of the function:def vmotion_configured(name, enabled, device='vmk0'):
'''
Configures a host's VMotion properties such as enabling VMotion and setting
the device VirtualNic that VMotion will use.
name
Name of the state.
enabled
Ensures whether or not VMo... | [] |
Please provide a description of the function:def vsan_configured(name, enabled, add_disks_to_vsan=False):
'''
Configures a host's VSAN properties such as enabling or disabling VSAN, or
adding VSAN-eligible disks to the VSAN system for the host.
name
Name of the state.
enabled
Ensur... | [] |
Please provide a description of the function:def ssh_configured(name,
service_running,
ssh_key=None,
ssh_key_file=None,
service_policy=None,
service_restart=False,
certificate_verify=False):
'''
Man... | [] |
Please provide a description of the function:def syslog_configured(name,
syslog_configs,
firewall=True,
reset_service=True,
reset_syslog_config=False,
reset_configs=None):
'''
Ensures the specified sysl... | [] |
Please provide a description of the function:def diskgroups_configured(name, diskgroups, erase_disks=False):
'''
Configures the disk groups to use for vsan.
This function will do the following:
1. Check whether or not all disks in the diskgroup spec exist, and raises
and errors if they do not.
... | [] |
Please provide a description of the function:def host_cache_configured(name, enabled, datastore, swap_size='100%',
dedicated_backing_disk=False,
erase_backing_disk=False):
'''
Configures the host cache used for swapping.
It will do the following:
1. ... | [] |
Please provide a description of the function:def hostname(name, hostname=None):
'''
Ensures that the hostname is set to the specified value.
.. versionadded:: 2019.2.0
name: The name of the module function to execute.
hostname(str): The hostname of the server.
SLS Example:
.. code-block... | [] |
Please provide a description of the function:def logging_levels(name, remote=None, local=None):
'''
Ensures that the logging levels are set on the device. The logging levels
must match the following options: emergency, alert, critical, error, warning,
notice, informational, debug.
.. versionadded::... | [] |
Please provide a description of the function:def ntp(name, servers):
'''
Ensures that the NTP servers are configured. Servers are provided as an individual string or list format. Only four
NTP servers will be reviewed. Any entries past four will be ignored.
name: The name of the module function to exec... | [] |
Please provide a description of the function:def power_configuration(name, policy=None, delayType=None, delayValue=None):
'''
Ensures that the power configuration is configured on the system. This is
only available on some C-Series servers.
.. versionadded:: 2019.2.0
name: The name of the module f... | [] |
Please provide a description of the function:def syslog(name, primary=None, secondary=None):
'''
Ensures that the syslog servers are set to the specified values. A value of None will be ignored.
name: The name of the module function to execute.
primary(str): The IP address or FQDN of the primary syslo... | [] |
Please provide a description of the function:def user(name, id='', user='', priv='', password='', status='active'):
'''
Ensures that a user is configured on the device. Due to being unable to
verify the user password. This is a forced operation.
.. versionadded:: 2019.2.0
name: The name of the mod... | [] |
Please provide a description of the function:def init(opts):
'''
This function gets called when the proxy starts up. For
login
the protocol and port are cached.
'''
log.debug('Initting esxcluster proxy module in process %s', os.getpid())
log.debug('Validating esxcluster proxy input')
sch... | [] |
Please provide a description of the function:def find_credentials():
'''
Cycle through all the possible credentials and return the first one that
works.
'''
# if the username and password were already found don't fo though the
# connection process again
if 'username' in DETAILS and 'passwor... | [] |
Please provide a description of the function:def targets(tgt, tgt_type='glob', **kwargs):
'''
Return the targets from the flat yaml file, checks opts for location but
defaults to /etc/salt/roster
'''
template = get_roster_file(__opts__)
rend = salt.loader.render(__opts__, {})
raw = compile_... | [] |
Please provide a description of the function:def run(self):
'''
Execute salt-key
'''
import salt.key
self.parse_args()
self.setup_logfile_logger()
verify_log(self.config)
key = salt.key.KeyCLI(self.config)
if check_user(self.config['user']):
... | [] |
Please provide a description of the function:def get(key, service=None, profile=None): # pylint: disable=W0613
'''
Get a decrypted secret from the tISMd API
'''
if not profile.get('url') or not profile.get('token'):
raise SaltConfigurationError("url and/or token missing from the tism sdb profi... | [] |
Please provide a description of the function:def ext_pillar(minion_id,
pillar,
*args,
**kwargs):
'''
Execute queries against POSTGRES, merge and return as a dict
'''
return POSTGRESExtPillar().fetch(minion_id, pillar, *args, **kwargs) | [] |
Please provide a description of the function:def _get_cursor(self):
'''
Yield a POSTGRES cursor
'''
_options = self._get_options()
conn = psycopg2.connect(host=_options['host'],
user=_options['user'],
password=_optio... | [] |
Please provide a description of the function:def extract_queries(self, args, kwargs):
'''
This function normalizes the config block into a set of queries we
can use. The return is a list of consistently laid out dicts.
'''
return super(POSTGRESExtPillar, self).extract_qu... | [] |
Please provide a description of the function:def _get_proc_cmdline(proc):
'''
Returns the cmdline of a Process instance.
It's backward compatible with < 2.0 versions of psutil.
'''
try:
return salt.utils.data.decode(proc.cmdline() if PSUTIL2 else proc.cmdline)
except (psutil.NoSuchProce... | [] |
Please provide a description of the function:def _get_proc_create_time(proc):
'''
Returns the create_time of a Process instance.
It's backward compatible with < 2.0 versions of psutil.
'''
try:
return salt.utils.data.decode(proc.create_time() if PSUTIL2 else proc.create_time)
except (ps... | [] |
Please provide a description of the function:def _get_proc_name(proc):
'''
Returns the name of a Process instance.
It's backward compatible with < 2.0 versions of psutil.
'''
try:
return salt.utils.data.decode(proc.name() if PSUTIL2 else proc.name)
except (psutil.NoSuchProcess, psutil.A... | [] |
Please provide a description of the function:def _get_proc_status(proc):
'''
Returns the status of a Process instance.
It's backward compatible with < 2.0 versions of psutil.
'''
try:
return salt.utils.data.decode(proc.status() if PSUTIL2 else proc.status)
except (psutil.NoSuchProcess, ... | [] |
Please provide a description of the function:def _get_proc_username(proc):
'''
Returns the username of a Process instance.
It's backward compatible with < 2.0 versions of psutil.
'''
try:
return salt.utils.data.decode(proc.username() if PSUTIL2 else proc.username)
except (psutil.NoSuchP... | [] |
Please provide a description of the function:def top(num_processes=5, interval=3):
'''
Return a list of top CPU consuming processes during the interval.
num_processes = return the top N CPU consuming processes
interval = the number of seconds to sample CPU usage over
CLI Examples:
.. code-bloc... | [] |
Please provide a description of the function:def proc_info(pid, attrs=None):
'''
Return a dictionary of information for a process id (PID).
CLI Example:
.. code-block:: bash
salt '*' ps.proc_info 2322
salt '*' ps.proc_info 2322 attrs='["pid", "name"]'
pid
PID of process t... | [] |
Please provide a description of the function:def kill_pid(pid, signal=15):
'''
Kill a process by PID.
.. code-block:: bash
salt 'minion' ps.kill_pid pid [signal=signal_number]
pid
PID of process to kill.
signal
Signal to send to the process. See manpage entry for kill
... | [] |
Please provide a description of the function:def pkill(pattern, user=None, signal=15, full=False):
'''
Kill processes matching a pattern.
.. code-block:: bash
salt '*' ps.pkill pattern [user=username] [signal=signal_number] \\
[full=(true|false)]
pattern
Pattern to sea... | [] |
Please provide a description of the function:def pgrep(pattern, user=None, full=False, pattern_is_regex=False):
'''
Return the pids for processes matching a pattern.
If full is true, the full command line is searched for a match,
otherwise only the name of the command is searched.
.. code-block:: ... | [] |
Please provide a description of the function:def cpu_percent(interval=0.1, per_cpu=False):
'''
Return the percent of time the CPU is busy.
interval
the number of seconds to sample CPU usage over
per_cpu
if True return an array of CPU percent busy for each CPU, otherwise
aggregat... | [] |
Please provide a description of the function:def cpu_times(per_cpu=False):
'''
Return the percent of time the CPU spends in each state,
e.g. user, system, idle, nice, iowait, irq, softirq.
per_cpu
if True return an array of percents for each CPU, otherwise aggregate
all percents into on... | [] |
Please provide a description of the function:def virtual_memory():
'''
.. versionadded:: 2014.7.0
Return a dict that describes statistics about system memory usage.
.. note::
This function is only available in psutil version 0.6.0 and above.
CLI Example:
.. code-block:: bash
... | [] |
Please provide a description of the function:def swap_memory():
'''
.. versionadded:: 2014.7.0
Return a dict that describes swap memory statistics.
.. note::
This function is only available in psutil version 0.6.0 and above.
CLI Example:
.. code-block:: bash
salt '*' ps.swa... | [] |
Please provide a description of the function:def disk_partitions(all=False):
'''
Return a list of disk partitions and their device, mount point, and
filesystem type.
all
if set to False, only return local, physical partitions (hard disk,
USB, CD/DVD partitions). If True, return all fil... | [] |
Please provide a description of the function: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)
fo... | [] |
Please provide a description of the function: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 availabl... | [] |
Please provide a description of the function: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... | [] |
Please provide a description of the function:def network_io_counters(interface=None):
'''
Return network I/O statistics.
CLI Example:
.. code-block:: bash
salt '*' ps.network_io_counters
salt '*' ps.network_io_counters interface=eth0
'''
if not interface:
return dict(... | [] |
Please provide a description of the function:def disk_io_counters(device=None):
'''
Return disk I/O statistics.
CLI Example:
.. code-block:: bash
salt '*' ps.disk_io_counters
salt '*' ps.disk_io_counters device=sda1
'''
if not device:
return dict(psutil.disk_io_counte... | [] |
Please provide a description of the function: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 o... | [] |
Please provide a description of the function: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)... | [] |
Please provide a description of the function: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")... | [] |
Please provide a description of the function: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']("... | [] |
Please provide a description of the function:def psaux(name):
'''
Retrieve information corresponding to a "ps aux" filtered
with the given pattern. It could be just a name or a regular
expression (using python search from "re" module).
CLI Example:
.. code-block:: bash
salt '*' ps.psa... | [] |
Please provide a description of the function:def present(profile='pagerduty', subdomain=None, api_key=None, **kwargs):
'''
Ensure pagerduty service exists.
This method accepts as arguments everything defined in
https://developer.pagerduty.com/documentation/rest/services/create
Note that many argume... | [] |
Please provide a description of the function: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',
... | [] |
Please provide a description of the function:def _diff(state_data, resource_object):
'''helper method to compare salt state info with the PagerDuty API json structure,
and determine if we need to update.
returns the dict to pass to the PD API to perform the update, or empty dict if no update.
'''
o... | [] |
Please provide a description of the function: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: Wa... | [] |
Please provide a description of the function:def output(data, **kwargs): # pylint: disable=unused-argument
'''
Mane function
'''
high_out = __salt__['highstate'](data)
return subprocess.check_output(['ponysay', salt.utils.data.decode(high_out)]) | [] |
Please provide a description of the function:def run_config(path,
source=None,
config_name=None,
config_data=None,
config_data_source=None,
script_parameters=None,
salt_env='base'):
r'''
Compile a DSC Configuration in the ... | [] |
Please provide a description of the function:def compile_config(path,
source=None,
config_name=None,
config_data=None,
config_data_source=None,
script_parameters=None,
salt_env='base'):
r'''
Compile... | [] |
Please provide a description of the function:def apply_config(path, source=None, salt_env='base'):
r'''
Run an compiled DSC configuration (a folder containing a .mof file). The
folder can be cached from the salt master using the ``source`` option.
Args:
path (str): Local path to the directory ... | [] |
Please provide a description of the function: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... | [] |
Please provide a description of the function: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 t... | [] |
Please provide a description of the function: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... | [] |
Please provide a description of the function: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... | [] |
Please provide a description of the function:def set_lcm_config(config_mode=None,
config_mode_freq=None,
refresh_freq=None,
reboot_if_needed=None,
action_after_reboot=None,
refresh_mode=None,
certificate_id... | [] |
Please provide a description of the function: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 adapt... | [] |
Please provide a description of the function: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... | [] |
Please provide a description of the function: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 rete... | [] |
Please provide a description of the function:def _dict_subset(keys, master_dict):
'''
Return a dictionary of only the subset of keys/values specified in keys
'''
return dict([(k, v) for k, v in six.iteritems(master_dict) if k in keys]) | [] |
Please provide a description of the function: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_... | [] |
Please provide a description of the function: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:
timeou... | [] |
Please provide a description of the function:def send(tag,
data=None,
preload=None,
with_env=False,
with_grains=False,
with_pillar=False,
with_env_opts=False,
timeout=60,
**kwargs):
'''
Send an event to the Salt Master
.. versionadded:: 2014.7... | [] |
Please provide a description of the function:def present(version,
name,
port=None,
encoding=None,
locale=None,
datadir=None,
allow_group_access=None,
data_checksums=None,
wal_segsize=None
):
'''
Ensure th... | [] |
Please provide a description of the function: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 = {... | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.