repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/modules/useradd.py | _format_info | def _format_info(data):
'''
Return user information in a pretty way
'''
# Put GECOS info into a list
gecos_field = salt.utils.stringutils.to_unicode(data.pw_gecos).split(',', 4)
# Make sure our list has at least five elements
while len(gecos_field) < 5:
gecos_field.append('')
re... | python | def _format_info(data):
'''
Return user information in a pretty way
'''
# Put GECOS info into a list
gecos_field = salt.utils.stringutils.to_unicode(data.pw_gecos).split(',', 4)
# Make sure our list has at least five elements
while len(gecos_field) < 5:
gecos_field.append('')
re... | [
"def",
"_format_info",
"(",
"data",
")",
":",
"# Put GECOS info into a list",
"gecos_field",
"=",
"salt",
".",
"utils",
".",
"stringutils",
".",
"to_unicode",
"(",
"data",
".",
"pw_gecos",
")",
".",
"split",
"(",
"','",
",",
"4",
")",
"# Make sure our list has... | Return user information in a pretty way | [
"Return",
"user",
"information",
"in",
"a",
"pretty",
"way"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/useradd.py#L793-L814 | train |
saltstack/salt | salt/modules/useradd.py | list_users | def list_users(root=None):
'''
Return a list of all users
root
Directory to chroot into
CLI Example:
.. code-block:: bash
salt '*' user.list_users
'''
if root is not None and __grains__['kernel'] != 'AIX':
getpwall = functools.partial(_getpwall, root=root)
els... | python | def list_users(root=None):
'''
Return a list of all users
root
Directory to chroot into
CLI Example:
.. code-block:: bash
salt '*' user.list_users
'''
if root is not None and __grains__['kernel'] != 'AIX':
getpwall = functools.partial(_getpwall, root=root)
els... | [
"def",
"list_users",
"(",
"root",
"=",
"None",
")",
":",
"if",
"root",
"is",
"not",
"None",
"and",
"__grains__",
"[",
"'kernel'",
"]",
"!=",
"'AIX'",
":",
"getpwall",
"=",
"functools",
".",
"partial",
"(",
"_getpwall",
",",
"root",
"=",
"root",
")",
... | Return a list of all users
root
Directory to chroot into
CLI Example:
.. code-block:: bash
salt '*' user.list_users | [
"Return",
"a",
"list",
"of",
"all",
"users"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/useradd.py#L852-L870 | train |
saltstack/salt | salt/modules/useradd.py | rename | def rename(name, new_name, root=None):
'''
Change the username for a named user
name
User to modify
new_name
New value of the login name
root
Directory to chroot into
CLI Example:
.. code-block:: bash
salt '*' user.rename name new_name
'''
if inf... | python | def rename(name, new_name, root=None):
'''
Change the username for a named user
name
User to modify
new_name
New value of the login name
root
Directory to chroot into
CLI Example:
.. code-block:: bash
salt '*' user.rename name new_name
'''
if inf... | [
"def",
"rename",
"(",
"name",
",",
"new_name",
",",
"root",
"=",
"None",
")",
":",
"if",
"info",
"(",
"new_name",
",",
"root",
"=",
"root",
")",
":",
"raise",
"CommandExecutionError",
"(",
"'User \\'{0}\\' already exists'",
".",
"format",
"(",
"new_name",
... | Change the username for a named user
name
User to modify
new_name
New value of the login name
root
Directory to chroot into
CLI Example:
.. code-block:: bash
salt '*' user.rename name new_name | [
"Change",
"the",
"username",
"for",
"a",
"named",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/useradd.py#L873-L895 | train |
saltstack/salt | salt/modules/useradd.py | _getpwnam | def _getpwnam(name, root=None):
'''
Alternative implementation for getpwnam, that use only /etc/passwd
'''
root = '/' if not root else root
passwd = os.path.join(root, 'etc/passwd')
with salt.utils.files.fopen(passwd) as fp_:
for line in fp_:
line = salt.utils.stringutils.to_... | python | def _getpwnam(name, root=None):
'''
Alternative implementation for getpwnam, that use only /etc/passwd
'''
root = '/' if not root else root
passwd = os.path.join(root, 'etc/passwd')
with salt.utils.files.fopen(passwd) as fp_:
for line in fp_:
line = salt.utils.stringutils.to_... | [
"def",
"_getpwnam",
"(",
"name",
",",
"root",
"=",
"None",
")",
":",
"root",
"=",
"'/'",
"if",
"not",
"root",
"else",
"root",
"passwd",
"=",
"os",
".",
"path",
".",
"join",
"(",
"root",
",",
"'etc/passwd'",
")",
"with",
"salt",
".",
"utils",
".",
... | Alternative implementation for getpwnam, that use only /etc/passwd | [
"Alternative",
"implementation",
"for",
"getpwnam",
"that",
"use",
"only",
"/",
"etc",
"/",
"passwd"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/useradd.py#L898-L912 | train |
saltstack/salt | salt/modules/useradd.py | add_subgids | def add_subgids(name, first=100000, last=110000):
'''
Add a range of subordinate gids to the user
name
User to modify
first
Begin of the range
last
End of the range
CLI Examples:
.. code-block:: bash
salt '*' user.add_subgids foo
salt '*' user.ad... | python | def add_subgids(name, first=100000, last=110000):
'''
Add a range of subordinate gids to the user
name
User to modify
first
Begin of the range
last
End of the range
CLI Examples:
.. code-block:: bash
salt '*' user.add_subgids foo
salt '*' user.ad... | [
"def",
"add_subgids",
"(",
"name",
",",
"first",
"=",
"100000",
",",
"last",
"=",
"110000",
")",
":",
"if",
"__grains__",
"[",
"'kernel'",
"]",
"!=",
"'Linux'",
":",
"log",
".",
"warning",
"(",
"\"'subgids' are only supported on GNU/Linux hosts.\"",
")",
"retu... | Add a range of subordinate gids to the user
name
User to modify
first
Begin of the range
last
End of the range
CLI Examples:
.. code-block:: bash
salt '*' user.add_subgids foo
salt '*' user.add_subgids foo first=105000
salt '*' user.add_subgids f... | [
"Add",
"a",
"range",
"of",
"subordinate",
"gids",
"to",
"the",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/useradd.py#L984-L1008 | train |
saltstack/salt | salt/states/win_dism.py | capability_installed | def capability_installed(name,
source=None,
limit_access=False,
image=None,
restart=False):
'''
Install a DISM capability
Args:
name (str): The capability to install
source (str): The optiona... | python | def capability_installed(name,
source=None,
limit_access=False,
image=None,
restart=False):
'''
Install a DISM capability
Args:
name (str): The capability to install
source (str): The optiona... | [
"def",
"capability_installed",
"(",
"name",
",",
"source",
"=",
"None",
",",
"limit_access",
"=",
"False",
",",
"image",
"=",
"None",
",",
"restart",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"... | Install a DISM capability
Args:
name (str): The capability to install
source (str): The optional source of the capability
limit_access (bool): Prevent DISM from contacting Windows Update for
online images
image (Optional[str]): The path to the root directory of an offlin... | [
"Install",
"a",
"DISM",
"capability"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_dism.py#L40-L101 | train |
saltstack/salt | salt/states/win_dism.py | package_removed | def package_removed(name, image=None, restart=False):
'''
Uninstall a package
Args:
name (str): The full path to the package. Can be either a .cab file or a
folder. Should point to the original source of the package, not to
where the file is installed. This can also be the n... | python | def package_removed(name, image=None, restart=False):
'''
Uninstall a package
Args:
name (str): The full path to the package. Can be either a .cab file or a
folder. Should point to the original source of the package, not to
where the file is installed. This can also be the n... | [
"def",
"package_removed",
"(",
"name",
",",
"image",
"=",
"None",
",",
"restart",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
"}",
"# Fa... | Uninstall a package
Args:
name (str): The full path to the package. Can be either a .cab file or a
folder. Should point to the original source of the package, not to
where the file is installed. This can also be the name of a package as listed in
``dism.installed_package... | [
"Uninstall",
"a",
"package"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_dism.py#L368-L443 | train |
saltstack/salt | salt/modules/network.py | ping | def ping(host, timeout=False, return_boolean=False):
'''
Performs an ICMP ping to a host
.. versionchanged:: 2015.8.0
Added support for SunOS
CLI Example:
.. code-block:: bash
salt '*' network.ping archlinux.org
.. versionadded:: 2015.5.0
Return a True or False instead ... | python | def ping(host, timeout=False, return_boolean=False):
'''
Performs an ICMP ping to a host
.. versionchanged:: 2015.8.0
Added support for SunOS
CLI Example:
.. code-block:: bash
salt '*' network.ping archlinux.org
.. versionadded:: 2015.5.0
Return a True or False instead ... | [
"def",
"ping",
"(",
"host",
",",
"timeout",
"=",
"False",
",",
"return_boolean",
"=",
"False",
")",
":",
"if",
"timeout",
":",
"if",
"__grains__",
"[",
"'kernel'",
"]",
"==",
"'SunOS'",
":",
"cmd",
"=",
"'ping -c 4 {1} {0}'",
".",
"format",
"(",
"timeout... | Performs an ICMP ping to a host
.. versionchanged:: 2015.8.0
Added support for SunOS
CLI Example:
.. code-block:: bash
salt '*' network.ping archlinux.org
.. versionadded:: 2015.5.0
Return a True or False instead of ping output.
.. code-block:: bash
salt '*' netwo... | [
"Performs",
"an",
"ICMP",
"ping",
"to",
"a",
"host"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/network.py#L63-L104 | train |
saltstack/salt | salt/modules/network.py | _netstat_linux | def _netstat_linux():
'''
Return netstat information for Linux distros
'''
ret = []
cmd = 'netstat -tulpnea'
out = __salt__['cmd.run'](cmd)
for line in out.splitlines():
comps = line.split()
if line.startswith('tcp'):
ret.append({
'proto': comps[0]... | python | def _netstat_linux():
'''
Return netstat information for Linux distros
'''
ret = []
cmd = 'netstat -tulpnea'
out = __salt__['cmd.run'](cmd)
for line in out.splitlines():
comps = line.split()
if line.startswith('tcp'):
ret.append({
'proto': comps[0]... | [
"def",
"_netstat_linux",
"(",
")",
":",
"ret",
"=",
"[",
"]",
"cmd",
"=",
"'netstat -tulpnea'",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
")",
"for",
"line",
"in",
"out",
".",
"splitlines",
"(",
")",
":",
"comps",
"=",
"line",
".",
... | Return netstat information for Linux distros | [
"Return",
"netstat",
"information",
"for",
"Linux",
"distros"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/network.py#L109-L139 | train |
saltstack/salt | salt/modules/network.py | _ss_linux | def _ss_linux():
'''
Return ss information for Linux distros
(netstat is deprecated and may not be available)
'''
ret = []
cmd = 'ss -tulpnea'
out = __salt__['cmd.run'](cmd)
for line in out.splitlines():
comps = line.split()
ss_user = 0
ss_inode = 0
ss_pro... | python | def _ss_linux():
'''
Return ss information for Linux distros
(netstat is deprecated and may not be available)
'''
ret = []
cmd = 'ss -tulpnea'
out = __salt__['cmd.run'](cmd)
for line in out.splitlines():
comps = line.split()
ss_user = 0
ss_inode = 0
ss_pro... | [
"def",
"_ss_linux",
"(",
")",
":",
"ret",
"=",
"[",
"]",
"cmd",
"=",
"'ss -tulpnea'",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
")",
"for",
"line",
"in",
"out",
".",
"splitlines",
"(",
")",
":",
"comps",
"=",
"line",
".",
"split",
... | Return ss information for Linux distros
(netstat is deprecated and may not be available) | [
"Return",
"ss",
"information",
"for",
"Linux",
"distros",
"(",
"netstat",
"is",
"deprecated",
"and",
"may",
"not",
"be",
"available",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/network.py#L142-L196 | train |
saltstack/salt | salt/modules/network.py | _netinfo_openbsd | def _netinfo_openbsd():
'''
Get process information for network connections using fstat
'''
ret = {}
_fstat_re = re.compile(
r'internet(6)? (?:stream tcp 0x\S+ (\S+)|dgram udp (\S+))'
r'(?: [<>=-]+ (\S+))?$'
)
out = __salt__['cmd.run']('fstat')
for line in out.splitlines(... | python | def _netinfo_openbsd():
'''
Get process information for network connections using fstat
'''
ret = {}
_fstat_re = re.compile(
r'internet(6)? (?:stream tcp 0x\S+ (\S+)|dgram udp (\S+))'
r'(?: [<>=-]+ (\S+))?$'
)
out = __salt__['cmd.run']('fstat')
for line in out.splitlines(... | [
"def",
"_netinfo_openbsd",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"_fstat_re",
"=",
"re",
".",
"compile",
"(",
"r'internet(6)? (?:stream tcp 0x\\S+ (\\S+)|dgram udp (\\S+))'",
"r'(?: [<>=-]+ (\\S+))?$'",
")",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'fstat... | Get process information for network connections using fstat | [
"Get",
"process",
"information",
"for",
"network",
"connections",
"using",
"fstat"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/network.py#L199-L243 | train |
saltstack/salt | salt/modules/network.py | _netinfo_freebsd_netbsd | def _netinfo_freebsd_netbsd():
'''
Get process information for network connections using sockstat
'''
ret = {}
# NetBSD requires '-n' to disable port-to-service resolution
out = __salt__['cmd.run'](
'sockstat -46 {0} | tail -n+2'.format(
'-n' if __grains__['kernel'] == 'NetBS... | python | def _netinfo_freebsd_netbsd():
'''
Get process information for network connections using sockstat
'''
ret = {}
# NetBSD requires '-n' to disable port-to-service resolution
out = __salt__['cmd.run'](
'sockstat -46 {0} | tail -n+2'.format(
'-n' if __grains__['kernel'] == 'NetBS... | [
"def",
"_netinfo_freebsd_netbsd",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"# NetBSD requires '-n' to disable port-to-service resolution",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'sockstat -46 {0} | tail -n+2'",
".",
"format",
"(",
"'-n'",
"if",
"__grains__",
... | Get process information for network connections using sockstat | [
"Get",
"process",
"information",
"for",
"network",
"connections",
"using",
"sockstat"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/network.py#L246-L267 | train |
saltstack/salt | salt/modules/network.py | _ppid | def _ppid():
'''
Return a dict of pid to ppid mappings
'''
ret = {}
if __grains__['kernel'] == 'SunOS':
cmd = 'ps -a -o pid,ppid | tail +2'
else:
cmd = 'ps -ax -o pid,ppid | tail -n+2'
out = __salt__['cmd.run'](cmd, python_shell=True)
for line in out.splitlines():
... | python | def _ppid():
'''
Return a dict of pid to ppid mappings
'''
ret = {}
if __grains__['kernel'] == 'SunOS':
cmd = 'ps -a -o pid,ppid | tail +2'
else:
cmd = 'ps -ax -o pid,ppid | tail -n+2'
out = __salt__['cmd.run'](cmd, python_shell=True)
for line in out.splitlines():
... | [
"def",
"_ppid",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"__grains__",
"[",
"'kernel'",
"]",
"==",
"'SunOS'",
":",
"cmd",
"=",
"'ps -a -o pid,ppid | tail +2'",
"else",
":",
"cmd",
"=",
"'ps -ax -o pid,ppid | tail -n+2'",
"out",
"=",
"__salt__",
"[",
"'cmd.... | Return a dict of pid to ppid mappings | [
"Return",
"a",
"dict",
"of",
"pid",
"to",
"ppid",
"mappings"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/network.py#L270-L283 | train |
saltstack/salt | salt/modules/network.py | _netstat_bsd | def _netstat_bsd():
'''
Return netstat information for BSD flavors
'''
ret = []
if __grains__['kernel'] == 'NetBSD':
for addr_family in ('inet', 'inet6'):
cmd = 'netstat -f {0} -an | tail -n+3'.format(addr_family)
out = __salt__['cmd.run'](cmd, python_shell=True)
... | python | def _netstat_bsd():
'''
Return netstat information for BSD flavors
'''
ret = []
if __grains__['kernel'] == 'NetBSD':
for addr_family in ('inet', 'inet6'):
cmd = 'netstat -f {0} -an | tail -n+3'.format(addr_family)
out = __salt__['cmd.run'](cmd, python_shell=True)
... | [
"def",
"_netstat_bsd",
"(",
")",
":",
"ret",
"=",
"[",
"]",
"if",
"__grains__",
"[",
"'kernel'",
"]",
"==",
"'NetBSD'",
":",
"for",
"addr_family",
"in",
"(",
"'inet'",
",",
"'inet6'",
")",
":",
"cmd",
"=",
"'netstat -f {0} -an | tail -n+3'",
".",
"format",... | Return netstat information for BSD flavors | [
"Return",
"netstat",
"information",
"for",
"BSD",
"flavors"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/network.py#L286-L360 | train |
saltstack/salt | salt/modules/network.py | _netstat_sunos | def _netstat_sunos():
'''
Return netstat information for SunOS flavors
'''
log.warning('User and program not (yet) supported on SunOS')
ret = []
for addr_family in ('inet', 'inet6'):
# Lookup TCP connections
cmd = 'netstat -f {0} -P tcp -an | tail +5'.format(addr_family)
... | python | def _netstat_sunos():
'''
Return netstat information for SunOS flavors
'''
log.warning('User and program not (yet) supported on SunOS')
ret = []
for addr_family in ('inet', 'inet6'):
# Lookup TCP connections
cmd = 'netstat -f {0} -P tcp -an | tail +5'.format(addr_family)
... | [
"def",
"_netstat_sunos",
"(",
")",
":",
"log",
".",
"warning",
"(",
"'User and program not (yet) supported on SunOS'",
")",
"ret",
"=",
"[",
"]",
"for",
"addr_family",
"in",
"(",
"'inet'",
",",
"'inet6'",
")",
":",
"# Lookup TCP connections",
"cmd",
"=",
"'netst... | Return netstat information for SunOS flavors | [
"Return",
"netstat",
"information",
"for",
"SunOS",
"flavors"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/network.py#L363-L393 | train |
saltstack/salt | salt/modules/network.py | _netstat_aix | def _netstat_aix():
'''
Return netstat information for SunOS flavors
'''
ret = []
## AIX 6.1 - 7.2, appears to ignore addr_family field contents
## for addr_family in ('inet', 'inet6'):
for addr_family in ('inet',):
# Lookup connections
cmd = 'netstat -n -a -f {0} | tail -n +... | python | def _netstat_aix():
'''
Return netstat information for SunOS flavors
'''
ret = []
## AIX 6.1 - 7.2, appears to ignore addr_family field contents
## for addr_family in ('inet', 'inet6'):
for addr_family in ('inet',):
# Lookup connections
cmd = 'netstat -n -a -f {0} | tail -n +... | [
"def",
"_netstat_aix",
"(",
")",
":",
"ret",
"=",
"[",
"]",
"## AIX 6.1 - 7.2, appears to ignore addr_family field contents",
"## for addr_family in ('inet', 'inet6'):",
"for",
"addr_family",
"in",
"(",
"'inet'",
",",
")",
":",
"# Lookup connections",
"cmd",
"=",
"'netsta... | Return netstat information for SunOS flavors | [
"Return",
"netstat",
"information",
"for",
"SunOS",
"flavors"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/network.py#L396-L440 | train |
saltstack/salt | salt/modules/network.py | _ip_route_linux | def _ip_route_linux():
'''
Return ip routing information for Linux distros
(netstat is deprecated and may not be available)
'''
# table main closest to old netstat inet output
ret = []
cmd = 'ip -4 route show table main'
out = __salt__['cmd.run'](cmd, python_shell=True)
for line in o... | python | def _ip_route_linux():
'''
Return ip routing information for Linux distros
(netstat is deprecated and may not be available)
'''
# table main closest to old netstat inet output
ret = []
cmd = 'ip -4 route show table main'
out = __salt__['cmd.run'](cmd, python_shell=True)
for line in o... | [
"def",
"_ip_route_linux",
"(",
")",
":",
"# table main closest to old netstat inet output",
"ret",
"=",
"[",
"]",
"cmd",
"=",
"'ip -4 route show table main'",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
",",
"python_shell",
"=",
"True",
")",
"for",
... | Return ip routing information for Linux distros
(netstat is deprecated and may not be available) | [
"Return",
"ip",
"routing",
"information",
"for",
"Linux",
"distros",
"(",
"netstat",
"is",
"deprecated",
"and",
"may",
"not",
"be",
"available",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/network.py#L484-L577 | train |
saltstack/salt | salt/modules/network.py | _netstat_route_freebsd | def _netstat_route_freebsd():
'''
Return netstat routing information for FreeBSD and macOS
'''
ret = []
cmd = 'netstat -f inet -rn | tail -n+5'
out = __salt__['cmd.run'](cmd, python_shell=True)
for line in out.splitlines():
comps = line.split()
if __grains__['os'] == 'FreeBSD... | python | def _netstat_route_freebsd():
'''
Return netstat routing information for FreeBSD and macOS
'''
ret = []
cmd = 'netstat -f inet -rn | tail -n+5'
out = __salt__['cmd.run'](cmd, python_shell=True)
for line in out.splitlines():
comps = line.split()
if __grains__['os'] == 'FreeBSD... | [
"def",
"_netstat_route_freebsd",
"(",
")",
":",
"ret",
"=",
"[",
"]",
"cmd",
"=",
"'netstat -f inet -rn | tail -n+5'",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
",",
"python_shell",
"=",
"True",
")",
"for",
"line",
"in",
"out",
".",
"split... | Return netstat routing information for FreeBSD and macOS | [
"Return",
"netstat",
"routing",
"information",
"for",
"FreeBSD",
"and",
"macOS"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/network.py#L580-L616 | train |
saltstack/salt | salt/modules/network.py | _netstat_route_netbsd | def _netstat_route_netbsd():
'''
Return netstat routing information for NetBSD
'''
ret = []
cmd = 'netstat -f inet -rn | tail -n+5'
out = __salt__['cmd.run'](cmd, python_shell=True)
for line in out.splitlines():
comps = line.split()
ret.append({
'addr_family': 'in... | python | def _netstat_route_netbsd():
'''
Return netstat routing information for NetBSD
'''
ret = []
cmd = 'netstat -f inet -rn | tail -n+5'
out = __salt__['cmd.run'](cmd, python_shell=True)
for line in out.splitlines():
comps = line.split()
ret.append({
'addr_family': 'in... | [
"def",
"_netstat_route_netbsd",
"(",
")",
":",
"ret",
"=",
"[",
"]",
"cmd",
"=",
"'netstat -f inet -rn | tail -n+5'",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
",",
"python_shell",
"=",
"True",
")",
"for",
"line",
"in",
"out",
".",
"splitl... | Return netstat routing information for NetBSD | [
"Return",
"netstat",
"routing",
"information",
"for",
"NetBSD"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/network.py#L619-L646 | train |
saltstack/salt | salt/modules/network.py | _netstat_route_sunos | def _netstat_route_sunos():
'''
Return netstat routing information for SunOS
'''
ret = []
cmd = 'netstat -f inet -rn | tail +5'
out = __salt__['cmd.run'](cmd, python_shell=True)
for line in out.splitlines():
comps = line.split()
ret.append({
'addr_family': 'inet',... | python | def _netstat_route_sunos():
'''
Return netstat routing information for SunOS
'''
ret = []
cmd = 'netstat -f inet -rn | tail +5'
out = __salt__['cmd.run'](cmd, python_shell=True)
for line in out.splitlines():
comps = line.split()
ret.append({
'addr_family': 'inet',... | [
"def",
"_netstat_route_sunos",
"(",
")",
":",
"ret",
"=",
"[",
"]",
"cmd",
"=",
"'netstat -f inet -rn | tail +5'",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
",",
"python_shell",
"=",
"True",
")",
"for",
"line",
"in",
"out",
".",
"splitline... | Return netstat routing information for SunOS | [
"Return",
"netstat",
"routing",
"information",
"for",
"SunOS"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/network.py#L679-L706 | train |
saltstack/salt | salt/modules/network.py | netstat | def netstat():
'''
Return information on open ports and states
.. note::
On BSD minions, the output contains PID info (where available) for each
netstat entry, fetched from sockstat/fstat output.
.. versionchanged:: 2014.1.4
Added support for OpenBSD, FreeBSD, and NetBSD
.... | python | def netstat():
'''
Return information on open ports and states
.. note::
On BSD minions, the output contains PID info (where available) for each
netstat entry, fetched from sockstat/fstat output.
.. versionchanged:: 2014.1.4
Added support for OpenBSD, FreeBSD, and NetBSD
.... | [
"def",
"netstat",
"(",
")",
":",
"if",
"__grains__",
"[",
"'kernel'",
"]",
"==",
"'Linux'",
":",
"if",
"not",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"'netstat'",
")",
":",
"return",
"_ss_linux",
"(",
")",
"else",
":",
"return",
"_netst... | Return information on open ports and states
.. note::
On BSD minions, the output contains PID info (where available) for each
netstat entry, fetched from sockstat/fstat output.
.. versionchanged:: 2014.1.4
Added support for OpenBSD, FreeBSD, and NetBSD
.. versionchanged:: 2015.8.0... | [
"Return",
"information",
"on",
"open",
"ports",
"and",
"states"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/network.py#L739-L773 | train |
saltstack/salt | salt/modules/network.py | active_tcp | def active_tcp():
'''
Return a dict containing information on all of the running TCP connections (currently linux and solaris only)
.. versionchanged:: 2015.8.4
Added support for SunOS
CLI Example:
.. code-block:: bash
salt '*' network.active_tcp
'''
if __grains__['kerne... | python | def active_tcp():
'''
Return a dict containing information on all of the running TCP connections (currently linux and solaris only)
.. versionchanged:: 2015.8.4
Added support for SunOS
CLI Example:
.. code-block:: bash
salt '*' network.active_tcp
'''
if __grains__['kerne... | [
"def",
"active_tcp",
"(",
")",
":",
"if",
"__grains__",
"[",
"'kernel'",
"]",
"==",
"'Linux'",
":",
"return",
"salt",
".",
"utils",
".",
"network",
".",
"active_tcp",
"(",
")",
"elif",
"__grains__",
"[",
"'kernel'",
"]",
"==",
"'SunOS'",
":",
"# lets use... | Return a dict containing information on all of the running TCP connections (currently linux and solaris only)
.. versionchanged:: 2015.8.4
Added support for SunOS
CLI Example:
.. code-block:: bash
salt '*' network.active_tcp | [
"Return",
"a",
"dict",
"containing",
"information",
"on",
"all",
"of",
"the",
"running",
"TCP",
"connections",
"(",
"currently",
"linux",
"and",
"solaris",
"only",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/network.py#L776-L823 | train |
saltstack/salt | salt/modules/network.py | traceroute | def traceroute(host):
'''
Performs a traceroute to a 3rd party host
.. versionchanged:: 2015.8.0
Added support for SunOS
.. versionchanged:: 2016.11.4
Added support for AIX
CLI Example:
.. code-block:: bash
salt '*' network.traceroute archlinux.org
'''
ret = ... | python | def traceroute(host):
'''
Performs a traceroute to a 3rd party host
.. versionchanged:: 2015.8.0
Added support for SunOS
.. versionchanged:: 2016.11.4
Added support for AIX
CLI Example:
.. code-block:: bash
salt '*' network.traceroute archlinux.org
'''
ret = ... | [
"def",
"traceroute",
"(",
"host",
")",
":",
"ret",
"=",
"[",
"]",
"if",
"not",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"'traceroute'",
")",
":",
"log",
".",
"info",
"(",
"'This minion does not have traceroute installed'",
")",
"return",
"ret"... | Performs a traceroute to a 3rd party host
.. versionchanged:: 2015.8.0
Added support for SunOS
.. versionchanged:: 2016.11.4
Added support for AIX
CLI Example:
.. code-block:: bash
salt '*' network.traceroute archlinux.org | [
"Performs",
"a",
"traceroute",
"to",
"a",
"3rd",
"party",
"host"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/network.py#L826-L956 | train |
saltstack/salt | salt/modules/network.py | dig | def dig(host):
'''
Performs a DNS lookup with dig
CLI Example:
.. code-block:: bash
salt '*' network.dig archlinux.org
'''
cmd = 'dig {0}'.format(salt.utils.network.sanitize_host(host))
return __salt__['cmd.run'](cmd) | python | def dig(host):
'''
Performs a DNS lookup with dig
CLI Example:
.. code-block:: bash
salt '*' network.dig archlinux.org
'''
cmd = 'dig {0}'.format(salt.utils.network.sanitize_host(host))
return __salt__['cmd.run'](cmd) | [
"def",
"dig",
"(",
"host",
")",
":",
"cmd",
"=",
"'dig {0}'",
".",
"format",
"(",
"salt",
".",
"utils",
".",
"network",
".",
"sanitize_host",
"(",
"host",
")",
")",
"return",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
")"
] | Performs a DNS lookup with dig
CLI Example:
.. code-block:: bash
salt '*' network.dig archlinux.org | [
"Performs",
"a",
"DNS",
"lookup",
"with",
"dig"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/network.py#L960-L971 | train |
saltstack/salt | salt/modules/network.py | arp | def arp():
'''
Return the arp table from the minion
.. versionchanged:: 2015.8.0
Added support for SunOS
CLI Example:
.. code-block:: bash
salt '*' network.arp
'''
ret = {}
out = __salt__['cmd.run']('arp -an')
for line in out.splitlines():
comps = line.spl... | python | def arp():
'''
Return the arp table from the minion
.. versionchanged:: 2015.8.0
Added support for SunOS
CLI Example:
.. code-block:: bash
salt '*' network.arp
'''
ret = {}
out = __salt__['cmd.run']('arp -an')
for line in out.splitlines():
comps = line.spl... | [
"def",
"arp",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'arp -an'",
")",
"for",
"line",
"in",
"out",
".",
"splitlines",
"(",
")",
":",
"comps",
"=",
"line",
".",
"split",
"(",
")",
"if",
"len",
"(... | Return the arp table from the minion
.. versionchanged:: 2015.8.0
Added support for SunOS
CLI Example:
.. code-block:: bash
salt '*' network.arp | [
"Return",
"the",
"arp",
"table",
"from",
"the",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/network.py#L975-L1009 | train |
saltstack/salt | salt/modules/network.py | convert_cidr | def convert_cidr(cidr):
'''
returns the network address, subnet mask and broadcast address of a cidr address
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt '*' network.convert_cidr 172.31.0.0/16
'''
ret = {'network': None,
'netmask': None,
... | python | def convert_cidr(cidr):
'''
returns the network address, subnet mask and broadcast address of a cidr address
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt '*' network.convert_cidr 172.31.0.0/16
'''
ret = {'network': None,
'netmask': None,
... | [
"def",
"convert_cidr",
"(",
"cidr",
")",
":",
"ret",
"=",
"{",
"'network'",
":",
"None",
",",
"'netmask'",
":",
"None",
",",
"'broadcast'",
":",
"None",
"}",
"cidr",
"=",
"calc_net",
"(",
"cidr",
")",
"network_info",
"=",
"ipaddress",
".",
"ip_network",
... | returns the network address, subnet mask and broadcast address of a cidr address
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt '*' network.convert_cidr 172.31.0.0/16 | [
"returns",
"the",
"network",
"address",
"subnet",
"mask",
"and",
"broadcast",
"address",
"of",
"a",
"cidr",
"address"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/network.py#L1125-L1145 | train |
saltstack/salt | salt/modules/network.py | mod_hostname | def mod_hostname(hostname):
'''
Modify hostname
.. versionchanged:: 2015.8.0
Added support for SunOS (Solaris 10, Illumos, SmartOS)
CLI Example:
.. code-block:: bash
salt '*' network.mod_hostname master.saltstack.com
'''
#
# SunOS tested on SmartOS and OmniOS (Solaris... | python | def mod_hostname(hostname):
'''
Modify hostname
.. versionchanged:: 2015.8.0
Added support for SunOS (Solaris 10, Illumos, SmartOS)
CLI Example:
.. code-block:: bash
salt '*' network.mod_hostname master.saltstack.com
'''
#
# SunOS tested on SmartOS and OmniOS (Solaris... | [
"def",
"mod_hostname",
"(",
"hostname",
")",
":",
"#",
"# SunOS tested on SmartOS and OmniOS (Solaris 10 compatible)",
"# Oracle Solaris 11 uses smf, currently not supported",
"#",
"# /etc/nodename is the hostname only, not fqdn",
"# /etc/defaultdomain is the domain",
"# /etc/hosts should ha... | Modify hostname
.. versionchanged:: 2015.8.0
Added support for SunOS (Solaris 10, Illumos, SmartOS)
CLI Example:
.. code-block:: bash
salt '*' network.mod_hostname master.saltstack.com | [
"Modify",
"hostname"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/network.py#L1250-L1376 | train |
saltstack/salt | salt/modules/network.py | _get_bufsize_linux | def _get_bufsize_linux(iface):
'''
Return network interface buffer information using ethtool
'''
ret = {'result': False}
cmd = '/sbin/ethtool -g {0}'.format(iface)
out = __salt__['cmd.run'](cmd)
pat = re.compile(r'^(.+):\s+(\d+)$')
suffix = 'max-'
for line in out.splitlines():
... | python | def _get_bufsize_linux(iface):
'''
Return network interface buffer information using ethtool
'''
ret = {'result': False}
cmd = '/sbin/ethtool -g {0}'.format(iface)
out = __salt__['cmd.run'](cmd)
pat = re.compile(r'^(.+):\s+(\d+)$')
suffix = 'max-'
for line in out.splitlines():
... | [
"def",
"_get_bufsize_linux",
"(",
"iface",
")",
":",
"ret",
"=",
"{",
"'result'",
":",
"False",
"}",
"cmd",
"=",
"'/sbin/ethtool -g {0}'",
".",
"format",
"(",
"iface",
")",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
")",
"pat",
"=",
"re... | Return network interface buffer information using ethtool | [
"Return",
"network",
"interface",
"buffer",
"information",
"using",
"ethtool"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/network.py#L1524-L1549 | train |
saltstack/salt | salt/modules/network.py | _mod_bufsize_linux | def _mod_bufsize_linux(iface, *args, **kwargs):
'''
Modify network interface buffer sizes using ethtool
'''
ret = {'result': False,
'comment': 'Requires rx=<val> tx==<val> rx-mini=<val> and/or rx-jumbo=<val>'}
cmd = '/sbin/ethtool -G ' + iface
if not kwargs:
return ret
if ... | python | def _mod_bufsize_linux(iface, *args, **kwargs):
'''
Modify network interface buffer sizes using ethtool
'''
ret = {'result': False,
'comment': 'Requires rx=<val> tx==<val> rx-mini=<val> and/or rx-jumbo=<val>'}
cmd = '/sbin/ethtool -G ' + iface
if not kwargs:
return ret
if ... | [
"def",
"_mod_bufsize_linux",
"(",
"iface",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'result'",
":",
"False",
",",
"'comment'",
":",
"'Requires rx=<val> tx==<val> rx-mini=<val> and/or rx-jumbo=<val>'",
"}",
"cmd",
"=",
"'/sbin/ethtool ... | Modify network interface buffer sizes using ethtool | [
"Modify",
"network",
"interface",
"buffer",
"sizes",
"using",
"ethtool"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/network.py#L1569-L1596 | train |
saltstack/salt | salt/modules/network.py | mod_bufsize | def mod_bufsize(iface, *args, **kwargs):
'''
Modify network interface buffers (currently linux only)
CLI Example:
.. code-block:: bash
salt '*' network.mod_bufsize tx=<val> rx=<val> rx-mini=<val> rx-jumbo=<val>
'''
if __grains__['kernel'] == 'Linux':
if os.path.exists('/sbin/e... | python | def mod_bufsize(iface, *args, **kwargs):
'''
Modify network interface buffers (currently linux only)
CLI Example:
.. code-block:: bash
salt '*' network.mod_bufsize tx=<val> rx=<val> rx-mini=<val> rx-jumbo=<val>
'''
if __grains__['kernel'] == 'Linux':
if os.path.exists('/sbin/e... | [
"def",
"mod_bufsize",
"(",
"iface",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"__grains__",
"[",
"'kernel'",
"]",
"==",
"'Linux'",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"'/sbin/ethtool'",
")",
":",
"return",
"_mod_bufsize_l... | Modify network interface buffers (currently linux only)
CLI Example:
.. code-block:: bash
salt '*' network.mod_bufsize tx=<val> rx=<val> rx-mini=<val> rx-jumbo=<val> | [
"Modify",
"network",
"interface",
"buffers",
"(",
"currently",
"linux",
"only",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/network.py#L1599-L1613 | train |
saltstack/salt | salt/modules/network.py | routes | def routes(family=None):
'''
Return currently configured routes from routing table
.. versionchanged:: 2015.8.0
Added support for SunOS (Solaris 10, Illumos, SmartOS)
.. versionchanged:: 2016.11.4
Added support for AIX
CLI Example:
.. code-block:: bash
salt '*' netwo... | python | def routes(family=None):
'''
Return currently configured routes from routing table
.. versionchanged:: 2015.8.0
Added support for SunOS (Solaris 10, Illumos, SmartOS)
.. versionchanged:: 2016.11.4
Added support for AIX
CLI Example:
.. code-block:: bash
salt '*' netwo... | [
"def",
"routes",
"(",
"family",
"=",
"None",
")",
":",
"if",
"family",
"!=",
"'inet'",
"and",
"family",
"!=",
"'inet6'",
"and",
"family",
"is",
"not",
"None",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid address family {0}'",
".",
"format",
"(",
"fa... | Return currently configured routes from routing table
.. versionchanged:: 2015.8.0
Added support for SunOS (Solaris 10, Illumos, SmartOS)
.. versionchanged:: 2016.11.4
Added support for AIX
CLI Example:
.. code-block:: bash
salt '*' network.routes | [
"Return",
"currently",
"configured",
"routes",
"from",
"routing",
"table"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/network.py#L1616-L1657 | train |
saltstack/salt | salt/modules/network.py | default_route | def default_route(family=None):
'''
Return default route(s) from routing table
.. versionchanged:: 2015.8.0
Added support for SunOS (Solaris 10, Illumos, SmartOS)
.. versionchanged:: 2016.11.4
Added support for AIX
CLI Example:
.. code-block:: bash
salt '*' network.d... | python | def default_route(family=None):
'''
Return default route(s) from routing table
.. versionchanged:: 2015.8.0
Added support for SunOS (Solaris 10, Illumos, SmartOS)
.. versionchanged:: 2016.11.4
Added support for AIX
CLI Example:
.. code-block:: bash
salt '*' network.d... | [
"def",
"default_route",
"(",
"family",
"=",
"None",
")",
":",
"if",
"family",
"!=",
"'inet'",
"and",
"family",
"!=",
"'inet6'",
"and",
"family",
"is",
"not",
"None",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid address family {0}'",
".",
"format",
"("... | Return default route(s) from routing table
.. versionchanged:: 2015.8.0
Added support for SunOS (Solaris 10, Illumos, SmartOS)
.. versionchanged:: 2016.11.4
Added support for AIX
CLI Example:
.. code-block:: bash
salt '*' network.default_route | [
"Return",
"default",
"route",
"(",
"s",
")",
"from",
"routing",
"table"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/network.py#L1660-L1704 | train |
saltstack/salt | salt/modules/network.py | get_route | def get_route(ip):
'''
Return routing information for given destination ip
.. versionadded:: 2015.5.3
.. versionchanged:: 2015.8.0
Added support for SunOS (Solaris 10, Illumos, SmartOS)
Added support for OpenBSD
.. versionchanged:: 2016.11.4
Added support for AIX
CLI ... | python | def get_route(ip):
'''
Return routing information for given destination ip
.. versionadded:: 2015.5.3
.. versionchanged:: 2015.8.0
Added support for SunOS (Solaris 10, Illumos, SmartOS)
Added support for OpenBSD
.. versionchanged:: 2016.11.4
Added support for AIX
CLI ... | [
"def",
"get_route",
"(",
"ip",
")",
":",
"if",
"__grains__",
"[",
"'kernel'",
"]",
"==",
"'Linux'",
":",
"cmd",
"=",
"'ip route get {0}'",
".",
"format",
"(",
"ip",
")",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
",",
"python_shell",
"=... | Return routing information for given destination ip
.. versionadded:: 2015.5.3
.. versionchanged:: 2015.8.0
Added support for SunOS (Solaris 10, Illumos, SmartOS)
Added support for OpenBSD
.. versionchanged:: 2016.11.4
Added support for AIX
CLI Example::
salt '*' net... | [
"Return",
"routing",
"information",
"for",
"given",
"destination",
"ip"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/network.py#L1707-L1839 | train |
saltstack/salt | salt/modules/network.py | ifacestartswith | def ifacestartswith(cidr):
'''
Retrieve the interface name from a specific CIDR
.. versionadded:: 2016.11.0
CLI Example:
.. code-block:: bash
salt '*' network.ifacestartswith 10.0
'''
net_list = interfaces()
intfnames = []
pattern = six.text_type(cidr)
size = len(patt... | python | def ifacestartswith(cidr):
'''
Retrieve the interface name from a specific CIDR
.. versionadded:: 2016.11.0
CLI Example:
.. code-block:: bash
salt '*' network.ifacestartswith 10.0
'''
net_list = interfaces()
intfnames = []
pattern = six.text_type(cidr)
size = len(patt... | [
"def",
"ifacestartswith",
"(",
"cidr",
")",
":",
"net_list",
"=",
"interfaces",
"(",
")",
"intfnames",
"=",
"[",
"]",
"pattern",
"=",
"six",
".",
"text_type",
"(",
"cidr",
")",
"size",
"=",
"len",
"(",
"pattern",
")",
"for",
"ifname",
",",
"ifval",
"... | Retrieve the interface name from a specific CIDR
.. versionadded:: 2016.11.0
CLI Example:
.. code-block:: bash
salt '*' network.ifacestartswith 10.0 | [
"Retrieve",
"the",
"interface",
"name",
"from",
"a",
"specific",
"CIDR"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/network.py#L1842-L1866 | train |
saltstack/salt | salt/modules/network.py | iphexval | def iphexval(ip):
'''
Retrieve the hexadecimal representation of an IP address
.. versionadded:: 2016.11.0
CLI Example:
.. code-block:: bash
salt '*' network.iphexval 10.0.0.1
'''
a = ip.split('.')
hexval = ['%02X' % int(x) for x in a] # pylint: disable=E1321
return ''.j... | python | def iphexval(ip):
'''
Retrieve the hexadecimal representation of an IP address
.. versionadded:: 2016.11.0
CLI Example:
.. code-block:: bash
salt '*' network.iphexval 10.0.0.1
'''
a = ip.split('.')
hexval = ['%02X' % int(x) for x in a] # pylint: disable=E1321
return ''.j... | [
"def",
"iphexval",
"(",
"ip",
")",
":",
"a",
"=",
"ip",
".",
"split",
"(",
"'.'",
")",
"hexval",
"=",
"[",
"'%02X'",
"%",
"int",
"(",
"x",
")",
"for",
"x",
"in",
"a",
"]",
"# pylint: disable=E1321",
"return",
"''",
".",
"join",
"(",
"hexval",
")"... | Retrieve the hexadecimal representation of an IP address
.. versionadded:: 2016.11.0
CLI Example:
.. code-block:: bash
salt '*' network.iphexval 10.0.0.1 | [
"Retrieve",
"the",
"hexadecimal",
"representation",
"of",
"an",
"IP",
"address"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/network.py#L1869-L1883 | train |
saltstack/salt | salt/states/boto_cloudwatch_event.py | present | def present(name, Name=None,
ScheduleExpression=None,
EventPattern=None,
Description=None,
RoleArn=None,
State=None,
Targets=None,
region=None, key=None, keyid=None, profile=None):
'''
Ensure trail exists.
name
The name of... | python | def present(name, Name=None,
ScheduleExpression=None,
EventPattern=None,
Description=None,
RoleArn=None,
State=None,
Targets=None,
region=None, key=None, keyid=None, profile=None):
'''
Ensure trail exists.
name
The name of... | [
"def",
"present",
"(",
"name",
",",
"Name",
"=",
"None",
",",
"ScheduleExpression",
"=",
"None",
",",
"EventPattern",
"=",
"None",
",",
"Description",
"=",
"None",
",",
"RoleArn",
"=",
"None",
",",
"State",
"=",
"None",
",",
"Targets",
"=",
"None",
","... | Ensure trail exists.
name
The name of the state definition
Name
Name of the event rule. Defaults to the value of the 'name' param if
not provided.
ScheduleExpression
The scheduling expression. For example, ``cron(0 20 * * ? *)``,
"rate(5 minutes)"
EventPatter... | [
"Ensure",
"trail",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_cloudwatch_event.py#L76-L268 | train |
saltstack/salt | salt/states/boto_cloudwatch_event.py | absent | def absent(name, Name=None, region=None, key=None, keyid=None, profile=None):
'''
Ensure CloudWatch event rule with passed properties is absent.
name
The name of the state definition.
Name
Name of the event rule. Defaults to the value of the 'name' param if
not provided.
... | python | def absent(name, Name=None, region=None, key=None, keyid=None, profile=None):
'''
Ensure CloudWatch event rule with passed properties is absent.
name
The name of the state definition.
Name
Name of the event rule. Defaults to the value of the 'name' param if
not provided.
... | [
"def",
"absent",
"(",
"name",
",",
"Name",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"Name",
",",
"'result'",
":",
"True",
... | Ensure CloudWatch event rule with passed properties is absent.
name
The name of the state definition.
Name
Name of the event rule. Defaults to the value of the 'name' param if
not provided.
region
Region to connect to.
key
Secret key to be used.
keyid
... | [
"Ensure",
"CloudWatch",
"event",
"rule",
"with",
"passed",
"properties",
"is",
"absent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_cloudwatch_event.py#L271-L352 | train |
saltstack/salt | salt/modules/libcloud_compute.py | list_nodes | def list_nodes(profile, **libcloud_kwargs):
'''
Return a list of nodes
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_nodes method
:type libcloud_kwargs: ``dict``
CLI Example:
.. code-block:: bash
salt m... | python | def list_nodes(profile, **libcloud_kwargs):
'''
Return a list of nodes
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_nodes method
:type libcloud_kwargs: ``dict``
CLI Example:
.. code-block:: bash
salt m... | [
"def",
"list_nodes",
"(",
"profile",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"libcloud_kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",
"*",
"libcloud_kwarg... | Return a list of nodes
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_nodes method
:type libcloud_kwargs: ``dict``
CLI Example:
.. code-block:: bash
salt myminion libcloud_compute.list_nodes profile1 | [
"Return",
"a",
"list",
"of",
"nodes"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_compute.py#L93-L115 | train |
saltstack/salt | salt/modules/libcloud_compute.py | list_sizes | def list_sizes(profile, location_id=None, **libcloud_kwargs):
'''
Return a list of node sizes
:param profile: The profile key
:type profile: ``str``
:param location_id: The location key, from list_locations
:type location_id: ``str``
:param libcloud_kwargs: Extra arguments for the drive... | python | def list_sizes(profile, location_id=None, **libcloud_kwargs):
'''
Return a list of node sizes
:param profile: The profile key
:type profile: ``str``
:param location_id: The location key, from list_locations
:type location_id: ``str``
:param libcloud_kwargs: Extra arguments for the drive... | [
"def",
"list_sizes",
"(",
"profile",
",",
"location_id",
"=",
"None",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"libcloud_kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs... | Return a list of node sizes
:param profile: The profile key
:type profile: ``str``
:param location_id: The location key, from list_locations
:type location_id: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_sizes method
:type libcloud_kwargs: ``dict``
CLI Exampl... | [
"Return",
"a",
"list",
"of",
"node",
"sizes"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_compute.py#L118-L152 | train |
saltstack/salt | salt/modules/libcloud_compute.py | list_locations | def list_locations(profile, **libcloud_kwargs):
'''
Return a list of locations for this cloud
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_locations method
:type libcloud_kwargs: ``dict``
CLI Example:
.. code-b... | python | def list_locations(profile, **libcloud_kwargs):
'''
Return a list of locations for this cloud
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_locations method
:type libcloud_kwargs: ``dict``
CLI Example:
.. code-b... | [
"def",
"list_locations",
"(",
"profile",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"libcloud_kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",
"*",
"libcloud_k... | Return a list of locations for this cloud
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_locations method
:type libcloud_kwargs: ``dict``
CLI Example:
.. code-block:: bash
salt myminion libcloud_compute.list_loc... | [
"Return",
"a",
"list",
"of",
"locations",
"for",
"this",
"cloud"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_compute.py#L155-L178 | train |
saltstack/salt | salt/modules/libcloud_compute.py | reboot_node | def reboot_node(node_id, profile, **libcloud_kwargs):
'''
Reboot a node in the cloud
:param node_id: Unique ID of the node to reboot
:type node_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's reboot_node method
... | python | def reboot_node(node_id, profile, **libcloud_kwargs):
'''
Reboot a node in the cloud
:param node_id: Unique ID of the node to reboot
:type node_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's reboot_node method
... | [
"def",
"reboot_node",
"(",
"node_id",
",",
"profile",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"node",
"=",
"_get_by_id",
"(",
"conn",
".",
"list_nodes",
"(",
"*",
"*",
"libcloud_kwargs",
... | Reboot a node in the cloud
:param node_id: Unique ID of the node to reboot
:type node_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's reboot_node method
:type libcloud_kwargs: ``dict``
CLI Example:
.. cod... | [
"Reboot",
"a",
"node",
"in",
"the",
"cloud"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_compute.py#L181-L202 | train |
saltstack/salt | salt/modules/libcloud_compute.py | list_volumes | def list_volumes(profile, **libcloud_kwargs):
'''
Return a list of storage volumes for this cloud
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_volumes method
:type libcloud_kwargs: ``dict``
CLI Example:
.. code... | python | def list_volumes(profile, **libcloud_kwargs):
'''
Return a list of storage volumes for this cloud
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_volumes method
:type libcloud_kwargs: ``dict``
CLI Example:
.. code... | [
"def",
"list_volumes",
"(",
"profile",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"libcloud_kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",
"*",
"libcloud_kwa... | Return a list of storage volumes for this cloud
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_volumes method
:type libcloud_kwargs: ``dict``
CLI Example:
.. code-block:: bash
salt myminion libcloud_compute.list... | [
"Return",
"a",
"list",
"of",
"storage",
"volumes",
"for",
"this",
"cloud"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_compute.py#L229-L252 | train |
saltstack/salt | salt/modules/libcloud_compute.py | list_volume_snapshots | def list_volume_snapshots(volume_id, profile, **libcloud_kwargs):
'''
Return a list of storage volumes snapshots for this cloud
:param volume_id: The volume identifier
:type volume_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments... | python | def list_volume_snapshots(volume_id, profile, **libcloud_kwargs):
'''
Return a list of storage volumes snapshots for this cloud
:param volume_id: The volume identifier
:type volume_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments... | [
"def",
"list_volume_snapshots",
"(",
"volume_id",
",",
"profile",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"libcloud_kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"("... | Return a list of storage volumes snapshots for this cloud
:param volume_id: The volume identifier
:type volume_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_volume_snapshots method
:type libcloud_kwargs: ``d... | [
"Return",
"a",
"list",
"of",
"storage",
"volumes",
"snapshots",
"for",
"this",
"cloud"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_compute.py#L255-L282 | train |
saltstack/salt | salt/modules/libcloud_compute.py | create_volume | def create_volume(size, name, profile, location_id=None, **libcloud_kwargs):
'''
Create a storage volume
:param size: Size of volume in gigabytes (required)
:type size: ``int``
:param name: Name of the volume to be created
:type name: ``str``
:param location_id: Which data center to creat... | python | def create_volume(size, name, profile, location_id=None, **libcloud_kwargs):
'''
Create a storage volume
:param size: Size of volume in gigabytes (required)
:type size: ``int``
:param name: Name of the volume to be created
:type name: ``str``
:param location_id: Which data center to creat... | [
"def",
"create_volume",
"(",
"size",
",",
"name",
",",
"profile",
",",
"location_id",
"=",
"None",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"libcloud_kwargs",
"=",
"salt",
".",
"utils",
... | Create a storage volume
:param size: Size of volume in gigabytes (required)
:type size: ``int``
:param name: Name of the volume to be created
:type name: ``str``
:param location_id: Which data center to create a volume in. If
empty, undefined behavior will be selected.... | [
"Create",
"a",
"storage",
"volume"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_compute.py#L285-L321 | train |
saltstack/salt | salt/modules/libcloud_compute.py | create_volume_snapshot | def create_volume_snapshot(volume_id, profile, name=None, **libcloud_kwargs):
'''
Create a storage volume snapshot
:param volume_id: Volume ID from which to create the new
snapshot.
:type volume_id: ``str``
:param profile: The profile key
:type profile: ``str``
... | python | def create_volume_snapshot(volume_id, profile, name=None, **libcloud_kwargs):
'''
Create a storage volume snapshot
:param volume_id: Volume ID from which to create the new
snapshot.
:type volume_id: ``str``
:param profile: The profile key
:type profile: ``str``
... | [
"def",
"create_volume_snapshot",
"(",
"volume_id",
",",
"profile",
",",
"name",
"=",
"None",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"libcloud_kwargs",
"=",
"salt",
".",
"utils",
".",
"ar... | Create a storage volume snapshot
:param volume_id: Volume ID from which to create the new
snapshot.
:type volume_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param name: Name of the snapshot to be created (optional)
:type name: ``str``
:p... | [
"Create",
"a",
"storage",
"volume",
"snapshot"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_compute.py#L324-L352 | train |
saltstack/salt | salt/modules/libcloud_compute.py | attach_volume | def attach_volume(node_id, volume_id, profile, device=None, **libcloud_kwargs):
'''
Attaches volume to node.
:param node_id: Node ID to target
:type node_id: ``str``
:param volume_id: Volume ID from which to attach
:type volume_id: ``str``
:param profile: The profile key
:type pr... | python | def attach_volume(node_id, volume_id, profile, device=None, **libcloud_kwargs):
'''
Attaches volume to node.
:param node_id: Node ID to target
:type node_id: ``str``
:param volume_id: Volume ID from which to attach
:type volume_id: ``str``
:param profile: The profile key
:type pr... | [
"def",
"attach_volume",
"(",
"node_id",
",",
"volume_id",
",",
"profile",
",",
"device",
"=",
"None",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"libcloud_kwargs",
"=",
"salt",
".",
"utils",... | Attaches volume to node.
:param node_id: Node ID to target
:type node_id: ``str``
:param volume_id: Volume ID from which to attach
:type volume_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param device: Where the device is exposed, e.g. '/dev/sdb'
:type de... | [
"Attaches",
"volume",
"to",
"node",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_compute.py#L355-L384 | train |
saltstack/salt | salt/modules/libcloud_compute.py | detach_volume | def detach_volume(volume_id, profile, **libcloud_kwargs):
'''
Detaches a volume from a node.
:param volume_id: Volume ID from which to detach
:type volume_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's detach_... | python | def detach_volume(volume_id, profile, **libcloud_kwargs):
'''
Detaches a volume from a node.
:param volume_id: Volume ID from which to detach
:type volume_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's detach_... | [
"def",
"detach_volume",
"(",
"volume_id",
",",
"profile",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"libcloud_kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",... | Detaches a volume from a node.
:param volume_id: Volume ID from which to detach
:type volume_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's detach_volume method
:type libcloud_kwargs: ``dict``
CLI Example:
... | [
"Detaches",
"a",
"volume",
"from",
"a",
"node",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_compute.py#L387-L409 | train |
saltstack/salt | salt/modules/libcloud_compute.py | destroy_volume_snapshot | def destroy_volume_snapshot(volume_id, snapshot_id, profile, **libcloud_kwargs):
'''
Destroy a volume snapshot.
:param volume_id: Volume ID from which the snapshot belongs
:type volume_id: ``str``
:param snapshot_id: Volume Snapshot ID from which to destroy
:type snapshot_id: ``str``
... | python | def destroy_volume_snapshot(volume_id, snapshot_id, profile, **libcloud_kwargs):
'''
Destroy a volume snapshot.
:param volume_id: Volume ID from which the snapshot belongs
:type volume_id: ``str``
:param snapshot_id: Volume Snapshot ID from which to destroy
:type snapshot_id: ``str``
... | [
"def",
"destroy_volume_snapshot",
"(",
"volume_id",
",",
"snapshot_id",
",",
"profile",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"libcloud_kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".... | Destroy a volume snapshot.
:param volume_id: Volume ID from which the snapshot belongs
:type volume_id: ``str``
:param snapshot_id: Volume Snapshot ID from which to destroy
:type snapshot_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extr... | [
"Destroy",
"a",
"volume",
"snapshot",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_compute.py#L437-L463 | train |
saltstack/salt | salt/modules/libcloud_compute.py | list_images | def list_images(profile, location_id=None, **libcloud_kwargs):
'''
Return a list of images for this cloud
:param profile: The profile key
:type profile: ``str``
:param location_id: The location key, from list_locations
:type location_id: ``str``
:param libcloud_kwargs: Extra arguments f... | python | def list_images(profile, location_id=None, **libcloud_kwargs):
'''
Return a list of images for this cloud
:param profile: The profile key
:type profile: ``str``
:param location_id: The location key, from list_locations
:type location_id: ``str``
:param libcloud_kwargs: Extra arguments f... | [
"def",
"list_images",
"(",
"profile",
",",
"location_id",
"=",
"None",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"libcloud_kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwarg... | Return a list of images for this cloud
:param profile: The profile key
:type profile: ``str``
:param location_id: The location key, from list_locations
:type location_id: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_images method
:type libcloud_kwargs: ``dict``
... | [
"Return",
"a",
"list",
"of",
"images",
"for",
"this",
"cloud"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_compute.py#L466-L496 | train |
saltstack/salt | salt/modules/libcloud_compute.py | create_image | def create_image(node_id, name, profile, description=None, **libcloud_kwargs):
'''
Create an image from a node
:param node_id: Node to run the task on.
:type node_id: ``str``
:param name: name for new image.
:type name: ``str``
:param profile: The profile key
:type profile: ``str``
... | python | def create_image(node_id, name, profile, description=None, **libcloud_kwargs):
'''
Create an image from a node
:param node_id: Node to run the task on.
:type node_id: ``str``
:param name: name for new image.
:type name: ``str``
:param profile: The profile key
:type profile: ``str``
... | [
"def",
"create_image",
"(",
"node_id",
",",
"name",
",",
"profile",
",",
"description",
"=",
"None",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"libcloud_kwargs",
"=",
"salt",
".",
"utils",
... | Create an image from a node
:param node_id: Node to run the task on.
:type node_id: ``str``
:param name: name for new image.
:type name: ``str``
:param profile: The profile key
:type profile: ``str``
:param description: description for new image.
:type description: ``description``
... | [
"Create",
"an",
"image",
"from",
"a",
"node"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_compute.py#L499-L528 | train |
saltstack/salt | salt/modules/libcloud_compute.py | delete_image | def delete_image(image_id, profile, **libcloud_kwargs):
'''
Delete an image of a node
:param image_id: Image to delete
:type image_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's delete_image method
:type li... | python | def delete_image(image_id, profile, **libcloud_kwargs):
'''
Delete an image of a node
:param image_id: Image to delete
:type image_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's delete_image method
:type li... | [
"def",
"delete_image",
"(",
"image_id",
",",
"profile",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"libcloud_kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",
... | Delete an image of a node
:param image_id: Image to delete
:type image_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's delete_image method
:type libcloud_kwargs: ``dict``
CLI Example:
.. code-block:: bash
... | [
"Delete",
"an",
"image",
"of",
"a",
"node"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_compute.py#L531-L553 | train |
saltstack/salt | salt/modules/libcloud_compute.py | get_image | def get_image(image_id, profile, **libcloud_kwargs):
'''
Get an image of a node
:param image_id: Image to fetch
:type image_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's delete_image method
:type libcloud_... | python | def get_image(image_id, profile, **libcloud_kwargs):
'''
Get an image of a node
:param image_id: Image to fetch
:type image_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's delete_image method
:type libcloud_... | [
"def",
"get_image",
"(",
"image_id",
",",
"profile",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"libcloud_kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",
"*... | Get an image of a node
:param image_id: Image to fetch
:type image_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's delete_image method
:type libcloud_kwargs: ``dict``
CLI Example:
.. code-block:: bash
... | [
"Get",
"an",
"image",
"of",
"a",
"node"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_compute.py#L556-L578 | train |
saltstack/salt | salt/modules/libcloud_compute.py | copy_image | def copy_image(source_region, image_id, name, profile, description=None, **libcloud_kwargs):
'''
Copies an image from a source region to the current region.
:param source_region: Region to copy the node from.
:type source_region: ``str``
:param image_id: Image to copy.
:type image_id: ``str``
... | python | def copy_image(source_region, image_id, name, profile, description=None, **libcloud_kwargs):
'''
Copies an image from a source region to the current region.
:param source_region: Region to copy the node from.
:type source_region: ``str``
:param image_id: Image to copy.
:type image_id: ``str``
... | [
"def",
"copy_image",
"(",
"source_region",
",",
"image_id",
",",
"name",
",",
"profile",
",",
"description",
"=",
"None",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"libcloud_kwargs",
"=",
"... | Copies an image from a source region to the current region.
:param source_region: Region to copy the node from.
:type source_region: ``str``
:param image_id: Image to copy.
:type image_id: ``str``
:param name: name for new image.
:type name: ``str``
:param profile: The profile key
:t... | [
"Copies",
"an",
"image",
"from",
"a",
"source",
"region",
"to",
"the",
"current",
"region",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_compute.py#L581-L614 | train |
saltstack/salt | salt/modules/libcloud_compute.py | list_key_pairs | def list_key_pairs(profile, **libcloud_kwargs):
'''
List all the available key pair objects.
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_key_pairs method
:type libcloud_kwargs: ``dict``
CLI Example:
.. code-bl... | python | def list_key_pairs(profile, **libcloud_kwargs):
'''
List all the available key pair objects.
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_key_pairs method
:type libcloud_kwargs: ``dict``
CLI Example:
.. code-bl... | [
"def",
"list_key_pairs",
"(",
"profile",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"libcloud_kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",
"*",
"libcloud_k... | List all the available key pair objects.
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_key_pairs method
:type libcloud_kwargs: ``dict``
CLI Example:
.. code-block:: bash
salt myminion libcloud_compute.list_key_... | [
"List",
"all",
"the",
"available",
"key",
"pair",
"objects",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_compute.py#L617-L640 | train |
saltstack/salt | salt/modules/libcloud_compute.py | get_key_pair | def get_key_pair(name, profile, **libcloud_kwargs):
'''
Get a single key pair by name
:param name: Name of the key pair to retrieve.
:type name: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's get_key_pair method
... | python | def get_key_pair(name, profile, **libcloud_kwargs):
'''
Get a single key pair by name
:param name: Name of the key pair to retrieve.
:type name: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's get_key_pair method
... | [
"def",
"get_key_pair",
"(",
"name",
",",
"profile",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"libcloud_kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",
"*"... | Get a single key pair by name
:param name: Name of the key pair to retrieve.
:type name: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's get_key_pair method
:type libcloud_kwargs: ``dict``
CLI Example:
.. code... | [
"Get",
"a",
"single",
"key",
"pair",
"by",
"name"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_compute.py#L643-L664 | train |
saltstack/salt | salt/modules/libcloud_compute.py | import_key_pair | def import_key_pair(name, key, profile, key_type=None, **libcloud_kwargs):
'''
Import a new public key from string or a file path
:param name: Key pair name.
:type name: ``str``
:param key: Public key material, the string or a path to a file
:type key: ``str`` or path ``str``
:param prof... | python | def import_key_pair(name, key, profile, key_type=None, **libcloud_kwargs):
'''
Import a new public key from string or a file path
:param name: Key pair name.
:type name: ``str``
:param key: Public key material, the string or a path to a file
:type key: ``str`` or path ``str``
:param prof... | [
"def",
"import_key_pair",
"(",
"name",
",",
"key",
",",
"profile",
",",
"key_type",
"=",
"None",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"libcloud_kwargs",
"=",
"salt",
".",
"utils",
".... | Import a new public key from string or a file path
:param name: Key pair name.
:type name: ``str``
:param key: Public key material, the string or a path to a file
:type key: ``str`` or path ``str``
:param profile: The profile key
:type profile: ``str``
:param key_type: The key pair typ... | [
"Import",
"a",
"new",
"public",
"key",
"from",
"string",
"or",
"a",
"file",
"path"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_compute.py#L691-L727 | train |
saltstack/salt | salt/modules/libcloud_compute.py | delete_key_pair | def delete_key_pair(name, profile, **libcloud_kwargs):
'''
Delete a key pair
:param name: Key pair name.
:type name: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's import_key_pair_from_xxx method
:type libclou... | python | def delete_key_pair(name, profile, **libcloud_kwargs):
'''
Delete a key pair
:param name: Key pair name.
:type name: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's import_key_pair_from_xxx method
:type libclou... | [
"def",
"delete_key_pair",
"(",
"name",
",",
"profile",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"libcloud_kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",
... | Delete a key pair
:param name: Key pair name.
:type name: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's import_key_pair_from_xxx method
:type libcloud_kwargs: ``dict``
CLI Example:
.. code-block:: bash
... | [
"Delete",
"a",
"key",
"pair"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_compute.py#L730-L752 | train |
saltstack/salt | salt/modules/libcloud_compute.py | _get_by_id | def _get_by_id(collection, id):
'''
Get item from a list by the id field
'''
matches = [item for item in collection if item.id == id]
if not matches:
raise ValueError('Could not find a matching item')
elif len(matches) > 1:
raise ValueError('The id matched {0} items, not 1'.forma... | python | def _get_by_id(collection, id):
'''
Get item from a list by the id field
'''
matches = [item for item in collection if item.id == id]
if not matches:
raise ValueError('Could not find a matching item')
elif len(matches) > 1:
raise ValueError('The id matched {0} items, not 1'.forma... | [
"def",
"_get_by_id",
"(",
"collection",
",",
"id",
")",
":",
"matches",
"=",
"[",
"item",
"for",
"item",
"in",
"collection",
"if",
"item",
".",
"id",
"==",
"id",
"]",
"if",
"not",
"matches",
":",
"raise",
"ValueError",
"(",
"'Could not find a matching item... | Get item from a list by the id field | [
"Get",
"item",
"from",
"a",
"list",
"by",
"the",
"id",
"field"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_compute.py#L780-L789 | train |
saltstack/salt | salt/states/monit.py | monitor | def monitor(name):
'''
Get the summary from module monit and try to see if service is
being monitored. If not then monitor the service.
'''
ret = {'result': None,
'name': name,
'comment': '',
'changes': {}
}
result = __salt__['monit.summary'](name)
... | python | def monitor(name):
'''
Get the summary from module monit and try to see if service is
being monitored. If not then monitor the service.
'''
ret = {'result': None,
'name': name,
'comment': '',
'changes': {}
}
result = __salt__['monit.summary'](name)
... | [
"def",
"monitor",
"(",
"name",
")",
":",
"ret",
"=",
"{",
"'result'",
":",
"None",
",",
"'name'",
":",
"name",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
"}",
"result",
"=",
"__salt__",
"[",
"'monit.summary'",
"]",
"(",
"name",
"... | Get the summary from module monit and try to see if service is
being monitored. If not then monitor the service. | [
"Get",
"the",
"summary",
"from",
"module",
"monit",
"and",
"try",
"to",
"see",
"if",
"service",
"is",
"being",
"monitored",
".",
"If",
"not",
"then",
"monitor",
"the",
"service",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/monit.py#L34-L65 | train |
saltstack/salt | salt/modules/jboss7.py | status | def status(jboss_config, host=None, server_config=None):
'''
Get status of running jboss instance.
jboss_config
Configuration dictionary with properties specified above.
host
The name of the host. JBoss domain mode only - and required if running in domain mode.
The host name is ... | python | def status(jboss_config, host=None, server_config=None):
'''
Get status of running jboss instance.
jboss_config
Configuration dictionary with properties specified above.
host
The name of the host. JBoss domain mode only - and required if running in domain mode.
The host name is ... | [
"def",
"status",
"(",
"jboss_config",
",",
"host",
"=",
"None",
",",
"server_config",
"=",
"None",
")",
":",
"log",
".",
"debug",
"(",
"\"======================== MODULE FUNCTION: jboss7.status\"",
")",
"if",
"host",
"is",
"None",
"and",
"server_config",
"is",
"... | Get status of running jboss instance.
jboss_config
Configuration dictionary with properties specified above.
host
The name of the host. JBoss domain mode only - and required if running in domain mode.
The host name is the "name" attribute of the "host" element in host.xml
server_con... | [
"Get",
"status",
"of",
"running",
"jboss",
"instance",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jboss7.py#L44-L73 | train |
saltstack/salt | salt/modules/jboss7.py | stop_server | def stop_server(jboss_config, host=None):
'''
Stop running jboss instance
jboss_config
Configuration dictionary with properties specified above.
host
The name of the host. JBoss domain mode only - and required if running in domain mode.
The host name is the "name" attribute of t... | python | def stop_server(jboss_config, host=None):
'''
Stop running jboss instance
jboss_config
Configuration dictionary with properties specified above.
host
The name of the host. JBoss domain mode only - and required if running in domain mode.
The host name is the "name" attribute of t... | [
"def",
"stop_server",
"(",
"jboss_config",
",",
"host",
"=",
"None",
")",
":",
"log",
".",
"debug",
"(",
"\"======================== MODULE FUNCTION: jboss7.stop_server\"",
")",
"if",
"host",
"is",
"None",
":",
"operation",
"=",
"':shutdown'",
"else",
":",
"operat... | Stop running jboss instance
jboss_config
Configuration dictionary with properties specified above.
host
The name of the host. JBoss domain mode only - and required if running in domain mode.
The host name is the "name" attribute of the "host" element in host.xml
CLI Example:
.... | [
"Stop",
"running",
"jboss",
"instance"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jboss7.py#L76-L103 | train |
saltstack/salt | salt/modules/jboss7.py | reload_ | def reload_(jboss_config, host=None):
'''
Reload running jboss instance
jboss_config
Configuration dictionary with properties specified above.
host
The name of the host. JBoss domain mode only - and required if running in domain mode.
The host name is the "name" attribute of the... | python | def reload_(jboss_config, host=None):
'''
Reload running jboss instance
jboss_config
Configuration dictionary with properties specified above.
host
The name of the host. JBoss domain mode only - and required if running in domain mode.
The host name is the "name" attribute of the... | [
"def",
"reload_",
"(",
"jboss_config",
",",
"host",
"=",
"None",
")",
":",
"log",
".",
"debug",
"(",
"\"======================== MODULE FUNCTION: jboss7.reload\"",
")",
"if",
"host",
"is",
"None",
":",
"operation",
"=",
"':reload'",
"else",
":",
"operation",
"="... | Reload running jboss instance
jboss_config
Configuration dictionary with properties specified above.
host
The name of the host. JBoss domain mode only - and required if running in domain mode.
The host name is the "name" attribute of the "host" element in host.xml
CLI Example:
... | [
"Reload",
"running",
"jboss",
"instance"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jboss7.py#L106-L135 | train |
saltstack/salt | salt/modules/jboss7.py | create_datasource | def create_datasource(jboss_config, name, datasource_properties, profile=None):
'''
Create datasource in running jboss instance
jboss_config
Configuration dictionary with properties specified above.
name
Datasource name
datasource_properties
A dictionary of datasource proper... | python | def create_datasource(jboss_config, name, datasource_properties, profile=None):
'''
Create datasource in running jboss instance
jboss_config
Configuration dictionary with properties specified above.
name
Datasource name
datasource_properties
A dictionary of datasource proper... | [
"def",
"create_datasource",
"(",
"jboss_config",
",",
"name",
",",
"datasource_properties",
",",
"profile",
"=",
"None",
")",
":",
"log",
".",
"debug",
"(",
"\"======================== MODULE FUNCTION: jboss7.create_datasource, name=%s, profile=%s\"",
",",
"name",
",",
"p... | Create datasource in running jboss instance
jboss_config
Configuration dictionary with properties specified above.
name
Datasource name
datasource_properties
A dictionary of datasource properties to be created:
- driver-name: mysql
- connection-url: 'jdbc:mysql:/... | [
"Create",
"datasource",
"in",
"running",
"jboss",
"instance"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jboss7.py#L138-L174 | train |
saltstack/salt | salt/modules/jboss7.py | update_datasource | def update_datasource(jboss_config, name, new_properties, profile=None):
'''
Update an existing datasource in running jboss instance.
If the property doesn't exist if will be created, if it does, it will be updated with the new value
jboss_config
Configuration dictionary with properties specifi... | python | def update_datasource(jboss_config, name, new_properties, profile=None):
'''
Update an existing datasource in running jboss instance.
If the property doesn't exist if will be created, if it does, it will be updated with the new value
jboss_config
Configuration dictionary with properties specifi... | [
"def",
"update_datasource",
"(",
"jboss_config",
",",
"name",
",",
"new_properties",
",",
"profile",
"=",
"None",
")",
":",
"log",
".",
"debug",
"(",
"\"======================== MODULE FUNCTION: jboss7.update_datasource, name=%s, profile=%s\"",
",",
"name",
",",
"profile"... | Update an existing datasource in running jboss instance.
If the property doesn't exist if will be created, if it does, it will be updated with the new value
jboss_config
Configuration dictionary with properties specified above.
name
Datasource name
new_properties
A dictionary of... | [
"Update",
"an",
"existing",
"datasource",
"in",
"running",
"jboss",
"instance",
".",
"If",
"the",
"property",
"doesn",
"t",
"exist",
"if",
"will",
"be",
"created",
"if",
"it",
"does",
"it",
"will",
"be",
"updated",
"with",
"the",
"new",
"value"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jboss7.py#L211-L258 | train |
saltstack/salt | salt/modules/jboss7.py | read_datasource | def read_datasource(jboss_config, name, profile=None):
'''
Read datasource properties in the running jboss instance.
jboss_config
Configuration dictionary with properties specified above.
name
Datasource name
profile
Profile name (JBoss domain mode only)
CLI Example:
... | python | def read_datasource(jboss_config, name, profile=None):
'''
Read datasource properties in the running jboss instance.
jboss_config
Configuration dictionary with properties specified above.
name
Datasource name
profile
Profile name (JBoss domain mode only)
CLI Example:
... | [
"def",
"read_datasource",
"(",
"jboss_config",
",",
"name",
",",
"profile",
"=",
"None",
")",
":",
"log",
".",
"debug",
"(",
"\"======================== MODULE FUNCTION: jboss7.read_datasource, name=%s\"",
",",
"name",
")",
"return",
"__read_datasource",
"(",
"jboss_con... | Read datasource properties in the running jboss instance.
jboss_config
Configuration dictionary with properties specified above.
name
Datasource name
profile
Profile name (JBoss domain mode only)
CLI Example:
.. code-block:: bash
salt '*' jboss7.read_datasource '{... | [
"Read",
"datasource",
"properties",
"in",
"the",
"running",
"jboss",
"instance",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jboss7.py#L272-L290 | train |
saltstack/salt | salt/modules/jboss7.py | create_simple_binding | def create_simple_binding(jboss_config, binding_name, value, profile=None):
'''
Create a simple jndi binding in the running jboss instance
jboss_config
Configuration dictionary with properties specified above.
binding_name
Binding name to be created
value
Binding value
p... | python | def create_simple_binding(jboss_config, binding_name, value, profile=None):
'''
Create a simple jndi binding in the running jboss instance
jboss_config
Configuration dictionary with properties specified above.
binding_name
Binding name to be created
value
Binding value
p... | [
"def",
"create_simple_binding",
"(",
"jboss_config",
",",
"binding_name",
",",
"value",
",",
"profile",
"=",
"None",
")",
":",
"log",
".",
"debug",
"(",
"\"======================== MODULE FUNCTION: jboss7.create_simple_binding, binding_name=%s, value=%s, profile=%s\"",
",",
"... | Create a simple jndi binding in the running jboss instance
jboss_config
Configuration dictionary with properties specified above.
binding_name
Binding name to be created
value
Binding value
profile
The profile name (JBoss domain mode only)
CLI Example:
.. code-... | [
"Create",
"a",
"simple",
"jndi",
"binding",
"in",
"the",
"running",
"jboss",
"instance"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jboss7.py#L293-L322 | train |
saltstack/salt | salt/modules/jboss7.py | read_simple_binding | def read_simple_binding(jboss_config, binding_name, profile=None):
'''
Read jndi binding in the running jboss instance
jboss_config
Configuration dictionary with properties specified above.
binding_name
Binding name to be created
profile
The profile name (JBoss domain mode o... | python | def read_simple_binding(jboss_config, binding_name, profile=None):
'''
Read jndi binding in the running jboss instance
jboss_config
Configuration dictionary with properties specified above.
binding_name
Binding name to be created
profile
The profile name (JBoss domain mode o... | [
"def",
"read_simple_binding",
"(",
"jboss_config",
",",
"binding_name",
",",
"profile",
"=",
"None",
")",
":",
"log",
".",
"debug",
"(",
"\"======================== MODULE FUNCTION: jboss7.read_simple_binding, %s\"",
",",
"binding_name",
")",
"return",
"__read_simple_bindin... | Read jndi binding in the running jboss instance
jboss_config
Configuration dictionary with properties specified above.
binding_name
Binding name to be created
profile
The profile name (JBoss domain mode only)
CLI Example:
.. code-block:: bash
salt '*' jboss7.r... | [
"Read",
"jndi",
"binding",
"in",
"the",
"running",
"jboss",
"instance"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jboss7.py#L354-L372 | train |
saltstack/salt | salt/modules/jboss7.py | remove_datasource | def remove_datasource(jboss_config, name, profile=None):
'''
Remove an existing datasource from the running jboss instance.
jboss_config
Configuration dictionary with properties specified above.
name
Datasource name
profile
The profile (JBoss domain mode only)
CLI Examp... | python | def remove_datasource(jboss_config, name, profile=None):
'''
Remove an existing datasource from the running jboss instance.
jboss_config
Configuration dictionary with properties specified above.
name
Datasource name
profile
The profile (JBoss domain mode only)
CLI Examp... | [
"def",
"remove_datasource",
"(",
"jboss_config",
",",
"name",
",",
"profile",
"=",
"None",
")",
":",
"log",
".",
"debug",
"(",
"\"======================== MODULE FUNCTION: jboss7.remove_datasource, name=%s, profile=%s\"",
",",
"name",
",",
"profile",
")",
"operation",
"... | Remove an existing datasource from the running jboss instance.
jboss_config
Configuration dictionary with properties specified above.
name
Datasource name
profile
The profile (JBoss domain mode only)
CLI Example:
.. code-block:: bash
salt '*' jboss7.remove_datasou... | [
"Remove",
"an",
"existing",
"datasource",
"from",
"the",
"running",
"jboss",
"instance",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jboss7.py#L414-L437 | train |
saltstack/salt | salt/modules/jboss7.py | deploy | def deploy(jboss_config, source_file):
'''
Deploy the application on the jboss instance from the local file system where minion is running.
jboss_config
Configuration dictionary with properties specified above.
source_file
Source file to deploy from
CLI Example:
.. code-block:... | python | def deploy(jboss_config, source_file):
'''
Deploy the application on the jboss instance from the local file system where minion is running.
jboss_config
Configuration dictionary with properties specified above.
source_file
Source file to deploy from
CLI Example:
.. code-block:... | [
"def",
"deploy",
"(",
"jboss_config",
",",
"source_file",
")",
":",
"log",
".",
"debug",
"(",
"\"======================== MODULE FUNCTION: jboss7.deploy, source_file=%s\"",
",",
"source_file",
")",
"command",
"=",
"'deploy {source_file} --force '",
".",
"format",
"(",
"so... | Deploy the application on the jboss instance from the local file system where minion is running.
jboss_config
Configuration dictionary with properties specified above.
source_file
Source file to deploy from
CLI Example:
.. code-block:: bash
salt '*' jboss7.deploy '{"cli_path"... | [
"Deploy",
"the",
"application",
"on",
"the",
"jboss",
"instance",
"from",
"the",
"local",
"file",
"system",
"where",
"minion",
"is",
"running",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jboss7.py#L440-L457 | train |
saltstack/salt | salt/modules/jboss7.py | list_deployments | def list_deployments(jboss_config):
'''
List all deployments on the jboss instance
jboss_config
Configuration dictionary with properties specified above.
CLI Example:
.. code-block:: bash
salt '*' jboss7.list_deployments '{"cli_path": "integration.modules.sysmod.SysModuleTest.... | python | def list_deployments(jboss_config):
'''
List all deployments on the jboss instance
jboss_config
Configuration dictionary with properties specified above.
CLI Example:
.. code-block:: bash
salt '*' jboss7.list_deployments '{"cli_path": "integration.modules.sysmod.SysModuleTest.... | [
"def",
"list_deployments",
"(",
"jboss_config",
")",
":",
"log",
".",
"debug",
"(",
"\"======================== MODULE FUNCTION: jboss7.list_deployments\"",
")",
"command_result",
"=",
"__salt__",
"[",
"'jboss7_cli.run_command'",
"]",
"(",
"jboss_config",
",",
"'deploy'",
... | List all deployments on the jboss instance
jboss_config
Configuration dictionary with properties specified above.
CLI Example:
.. code-block:: bash
salt '*' jboss7.list_deployments '{"cli_path": "integration.modules.sysmod.SysModuleTest.test_valid_docs", "controller": "10.11.12.13:999... | [
"List",
"all",
"deployments",
"on",
"the",
"jboss",
"instance"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jboss7.py#L460-L480 | train |
saltstack/salt | salt/modules/jboss7.py | undeploy | def undeploy(jboss_config, deployment):
'''
Undeploy the application from jboss instance
jboss_config
Configuration dictionary with properties specified above.
deployment
Deployment name to undeploy
CLI Example:
.. code-block:: bash
salt '*' jboss7.undeploy '{"cli_pat... | python | def undeploy(jboss_config, deployment):
'''
Undeploy the application from jboss instance
jboss_config
Configuration dictionary with properties specified above.
deployment
Deployment name to undeploy
CLI Example:
.. code-block:: bash
salt '*' jboss7.undeploy '{"cli_pat... | [
"def",
"undeploy",
"(",
"jboss_config",
",",
"deployment",
")",
":",
"log",
".",
"debug",
"(",
"\"======================== MODULE FUNCTION: jboss7.undeploy, deployment=%s\"",
",",
"deployment",
")",
"command",
"=",
"'undeploy {deployment} '",
".",
"format",
"(",
"deployme... | Undeploy the application from jboss instance
jboss_config
Configuration dictionary with properties specified above.
deployment
Deployment name to undeploy
CLI Example:
.. code-block:: bash
salt '*' jboss7.undeploy '{"cli_path": "integration.modules.sysmod.SysModuleTest.test_v... | [
"Undeploy",
"the",
"application",
"from",
"jboss",
"instance"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jboss7.py#L483-L500 | train |
saltstack/salt | salt/utils/timeutil.py | get_timestamp_at | def get_timestamp_at(time_in=None, time_at=None):
'''
Computes the timestamp for a future event that may occur in ``time_in`` time
or at ``time_at``.
'''
if time_in:
if isinstance(time_in, int):
hours = 0
minutes = time_in
else:
time_in = time_in.r... | python | def get_timestamp_at(time_in=None, time_at=None):
'''
Computes the timestamp for a future event that may occur in ``time_in`` time
or at ``time_at``.
'''
if time_in:
if isinstance(time_in, int):
hours = 0
minutes = time_in
else:
time_in = time_in.r... | [
"def",
"get_timestamp_at",
"(",
"time_in",
"=",
"None",
",",
"time_at",
"=",
"None",
")",
":",
"if",
"time_in",
":",
"if",
"isinstance",
"(",
"time_in",
",",
"int",
")",
":",
"hours",
"=",
"0",
"minutes",
"=",
"time_in",
"else",
":",
"time_in",
"=",
... | Computes the timestamp for a future event that may occur in ``time_in`` time
or at ``time_at``. | [
"Computes",
"the",
"timestamp",
"for",
"a",
"future",
"event",
"that",
"may",
"occur",
"in",
"time_in",
"time",
"or",
"at",
"time_at",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/timeutil.py#L18-L66 | train |
saltstack/salt | salt/utils/timeutil.py | get_time_at | def get_time_at(time_in=None, time_at=None, out_fmt='%Y-%m-%dT%H:%M:%S'):
'''
Return the time in human readable format for a future event that may occur
in ``time_in`` time, or at ``time_at``.
'''
dt = get_timestamp_at(time_in=time_in, time_at=time_at)
return time.strftime(out_fmt, time.localtim... | python | def get_time_at(time_in=None, time_at=None, out_fmt='%Y-%m-%dT%H:%M:%S'):
'''
Return the time in human readable format for a future event that may occur
in ``time_in`` time, or at ``time_at``.
'''
dt = get_timestamp_at(time_in=time_in, time_at=time_at)
return time.strftime(out_fmt, time.localtim... | [
"def",
"get_time_at",
"(",
"time_in",
"=",
"None",
",",
"time_at",
"=",
"None",
",",
"out_fmt",
"=",
"'%Y-%m-%dT%H:%M:%S'",
")",
":",
"dt",
"=",
"get_timestamp_at",
"(",
"time_in",
"=",
"time_in",
",",
"time_at",
"=",
"time_at",
")",
"return",
"time",
".",... | Return the time in human readable format for a future event that may occur
in ``time_in`` time, or at ``time_at``. | [
"Return",
"the",
"time",
"in",
"human",
"readable",
"format",
"for",
"a",
"future",
"event",
"that",
"may",
"occur",
"in",
"time_in",
"time",
"or",
"at",
"time_at",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/timeutil.py#L69-L75 | train |
saltstack/salt | salt/states/archive.py | _path_is_abs | def _path_is_abs(path):
'''
Return a bool telling whether or ``path`` is absolute. If ``path`` is None,
return ``True``. This function is designed to validate variables which
optionally contain a file path.
'''
if path is None:
return True
try:
return os.path.isabs(path)
... | python | def _path_is_abs(path):
'''
Return a bool telling whether or ``path`` is absolute. If ``path`` is None,
return ``True``. This function is designed to validate variables which
optionally contain a file path.
'''
if path is None:
return True
try:
return os.path.isabs(path)
... | [
"def",
"_path_is_abs",
"(",
"path",
")",
":",
"if",
"path",
"is",
"None",
":",
"return",
"True",
"try",
":",
"return",
"os",
".",
"path",
".",
"isabs",
"(",
"path",
")",
"except",
"AttributeError",
":",
"# Non-string data passed",
"return",
"False"
] | Return a bool telling whether or ``path`` is absolute. If ``path`` is None,
return ``True``. This function is designed to validate variables which
optionally contain a file path. | [
"Return",
"a",
"bool",
"telling",
"whether",
"or",
"path",
"is",
"absolute",
".",
"If",
"path",
"is",
"None",
"return",
"True",
".",
"This",
"function",
"is",
"designed",
"to",
"validate",
"variables",
"which",
"optionally",
"contain",
"a",
"file",
"path",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/archive.py#L37-L49 | train |
saltstack/salt | salt/states/archive.py | extracted | def extracted(name,
source,
source_hash=None,
source_hash_name=None,
source_hash_update=False,
skip_verify=False,
password=None,
options=None,
list_options=None,
force=False,
overw... | python | def extracted(name,
source,
source_hash=None,
source_hash_name=None,
source_hash_update=False,
skip_verify=False,
password=None,
options=None,
list_options=None,
force=False,
overw... | [
"def",
"extracted",
"(",
"name",
",",
"source",
",",
"source_hash",
"=",
"None",
",",
"source_hash_name",
"=",
"None",
",",
"source_hash_update",
"=",
"False",
",",
"skip_verify",
"=",
"False",
",",
"password",
"=",
"None",
",",
"options",
"=",
"None",
","... | .. versionadded:: 2014.1.0
.. versionchanged:: 2016.11.0
This state has been rewritten. Some arguments are new to this release
and will not be available in the 2016.3 release cycle (and earlier).
Additionally, the **ZIP Archive Handling** section below applies
specifically to the 201... | [
"..",
"versionadded",
"::",
"2014",
".",
"1",
".",
"0",
"..",
"versionchanged",
"::",
"2016",
".",
"11",
".",
"0",
"This",
"state",
"has",
"been",
"rewritten",
".",
"Some",
"arguments",
"are",
"new",
"to",
"this",
"release",
"and",
"will",
"not",
"be",... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/archive.py#L174-L1551 | train |
saltstack/salt | salt/modules/win_firewall.py | get_config | def get_config():
'''
Get the status of all the firewall profiles
Returns:
dict: A dictionary of all profiles on the system
Raises:
CommandExecutionError: If the command fails
CLI Example:
.. code-block:: bash
salt '*' firewall.get_config
'''
profiles = {}
... | python | def get_config():
'''
Get the status of all the firewall profiles
Returns:
dict: A dictionary of all profiles on the system
Raises:
CommandExecutionError: If the command fails
CLI Example:
.. code-block:: bash
salt '*' firewall.get_config
'''
profiles = {}
... | [
"def",
"get_config",
"(",
")",
":",
"profiles",
"=",
"{",
"}",
"curr",
"=",
"None",
"cmd",
"=",
"[",
"'netsh'",
",",
"'advfirewall'",
",",
"'show'",
",",
"'allprofiles'",
"]",
"ret",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
",",
"python_... | Get the status of all the firewall profiles
Returns:
dict: A dictionary of all profiles on the system
Raises:
CommandExecutionError: If the command fails
CLI Example:
.. code-block:: bash
salt '*' firewall.get_config | [
"Get",
"the",
"status",
"of",
"all",
"the",
"firewall",
"profiles"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_firewall.py#L29-L65 | train |
saltstack/salt | salt/modules/win_firewall.py | enable | def enable(profile='allprofiles'):
'''
.. versionadded:: 2015.5.0
Enable firewall profile
Args:
profile (Optional[str]): The name of the profile to enable. Default is
``allprofiles``. Valid options are:
- allprofiles
- domainprofile
- privatepro... | python | def enable(profile='allprofiles'):
'''
.. versionadded:: 2015.5.0
Enable firewall profile
Args:
profile (Optional[str]): The name of the profile to enable. Default is
``allprofiles``. Valid options are:
- allprofiles
- domainprofile
- privatepro... | [
"def",
"enable",
"(",
"profile",
"=",
"'allprofiles'",
")",
":",
"cmd",
"=",
"[",
"'netsh'",
",",
"'advfirewall'",
",",
"'set'",
",",
"profile",
",",
"'state'",
",",
"'on'",
"]",
"ret",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
",",
"pyth... | .. versionadded:: 2015.5.0
Enable firewall profile
Args:
profile (Optional[str]): The name of the profile to enable. Default is
``allprofiles``. Valid options are:
- allprofiles
- domainprofile
- privateprofile
- publicprofile
Returns:
... | [
"..",
"versionadded",
"::",
"2015",
".",
"5",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_firewall.py#L101-L133 | train |
saltstack/salt | salt/modules/win_firewall.py | get_rule | def get_rule(name='all'):
'''
.. versionadded:: 2015.5.0
Display all matching rules as specified by name
Args:
name (Optional[str]): The full name of the rule. ``all`` will return all
rules. Default is ``all``
Returns:
dict: A dictionary of all rules or rules that matc... | python | def get_rule(name='all'):
'''
.. versionadded:: 2015.5.0
Display all matching rules as specified by name
Args:
name (Optional[str]): The full name of the rule. ``all`` will return all
rules. Default is ``all``
Returns:
dict: A dictionary of all rules or rules that matc... | [
"def",
"get_rule",
"(",
"name",
"=",
"'all'",
")",
":",
"cmd",
"=",
"[",
"'netsh'",
",",
"'advfirewall'",
",",
"'firewall'",
",",
"'show'",
",",
"'rule'",
",",
"'name={0}'",
".",
"format",
"(",
"name",
")",
"]",
"ret",
"=",
"__salt__",
"[",
"'cmd.run_a... | .. versionadded:: 2015.5.0
Display all matching rules as specified by name
Args:
name (Optional[str]): The full name of the rule. ``all`` will return all
rules. Default is ``all``
Returns:
dict: A dictionary of all rules or rules that match the name exactly
Raises:
... | [
"..",
"versionadded",
"::",
"2015",
".",
"5",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_firewall.py#L136-L164 | train |
saltstack/salt | salt/modules/win_firewall.py | add_rule | def add_rule(name, localport, protocol='tcp', action='allow', dir='in',
remoteip='any'):
'''
.. versionadded:: 2015.5.0
Add a new inbound or outbound rule to the firewall policy
Args:
name (str): The name of the rule. Must be unique and cannot be "all".
Required.
... | python | def add_rule(name, localport, protocol='tcp', action='allow', dir='in',
remoteip='any'):
'''
.. versionadded:: 2015.5.0
Add a new inbound or outbound rule to the firewall policy
Args:
name (str): The name of the rule. Must be unique and cannot be "all".
Required.
... | [
"def",
"add_rule",
"(",
"name",
",",
"localport",
",",
"protocol",
"=",
"'tcp'",
",",
"action",
"=",
"'allow'",
",",
"dir",
"=",
"'in'",
",",
"remoteip",
"=",
"'any'",
")",
":",
"cmd",
"=",
"[",
"'netsh'",
",",
"'advfirewall'",
",",
"'firewall'",
",",
... | .. versionadded:: 2015.5.0
Add a new inbound or outbound rule to the firewall policy
Args:
name (str): The name of the rule. Must be unique and cannot be "all".
Required.
localport (int): The port the rule applies to. Must be a number between
0 and 65535. Can be a ran... | [
"..",
"versionadded",
"::",
"2015",
".",
"5",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_firewall.py#L167-L246 | train |
saltstack/salt | salt/modules/win_firewall.py | delete_rule | def delete_rule(name=None,
localport=None,
protocol=None,
dir=None,
remoteip=None):
'''
.. versionadded:: 2015.8.0
Delete an existing firewall rule identified by name and optionally by ports,
protocols, direction, and remote IP.
Args:... | python | def delete_rule(name=None,
localport=None,
protocol=None,
dir=None,
remoteip=None):
'''
.. versionadded:: 2015.8.0
Delete an existing firewall rule identified by name and optionally by ports,
protocols, direction, and remote IP.
Args:... | [
"def",
"delete_rule",
"(",
"name",
"=",
"None",
",",
"localport",
"=",
"None",
",",
"protocol",
"=",
"None",
",",
"dir",
"=",
"None",
",",
"remoteip",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"'netsh'",
",",
"'advfirewall'",
",",
"'firewall'",
",",
"'... | .. versionadded:: 2015.8.0
Delete an existing firewall rule identified by name and optionally by ports,
protocols, direction, and remote IP.
Args:
name (str): The name of the rule to delete. If the name ``all`` is used
you must specify additional parameters.
localport (Option... | [
"..",
"versionadded",
"::",
"2015",
".",
"8",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_firewall.py#L249-L319 | train |
saltstack/salt | salt/modules/win_firewall.py | get_settings | def get_settings(profile, section, store='local'):
'''
Get the firewall property from the specified profile in the specified store
as returned by ``netsh advfirewall``.
.. versionadded:: 2018.3.4
.. versionadded:: 2019.2.0
Args:
profile (str):
The firewall profile to query... | python | def get_settings(profile, section, store='local'):
'''
Get the firewall property from the specified profile in the specified store
as returned by ``netsh advfirewall``.
.. versionadded:: 2018.3.4
.. versionadded:: 2019.2.0
Args:
profile (str):
The firewall profile to query... | [
"def",
"get_settings",
"(",
"profile",
",",
"section",
",",
"store",
"=",
"'local'",
")",
":",
"return",
"salt",
".",
"utils",
".",
"win_lgpo_netsh",
".",
"get_settings",
"(",
"profile",
"=",
"profile",
",",
"section",
"=",
"section",
",",
"store",
"=",
... | Get the firewall property from the specified profile in the specified store
as returned by ``netsh advfirewall``.
.. versionadded:: 2018.3.4
.. versionadded:: 2019.2.0
Args:
profile (str):
The firewall profile to query. Valid options are:
- domain
- public... | [
"Get",
"the",
"firewall",
"property",
"from",
"the",
"specified",
"profile",
"in",
"the",
"specified",
"store",
"as",
"returned",
"by",
"netsh",
"advfirewall",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_firewall.py#L348-L404 | train |
saltstack/salt | salt/modules/win_firewall.py | get_all_settings | def get_all_settings(domain, store='local'):
'''
Gets all the properties for the specified profile in the specified store
.. versionadded:: 2018.3.4
.. versionadded:: 2019.2.0
Args:
profile (str):
The firewall profile to query. Valid options are:
- domain
... | python | def get_all_settings(domain, store='local'):
'''
Gets all the properties for the specified profile in the specified store
.. versionadded:: 2018.3.4
.. versionadded:: 2019.2.0
Args:
profile (str):
The firewall profile to query. Valid options are:
- domain
... | [
"def",
"get_all_settings",
"(",
"domain",
",",
"store",
"=",
"'local'",
")",
":",
"return",
"salt",
".",
"utils",
".",
"win_lgpo_netsh",
".",
"get_all_settings",
"(",
"profile",
"=",
"domain",
",",
"store",
"=",
"store",
")"
] | Gets all the properties for the specified profile in the specified store
.. versionadded:: 2018.3.4
.. versionadded:: 2019.2.0
Args:
profile (str):
The firewall profile to query. Valid options are:
- domain
- public
- private
store (str):
... | [
"Gets",
"all",
"the",
"properties",
"for",
"the",
"specified",
"profile",
"in",
"the",
"specified",
"store"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_firewall.py#L407-L447 | train |
saltstack/salt | salt/modules/win_firewall.py | set_firewall_settings | def set_firewall_settings(profile, inbound=None, outbound=None, store='local'):
'''
Set the firewall inbound/outbound settings for the specified profile and
store
.. versionadded:: 2018.3.4
.. versionadded:: 2019.2.0
Args:
profile (str):
The firewall profile to query. Vali... | python | def set_firewall_settings(profile, inbound=None, outbound=None, store='local'):
'''
Set the firewall inbound/outbound settings for the specified profile and
store
.. versionadded:: 2018.3.4
.. versionadded:: 2019.2.0
Args:
profile (str):
The firewall profile to query. Vali... | [
"def",
"set_firewall_settings",
"(",
"profile",
",",
"inbound",
"=",
"None",
",",
"outbound",
"=",
"None",
",",
"store",
"=",
"'local'",
")",
":",
"return",
"salt",
".",
"utils",
".",
"win_lgpo_netsh",
".",
"set_firewall_settings",
"(",
"profile",
"=",
"prof... | Set the firewall inbound/outbound settings for the specified profile and
store
.. versionadded:: 2018.3.4
.. versionadded:: 2019.2.0
Args:
profile (str):
The firewall profile to query. Valid options are:
- domain
- public
- private
inb... | [
"Set",
"the",
"firewall",
"inbound",
"/",
"outbound",
"settings",
"for",
"the",
"specified",
"profile",
"and",
"store"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_firewall.py#L486-L559 | train |
saltstack/salt | salt/modules/win_firewall.py | set_logging_settings | def set_logging_settings(profile, setting, value, store='local'):
r'''
Configure logging settings for the Windows firewall.
.. versionadded:: 2018.3.4
.. versionadded:: 2019.2.0
Args:
profile (str):
The firewall profile to configure. Valid options are:
- domain
... | python | def set_logging_settings(profile, setting, value, store='local'):
r'''
Configure logging settings for the Windows firewall.
.. versionadded:: 2018.3.4
.. versionadded:: 2019.2.0
Args:
profile (str):
The firewall profile to configure. Valid options are:
- domain
... | [
"def",
"set_logging_settings",
"(",
"profile",
",",
"setting",
",",
"value",
",",
"store",
"=",
"'local'",
")",
":",
"return",
"salt",
".",
"utils",
".",
"win_lgpo_netsh",
".",
"set_logging_settings",
"(",
"profile",
"=",
"profile",
",",
"setting",
"=",
"set... | r'''
Configure logging settings for the Windows firewall.
.. versionadded:: 2018.3.4
.. versionadded:: 2019.2.0
Args:
profile (str):
The firewall profile to configure. Valid options are:
- domain
- public
- private
setting (str):
... | [
"r",
"Configure",
"logging",
"settings",
"for",
"the",
"Windows",
"firewall",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_firewall.py#L562-L653 | train |
saltstack/salt | salt/modules/win_firewall.py | set_settings | def set_settings(profile, setting, value, store='local'):
'''
Configure firewall settings.
.. versionadded:: 2018.3.4
.. versionadded:: 2019.2.0
Args:
profile (str):
The firewall profile to configure. Valid options are:
- domain
- public
- ... | python | def set_settings(profile, setting, value, store='local'):
'''
Configure firewall settings.
.. versionadded:: 2018.3.4
.. versionadded:: 2019.2.0
Args:
profile (str):
The firewall profile to configure. Valid options are:
- domain
- public
- ... | [
"def",
"set_settings",
"(",
"profile",
",",
"setting",
",",
"value",
",",
"store",
"=",
"'local'",
")",
":",
"return",
"salt",
".",
"utils",
".",
"win_lgpo_netsh",
".",
"set_settings",
"(",
"profile",
"=",
"profile",
",",
"setting",
"=",
"setting",
",",
... | Configure firewall settings.
.. versionadded:: 2018.3.4
.. versionadded:: 2019.2.0
Args:
profile (str):
The firewall profile to configure. Valid options are:
- domain
- public
- private
setting (str):
The firewall setting to co... | [
"Configure",
"firewall",
"settings",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_firewall.py#L656-L720 | train |
saltstack/salt | salt/modules/win_firewall.py | set_state | def set_state(profile, state, store='local'):
'''
Configure the firewall state.
.. versionadded:: 2018.3.4
.. versionadded:: 2019.2.0
Args:
profile (str):
The firewall profile to configure. Valid options are:
- domain
- public
- private
... | python | def set_state(profile, state, store='local'):
'''
Configure the firewall state.
.. versionadded:: 2018.3.4
.. versionadded:: 2019.2.0
Args:
profile (str):
The firewall profile to configure. Valid options are:
- domain
- public
- private
... | [
"def",
"set_state",
"(",
"profile",
",",
"state",
",",
"store",
"=",
"'local'",
")",
":",
"return",
"salt",
".",
"utils",
".",
"win_lgpo_netsh",
".",
"set_state",
"(",
"profile",
"=",
"profile",
",",
"state",
"=",
"state",
",",
"store",
"=",
"store",
"... | Configure the firewall state.
.. versionadded:: 2018.3.4
.. versionadded:: 2019.2.0
Args:
profile (str):
The firewall profile to configure. Valid options are:
- domain
- public
- private
state (str):
The firewall state. Valid o... | [
"Configure",
"the",
"firewall",
"state",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_firewall.py#L723-L778 | train |
saltstack/salt | salt/utils/templates.py | _get_jinja_error | def _get_jinja_error(trace, context=None):
'''
Return the error line and error message output from
a stacktrace.
If we are in a macro, also output inside the message the
exact location of the error in the macro
'''
if not context:
context = {}
out = ''
error = _get_jinja_erro... | python | def _get_jinja_error(trace, context=None):
'''
Return the error line and error message output from
a stacktrace.
If we are in a macro, also output inside the message the
exact location of the error in the macro
'''
if not context:
context = {}
out = ''
error = _get_jinja_erro... | [
"def",
"_get_jinja_error",
"(",
"trace",
",",
"context",
"=",
"None",
")",
":",
"if",
"not",
"context",
":",
"context",
"=",
"{",
"}",
"out",
"=",
"''",
"error",
"=",
"_get_jinja_error_slug",
"(",
"trace",
")",
"line",
"=",
"_get_jinja_error_line",
"(",
... | Return the error line and error message output from
a stacktrace.
If we are in a macro, also output inside the message the
exact location of the error in the macro | [
"Return",
"the",
"error",
"line",
"and",
"error",
"message",
"output",
"from",
"a",
"stacktrace",
".",
"If",
"we",
"are",
"in",
"a",
"macro",
"also",
"output",
"inside",
"the",
"message",
"the",
"exact",
"location",
"of",
"the",
"error",
"in",
"the",
"ma... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/templates.py#L237-L287 | train |
saltstack/salt | salt/utils/templates.py | render_genshi_tmpl | def render_genshi_tmpl(tmplstr, context, tmplpath=None):
'''
Render a Genshi template. A method should be passed in as part of the
context. If no method is passed in, xml is assumed. Valid methods are:
.. code-block:
- xml
- xhtml
- html
- text
- newtext
... | python | def render_genshi_tmpl(tmplstr, context, tmplpath=None):
'''
Render a Genshi template. A method should be passed in as part of the
context. If no method is passed in, xml is assumed. Valid methods are:
.. code-block:
- xml
- xhtml
- html
- text
- newtext
... | [
"def",
"render_genshi_tmpl",
"(",
"tmplstr",
",",
"context",
",",
"tmplpath",
"=",
"None",
")",
":",
"method",
"=",
"context",
".",
"get",
"(",
"'method'",
",",
"'xml'",
")",
"if",
"method",
"==",
"'text'",
"or",
"method",
"==",
"'newtext'",
":",
"from",... | Render a Genshi template. A method should be passed in as part of the
context. If no method is passed in, xml is assumed. Valid methods are:
.. code-block:
- xml
- xhtml
- html
- text
- newtext
- oldtext
Note that the ``text`` method will call ``NewTextTemp... | [
"Render",
"a",
"Genshi",
"template",
".",
"A",
"method",
"should",
"be",
"passed",
"in",
"as",
"part",
"of",
"the",
"context",
".",
"If",
"no",
"method",
"is",
"passed",
"in",
"xml",
"is",
"assumed",
".",
"Valid",
"methods",
"are",
":"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/templates.py#L485-L513 | train |
saltstack/salt | salt/utils/templates.py | render_cheetah_tmpl | def render_cheetah_tmpl(tmplstr, context, tmplpath=None):
'''
Render a Cheetah template.
'''
from Cheetah.Template import Template
return salt.utils.data.decode(Template(tmplstr, searchList=[context])) | python | def render_cheetah_tmpl(tmplstr, context, tmplpath=None):
'''
Render a Cheetah template.
'''
from Cheetah.Template import Template
return salt.utils.data.decode(Template(tmplstr, searchList=[context])) | [
"def",
"render_cheetah_tmpl",
"(",
"tmplstr",
",",
"context",
",",
"tmplpath",
"=",
"None",
")",
":",
"from",
"Cheetah",
".",
"Template",
"import",
"Template",
"return",
"salt",
".",
"utils",
".",
"data",
".",
"decode",
"(",
"Template",
"(",
"tmplstr",
","... | Render a Cheetah template. | [
"Render",
"a",
"Cheetah",
"template",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/templates.py#L516-L521 | train |
saltstack/salt | salt/utils/templates.py | py | def py(sfn, string=False, **kwargs): # pylint: disable=C0103
'''
Render a template from a python source file
Returns::
{'result': bool,
'data': <Error data or rendered file path>}
'''
if not os.path.isfile(sfn):
return {}
base_fname = os.path.basename(sfn)
name =... | python | def py(sfn, string=False, **kwargs): # pylint: disable=C0103
'''
Render a template from a python source file
Returns::
{'result': bool,
'data': <Error data or rendered file path>}
'''
if not os.path.isfile(sfn):
return {}
base_fname = os.path.basename(sfn)
name =... | [
"def",
"py",
"(",
"sfn",
",",
"string",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=C0103",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"sfn",
")",
":",
"return",
"{",
"}",
"base_fname",
"=",
"os",
".",
"path",
".",
... | Render a template from a python source file
Returns::
{'result': bool,
'data': <Error data or rendered file path>} | [
"Render",
"a",
"template",
"from",
"a",
"python",
"source",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/templates.py#L525-L577 | train |
saltstack/salt | salt/modules/namecheap_users.py | get_balances | def get_balances():
'''
Gets information about fund in the user's account. This method returns the
following information: Available Balance, Account Balance, Earned Amount,
Withdrawable Amount and Funds Required for AutoRenew.
.. note::
If a domain setup with automatic renewal is expiring w... | python | def get_balances():
'''
Gets information about fund in the user's account. This method returns the
following information: Available Balance, Account Balance, Earned Amount,
Withdrawable Amount and Funds Required for AutoRenew.
.. note::
If a domain setup with automatic renewal is expiring w... | [
"def",
"get_balances",
"(",
")",
":",
"opts",
"=",
"salt",
".",
"utils",
".",
"namecheap",
".",
"get_opts",
"(",
"'namecheap.users.getBalances'",
")",
"response_xml",
"=",
"salt",
".",
"utils",
".",
"namecheap",
".",
"get_request",
"(",
"opts",
")",
"if",
... | Gets information about fund in the user's account. This method returns the
following information: Available Balance, Account Balance, Earned Amount,
Withdrawable Amount and Funds Required for AutoRenew.
.. note::
If a domain setup with automatic renewal is expiring within the next 90
days, ... | [
"Gets",
"information",
"about",
"fund",
"in",
"the",
"user",
"s",
"account",
".",
"This",
"method",
"returns",
"the",
"following",
"information",
":",
"Available",
"Balance",
"Account",
"Balance",
"Earned",
"Amount",
"Withdrawable",
"Amount",
"and",
"Funds",
"Re... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/namecheap_users.py#L49-L74 | train |
saltstack/salt | salt/modules/namecheap_users.py | check_balances | def check_balances(minimum=100):
'''
Checks if the provided minimum value is present in the user's account.
Returns a boolean. Returns ``False`` if the user's account balance is less
than the provided minimum or ``True`` if greater than the minimum.
minimum : 100
The value to check
CL... | python | def check_balances(minimum=100):
'''
Checks if the provided minimum value is present in the user's account.
Returns a boolean. Returns ``False`` if the user's account balance is less
than the provided minimum or ``True`` if greater than the minimum.
minimum : 100
The value to check
CL... | [
"def",
"check_balances",
"(",
"minimum",
"=",
"100",
")",
":",
"min_float",
"=",
"float",
"(",
"minimum",
")",
"result",
"=",
"get_balances",
"(",
")",
"if",
"result",
"[",
"'accountbalance'",
"]",
"<=",
"min_float",
":",
"return",
"False",
"return",
"True... | Checks if the provided minimum value is present in the user's account.
Returns a boolean. Returns ``False`` if the user's account balance is less
than the provided minimum or ``True`` if greater than the minimum.
minimum : 100
The value to check
CLI Example:
.. code-block:: bash
... | [
"Checks",
"if",
"the",
"provided",
"minimum",
"value",
"is",
"present",
"in",
"the",
"user",
"s",
"account",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/namecheap_users.py#L77-L99 | train |
saltstack/salt | salt/transport/zeromq.py | _get_master_uri | def _get_master_uri(master_ip,
master_port,
source_ip=None,
source_port=None):
'''
Return the ZeroMQ URI to connect the Minion to the Master.
It supports different source IP / port, given the ZeroMQ syntax:
// Connecting using a IP address and ... | python | def _get_master_uri(master_ip,
master_port,
source_ip=None,
source_port=None):
'''
Return the ZeroMQ URI to connect the Minion to the Master.
It supports different source IP / port, given the ZeroMQ syntax:
// Connecting using a IP address and ... | [
"def",
"_get_master_uri",
"(",
"master_ip",
",",
"master_port",
",",
"source_ip",
"=",
"None",
",",
"source_port",
"=",
"None",
")",
":",
"from",
"salt",
".",
"utils",
".",
"zeromq",
"import",
"ip_bracket",
"master_uri",
"=",
"'tcp://{master_ip}:{master_port}'",
... | Return the ZeroMQ URI to connect the Minion to the Master.
It supports different source IP / port, given the ZeroMQ syntax:
// Connecting using a IP address and bind to an IP address
rc = zmq_connect(socket, "tcp://192.168.1.17:5555;192.168.1.1:5555"); assert (rc == 0);
Source: http://api.zeromq.org/4-1... | [
"Return",
"the",
"ZeroMQ",
"URI",
"to",
"connect",
"the",
"Minion",
"to",
"the",
"Master",
".",
"It",
"supports",
"different",
"source",
"IP",
"/",
"port",
"given",
"the",
"ZeroMQ",
"syntax",
":",
"//",
"Connecting",
"using",
"a",
"IP",
"address",
"and",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/zeromq.py#L70-L108 | train |
saltstack/salt | salt/transport/zeromq.py | _set_tcp_keepalive | def _set_tcp_keepalive(zmq_socket, opts):
'''
Ensure that TCP keepalives are set as specified in "opts".
Warning: Failure to set TCP keepalives on the salt-master can result in
not detecting the loss of a minion when the connection is lost or when
it's host has been terminated without first closing... | python | def _set_tcp_keepalive(zmq_socket, opts):
'''
Ensure that TCP keepalives are set as specified in "opts".
Warning: Failure to set TCP keepalives on the salt-master can result in
not detecting the loss of a minion when the connection is lost or when
it's host has been terminated without first closing... | [
"def",
"_set_tcp_keepalive",
"(",
"zmq_socket",
",",
"opts",
")",
":",
"if",
"hasattr",
"(",
"zmq",
",",
"'TCP_KEEPALIVE'",
")",
"and",
"opts",
":",
"if",
"'tcp_keepalive'",
"in",
"opts",
":",
"zmq_socket",
".",
"setsockopt",
"(",
"zmq",
".",
"TCP_KEEPALIVE"... | Ensure that TCP keepalives are set as specified in "opts".
Warning: Failure to set TCP keepalives on the salt-master can result in
not detecting the loss of a minion when the connection is lost or when
it's host has been terminated without first closing the socket.
Salt's Presence System depends on thi... | [
"Ensure",
"that",
"TCP",
"keepalives",
"are",
"set",
"as",
"specified",
"in",
"opts",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/zeromq.py#L800-L829 | train |
saltstack/salt | salt/transport/zeromq.py | AsyncZeroMQReqChannel._uncrypted_transfer | def _uncrypted_transfer(self, load, tries=3, timeout=60):
'''
Send a load across the wire in cleartext
:param dict load: A load to send across the wire
:param int tries: The number of times to make before failure
:param int timeout: The number of seconds on a response before fai... | python | def _uncrypted_transfer(self, load, tries=3, timeout=60):
'''
Send a load across the wire in cleartext
:param dict load: A load to send across the wire
:param int tries: The number of times to make before failure
:param int timeout: The number of seconds on a response before fai... | [
"def",
"_uncrypted_transfer",
"(",
"self",
",",
"load",
",",
"tries",
"=",
"3",
",",
"timeout",
"=",
"60",
")",
":",
"ret",
"=",
"yield",
"self",
".",
"message_client",
".",
"send",
"(",
"self",
".",
"_package_load",
"(",
"load",
")",
",",
"timeout",
... | Send a load across the wire in cleartext
:param dict load: A load to send across the wire
:param int tries: The number of times to make before failure
:param int timeout: The number of seconds on a response before failing | [
"Send",
"a",
"load",
"across",
"the",
"wire",
"in",
"cleartext"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/zeromq.py#L353-L367 | train |
saltstack/salt | salt/transport/zeromq.py | AsyncZeroMQReqChannel.send | def send(self, load, tries=3, timeout=60, raw=False):
'''
Send a request, return a future which will complete when we send the message
'''
if self.crypt == 'clear':
ret = yield self._uncrypted_transfer(load, tries=tries, timeout=timeout)
else:
ret = yield ... | python | def send(self, load, tries=3, timeout=60, raw=False):
'''
Send a request, return a future which will complete when we send the message
'''
if self.crypt == 'clear':
ret = yield self._uncrypted_transfer(load, tries=tries, timeout=timeout)
else:
ret = yield ... | [
"def",
"send",
"(",
"self",
",",
"load",
",",
"tries",
"=",
"3",
",",
"timeout",
"=",
"60",
",",
"raw",
"=",
"False",
")",
":",
"if",
"self",
".",
"crypt",
"==",
"'clear'",
":",
"ret",
"=",
"yield",
"self",
".",
"_uncrypted_transfer",
"(",
"load",
... | Send a request, return a future which will complete when we send the message | [
"Send",
"a",
"request",
"return",
"a",
"future",
"which",
"will",
"complete",
"when",
"we",
"send",
"the",
"message"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/zeromq.py#L370-L378 | train |
saltstack/salt | salt/transport/zeromq.py | AsyncZeroMQPubChannel.master_pub | def master_pub(self):
'''
Return the master publish port
'''
return _get_master_uri(self.opts['master_ip'],
self.publish_port,
source_ip=self.opts.get('source_ip'),
source_port=self.opts.get('sou... | python | def master_pub(self):
'''
Return the master publish port
'''
return _get_master_uri(self.opts['master_ip'],
self.publish_port,
source_ip=self.opts.get('source_ip'),
source_port=self.opts.get('sou... | [
"def",
"master_pub",
"(",
"self",
")",
":",
"return",
"_get_master_uri",
"(",
"self",
".",
"opts",
"[",
"'master_ip'",
"]",
",",
"self",
".",
"publish_port",
",",
"source_ip",
"=",
"self",
".",
"opts",
".",
"get",
"(",
"'source_ip'",
")",
",",
"source_po... | Return the master publish port | [
"Return",
"the",
"master",
"publish",
"port"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/zeromq.py#L514-L521 | train |
saltstack/salt | salt/transport/zeromq.py | AsyncZeroMQPubChannel._decode_messages | def _decode_messages(self, messages):
'''
Take the zmq messages, decrypt/decode them into a payload
:param list messages: A list of messages to be decoded
'''
messages_len = len(messages)
# if it was one message, then its old style
if messages_len == 1:
... | python | def _decode_messages(self, messages):
'''
Take the zmq messages, decrypt/decode them into a payload
:param list messages: A list of messages to be decoded
'''
messages_len = len(messages)
# if it was one message, then its old style
if messages_len == 1:
... | [
"def",
"_decode_messages",
"(",
"self",
",",
"messages",
")",
":",
"messages_len",
"=",
"len",
"(",
"messages",
")",
"# if it was one message, then its old style",
"if",
"messages_len",
"==",
"1",
":",
"payload",
"=",
"self",
".",
"serial",
".",
"loads",
"(",
... | Take the zmq messages, decrypt/decode them into a payload
:param list messages: A list of messages to be decoded | [
"Take",
"the",
"zmq",
"messages",
"decrypt",
"/",
"decode",
"them",
"into",
"a",
"payload"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/zeromq.py#L524-L547 | train |
saltstack/salt | salt/transport/zeromq.py | AsyncZeroMQPubChannel.stream | def stream(self):
'''
Return the current zmqstream, creating one if necessary
'''
if not hasattr(self, '_stream'):
self._stream = zmq.eventloop.zmqstream.ZMQStream(self._socket, io_loop=self.io_loop)
return self._stream | python | def stream(self):
'''
Return the current zmqstream, creating one if necessary
'''
if not hasattr(self, '_stream'):
self._stream = zmq.eventloop.zmqstream.ZMQStream(self._socket, io_loop=self.io_loop)
return self._stream | [
"def",
"stream",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_stream'",
")",
":",
"self",
".",
"_stream",
"=",
"zmq",
".",
"eventloop",
".",
"zmqstream",
".",
"ZMQStream",
"(",
"self",
".",
"_socket",
",",
"io_loop",
"=",
"self... | Return the current zmqstream, creating one if necessary | [
"Return",
"the",
"current",
"zmqstream",
"creating",
"one",
"if",
"necessary"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/zeromq.py#L550-L556 | train |
saltstack/salt | salt/transport/zeromq.py | AsyncZeroMQPubChannel.on_recv | def on_recv(self, callback):
'''
Register a callback for received messages (that we didn't initiate)
:param func callback: A function which should be called when data is received
'''
if callback is None:
return self.stream.on_recv(None)
@tornado.gen.coroutin... | python | def on_recv(self, callback):
'''
Register a callback for received messages (that we didn't initiate)
:param func callback: A function which should be called when data is received
'''
if callback is None:
return self.stream.on_recv(None)
@tornado.gen.coroutin... | [
"def",
"on_recv",
"(",
"self",
",",
"callback",
")",
":",
"if",
"callback",
"is",
"None",
":",
"return",
"self",
".",
"stream",
".",
"on_recv",
"(",
"None",
")",
"@",
"tornado",
".",
"gen",
".",
"coroutine",
"def",
"wrap_callback",
"(",
"messages",
")"... | Register a callback for received messages (that we didn't initiate)
:param func callback: A function which should be called when data is received | [
"Register",
"a",
"callback",
"for",
"received",
"messages",
"(",
"that",
"we",
"didn",
"t",
"initiate",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/zeromq.py#L558-L572 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.