Code stringlengths 103 85.9k | Summary listlengths 0 94 |
|---|---|
Please provide a description of the function:def item(keys, default=''):
'''
Get one or more salt process environment variables.
Returns a dict.
keys
Either a string or a list of strings that will be used as the
keys for environment lookup.
default
If the key is not found i... | [] |
Please provide a description of the function:def _extract_key_val(kv, delimiter='='):
'''Extract key and value from key=val string.
Example:
>>> _extract_key_val('foo=bar')
('foo', 'bar')
'''
pieces = kv.split(delimiter)
key = pieces[0]
val = delimiter.join(pieces[1:])
return key, v... | [] |
Please provide a description of the function:def ext_pillar(minion_id,
pillar, # pylint: disable=W0613
repo_string):
'''
Execute a command and read the output as YAML
'''
# split the branch, repo name and optional extra (key=val) parameters.
options = repo_string.strip... | [] |
Please provide a description of the function:def pillar_dir(self):
'''
Returns the directory of the pillars (repo cache + branch + root)
'''
repo_dir = self.repo_dir
root = self.root
branch = self.branch
if branch == 'trunk' or branch == 'base':
workin... | [] |
Please provide a description of the function:def ext_pillar(hyper_id, pillar, name, key):
'''
Accept the key for the VM on the hyper, if authorized.
'''
vk = salt.utils.virt.VirtKey(hyper_id, name, __opts__)
ok = vk.accept(key)
pillar['virtkey'] = {name: ok}
return {} | [] |
Please provide a description of the function:def pv_present(name, **kwargs):
'''
Set a Physical Device to be used as an LVM Physical Volume
name
The device name to initialize.
kwargs
Any supported options to pvcreate. See
:mod:`linux_lvm <salt.modules.linux_lvm>` for more detai... | [] |
Please provide a description of the function:def pv_absent(name):
'''
Ensure that a Physical Device is not being used by lvm
name
The device name to initialize.
'''
ret = {'changes': {},
'comment': '',
'name': name,
'result': True}
if not __salt__['lvm.... | [] |
Please provide a description of the function:def vg_present(name, devices=None, **kwargs):
'''
Create an LVM Volume Group
name
The Volume Group name to create
devices
A list of devices that will be added to the Volume Group
kwargs
Any supported options to vgcreate. See
... | [] |
Please provide a description of the function:def lv_present(name,
vgname=None,
size=None,
extents=None,
snapshot=None,
pv='',
thinvolume=False,
thinpool=False,
force=False,
**kwargs):
... | [] |
Please provide a description of the function:def lv_absent(name, vgname=None):
'''
Remove a given existing Logical Volume from a named existing volume group
name
The Logical Volume to remove
vgname
The name of the Volume Group on which the Logical Volume resides
'''
ret = {'cha... | [] |
Please provide a description of the function:def get_conn(profile):
'''
Return a client object for accessing consul
'''
params = {}
for key in ('host', 'port', 'token', 'scheme', 'consistency', 'dc', 'verify'):
if key in profile:
params[key] = profile[key]
if HAS_CONSUL:
... | [] |
Please provide a description of the function:def _delivery_report(err, msg):
''' Called once for each message produced to indicate delivery result.
Triggered by poll() or flush(). '''
if err is not None:
log.error('Message delivery failed: %s', err)
else:
log.debug('Message delivered... | [] |
Please provide a description of the function:def returner(ret):
'''
Return information to a Kafka server
'''
if __salt__['config.option']('returner.kafka.topic'):
topic = __salt__['config.option']('returner.kafka.topic')
conn = _get_conn()
producer = Producer({'bootstrap.servers... | [] |
Please provide a description of the function:def installed(name,
composer=None,
php=None,
user=None,
prefer_source=None,
prefer_dist=None,
no_scripts=None,
no_plugins=None,
optimize=None,
no_dev... | [] |
Please provide a description of the function:def update(name,
composer=None,
php=None,
user=None,
prefer_source=None,
prefer_dist=None,
no_scripts=None,
no_plugins=None,
optimize=None,
no_dev=None,
quiet=False,... | [] |
Please provide a description of the function:def exists(name, region=None, key=None, keyid=None, profile=None):
'''
Check to see if a cache cluster exists.
CLI example::
salt myminion boto_elasticache.exists myelasticache
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile=pr... | [] |
Please provide a description of the function:def group_exists(name, region=None, key=None, keyid=None, profile=None):
'''
Check to see if a replication group exists.
CLI example::
salt myminion boto_elasticache.group_exists myelasticache
'''
conn = _get_conn(region=region, key=key, keyid=k... | [] |
Please provide a description of the function:def create_replication_group(name, primary_cluster_id, replication_group_description,
wait=None, region=None, key=None,
keyid=None, profile=None):
'''
Create replication group.
CLI example::
salt... | [] |
Please provide a description of the function:def describe_replication_group(name, region=None, key=None, keyid=None,
profile=None, parameter=None):
'''
Get replication group information.
CLI example::
salt myminion boto_elasticache.describe_replication_group mygroup
... | [] |
Please provide a description of the function:def get_config(name, region=None, key=None, keyid=None, profile=None):
'''
Get the configuration for a cache cluster.
CLI example::
salt myminion boto_elasticache.get_config myelasticache
'''
conn = _get_conn(region=region, key=key, keyid=keyid,... | [] |
Please provide a description of the function:def get_node_host(name, region=None, key=None, keyid=None, profile=None):
'''
Get hostname from cache node
CLI example::
salt myminion boto_elasticache.get_node_host myelasticache
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile... | [] |
Please provide a description of the function:def get_group_host(name, region=None, key=None, keyid=None, profile=None):
'''
Get hostname from replication cache group
CLI example::
salt myminion boto_elasticache.get_group_host myelasticachegroup
'''
conn = _get_conn(region=region, key=key, ... | [] |
Please provide a description of the function:def get_all_cache_subnet_groups(name=None, region=None, key=None,
keyid=None, profile=None):
'''
Return a list of all cache subnet groups with details
CLI example::
salt myminion boto_elasticache.get_all_subnet_groups reg... | [] |
Please provide a description of the function:def list_cache_subnet_groups(name=None, region=None, key=None,
keyid=None, profile=None):
'''
Return a list of all cache subnet group names
CLI example::
salt myminion boto_elasticache.list_subnet_groups region=us-east-1
... | [] |
Please provide a description of the function:def subnet_group_exists(name, tags=None, region=None, key=None, keyid=None, profile=None):
'''
Check to see if an ElastiCache subnet group exists.
CLI example::
salt myminion boto_elasticache.subnet_group_exists my-param-group \
region=u... | [] |
Please provide a description of the function:def create_subnet_group(name, description, subnet_ids=None, subnet_names=None, tags=None,
region=None, key=None, keyid=None, profile=None):
'''
Create an ElastiCache subnet group
CLI example to create an ElastiCache subnet group::
... | [] |
Please provide a description of the function:def get_cache_subnet_group(name, region=None, key=None, keyid=None,
profile=None):
'''
Get information about a cache subnet group.
CLI example::
salt myminion boto_elasticache.get_cache_subnet_group mycache_subnet_group
''... | [] |
Please provide a description of the function:def delete_subnet_group(name, region=None, key=None, keyid=None, profile=None):
'''
Delete an ElastiCache subnet group.
CLI example::
salt myminion boto_elasticache.delete_subnet_group my-subnet-group \
region=us-east-1
'''
conn ... | [] |
Please provide a description of the function:def create(name, num_cache_nodes=None, engine=None, cache_node_type=None,
replication_group_id=None, engine_version=None,
cache_parameter_group_name=None, cache_subnet_group_name=None,
cache_security_group_names=None, security_group_ids=None,... | [] |
Please provide a description of the function:def delete(name, wait=False, region=None, key=None, keyid=None, profile=None):
'''
Delete a cache cluster.
CLI example::
salt myminion boto_elasticache.delete myelasticache
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profil... | [] |
Please provide a description of the function:def create_cache_security_group(name, description, region=None, key=None,
keyid=None, profile=None):
'''
Create a cache security group.
CLI example::
salt myminion boto_elasticache.create_cache_security_group myelasticach... | [] |
Please provide a description of the function:def delete_cache_security_group(name, region=None, key=None, keyid=None,
profile=None):
'''
Delete a cache security group.
CLI example::
salt myminion boto_elasticache.delete_cache_security_group myelasticachesg 'My Cache... | [] |
Please provide a description of the function:def authorize_cache_security_group_ingress(name, ec2_security_group_name,
ec2_security_group_owner_id,
region=None, key=None, keyid=None,
profile=... | [] |
Please provide a description of the function:def try_printout(data, out, opts, **kwargs):
'''
Safely get the string to print out, try the configured outputter, then
fall back to nested and then to raw
'''
try:
printout = get_printout(out, opts)(data, **kwargs)
if printout is not None... | [] |
Please provide a description of the function:def get_progress(opts, out, progress):
'''
Get the progress bar from the given outputter
'''
return salt.loader.raw_mod(opts,
out,
'rawmodule',
mod='output')['{0}.... | [] |
Please provide a description of the function:def update_progress(opts, progress, progress_iter, out):
'''
Update the progress iterator for the given outputter
'''
# Look up the outputter
try:
progress_outputter = salt.loader.outputters(opts)[out]
except KeyError: # Outputter is not load... | [] |
Please provide a description of the function:def display_output(data, out=None, opts=None, **kwargs):
'''
Print the passed data using the desired output
'''
if opts is None:
opts = {}
display_data = try_printout(data, out, opts, **kwargs)
output_filename = opts.get('output_file', None)
... | [] |
Please provide a description of the function:def get_printout(out, opts=None, **kwargs):
'''
Return a printer function
'''
if opts is None:
opts = {}
if 'output' in opts and opts['output'] != 'highstate':
# new --out option, but don't choke when using --out=highstate at CLI
... | [] |
Please provide a description of the function:def out_format(data, out, opts=None, **kwargs):
'''
Return the formatted outputter string for the passed data
'''
return try_printout(data, out, opts, **kwargs) | [] |
Please provide a description of the function:def string_format(data, out, opts=None, **kwargs):
'''
Return the formatted outputter string, removing the ANSI escape sequences.
'''
raw_output = try_printout(data, out, opts, **kwargs)
ansi_escape = re.compile(r'\x1b[^m]*m')
return ansi_escape.sub('... | [] |
Please provide a description of the function:def html_format(data, out, opts=None, **kwargs):
'''
Return the formatted string as HTML.
'''
ansi_escaped_string = string_format(data, out, opts, **kwargs)
return ansi_escaped_string.replace(' ', ' ').replace('\n', '<br />') | [] |
Please provide a description of the function:def strip_esc_sequence(txt):
'''
Replace ESC (ASCII 27/Oct 33) to prevent unsafe strings
from writing their own terminal manipulation commands
'''
if isinstance(txt, six.string_types):
try:
return txt.replace('\033', '?')
excep... | [] |
Please provide a description of the function:def _tree(domain, tld=False):
'''
Split out a domain in its parents
Leverages tldextract to take the TLDs from publicsuffix.org
or makes a valiant approximation of that
:param domain: dc2.ams2.example.com
:param tld: Include TLD in list
:return:... | [] |
Please provide a description of the function:def _data2rec(schema, rec_data):
'''
schema = OrderedDict({
'prio': int,
'weight': int,
'port': to_port,
'name': str,
})
rec_data = '10 20 25 myawesome.nl'
res = {'prio': 10, 'weight': 20, 'port': 25 'name': 'myawesome.nl'... | [] |
Please provide a description of the function:def _lookup_dig(name, rdtype, timeout=None, servers=None, secure=None):
'''
Use dig to lookup addresses
:param name: Name of record to search
:param rdtype: DNS record type
:param timeout: server response timeout
:param servers: [] of servers to use
... | [] |
Please provide a description of the function:def _lookup_drill(name, rdtype, timeout=None, servers=None, secure=None):
'''
Use drill to lookup addresses
:param name: Name of record to search
:param rdtype: DNS record type
:param timeout: command return timeout
:param servers: [] of servers to us... | [] |
Please provide a description of the function:def _lookup_gai(name, rdtype, timeout=None):
'''
Use Python's socket interface to lookup addresses
:param name: Name of record to search
:param rdtype: A or AAAA
:param timeout: ignored
:return: [] of addresses or False if error
'''
try:
... | [] |
Please provide a description of the function:def _lookup_host(name, rdtype, timeout=None, server=None):
'''
Use host to lookup addresses
:param name: Name of record to search
:param server: Server to query
:param rdtype: DNS record type
:param timeout: server response wait
:return: [] of rec... | [] |
Please provide a description of the function:def _lookup_dnspython(name, rdtype, timeout=None, servers=None, secure=None):
'''
Use dnspython to lookup addresses
:param name: Name of record to search
:param rdtype: DNS record type
:param timeout: query timeout
:param server: [] of server(s) to tr... | [] |
Please provide a description of the function:def _lookup_nslookup(name, rdtype, timeout=None, server=None):
'''
Use nslookup to lookup addresses
:param name: Name of record to search
:param rdtype: DNS record type
:param timeout: server response timeout
:param server: server to query
:return... | [] |
Please provide a description of the function:def lookup(
name,
rdtype,
method=None,
servers=None,
timeout=None,
walk=False,
walk_tld=False,
secure=None
):
'''
Lookup DNS records and return their data
:param name: name to lookup
:param rdtype: DNS record type
:param m... | [] |
Please provide a description of the function:def query(
name,
rdtype,
method=None,
servers=None,
timeout=None,
walk=False,
walk_tld=False,
secure=None
):
'''
Query DNS for information.
Where `lookup()` returns record data, `query()` tries to interpret the data and return it's... | [] |
Please provide a description of the function:def host(name, ip4=True, ip6=True, **kwargs):
'''
Return a list of addresses for name
ip6:
Return IPv6 addresses
ip4:
Return IPv4 addresses
the rest is passed on to lookup()
'''
res = {}
if ip6:
ip6 = lookup(name, 'AA... | [] |
Please provide a description of the function:def caa_rec(rdatas):
'''
Validate and parse DNS record data for a CAA record
:param rdata: DNS record data
:return: dict w/fields
'''
rschema = OrderedDict((
('flags', lambda flag: ['critical'] if int(flag) > 0 else []),
('tag', RFC.CA... | [] |
Please provide a description of the function:def ptr_name(rdata):
'''
Return PTR name of given IP
:param rdata: IP address
:return: PTR record name
'''
try:
return ipaddress.ip_address(rdata).reverse_pointer
except ValueError:
log.error(
'Unable to generate PTR re... | [] |
Please provide a description of the function:def soa_rec(rdata):
'''
Validate and parse DNS record data for SOA record(s)
:param rdata: DNS record data
:return: dict w/fields
'''
rschema = OrderedDict((
('mname', str),
('rname', str),
('serial', int),
('refresh', ... | [] |
Please provide a description of the function:def spf_rec(rdata):
'''
Validate and parse DNS record data for SPF record(s)
:param rdata: DNS record data
:return: dict w/fields
'''
spf_fields = rdata.split(' ')
if not spf_fields.pop(0).startswith('v=spf'):
raise ValueError('Not an SPF ... | [] |
Please provide a description of the function:def srv_data(target, port, prio=10, weight=10):
'''
Generate SRV record data
:param target:
:param port:
:param prio:
:param weight:
:return:
'''
return _rec2data(prio, weight, port, target) | [] |
Please provide a description of the function:def srv_name(svc, proto='tcp', domain=None):
'''
Generate SRV record name
:param svc: ldap, 389 etc
:param proto: tcp, udp, sctp etc.
:param domain: name to append
:return:
'''
proto = RFC.validate(proto, RFC.SRV_PROTO)
if isinstance(svc, ... | [] |
Please provide a description of the function:def srv_rec(rdatas):
'''
Validate and parse DNS record data for SRV record(s)
:param rdata: DNS record data
:return: dict w/fields
'''
rschema = OrderedDict((
('prio', int),
('weight', int),
('port', _to_port),
('name',... | [] |
Please provide a description of the function:def sshfp_data(key_t, hash_t, pub):
'''
Generate an SSHFP record
:param key_t: rsa/dsa/ecdsa/ed25519
:param hash_t: sha1/sha256
:param pub: the SSH public key
'''
key_t = RFC.validate(key_t, RFC.SSHFP_ALGO, 'in')
hash_t = RFC.validate(hash_t, ... | [] |
Please provide a description of the function:def sshfp_rec(rdata):
'''
Validate and parse DNS record data for TLSA record(s)
:param rdata: DNS record data
:return: dict w/fields
'''
rschema = OrderedDict((
('algorithm', RFC.SSHFP_ALGO),
('fp_hash', RFC.SSHFP_HASH),
('fing... | [] |
Please provide a description of the function:def tlsa_data(pub, usage, selector, matching):
'''
Generate a TLSA rec
:param pub: Pub key in PEM format
:param usage:
:param selector:
:param matching:
:return: TLSA data portion
'''
usage = RFC.validate(usage, RFC.TLSA_USAGE)
selecto... | [] |
Please provide a description of the function:def tlsa_rec(rdata):
'''
Validate and parse DNS record data for TLSA record(s)
:param rdata: DNS record data
:return: dict w/fields
'''
rschema = OrderedDict((
('usage', RFC.TLSA_USAGE),
('selector', RFC.TLSA_SELECT),
('matchin... | [] |
Please provide a description of the function:def service(
svc,
proto='tcp',
domain=None,
walk=False,
secure=None
):
'''
Find an SRV service in a domain or it's parents
:param svc: service to find (ldap, 389, etc)
:param proto: protocol the service talks (tcp, udp, etc)
:param dom... | [] |
Please provide a description of the function:def services(services_file='/etc/services'):
'''
Parse through system-known services
:return: {
'svc': [
{ 'port': port
'proto': proto,
'desc': comment
},
],
}
'''
res = {}
with salt.u... | [] |
Please provide a description of the function:def parse_resolv(src='/etc/resolv.conf'):
'''
Parse a resolver configuration file (traditionally /etc/resolv.conf)
'''
nameservers = []
ip4_nameservers = []
ip6_nameservers = []
search = []
sortlist = []
domain = ''
options = []
... | [] |
Please provide a description of the function:def get_returner_options(virtualname=None,
ret=None,
attrs=None,
**kwargs):
'''
Get the returner options from salt.
:param str virtualname: The returner virtualname (as returned
b... | [] |
Please provide a description of the function:def _fetch_option(cfg, ret_config, virtualname, attr_name):
# c_cfg is a dictionary returned from config.option for
# any options configured for this returner.
if isinstance(cfg, dict):
c_cfg = cfg
else:
c_cfg = cfg('{0}'.format(virtualna... | [
"\n Fetch a given option value from the config.\n\n @see :func:`get_returner_options`\n "
] |
Please provide a description of the function:def _options_browser(cfg, ret_config, defaults, virtualname, options):
for option in options:
# default place for the option in the config
value = _fetch_option(cfg, ret_config, virtualname, options[option])
if value:
yield opt... | [
"\n Iterator generating all duples ```option name -> value```\n\n @see :func:`get_returner_options`\n "
] |
Please provide a description of the function:def _fetch_profile_opts(
cfg, virtualname,
__salt__,
_options,
profile_attr,
profile_attrs
):
if (not profile_attr) or (profile_attr not in _options):
return {}
# Using a profile and it is in _options
cr... | [
"\n Fetches profile specific options if applicable\n\n @see :func:`get_returner_options`\n\n :return: a options dict\n "
] |
Please provide a description of the function:def enabled(name, runas=None):
'''
Ensure the RabbitMQ plugin is enabled.
name
The name of the plugin
runas
The user to run the rabbitmq-plugin command as
'''
ret = {'name': name, 'result': True, 'comment': '', 'changes': {}}
tr... | [] |
Please provide a description of the function:def _revs_equal(rev1, rev2, rev_type):
'''
Shorthand helper function for comparing SHA1s. If rev_type == 'sha1' then
the comparison will be done using str.startwith() to allow short SHA1s to
compare successfully.
NOTE: This means that rev2 must be the sh... | [] |
Please provide a description of the function:def _get_branch_opts(branch, local_branch, all_local_branches,
desired_upstream, git_ver=None):
'''
DRY helper to build list of opts for git.branch, for the purposes of
setting upstream tracking branch
'''
if branch is not None and br... | [] |
Please provide a description of the function:def _get_local_rev_and_branch(target, user, password, output_encoding=None):
'''
Return the local revision for before/after comparisons
'''
log.info('Checking local revision for %s', target)
try:
local_rev = __salt__['git.revision'](
t... | [] |
Please provide a description of the function:def present(name,
force=False,
bare=True,
template=None,
separate_git_dir=None,
shared=None,
user=None,
password=None,
output_encoding=None):
'''
Ensure that a repository ... | [] |
Please provide a description of the function:def detached(name,
rev,
target=None,
remote='origin',
user=None,
password=None,
force_clone=False,
force_checkout=False,
fetch_remote=True,
hard_reset=False,
submodu... | [] |
Please provide a description of the function:def cloned(name,
target=None,
branch=None,
user=None,
password=None,
identity=None,
https_user=None,
https_pass=None,
output_encoding=None):
'''
.. versionadded:: 2018.3.3,2019.2.... | [] |
Please provide a description of the function:def config_unset(name,
value_regex=None,
repo=None,
user=None,
password=None,
output_encoding=None,
**kwargs):
r'''
.. versionadded:: 2015.8.0
Ensure that the n... | [] |
Please provide a description of the function:def config_set(name,
value=None,
multivar=None,
repo=None,
user=None,
password=None,
output_encoding=None,
**kwargs):
'''
.. versionadded:: 2014.7.0
.. versio... | [] |
Please provide a description of the function:def mod_run_check(cmd_kwargs, onlyif, unless):
'''
Execute the onlyif and unless logic. Return a result dict if:
* onlyif failed (onlyif != 0)
* unless succeeded (unless == 0)
Otherwise, returns ``True``
'''
cmd_kwargs = copy.deepcopy(cmd_kwargs... | [] |
Please provide a description of the function:def push_note(device=None, title=None, body=None):
'''
Pushing a text note.
:param device: Pushbullet target device
:param title: Note title
:param body: Note body
:return: Boolean if message was sent successfully.
CLI Examp... | [] |
Please provide a description of the function:def verify_webhook(signature, body):
'''
Verify the webhook signature from travisci
signature
The signature header from the webhook header
body
The full payload body from the webhook post
.. note:: The body needs to be the urlencoded ve... | [] |
Please provide a description of the function:def managed(name, type, enabled=True, **kwargs):
'''
Ensure that the named interface is configured properly.
name
The name of the interface to manage
type
Type of interface and configuration.
enabled
Designates the state of this... | [] |
Please provide a description of the function:def routes(name, **kwargs):
'''
Manage network interface static routes.
name
Interface name to apply the route to.
kwargs
Named routes
'''
ret = {
'name': name,
'changes': {},
'result': True,
'comment'... | [] |
Please provide a description of the function:def system(name, **kwargs):
'''
Ensure that global network settings are configured properly.
name
Custom name to represent this configuration change.
kwargs
The global parameters for the system.
'''
ret = {
'name': name,
... | [] |
Please provide a description of the function:def present(name, mediatype, **kwargs):
'''
Creates new mediatype.
NOTE: This function accepts all standard mediatype properties: keyword argument names differ depending on your
zabbix version, see:
https://www.zabbix.com/documentation/3.0/manual/api/refe... | [] |
Please provide a description of the function:def absent(name, **kwargs):
'''
Ensures that the mediatype does not exist, eventually deletes the mediatype.
:param name: name of the mediatype
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:p... | [] |
Please provide a description of the function:def sanitize_host(host):
'''
Sanitize host string.
https://tools.ietf.org/html/rfc1123#section-2.1
'''
RFC952_characters = ascii_letters + digits + ".-"
return "".join([c for c in host[0:255] if c in RFC952_characters]) | [] |
Please provide a description of the function:def isportopen(host, port):
'''
Return status of a port
'''
if not 1 <= int(port) <= 65535:
return False
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
out = sock.connect_ex((sanitize_host(host), int(port)))
return out | [] |
Please provide a description of the function:def host_to_ips(host):
'''
Returns a list of IP addresses of a given hostname or None if not found.
'''
ips = []
try:
for family, socktype, proto, canonname, sockaddr in socket.getaddrinfo(
host, 0, socket.AF_UNSPEC, socket.SOCK_ST... | [] |
Please provide a description of the function:def _generate_minion_id():
'''
Get list of possible host names and convention names.
:return:
'''
# There are three types of hostnames:
# 1. Network names. How host is accessed from the network.
# 2. Host aliases. They might be not available in a... | [] |
Please provide a description of the function:def generate_minion_id():
'''
Return only first element of the hostname from all possible list.
:return:
'''
try:
ret = salt.utils.stringutils.to_unicode(_generate_minion_id().first())
except TypeError:
ret = None
return ret or 'l... | [] |
Please provide a description of the function:def get_socket(addr, type=socket.SOCK_STREAM, proto=0):
'''
Return a socket object for the addr
IP-version agnostic
'''
version = ipaddress.ip_address(addr).version
if version == 4:
family = socket.AF_INET
elif version == 6:
famil... | [] |
Please provide a description of the function:def get_fqhostname():
'''
Returns the fully qualified hostname
'''
# try getaddrinfo()
fqdn = None
try:
addrinfo = socket.getaddrinfo(
socket.gethostname(), 0, socket.AF_UNSPEC, socket.SOCK_STREAM,
socket.SOL_TCP, socke... | [] |
Please provide a description of the function:def ip_to_host(ip):
'''
Returns the hostname of a given IP
'''
try:
hostname, aliaslist, ipaddrlist = socket.gethostbyaddr(ip)
except Exception as exc:
log.debug('salt.utils.network.ip_to_host(%r) failed: %s', ip, exc)
hostname = N... | [] |
Please provide a description of the function:def is_reachable_host(entity_name):
'''
Returns a bool telling if the entity name is a reachable host (IPv4/IPv6/FQDN/etc).
:param hostname:
:return:
'''
try:
assert type(socket.getaddrinfo(entity_name, 0, 0, 0, 0)) == list
ret = True
... | [] |
Please provide a description of the function:def is_ip_filter(ip, options=None):
'''
Returns a bool telling if the passed IP is a valid IPv4 or IPv6 address.
'''
return is_ipv4_filter(ip, options=options) or is_ipv6_filter(ip, options=options) | [] |
Please provide a description of the function:def is_ipv4_filter(ip, options=None):
'''
Returns a bool telling if the value passed to it was a valid IPv4 address.
ip
The IP address.
net: False
Consider IP addresses followed by netmask.
options
CSV of options regarding the n... | [] |
Please provide a description of the function:def is_ipv6_filter(ip, options=None):
'''
Returns a bool telling if the value passed to it was a valid IPv6 address.
ip
The IP address.
net: False
Consider IP addresses followed by netmask.
options
CSV of options regarding the n... | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.