repo stringlengths 7 54 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 20 28.4k | docstring stringlengths 1 46.3k | docstring_tokens listlengths 1 1.66k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value | summary stringlengths 4 350 | obf_code stringlengths 7.85k 764k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/utils/dns.py | parse_resolv | def parse_resolv(src='/etc/resolv.conf'):
'''
Parse a resolver configuration file (traditionally /etc/resolv.conf)
'''
nameservers = []
ip4_nameservers = []
ip6_nameservers = []
search = []
sortlist = []
domain = ''
options = []
try:
with salt.utils.files.fopen(src)... | python | def parse_resolv(src='/etc/resolv.conf'):
'''
Parse a resolver configuration file (traditionally /etc/resolv.conf)
'''
nameservers = []
ip4_nameservers = []
ip6_nameservers = []
search = []
sortlist = []
domain = ''
options = []
try:
with salt.utils.files.fopen(src)... | [
"def",
"parse_resolv",
"(",
"src",
"=",
"'/etc/resolv.conf'",
")",
":",
"nameservers",
"=",
"[",
"]",
"ip4_nameservers",
"=",
"[",
"]",
"ip6_nameservers",
"=",
"[",
"]",
"search",
"=",
"[",
"]",
"sortlist",
"=",
"[",
"]",
"domain",
"=",
"''",
"options",
... | Parse a resolver configuration file (traditionally /etc/resolv.conf) | [
"Parse",
"a",
"resolver",
"configuration",
"file",
"(",
"traditionally",
"/",
"etc",
"/",
"resolv",
".",
"conf",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dns.py#L1128-L1224 | train | Parse a resolver configuration file into a list of components. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/returners/__init__.py | get_returner_options | def get_returner_options(virtualname=None,
ret=None,
attrs=None,
**kwargs):
'''
Get the returner options from salt.
:param str virtualname: The returner virtualname (as returned
by __virtual__()
:param ret: result of the... | python | def get_returner_options(virtualname=None,
ret=None,
attrs=None,
**kwargs):
'''
Get the returner options from salt.
:param str virtualname: The returner virtualname (as returned
by __virtual__()
:param ret: result of the... | [
"def",
"get_returner_options",
"(",
"virtualname",
"=",
"None",
",",
"ret",
"=",
"None",
",",
"attrs",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret_config",
"=",
"_fetch_ret_config",
"(",
"ret",
")",
"attrs",
"=",
"attrs",
"or",
"{",
"}",
"prof... | Get the returner options from salt.
:param str virtualname: The returner virtualname (as returned
by __virtual__()
:param ret: result of the module that ran. dict-like object
May contain a `ret_config` key pointing to a string
If a `ret_config` is specified, config options are read fro... | [
"Get",
"the",
"returner",
"options",
"from",
"salt",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/__init__.py#L16-L107 | train | Get the returner options from salt. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/returners/__init__.py | _fetch_option | def _fetch_option(cfg, ret_config, virtualname, attr_name):
"""
Fetch a given option value from the config.
@see :func:`get_returner_options`
"""
# c_cfg is a dictionary returned from config.option for
# any options configured for this returner.
if isinstance(cfg, dict):
c_cfg = cfg... | python | def _fetch_option(cfg, ret_config, virtualname, attr_name):
"""
Fetch a given option value from the config.
@see :func:`get_returner_options`
"""
# c_cfg is a dictionary returned from config.option for
# any options configured for this returner.
if isinstance(cfg, dict):
c_cfg = cfg... | [
"def",
"_fetch_option",
"(",
"cfg",
",",
"ret_config",
",",
"virtualname",
",",
"attr_name",
")",
":",
"# c_cfg is a dictionary returned from config.option for",
"# any options configured for this returner.",
"if",
"isinstance",
"(",
"cfg",
",",
"dict",
")",
":",
"c_cfg",... | Fetch a given option value from the config.
@see :func:`get_returner_options` | [
"Fetch",
"a",
"given",
"option",
"value",
"from",
"the",
"config",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/__init__.py#L123-L166 | train | Fetch a given option value from the config. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/returners/__init__.py | _options_browser | def _options_browser(cfg, ret_config, defaults, virtualname, options):
"""
Iterator generating all duples ```option name -> value```
@see :func:`get_returner_options`
"""
for option in options:
# default place for the option in the config
value = _fetch_option(cfg, ret_config, vir... | python | def _options_browser(cfg, ret_config, defaults, virtualname, options):
"""
Iterator generating all duples ```option name -> value```
@see :func:`get_returner_options`
"""
for option in options:
# default place for the option in the config
value = _fetch_option(cfg, ret_config, vir... | [
"def",
"_options_browser",
"(",
"cfg",
",",
"ret_config",
",",
"defaults",
",",
"virtualname",
",",
"options",
")",
":",
"for",
"option",
"in",
"options",
":",
"# default place for the option in the config",
"value",
"=",
"_fetch_option",
"(",
"cfg",
",",
"ret_con... | Iterator generating all duples ```option name -> value```
@see :func:`get_returner_options` | [
"Iterator",
"generating",
"all",
"duples",
"option",
"name",
"-",
">",
"value"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/__init__.py#L169-L193 | train | Generator for all options in the browser | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/returners/__init__.py | _fetch_profile_opts | def _fetch_profile_opts(
cfg, virtualname,
__salt__,
_options,
profile_attr,
profile_attrs
):
"""
Fetches profile specific options if applicable
@see :func:`get_returner_options`
:return: a options dict
"""
if (not profile_attr) or (profile_attr not... | python | def _fetch_profile_opts(
cfg, virtualname,
__salt__,
_options,
profile_attr,
profile_attrs
):
"""
Fetches profile specific options if applicable
@see :func:`get_returner_options`
:return: a options dict
"""
if (not profile_attr) or (profile_attr not... | [
"def",
"_fetch_profile_opts",
"(",
"cfg",
",",
"virtualname",
",",
"__salt__",
",",
"_options",
",",
"profile_attr",
",",
"profile_attrs",
")",
":",
"if",
"(",
"not",
"profile_attr",
")",
"or",
"(",
"profile_attr",
"not",
"in",
"_options",
")",
":",
"return"... | Fetches profile specific options if applicable
@see :func:`get_returner_options`
:return: a options dict | [
"Fetches",
"profile",
"specific",
"options",
"if",
"applicable"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/__init__.py#L196-L235 | train | Fetch the specific options for a specific profile | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/states/rabbitmq_plugin.py | enabled | def enabled(name, runas=None):
'''
Ensure the RabbitMQ plugin is enabled.
name
The name of the plugin
runas
The user to run the rabbitmq-plugin command as
'''
ret = {'name': name, 'result': True, 'comment': '', 'changes': {}}
try:
plugin_enabled = __salt__['rabbitm... | python | def enabled(name, runas=None):
'''
Ensure the RabbitMQ plugin is enabled.
name
The name of the plugin
runas
The user to run the rabbitmq-plugin command as
'''
ret = {'name': name, 'result': True, 'comment': '', 'changes': {}}
try:
plugin_enabled = __salt__['rabbitm... | [
"def",
"enabled",
"(",
"name",
",",
"runas",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
"}",
"try",
":",
"plugin_enabled",
"=",
"__salt_... | Ensure the RabbitMQ plugin is enabled.
name
The name of the plugin
runas
The user to run the rabbitmq-plugin command as | [
"Ensure",
"the",
"RabbitMQ",
"plugin",
"is",
"enabled",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/rabbitmq_plugin.py#L35-L73 | train | Ensure the RabbitMQ plugin is enabled. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/states/git.py | _revs_equal | def _revs_equal(rev1, rev2, rev_type):
'''
Shorthand helper function for comparing SHA1s. If rev_type == 'sha1' then
the comparison will be done using str.startwith() to allow short SHA1s to
compare successfully.
NOTE: This means that rev2 must be the short rev.
'''
if (rev1 is None and rev... | python | def _revs_equal(rev1, rev2, rev_type):
'''
Shorthand helper function for comparing SHA1s. If rev_type == 'sha1' then
the comparison will be done using str.startwith() to allow short SHA1s to
compare successfully.
NOTE: This means that rev2 must be the short rev.
'''
if (rev1 is None and rev... | [
"def",
"_revs_equal",
"(",
"rev1",
",",
"rev2",
",",
"rev_type",
")",
":",
"if",
"(",
"rev1",
"is",
"None",
"and",
"rev2",
"is",
"not",
"None",
")",
"or",
"(",
"rev2",
"is",
"None",
"and",
"rev1",
"is",
"not",
"None",
")",
":",
"return",
"False",
... | Shorthand helper function for comparing SHA1s. If rev_type == 'sha1' then
the comparison will be done using str.startwith() to allow short SHA1s to
compare successfully.
NOTE: This means that rev2 must be the short rev. | [
"Shorthand",
"helper",
"function",
"for",
"comparing",
"SHA1s",
".",
"If",
"rev_type",
"==",
"sha1",
"then",
"the",
"comparison",
"will",
"be",
"done",
"using",
"str",
".",
"startwith",
"()",
"to",
"allow",
"short",
"SHA1s",
"to",
"compare",
"successfully",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/git.py#L47-L63 | train | Returns True if rev1 and rev2 are equal. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/states/git.py | _get_branch_opts | def _get_branch_opts(branch, local_branch, all_local_branches,
desired_upstream, git_ver=None):
'''
DRY helper to build list of opts for git.branch, for the purposes of
setting upstream tracking branch
'''
if branch is not None and branch not in all_local_branches:
# We ... | python | def _get_branch_opts(branch, local_branch, all_local_branches,
desired_upstream, git_ver=None):
'''
DRY helper to build list of opts for git.branch, for the purposes of
setting upstream tracking branch
'''
if branch is not None and branch not in all_local_branches:
# We ... | [
"def",
"_get_branch_opts",
"(",
"branch",
",",
"local_branch",
",",
"all_local_branches",
",",
"desired_upstream",
",",
"git_ver",
"=",
"None",
")",
":",
"if",
"branch",
"is",
"not",
"None",
"and",
"branch",
"not",
"in",
"all_local_branches",
":",
"# We won't be... | DRY helper to build list of opts for git.branch, for the purposes of
setting upstream tracking branch | [
"DRY",
"helper",
"to",
"build",
"list",
"of",
"opts",
"for",
"git",
".",
"branch",
"for",
"the",
"purposes",
"of",
"setting",
"upstream",
"tracking",
"branch"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/git.py#L87-L110 | train | Helper function to build list of opts for git. branch | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/states/git.py | _get_local_rev_and_branch | def _get_local_rev_and_branch(target, user, password, output_encoding=None):
'''
Return the local revision for before/after comparisons
'''
log.info('Checking local revision for %s', target)
try:
local_rev = __salt__['git.revision'](
target,
user=user,
pas... | python | def _get_local_rev_and_branch(target, user, password, output_encoding=None):
'''
Return the local revision for before/after comparisons
'''
log.info('Checking local revision for %s', target)
try:
local_rev = __salt__['git.revision'](
target,
user=user,
pas... | [
"def",
"_get_local_rev_and_branch",
"(",
"target",
",",
"user",
",",
"password",
",",
"output_encoding",
"=",
"None",
")",
":",
"log",
".",
"info",
"(",
"'Checking local revision for %s'",
",",
"target",
")",
"try",
":",
"local_rev",
"=",
"__salt__",
"[",
"'gi... | Return the local revision for before/after comparisons | [
"Return",
"the",
"local",
"revision",
"for",
"before",
"/",
"after",
"comparisons"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/git.py#L113-L141 | train | Return the local revision and branch for before and after comparisons | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/states/git.py | present | def present(name,
force=False,
bare=True,
template=None,
separate_git_dir=None,
shared=None,
user=None,
password=None,
output_encoding=None):
'''
Ensure that a repository exists in the given directory
.. warning... | python | def present(name,
force=False,
bare=True,
template=None,
separate_git_dir=None,
shared=None,
user=None,
password=None,
output_encoding=None):
'''
Ensure that a repository exists in the given directory
.. warning... | [
"def",
"present",
"(",
"name",
",",
"force",
"=",
"False",
",",
"bare",
"=",
"True",
",",
"template",
"=",
"None",
",",
"separate_git_dir",
"=",
"None",
",",
"shared",
"=",
"None",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"output_... | Ensure that a repository exists in the given directory
.. warning::
If the minion has Git 2.5 or later installed, ``name`` points to a
worktree_, and ``force`` is set to ``True``, then the worktree will be
deleted. This has been corrected in Salt 2015.8.0.
name
Path to the dire... | [
"Ensure",
"that",
"a",
"repository",
"exists",
"in",
"the",
"given",
"directory"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/git.py#L2063-L2235 | train | Ensure that a git repository exists in the given directory and is present in the given directory. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/states/git.py | detached | def detached(name,
rev,
target=None,
remote='origin',
user=None,
password=None,
force_clone=False,
force_checkout=False,
fetch_remote=True,
hard_reset=False,
submodules=False,
identity=None,
... | python | def detached(name,
rev,
target=None,
remote='origin',
user=None,
password=None,
force_clone=False,
force_checkout=False,
fetch_remote=True,
hard_reset=False,
submodules=False,
identity=None,
... | [
"def",
"detached",
"(",
"name",
",",
"rev",
",",
"target",
"=",
"None",
",",
"remote",
"=",
"'origin'",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"force_clone",
"=",
"False",
",",
"force_checkout",
"=",
"False",
",",
"fetch_remote",
... | .. versionadded:: 2016.3.0
Make sure a repository is cloned to the given target directory and is
a detached HEAD checkout of the commit ID resolved from ``rev``.
name
Address of the remote repository.
rev
The branch, tag, or commit ID to checkout after clone.
If a branch or ta... | [
"..",
"versionadded",
"::",
"2016",
".",
"3",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/git.py#L2238-L2761 | train | Return a new git repository that is detached from the given revision ID. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/states/git.py | cloned | def cloned(name,
target=None,
branch=None,
user=None,
password=None,
identity=None,
https_user=None,
https_pass=None,
output_encoding=None):
'''
.. versionadded:: 2018.3.3,2019.2.0
Ensure that a repository has been clon... | python | def cloned(name,
target=None,
branch=None,
user=None,
password=None,
identity=None,
https_user=None,
https_pass=None,
output_encoding=None):
'''
.. versionadded:: 2018.3.3,2019.2.0
Ensure that a repository has been clon... | [
"def",
"cloned",
"(",
"name",
",",
"target",
"=",
"None",
",",
"branch",
"=",
"None",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"identity",
"=",
"None",
",",
"https_user",
"=",
"None",
",",
"https_pass",
"=",
"None",
",",
"output_e... | .. versionadded:: 2018.3.3,2019.2.0
Ensure that a repository has been cloned to the specified target directory.
If not, clone that repository. No fetches will be performed once cloned.
name
Address of the remote repository
target
Name of the target directory where repository should be... | [
"..",
"versionadded",
"::",
"2018",
".",
"3",
".",
"3",
"2019",
".",
"2",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/git.py#L2764-L2957 | train | Return a new version of the specified branch in the specified target directory. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/states/git.py | config_unset | def config_unset(name,
value_regex=None,
repo=None,
user=None,
password=None,
output_encoding=None,
**kwargs):
r'''
.. versionadded:: 2015.8.0
Ensure that the named config key is not present
name
... | python | def config_unset(name,
value_regex=None,
repo=None,
user=None,
password=None,
output_encoding=None,
**kwargs):
r'''
.. versionadded:: 2015.8.0
Ensure that the named config key is not present
name
... | [
"def",
"config_unset",
"(",
"name",
",",
"value_regex",
"=",
"None",
",",
"repo",
"=",
"None",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"output_encoding",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
... | r'''
.. versionadded:: 2015.8.0
Ensure that the named config key is not present
name
The name of the configuration key to unset. This value can be a regex,
but the regex must match the entire key name. For example, ``foo\.``
would not match all keys in the ``foo`` section, it would... | [
"r",
"..",
"versionadded",
"::",
"2015",
".",
"8",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/git.py#L2960-L3217 | train | r Removes the value of a named config key from a git repository. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/states/git.py | config_set | def config_set(name,
value=None,
multivar=None,
repo=None,
user=None,
password=None,
output_encoding=None,
**kwargs):
'''
.. versionadded:: 2014.7.0
.. versionchanged:: 2015.8.0
Renamed from ``gi... | python | def config_set(name,
value=None,
multivar=None,
repo=None,
user=None,
password=None,
output_encoding=None,
**kwargs):
'''
.. versionadded:: 2014.7.0
.. versionchanged:: 2015.8.0
Renamed from ``gi... | [
"def",
"config_set",
"(",
"name",
",",
"value",
"=",
"None",
",",
"multivar",
"=",
"None",
",",
"repo",
"=",
"None",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"output_encoding",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"re... | .. versionadded:: 2014.7.0
.. versionchanged:: 2015.8.0
Renamed from ``git.config`` to ``git.config_set``. For earlier
versions, use ``git.config``.
Ensure that a config value is set to the desired value(s)
name
Name of the git config value to set
value
Set a single va... | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0",
"..",
"versionchanged",
"::",
"2015",
".",
"8",
".",
"0",
"Renamed",
"from",
"git",
".",
"config",
"to",
"git",
".",
"config_set",
".",
"For",
"earlier",
"versions",
"use",
"git",
".",
"config",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/git.py#L3220-L3438 | train | Set the value of a git config item. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/states/git.py | mod_run_check | def mod_run_check(cmd_kwargs, onlyif, unless):
'''
Execute the onlyif and unless logic. Return a result dict if:
* onlyif failed (onlyif != 0)
* unless succeeded (unless == 0)
Otherwise, returns ``True``
'''
cmd_kwargs = copy.deepcopy(cmd_kwargs)
cmd_kwargs.update({
'use_vt': F... | python | def mod_run_check(cmd_kwargs, onlyif, unless):
'''
Execute the onlyif and unless logic. Return a result dict if:
* onlyif failed (onlyif != 0)
* unless succeeded (unless == 0)
Otherwise, returns ``True``
'''
cmd_kwargs = copy.deepcopy(cmd_kwargs)
cmd_kwargs.update({
'use_vt': F... | [
"def",
"mod_run_check",
"(",
"cmd_kwargs",
",",
"onlyif",
",",
"unless",
")",
":",
"cmd_kwargs",
"=",
"copy",
".",
"deepcopy",
"(",
"cmd_kwargs",
")",
"cmd_kwargs",
".",
"update",
"(",
"{",
"'use_vt'",
":",
"False",
",",
"'bg'",
":",
"False",
",",
"'igno... | Execute the onlyif and unless logic. Return a result dict if:
* onlyif failed (onlyif != 0)
* unless succeeded (unless == 0)
Otherwise, returns ``True`` | [
"Execute",
"the",
"onlyif",
"and",
"unless",
"logic",
".",
"Return",
"a",
"result",
"dict",
"if",
":"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/git.py#L3441-L3512 | train | Execute the onlyif and unless logic. Return a result dict if the command was successful or False if the command failed. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/modules/pushbullet.py | push_note | def push_note(device=None, title=None, body=None):
'''
Pushing a text note.
:param device: Pushbullet target device
:param title: Note title
:param body: Note body
:return: Boolean if message was sent successfully.
CLI Example:
.. code-block:: bash
salt "... | python | def push_note(device=None, title=None, body=None):
'''
Pushing a text note.
:param device: Pushbullet target device
:param title: Note title
:param body: Note body
:return: Boolean if message was sent successfully.
CLI Example:
.. code-block:: bash
salt "... | [
"def",
"push_note",
"(",
"device",
"=",
"None",
",",
"title",
"=",
"None",
",",
"body",
"=",
"None",
")",
":",
"spb",
"=",
"_SaltPushbullet",
"(",
"device",
")",
"res",
"=",
"spb",
".",
"push_note",
"(",
"title",
",",
"body",
")",
"return",
"res"
] | Pushing a text note.
:param device: Pushbullet target device
:param title: Note title
:param body: Note body
:return: Boolean if message was sent successfully.
CLI Example:
.. code-block:: bash
salt "*" pushbullet.push_note device="Chrome" title="Example title" b... | [
"Pushing",
"a",
"text",
"note",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pushbullet.py#L65-L84 | train | Push a text note to a pushbullet. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/modules/travisci.py | verify_webhook | def verify_webhook(signature, body):
'''
Verify the webhook signature from travisci
signature
The signature header from the webhook header
body
The full payload body from the webhook post
.. note:: The body needs to be the urlencoded version of the body.
CLI Example:
.. ... | python | def verify_webhook(signature, body):
'''
Verify the webhook signature from travisci
signature
The signature header from the webhook header
body
The full payload body from the webhook post
.. note:: The body needs to be the urlencoded version of the body.
CLI Example:
.. ... | [
"def",
"verify_webhook",
"(",
"signature",
",",
"body",
")",
":",
"# get public key setup",
"public_key",
"=",
"__utils__",
"[",
"'http.query'",
"]",
"(",
"'https://api.travis-ci.org/config'",
")",
"[",
"'config'",
"]",
"[",
"'notifications'",
"]",
"[",
"'webhook'",... | Verify the webhook signature from travisci
signature
The signature header from the webhook header
body
The full payload body from the webhook post
.. note:: The body needs to be the urlencoded version of the body.
CLI Example:
.. code-block:: bash
salt '*' travisci.veri... | [
"Verify",
"the",
"webhook",
"signature",
"from",
"travisci"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/travisci.py#L42-L77 | train | Verify the webhook signature from travisci
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/states/network.py | managed | def managed(name, type, enabled=True, **kwargs):
'''
Ensure that the named interface is configured properly.
name
The name of the interface to manage
type
Type of interface and configuration.
enabled
Designates the state of this interface.
kwargs
The IP parame... | python | def managed(name, type, enabled=True, **kwargs):
'''
Ensure that the named interface is configured properly.
name
The name of the interface to manage
type
Type of interface and configuration.
enabled
Designates the state of this interface.
kwargs
The IP parame... | [
"def",
"managed",
"(",
"name",
",",
"type",
",",
"enabled",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"# For this function we are purposefully overwriting a bif",
"# to enhance the user experience. This does not look like",
"# it will cause a problem. Just giving a heads up... | Ensure that the named interface is configured properly.
name
The name of the interface to manage
type
Type of interface and configuration.
enabled
Designates the state of this interface.
kwargs
The IP parameters for this interface. | [
"Ensure",
"that",
"the",
"named",
"interface",
"is",
"configured",
"properly",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/network.py#L359-L551 | train | Manage the named interface. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/states/network.py | routes | def routes(name, **kwargs):
'''
Manage network interface static routes.
name
Interface name to apply the route to.
kwargs
Named routes
'''
ret = {
'name': name,
'changes': {},
'result': True,
'comment': 'Interface {0} routes are up to date.'.form... | python | def routes(name, **kwargs):
'''
Manage network interface static routes.
name
Interface name to apply the route to.
kwargs
Named routes
'''
ret = {
'name': name,
'changes': {},
'result': True,
'comment': 'Interface {0} routes are up to date.'.form... | [
"def",
"routes",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"'Interface {0} routes are up to date.'",
".",
"format",
"(",
... | Manage network interface static routes.
name
Interface name to apply the route to.
kwargs
Named routes | [
"Manage",
"network",
"interface",
"static",
"routes",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/network.py#L554-L614 | train | Manage network interface static routes. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/states/network.py | system | def system(name, **kwargs):
'''
Ensure that global network settings are configured properly.
name
Custom name to represent this configuration change.
kwargs
The global parameters for the system.
'''
ret = {
'name': name,
'changes': {},
'result': True,
... | python | def system(name, **kwargs):
'''
Ensure that global network settings are configured properly.
name
Custom name to represent this configuration change.
kwargs
The global parameters for the system.
'''
ret = {
'name': name,
'changes': {},
'result': True,
... | [
"def",
"system",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"'Global network settings are up to date.'",
",",
"}",
"apply_n... | Ensure that global network settings are configured properly.
name
Custom name to represent this configuration change.
kwargs
The global parameters for the system. | [
"Ensure",
"that",
"global",
"network",
"settings",
"are",
"configured",
"properly",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/network.py#L617-L678 | train | Ensure that global network settings are set correctly. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/states/zabbix_mediatype.py | present | def present(name, mediatype, **kwargs):
'''
Creates new mediatype.
NOTE: This function accepts all standard mediatype properties: keyword argument names differ depending on your
zabbix version, see:
https://www.zabbix.com/documentation/3.0/manual/api/reference/host/object#host_inventory
:param ... | python | def present(name, mediatype, **kwargs):
'''
Creates new mediatype.
NOTE: This function accepts all standard mediatype properties: keyword argument names differ depending on your
zabbix version, see:
https://www.zabbix.com/documentation/3.0/manual/api/reference/host/object#host_inventory
:param ... | [
"def",
"present",
"(",
"name",
",",
"mediatype",
",",
"*",
"*",
"kwargs",
")",
":",
"connection_args",
"=",
"{",
"}",
"if",
"'_connection_user'",
"in",
"kwargs",
":",
"connection_args",
"[",
"'_connection_user'",
"]",
"=",
"kwargs",
"[",
"'_connection_user'",
... | Creates new mediatype.
NOTE: This function accepts all standard mediatype properties: keyword argument names differ depending on your
zabbix version, see:
https://www.zabbix.com/documentation/3.0/manual/api/reference/host/object#host_inventory
:param name: name of the mediatype
:param _connection_u... | [
"Creates",
"new",
"mediatype",
".",
"NOTE",
":",
"This",
"function",
"accepts",
"all",
"standard",
"mediatype",
"properties",
":",
"keyword",
"argument",
"names",
"differ",
"depending",
"on",
"your",
"zabbix",
"version",
"see",
":",
"https",
":",
"//",
"www",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_mediatype.py#L23-L319 | train | Creates a new mediatype. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/states/zabbix_mediatype.py | absent | def absent(name, **kwargs):
'''
Ensures that the mediatype does not exist, eventually deletes the mediatype.
:param name: name of the mediatype
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_password: Optional - zabbix ... | python | def absent(name, **kwargs):
'''
Ensures that the mediatype does not exist, eventually deletes the mediatype.
:param name: name of the mediatype
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_password: Optional - zabbix ... | [
"def",
"absent",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"connection_args",
"=",
"{",
"}",
"if",
"'_connection_user'",
"in",
"kwargs",
":",
"connection_args",
"[",
"'_connection_user'",
"]",
"=",
"kwargs",
"[",
"'_connection_user'",
"]",
"if",
"'_con... | Ensures that the mediatype does not exist, eventually deletes the mediatype.
:param name: name of the mediatype
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_password: Optional - zabbix password (can also be set in opts or pil... | [
"Ensures",
"that",
"the",
"mediatype",
"does",
"not",
"exist",
"eventually",
"deletes",
"the",
"mediatype",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_mediatype.py#L322-L386 | train | Ensures that the mediatype with the given name does not exist eventually deletes the mediatype. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | sanitize_host | def sanitize_host(host):
'''
Sanitize host string.
https://tools.ietf.org/html/rfc1123#section-2.1
'''
RFC952_characters = ascii_letters + digits + ".-"
return "".join([c for c in host[0:255] if c in RFC952_characters]) | python | def sanitize_host(host):
'''
Sanitize host string.
https://tools.ietf.org/html/rfc1123#section-2.1
'''
RFC952_characters = ascii_letters + digits + ".-"
return "".join([c for c in host[0:255] if c in RFC952_characters]) | [
"def",
"sanitize_host",
"(",
"host",
")",
":",
"RFC952_characters",
"=",
"ascii_letters",
"+",
"digits",
"+",
"\".-\"",
"return",
"\"\"",
".",
"join",
"(",
"[",
"c",
"for",
"c",
"in",
"host",
"[",
"0",
":",
"255",
"]",
"if",
"c",
"in",
"RFC952_characte... | Sanitize host string.
https://tools.ietf.org/html/rfc1123#section-2.1 | [
"Sanitize",
"host",
"string",
".",
"https",
":",
"//",
"tools",
".",
"ietf",
".",
"org",
"/",
"html",
"/",
"rfc1123#section",
"-",
"2",
".",
"1"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L58-L64 | train | Sanitize a host string. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | isportopen | def isportopen(host, port):
'''
Return status of a port
'''
if not 1 <= int(port) <= 65535:
return False
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
out = sock.connect_ex((sanitize_host(host), int(port)))
return out | python | def isportopen(host, port):
'''
Return status of a port
'''
if not 1 <= int(port) <= 65535:
return False
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
out = sock.connect_ex((sanitize_host(host), int(port)))
return out | [
"def",
"isportopen",
"(",
"host",
",",
"port",
")",
":",
"if",
"not",
"1",
"<=",
"int",
"(",
"port",
")",
"<=",
"65535",
":",
"return",
"False",
"sock",
"=",
"socket",
".",
"socket",
"(",
"socket",
".",
"AF_INET",
",",
"socket",
".",
"SOCK_STREAM",
... | Return status of a port | [
"Return",
"status",
"of",
"a",
"port"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L67-L78 | train | Return status of a port. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | host_to_ips | def host_to_ips(host):
'''
Returns a list of IP addresses of a given hostname or None if not found.
'''
ips = []
try:
for family, socktype, proto, canonname, sockaddr in socket.getaddrinfo(
host, 0, socket.AF_UNSPEC, socket.SOCK_STREAM):
if family == socket.AF_INE... | python | def host_to_ips(host):
'''
Returns a list of IP addresses of a given hostname or None if not found.
'''
ips = []
try:
for family, socktype, proto, canonname, sockaddr in socket.getaddrinfo(
host, 0, socket.AF_UNSPEC, socket.SOCK_STREAM):
if family == socket.AF_INE... | [
"def",
"host_to_ips",
"(",
"host",
")",
":",
"ips",
"=",
"[",
"]",
"try",
":",
"for",
"family",
",",
"socktype",
",",
"proto",
",",
"canonname",
",",
"sockaddr",
"in",
"socket",
".",
"getaddrinfo",
"(",
"host",
",",
"0",
",",
"socket",
".",
"AF_UNSPE... | Returns a list of IP addresses of a given hostname or None if not found. | [
"Returns",
"a",
"list",
"of",
"IP",
"addresses",
"of",
"a",
"given",
"hostname",
"or",
"None",
"if",
"not",
"found",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L81-L98 | train | Returns a list of IP addresses of a given hostname or None if not found. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | _generate_minion_id | def _generate_minion_id():
'''
Get list of possible host names and convention names.
:return:
'''
# There are three types of hostnames:
# 1. Network names. How host is accessed from the network.
# 2. Host aliases. They might be not available in all the network or only locally (/etc/hosts)
... | python | def _generate_minion_id():
'''
Get list of possible host names and convention names.
:return:
'''
# There are three types of hostnames:
# 1. Network names. How host is accessed from the network.
# 2. Host aliases. They might be not available in all the network or only locally (/etc/hosts)
... | [
"def",
"_generate_minion_id",
"(",
")",
":",
"# There are three types of hostnames:",
"# 1. Network names. How host is accessed from the network.",
"# 2. Host aliases. They might be not available in all the network or only locally (/etc/hosts)",
"# 3. Convention names, an internal nodename.",
"cla... | Get list of possible host names and convention names.
:return: | [
"Get",
"list",
"of",
"possible",
"host",
"names",
"and",
"convention",
"names",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L101-L170 | train | Generate a new minion id for the hosts and convention names. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | generate_minion_id | def generate_minion_id():
'''
Return only first element of the hostname from all possible list.
:return:
'''
try:
ret = salt.utils.stringutils.to_unicode(_generate_minion_id().first())
except TypeError:
ret = None
return ret or 'localhost' | python | def generate_minion_id():
'''
Return only first element of the hostname from all possible list.
:return:
'''
try:
ret = salt.utils.stringutils.to_unicode(_generate_minion_id().first())
except TypeError:
ret = None
return ret or 'localhost' | [
"def",
"generate_minion_id",
"(",
")",
":",
"try",
":",
"ret",
"=",
"salt",
".",
"utils",
".",
"stringutils",
".",
"to_unicode",
"(",
"_generate_minion_id",
"(",
")",
".",
"first",
"(",
")",
")",
"except",
"TypeError",
":",
"ret",
"=",
"None",
"return",
... | Return only first element of the hostname from all possible list.
:return: | [
"Return",
"only",
"first",
"element",
"of",
"the",
"hostname",
"from",
"all",
"possible",
"list",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L173-L183 | train | Return only first element of the hostname from all possible list. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | get_socket | def get_socket(addr, type=socket.SOCK_STREAM, proto=0):
'''
Return a socket object for the addr
IP-version agnostic
'''
version = ipaddress.ip_address(addr).version
if version == 4:
family = socket.AF_INET
elif version == 6:
family = socket.AF_INET6
return socket.socket(... | python | def get_socket(addr, type=socket.SOCK_STREAM, proto=0):
'''
Return a socket object for the addr
IP-version agnostic
'''
version = ipaddress.ip_address(addr).version
if version == 4:
family = socket.AF_INET
elif version == 6:
family = socket.AF_INET6
return socket.socket(... | [
"def",
"get_socket",
"(",
"addr",
",",
"type",
"=",
"socket",
".",
"SOCK_STREAM",
",",
"proto",
"=",
"0",
")",
":",
"version",
"=",
"ipaddress",
".",
"ip_address",
"(",
"addr",
")",
".",
"version",
"if",
"version",
"==",
"4",
":",
"family",
"=",
"soc... | Return a socket object for the addr
IP-version agnostic | [
"Return",
"a",
"socket",
"object",
"for",
"the",
"addr",
"IP",
"-",
"version",
"agnostic"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L186-L197 | train | Returns a socket object for the addr | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | get_fqhostname | def get_fqhostname():
'''
Returns the fully qualified hostname
'''
# try getaddrinfo()
fqdn = None
try:
addrinfo = socket.getaddrinfo(
socket.gethostname(), 0, socket.AF_UNSPEC, socket.SOCK_STREAM,
socket.SOL_TCP, socket.AI_CANONNAME
)
for info in ... | python | def get_fqhostname():
'''
Returns the fully qualified hostname
'''
# try getaddrinfo()
fqdn = None
try:
addrinfo = socket.getaddrinfo(
socket.gethostname(), 0, socket.AF_UNSPEC, socket.SOCK_STREAM,
socket.SOL_TCP, socket.AI_CANONNAME
)
for info in ... | [
"def",
"get_fqhostname",
"(",
")",
":",
"# try getaddrinfo()",
"fqdn",
"=",
"None",
"try",
":",
"addrinfo",
"=",
"socket",
".",
"getaddrinfo",
"(",
"socket",
".",
"gethostname",
"(",
")",
",",
"0",
",",
"socket",
".",
"AF_UNSPEC",
",",
"socket",
".",
"SO... | Returns the fully qualified hostname | [
"Returns",
"the",
"fully",
"qualified",
"hostname"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L200-L224 | train | Returns the fully qualified hostname of the current node. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | ip_to_host | def ip_to_host(ip):
'''
Returns the hostname of a given IP
'''
try:
hostname, aliaslist, ipaddrlist = socket.gethostbyaddr(ip)
except Exception as exc:
log.debug('salt.utils.network.ip_to_host(%r) failed: %s', ip, exc)
hostname = None
return hostname | python | def ip_to_host(ip):
'''
Returns the hostname of a given IP
'''
try:
hostname, aliaslist, ipaddrlist = socket.gethostbyaddr(ip)
except Exception as exc:
log.debug('salt.utils.network.ip_to_host(%r) failed: %s', ip, exc)
hostname = None
return hostname | [
"def",
"ip_to_host",
"(",
"ip",
")",
":",
"try",
":",
"hostname",
",",
"aliaslist",
",",
"ipaddrlist",
"=",
"socket",
".",
"gethostbyaddr",
"(",
"ip",
")",
"except",
"Exception",
"as",
"exc",
":",
"log",
".",
"debug",
"(",
"'salt.utils.network.ip_to_host(%r)... | Returns the hostname of a given IP | [
"Returns",
"the",
"hostname",
"of",
"a",
"given",
"IP"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L227-L236 | train | Returns the hostname of a given IP
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | is_reachable_host | def is_reachable_host(entity_name):
'''
Returns a bool telling if the entity name is a reachable host (IPv4/IPv6/FQDN/etc).
:param hostname:
:return:
'''
try:
assert type(socket.getaddrinfo(entity_name, 0, 0, 0, 0)) == list
ret = True
except socket.gaierror:
ret = Fal... | python | def is_reachable_host(entity_name):
'''
Returns a bool telling if the entity name is a reachable host (IPv4/IPv6/FQDN/etc).
:param hostname:
:return:
'''
try:
assert type(socket.getaddrinfo(entity_name, 0, 0, 0, 0)) == list
ret = True
except socket.gaierror:
ret = Fal... | [
"def",
"is_reachable_host",
"(",
"entity_name",
")",
":",
"try",
":",
"assert",
"type",
"(",
"socket",
".",
"getaddrinfo",
"(",
"entity_name",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
")",
")",
"==",
"list",
"ret",
"=",
"True",
"except",
"socket",
"."... | Returns a bool telling if the entity name is a reachable host (IPv4/IPv6/FQDN/etc).
:param hostname:
:return: | [
"Returns",
"a",
"bool",
"telling",
"if",
"the",
"entity",
"name",
"is",
"a",
"reachable",
"host",
"(",
"IPv4",
"/",
"IPv6",
"/",
"FQDN",
"/",
"etc",
")",
".",
":",
"param",
"hostname",
":",
":",
"return",
":"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L241-L253 | train | Returns a bool telling if the entity name is a reachable host. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | is_ip_filter | def is_ip_filter(ip, options=None):
'''
Returns a bool telling if the passed IP is a valid IPv4 or IPv6 address.
'''
return is_ipv4_filter(ip, options=options) or is_ipv6_filter(ip, options=options) | python | def is_ip_filter(ip, options=None):
'''
Returns a bool telling if the passed IP is a valid IPv4 or IPv6 address.
'''
return is_ipv4_filter(ip, options=options) or is_ipv6_filter(ip, options=options) | [
"def",
"is_ip_filter",
"(",
"ip",
",",
"options",
"=",
"None",
")",
":",
"return",
"is_ipv4_filter",
"(",
"ip",
",",
"options",
"=",
"options",
")",
"or",
"is_ipv6_filter",
"(",
"ip",
",",
"options",
"=",
"options",
")"
] | Returns a bool telling if the passed IP is a valid IPv4 or IPv6 address. | [
"Returns",
"a",
"bool",
"telling",
"if",
"the",
"passed",
"IP",
"is",
"a",
"valid",
"IPv4",
"or",
"IPv6",
"address",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L311-L315 | train | Returns a bool telling if the passed IP is a valid IPv4 or IPv6 address. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | is_ipv4_filter | def is_ipv4_filter(ip, options=None):
'''
Returns a bool telling if the value passed to it was a valid IPv4 address.
ip
The IP address.
net: False
Consider IP addresses followed by netmask.
options
CSV of options regarding the nature of the IP address. E.g.: loopback, mult... | python | def is_ipv4_filter(ip, options=None):
'''
Returns a bool telling if the value passed to it was a valid IPv4 address.
ip
The IP address.
net: False
Consider IP addresses followed by netmask.
options
CSV of options regarding the nature of the IP address. E.g.: loopback, mult... | [
"def",
"is_ipv4_filter",
"(",
"ip",
",",
"options",
"=",
"None",
")",
":",
"_is_ipv4",
"=",
"_is_ipv",
"(",
"ip",
",",
"4",
",",
"options",
"=",
"options",
")",
"return",
"isinstance",
"(",
"_is_ipv4",
",",
"six",
".",
"string_types",
")"
] | Returns a bool telling if the value passed to it was a valid IPv4 address.
ip
The IP address.
net: False
Consider IP addresses followed by netmask.
options
CSV of options regarding the nature of the IP address. E.g.: loopback, multicast, private etc. | [
"Returns",
"a",
"bool",
"telling",
"if",
"the",
"value",
"passed",
"to",
"it",
"was",
"a",
"valid",
"IPv4",
"address",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L414-L428 | train | Returns a bool telling if the value passed to it was a valid IPv4 address. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | is_ipv6_filter | def is_ipv6_filter(ip, options=None):
'''
Returns a bool telling if the value passed to it was a valid IPv6 address.
ip
The IP address.
net: False
Consider IP addresses followed by netmask.
options
CSV of options regarding the nature of the IP address. E.g.: loopback, mult... | python | def is_ipv6_filter(ip, options=None):
'''
Returns a bool telling if the value passed to it was a valid IPv6 address.
ip
The IP address.
net: False
Consider IP addresses followed by netmask.
options
CSV of options regarding the nature of the IP address. E.g.: loopback, mult... | [
"def",
"is_ipv6_filter",
"(",
"ip",
",",
"options",
"=",
"None",
")",
":",
"_is_ipv6",
"=",
"_is_ipv",
"(",
"ip",
",",
"6",
",",
"options",
"=",
"options",
")",
"return",
"isinstance",
"(",
"_is_ipv6",
",",
"six",
".",
"string_types",
")"
] | Returns a bool telling if the value passed to it was a valid IPv6 address.
ip
The IP address.
net: False
Consider IP addresses followed by netmask.
options
CSV of options regarding the nature of the IP address. E.g.: loopback, multicast, private etc. | [
"Returns",
"a",
"bool",
"telling",
"if",
"the",
"value",
"passed",
"to",
"it",
"was",
"a",
"valid",
"IPv6",
"address",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L432-L446 | train | Returns a bool telling if the value passed to it was a valid IPv6 address. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | ipaddr | def ipaddr(value, options=None):
'''
Filters and returns only valid IP objects.
'''
ipv4_obj = ipv4(value, options=options)
ipv6_obj = ipv6(value, options=options)
if ipv4_obj is None or ipv6_obj is None:
# an IP address can be either IPv4 either IPv6
# therefofe if the value pas... | python | def ipaddr(value, options=None):
'''
Filters and returns only valid IP objects.
'''
ipv4_obj = ipv4(value, options=options)
ipv6_obj = ipv6(value, options=options)
if ipv4_obj is None or ipv6_obj is None:
# an IP address can be either IPv4 either IPv6
# therefofe if the value pas... | [
"def",
"ipaddr",
"(",
"value",
",",
"options",
"=",
"None",
")",
":",
"ipv4_obj",
"=",
"ipv4",
"(",
"value",
",",
"options",
"=",
"options",
")",
"ipv6_obj",
"=",
"ipv6",
"(",
"value",
",",
"options",
"=",
"options",
")",
"if",
"ipv4_obj",
"is",
"Non... | Filters and returns only valid IP objects. | [
"Filters",
"and",
"returns",
"only",
"valid",
"IP",
"objects",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L484-L496 | train | Filters and returns only valid IP objects. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | ip_host | def ip_host(value, options=None, version=None):
'''
Returns the interfaces IP address, e.g.: 192.168.0.1/28.
'''
ipaddr_filter_out = _filter_ipaddr(value, options=options, version=version)
if not ipaddr_filter_out:
return
if not isinstance(value, (list, tuple, types.GeneratorType)):
... | python | def ip_host(value, options=None, version=None):
'''
Returns the interfaces IP address, e.g.: 192.168.0.1/28.
'''
ipaddr_filter_out = _filter_ipaddr(value, options=options, version=version)
if not ipaddr_filter_out:
return
if not isinstance(value, (list, tuple, types.GeneratorType)):
... | [
"def",
"ip_host",
"(",
"value",
",",
"options",
"=",
"None",
",",
"version",
"=",
"None",
")",
":",
"ipaddr_filter_out",
"=",
"_filter_ipaddr",
"(",
"value",
",",
"options",
"=",
"options",
",",
"version",
"=",
"version",
")",
"if",
"not",
"ipaddr_filter_o... | Returns the interfaces IP address, e.g.: 192.168.0.1/28. | [
"Returns",
"the",
"interfaces",
"IP",
"address",
"e",
".",
"g",
".",
":",
"192",
".",
"168",
".",
"0",
".",
"1",
"/",
"28",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L516-L525 | train | Returns the interfaces IP address of the given value. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | network_hosts | def network_hosts(value, options=None, version=None):
'''
Return the list of hosts within a network.
.. note::
When running this command with a large IPv6 network, the command will
take a long time to gather all of the hosts.
'''
ipaddr_filter_out = _filter_ipaddr(value, options=op... | python | def network_hosts(value, options=None, version=None):
'''
Return the list of hosts within a network.
.. note::
When running this command with a large IPv6 network, the command will
take a long time to gather all of the hosts.
'''
ipaddr_filter_out = _filter_ipaddr(value, options=op... | [
"def",
"network_hosts",
"(",
"value",
",",
"options",
"=",
"None",
",",
"version",
"=",
"None",
")",
":",
"ipaddr_filter_out",
"=",
"_filter_ipaddr",
"(",
"value",
",",
"options",
"=",
"options",
",",
"version",
"=",
"version",
")",
"if",
"not",
"ipaddr_fi... | Return the list of hosts within a network.
.. note::
When running this command with a large IPv6 network, the command will
take a long time to gather all of the hosts. | [
"Return",
"the",
"list",
"of",
"hosts",
"within",
"a",
"network",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L536-L553 | train | Return the list of hosts within a network. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | network_size | def network_size(value, options=None, version=None):
'''
Get the size of a network.
'''
ipaddr_filter_out = _filter_ipaddr(value, options=options, version=version)
if not ipaddr_filter_out:
return
if not isinstance(value, (list, tuple, types.GeneratorType)):
return _network_size(... | python | def network_size(value, options=None, version=None):
'''
Get the size of a network.
'''
ipaddr_filter_out = _filter_ipaddr(value, options=options, version=version)
if not ipaddr_filter_out:
return
if not isinstance(value, (list, tuple, types.GeneratorType)):
return _network_size(... | [
"def",
"network_size",
"(",
"value",
",",
"options",
"=",
"None",
",",
"version",
"=",
"None",
")",
":",
"ipaddr_filter_out",
"=",
"_filter_ipaddr",
"(",
"value",
",",
"options",
"=",
"options",
",",
"version",
"=",
"version",
")",
"if",
"not",
"ipaddr_fil... | Get the size of a network. | [
"Get",
"the",
"size",
"of",
"a",
"network",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L561-L573 | train | Get the size of a network. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | natural_ipv4_netmask | def natural_ipv4_netmask(ip, fmt='prefixlen'):
'''
Returns the "natural" mask of an IPv4 address
'''
bits = _ipv4_to_bits(ip)
if bits.startswith('11'):
mask = '24'
elif bits.startswith('1'):
mask = '16'
else:
mask = '8'
if fmt == 'netmask':
return cidr_t... | python | def natural_ipv4_netmask(ip, fmt='prefixlen'):
'''
Returns the "natural" mask of an IPv4 address
'''
bits = _ipv4_to_bits(ip)
if bits.startswith('11'):
mask = '24'
elif bits.startswith('1'):
mask = '16'
else:
mask = '8'
if fmt == 'netmask':
return cidr_t... | [
"def",
"natural_ipv4_netmask",
"(",
"ip",
",",
"fmt",
"=",
"'prefixlen'",
")",
":",
"bits",
"=",
"_ipv4_to_bits",
"(",
"ip",
")",
"if",
"bits",
".",
"startswith",
"(",
"'11'",
")",
":",
"mask",
"=",
"'24'",
"elif",
"bits",
".",
"startswith",
"(",
"'1'"... | Returns the "natural" mask of an IPv4 address | [
"Returns",
"the",
"natural",
"mask",
"of",
"an",
"IPv4",
"address"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L576-L592 | train | Returns the natural IPv4 netmask of an IPv4 address | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | cidr_to_ipv4_netmask | def cidr_to_ipv4_netmask(cidr_bits):
'''
Returns an IPv4 netmask
'''
try:
cidr_bits = int(cidr_bits)
if not 1 <= cidr_bits <= 32:
return ''
except ValueError:
return ''
netmask = ''
for idx in range(4):
if idx:
netmask += '.'
i... | python | def cidr_to_ipv4_netmask(cidr_bits):
'''
Returns an IPv4 netmask
'''
try:
cidr_bits = int(cidr_bits)
if not 1 <= cidr_bits <= 32:
return ''
except ValueError:
return ''
netmask = ''
for idx in range(4):
if idx:
netmask += '.'
i... | [
"def",
"cidr_to_ipv4_netmask",
"(",
"cidr_bits",
")",
":",
"try",
":",
"cidr_bits",
"=",
"int",
"(",
"cidr_bits",
")",
"if",
"not",
"1",
"<=",
"cidr_bits",
"<=",
"32",
":",
"return",
"''",
"except",
"ValueError",
":",
"return",
"''",
"netmask",
"=",
"''"... | Returns an IPv4 netmask | [
"Returns",
"an",
"IPv4",
"netmask"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L606-L627 | train | Returns an IPv4 netmask | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | _number_of_set_bits | def _number_of_set_bits(x):
'''
Returns the number of bits that are set in a 32bit int
'''
# Taken from http://stackoverflow.com/a/4912729. Many thanks!
x -= (x >> 1) & 0x55555555
x = ((x >> 2) & 0x33333333) + (x & 0x33333333)
x = ((x >> 4) + x) & 0x0f0f0f0f
x += x >> 8
x += x >> 16
... | python | def _number_of_set_bits(x):
'''
Returns the number of bits that are set in a 32bit int
'''
# Taken from http://stackoverflow.com/a/4912729. Many thanks!
x -= (x >> 1) & 0x55555555
x = ((x >> 2) & 0x33333333) + (x & 0x33333333)
x = ((x >> 4) + x) & 0x0f0f0f0f
x += x >> 8
x += x >> 16
... | [
"def",
"_number_of_set_bits",
"(",
"x",
")",
":",
"# Taken from http://stackoverflow.com/a/4912729. Many thanks!",
"x",
"-=",
"(",
"x",
">>",
"1",
")",
"&",
"0x55555555",
"x",
"=",
"(",
"(",
"x",
">>",
"2",
")",
"&",
"0x33333333",
")",
"+",
"(",
"x",
"&",
... | Returns the number of bits that are set in a 32bit int | [
"Returns",
"the",
"number",
"of",
"bits",
"that",
"are",
"set",
"in",
"a",
"32bit",
"int"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L640-L650 | train | Returns the number of bits that are set in a 32bit int
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | _interfaces_ifconfig | def _interfaces_ifconfig(out):
'''
Uses ifconfig to return a dictionary of interfaces with various information
about each (up/down state, ip address, netmask, and hwaddr)
'''
ret = dict()
piface = re.compile(r'^([^\s:]+)')
pmac = re.compile('.*?(?:HWaddr|ether|address:|lladdr) ([0-9a-fA-F:]... | python | def _interfaces_ifconfig(out):
'''
Uses ifconfig to return a dictionary of interfaces with various information
about each (up/down state, ip address, netmask, and hwaddr)
'''
ret = dict()
piface = re.compile(r'^([^\s:]+)')
pmac = re.compile('.*?(?:HWaddr|ether|address:|lladdr) ([0-9a-fA-F:]... | [
"def",
"_interfaces_ifconfig",
"(",
"out",
")",
":",
"ret",
"=",
"dict",
"(",
")",
"piface",
"=",
"re",
".",
"compile",
"(",
"r'^([^\\s:]+)'",
")",
"pmac",
"=",
"re",
".",
"compile",
"(",
"'.*?(?:HWaddr|ether|address:|lladdr) ([0-9a-fA-F:]+)'",
")",
"if",
"sal... | Uses ifconfig to return a dictionary of interfaces with various information
about each (up/down state, ip address, netmask, and hwaddr) | [
"Uses",
"ifconfig",
"to",
"return",
"a",
"dictionary",
"of",
"interfaces",
"with",
"various",
"information",
"about",
"each",
"(",
"up",
"/",
"down",
"state",
"ip",
"address",
"netmask",
"and",
"hwaddr",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L748-L841 | train | Returns a dictionary of interfaces with various information about each interface. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | linux_interfaces | def linux_interfaces():
'''
Obtain interface information for *NIX/BSD variants
'''
ifaces = dict()
ip_path = salt.utils.path.which('ip')
ifconfig_path = None if ip_path else salt.utils.path.which('ifconfig')
if ip_path:
cmd1 = subprocess.Popen(
'{0} link show'.format(ip_p... | python | def linux_interfaces():
'''
Obtain interface information for *NIX/BSD variants
'''
ifaces = dict()
ip_path = salt.utils.path.which('ip')
ifconfig_path = None if ip_path else salt.utils.path.which('ifconfig')
if ip_path:
cmd1 = subprocess.Popen(
'{0} link show'.format(ip_p... | [
"def",
"linux_interfaces",
"(",
")",
":",
"ifaces",
"=",
"dict",
"(",
")",
"ip_path",
"=",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"'ip'",
")",
"ifconfig_path",
"=",
"None",
"if",
"ip_path",
"else",
"salt",
".",
"utils",
".",
"path",
".... | Obtain interface information for *NIX/BSD variants | [
"Obtain",
"interface",
"information",
"for",
"*",
"NIX",
"/",
"BSD",
"variants"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L844-L874 | train | Obtain interface information for Linux variants
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | _netbsd_interfaces_ifconfig | def _netbsd_interfaces_ifconfig(out):
'''
Uses ifconfig to return a dictionary of interfaces with various information
about each (up/down state, ip address, netmask, and hwaddr)
'''
ret = dict()
piface = re.compile(r'^([^\s:]+)')
pmac = re.compile('.*?address: ([0-9a-f:]+)')
pip = re.c... | python | def _netbsd_interfaces_ifconfig(out):
'''
Uses ifconfig to return a dictionary of interfaces with various information
about each (up/down state, ip address, netmask, and hwaddr)
'''
ret = dict()
piface = re.compile(r'^([^\s:]+)')
pmac = re.compile('.*?address: ([0-9a-f:]+)')
pip = re.c... | [
"def",
"_netbsd_interfaces_ifconfig",
"(",
"out",
")",
":",
"ret",
"=",
"dict",
"(",
")",
"piface",
"=",
"re",
".",
"compile",
"(",
"r'^([^\\s:]+)'",
")",
"pmac",
"=",
"re",
".",
"compile",
"(",
"'.*?address: ([0-9a-f:]+)'",
")",
"pip",
"=",
"re",
".",
"... | Uses ifconfig to return a dictionary of interfaces with various information
about each (up/down state, ip address, netmask, and hwaddr) | [
"Uses",
"ifconfig",
"to",
"return",
"a",
"dictionary",
"of",
"interfaces",
"with",
"various",
"information",
"about",
"each",
"(",
"up",
"/",
"down",
"state",
"ip",
"address",
"netmask",
"and",
"hwaddr",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L877-L934 | train | Uses ifconfig to return a dictionary of interfaces with various information about each. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | netbsd_interfaces | def netbsd_interfaces():
'''
Obtain interface information for NetBSD >= 8 where the ifconfig
output diverged from other BSD variants (Netmask is now part of the
address)
'''
# NetBSD versions prior to 8.0 can still use linux_interfaces()
if LooseVersion(os.uname()[2]) < LooseVersion('8.0'):
... | python | def netbsd_interfaces():
'''
Obtain interface information for NetBSD >= 8 where the ifconfig
output diverged from other BSD variants (Netmask is now part of the
address)
'''
# NetBSD versions prior to 8.0 can still use linux_interfaces()
if LooseVersion(os.uname()[2]) < LooseVersion('8.0'):
... | [
"def",
"netbsd_interfaces",
"(",
")",
":",
"# NetBSD versions prior to 8.0 can still use linux_interfaces()",
"if",
"LooseVersion",
"(",
"os",
".",
"uname",
"(",
")",
"[",
"2",
"]",
")",
"<",
"LooseVersion",
"(",
"'8.0'",
")",
":",
"return",
"linux_interfaces",
"(... | Obtain interface information for NetBSD >= 8 where the ifconfig
output diverged from other BSD variants (Netmask is now part of the
address) | [
"Obtain",
"interface",
"information",
"for",
"NetBSD",
">",
"=",
"8",
"where",
"the",
"ifconfig",
"output",
"diverged",
"from",
"other",
"BSD",
"variants",
"(",
"Netmask",
"is",
"now",
"part",
"of",
"the",
"address",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L937-L953 | train | Return the netbsd interfaces for NetBSD > = 8 where the ifconfig output diverged from other BSD variants | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | _interfaces_ipconfig | def _interfaces_ipconfig(out):
'''
Returns a dictionary of interfaces with various information about each
(up/down state, ip address, netmask, and hwaddr)
NOTE: This is not used by any function and may be able to be removed in the
future.
'''
ifaces = dict()
iface = None
adapter_ifa... | python | def _interfaces_ipconfig(out):
'''
Returns a dictionary of interfaces with various information about each
(up/down state, ip address, netmask, and hwaddr)
NOTE: This is not used by any function and may be able to be removed in the
future.
'''
ifaces = dict()
iface = None
adapter_ifa... | [
"def",
"_interfaces_ipconfig",
"(",
"out",
")",
":",
"ifaces",
"=",
"dict",
"(",
")",
"iface",
"=",
"None",
"adapter_iface_regex",
"=",
"re",
".",
"compile",
"(",
"r'adapter (\\S.+):$'",
")",
"for",
"line",
"in",
"out",
".",
"splitlines",
"(",
")",
":",
... | Returns a dictionary of interfaces with various information about each
(up/down state, ip address, netmask, and hwaddr)
NOTE: This is not used by any function and may be able to be removed in the
future. | [
"Returns",
"a",
"dictionary",
"of",
"interfaces",
"with",
"various",
"information",
"about",
"each",
"(",
"up",
"/",
"down",
"state",
"ip",
"address",
"netmask",
"and",
"hwaddr",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L956-L1002 | train | Returns a dictionary of interfaces with various information about each node in the nexus network. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | win_interfaces | def win_interfaces():
'''
Obtain interface information for Windows systems
'''
with salt.utils.winapi.Com():
c = wmi.WMI()
ifaces = {}
for iface in c.Win32_NetworkAdapterConfiguration(IPEnabled=1):
ifaces[iface.Description] = dict()
if iface.MACAddress:
... | python | def win_interfaces():
'''
Obtain interface information for Windows systems
'''
with salt.utils.winapi.Com():
c = wmi.WMI()
ifaces = {}
for iface in c.Win32_NetworkAdapterConfiguration(IPEnabled=1):
ifaces[iface.Description] = dict()
if iface.MACAddress:
... | [
"def",
"win_interfaces",
"(",
")",
":",
"with",
"salt",
".",
"utils",
".",
"winapi",
".",
"Com",
"(",
")",
":",
"c",
"=",
"wmi",
".",
"WMI",
"(",
")",
"ifaces",
"=",
"{",
"}",
"for",
"iface",
"in",
"c",
".",
"Win32_NetworkAdapterConfiguration",
"(",
... | Obtain interface information for Windows systems | [
"Obtain",
"interface",
"information",
"for",
"Windows",
"systems"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1005-L1048 | train | Return a list of Windows interfaces that can be used in a Windows system. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | interfaces | def interfaces():
'''
Return a dictionary of information about all the interfaces on the minion
'''
if salt.utils.platform.is_windows():
return win_interfaces()
elif salt.utils.platform.is_netbsd():
return netbsd_interfaces()
else:
return linux_interfaces() | python | def interfaces():
'''
Return a dictionary of information about all the interfaces on the minion
'''
if salt.utils.platform.is_windows():
return win_interfaces()
elif salt.utils.platform.is_netbsd():
return netbsd_interfaces()
else:
return linux_interfaces() | [
"def",
"interfaces",
"(",
")",
":",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"return",
"win_interfaces",
"(",
")",
"elif",
"salt",
".",
"utils",
".",
"platform",
".",
"is_netbsd",
"(",
")",
":",
"return",
"netbsd_i... | Return a dictionary of information about all the interfaces on the minion | [
"Return",
"a",
"dictionary",
"of",
"information",
"about",
"all",
"the",
"interfaces",
"on",
"the",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1051-L1060 | train | Return a dictionary of information about all the interfaces on the minion | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | get_net_start | def get_net_start(ipaddr, netmask):
'''
Return the address of the network
'''
net = ipaddress.ip_network('{0}/{1}'.format(ipaddr, netmask), strict=False)
return six.text_type(net.network_address) | python | def get_net_start(ipaddr, netmask):
'''
Return the address of the network
'''
net = ipaddress.ip_network('{0}/{1}'.format(ipaddr, netmask), strict=False)
return six.text_type(net.network_address) | [
"def",
"get_net_start",
"(",
"ipaddr",
",",
"netmask",
")",
":",
"net",
"=",
"ipaddress",
".",
"ip_network",
"(",
"'{0}/{1}'",
".",
"format",
"(",
"ipaddr",
",",
"netmask",
")",
",",
"strict",
"=",
"False",
")",
"return",
"six",
".",
"text_type",
"(",
... | Return the address of the network | [
"Return",
"the",
"address",
"of",
"the",
"network"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1063-L1068 | train | Return the address of the network containing the given ipaddr and netmask | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | get_net_size | def get_net_size(mask):
'''
Turns an IPv4 netmask into it's corresponding prefix length
(255.255.255.0 -> 24 as in 192.168.1.10/24).
'''
binary_str = ''
for octet in mask.split('.'):
binary_str += bin(int(octet))[2:].zfill(8)
return len(binary_str.rstrip('0')) | python | def get_net_size(mask):
'''
Turns an IPv4 netmask into it's corresponding prefix length
(255.255.255.0 -> 24 as in 192.168.1.10/24).
'''
binary_str = ''
for octet in mask.split('.'):
binary_str += bin(int(octet))[2:].zfill(8)
return len(binary_str.rstrip('0')) | [
"def",
"get_net_size",
"(",
"mask",
")",
":",
"binary_str",
"=",
"''",
"for",
"octet",
"in",
"mask",
".",
"split",
"(",
"'.'",
")",
":",
"binary_str",
"+=",
"bin",
"(",
"int",
"(",
"octet",
")",
")",
"[",
"2",
":",
"]",
".",
"zfill",
"(",
"8",
... | Turns an IPv4 netmask into it's corresponding prefix length
(255.255.255.0 -> 24 as in 192.168.1.10/24). | [
"Turns",
"an",
"IPv4",
"netmask",
"into",
"it",
"s",
"corresponding",
"prefix",
"length",
"(",
"255",
".",
"255",
".",
"255",
".",
"0",
"-",
">",
"24",
"as",
"in",
"192",
".",
"168",
".",
"1",
".",
"10",
"/",
"24",
")",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1071-L1079 | train | Returns the size of a netmask as a number of bits. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | calc_net | def calc_net(ipaddr, netmask=None):
'''
Takes IP (CIDR notation supported) and optionally netmask
and returns the network in CIDR-notation.
(The IP can be any IP inside the subnet)
'''
if netmask is not None:
ipaddr = '{0}/{1}'.format(ipaddr, netmask)
return six.text_type(ipaddress.... | python | def calc_net(ipaddr, netmask=None):
'''
Takes IP (CIDR notation supported) and optionally netmask
and returns the network in CIDR-notation.
(The IP can be any IP inside the subnet)
'''
if netmask is not None:
ipaddr = '{0}/{1}'.format(ipaddr, netmask)
return six.text_type(ipaddress.... | [
"def",
"calc_net",
"(",
"ipaddr",
",",
"netmask",
"=",
"None",
")",
":",
"if",
"netmask",
"is",
"not",
"None",
":",
"ipaddr",
"=",
"'{0}/{1}'",
".",
"format",
"(",
"ipaddr",
",",
"netmask",
")",
"return",
"six",
".",
"text_type",
"(",
"ipaddress",
".",... | Takes IP (CIDR notation supported) and optionally netmask
and returns the network in CIDR-notation.
(The IP can be any IP inside the subnet) | [
"Takes",
"IP",
"(",
"CIDR",
"notation",
"supported",
")",
"and",
"optionally",
"netmask",
"and",
"returns",
"the",
"network",
"in",
"CIDR",
"-",
"notation",
".",
"(",
"The",
"IP",
"can",
"be",
"any",
"IP",
"inside",
"the",
"subnet",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1082-L1091 | train | Calculates the network of the given IP address and netmask. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | _ipv4_to_bits | def _ipv4_to_bits(ipaddr):
'''
Accepts an IPv4 dotted quad and returns a string representing its binary
counterpart
'''
return ''.join([bin(int(x))[2:].rjust(8, '0') for x in ipaddr.split('.')]) | python | def _ipv4_to_bits(ipaddr):
'''
Accepts an IPv4 dotted quad and returns a string representing its binary
counterpart
'''
return ''.join([bin(int(x))[2:].rjust(8, '0') for x in ipaddr.split('.')]) | [
"def",
"_ipv4_to_bits",
"(",
"ipaddr",
")",
":",
"return",
"''",
".",
"join",
"(",
"[",
"bin",
"(",
"int",
"(",
"x",
")",
")",
"[",
"2",
":",
"]",
".",
"rjust",
"(",
"8",
",",
"'0'",
")",
"for",
"x",
"in",
"ipaddr",
".",
"split",
"(",
"'.'",
... | Accepts an IPv4 dotted quad and returns a string representing its binary
counterpart | [
"Accepts",
"an",
"IPv4",
"dotted",
"quad",
"and",
"returns",
"a",
"string",
"representing",
"its",
"binary",
"counterpart"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1094-L1099 | train | Takes an IPv4 dotted quad and returns a string representing its binary
counterpart
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | _get_iface_info | def _get_iface_info(iface):
'''
If `iface` is available, return interface info and no error, otherwise
return no info and log and return an error
'''
iface_info = interfaces()
if iface in iface_info.keys():
return iface_info, False
else:
error_msg = ('Interface "{0}" not in ... | python | def _get_iface_info(iface):
'''
If `iface` is available, return interface info and no error, otherwise
return no info and log and return an error
'''
iface_info = interfaces()
if iface in iface_info.keys():
return iface_info, False
else:
error_msg = ('Interface "{0}" not in ... | [
"def",
"_get_iface_info",
"(",
"iface",
")",
":",
"iface_info",
"=",
"interfaces",
"(",
")",
"if",
"iface",
"in",
"iface_info",
".",
"keys",
"(",
")",
":",
"return",
"iface_info",
",",
"False",
"else",
":",
"error_msg",
"=",
"(",
"'Interface \"{0}\" not in a... | If `iface` is available, return interface info and no error, otherwise
return no info and log and return an error | [
"If",
"iface",
"is",
"available",
"return",
"interface",
"info",
"and",
"no",
"error",
"otherwise",
"return",
"no",
"info",
"and",
"log",
"and",
"return",
"an",
"error"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1102-L1115 | train | Get the information about the given interface. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | _hw_addr_aix | def _hw_addr_aix(iface):
'''
Return the hardware address (a.k.a. MAC address) for a given interface on AIX
MAC address not available in through interfaces
'''
cmd = subprocess.Popen(
'entstat -d {0} | grep \'Hardware Address\''.format(iface),
shell=True,
stdout=subprocess.PIP... | python | def _hw_addr_aix(iface):
'''
Return the hardware address (a.k.a. MAC address) for a given interface on AIX
MAC address not available in through interfaces
'''
cmd = subprocess.Popen(
'entstat -d {0} | grep \'Hardware Address\''.format(iface),
shell=True,
stdout=subprocess.PIP... | [
"def",
"_hw_addr_aix",
"(",
"iface",
")",
":",
"cmd",
"=",
"subprocess",
".",
"Popen",
"(",
"'entstat -d {0} | grep \\'Hardware Address\\''",
".",
"format",
"(",
"iface",
")",
",",
"shell",
"=",
"True",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
",",
"st... | Return the hardware address (a.k.a. MAC address) for a given interface on AIX
MAC address not available in through interfaces | [
"Return",
"the",
"hardware",
"address",
"(",
"a",
".",
"k",
".",
"a",
".",
"MAC",
"address",
")",
"for",
"a",
"given",
"interface",
"on",
"AIX",
"MAC",
"address",
"not",
"available",
"in",
"through",
"interfaces"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1118-L1137 | train | Return the hardware address for a given interface on AIX
MAC address not available in through interfaces
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | hw_addr | def hw_addr(iface):
'''
Return the hardware address (a.k.a. MAC address) for a given interface
.. versionchanged:: 2016.11.4
Added support for AIX
'''
if salt.utils.platform.is_aix():
return _hw_addr_aix
iface_info, error = _get_iface_info(iface)
if error is False:
... | python | def hw_addr(iface):
'''
Return the hardware address (a.k.a. MAC address) for a given interface
.. versionchanged:: 2016.11.4
Added support for AIX
'''
if salt.utils.platform.is_aix():
return _hw_addr_aix
iface_info, error = _get_iface_info(iface)
if error is False:
... | [
"def",
"hw_addr",
"(",
"iface",
")",
":",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_aix",
"(",
")",
":",
"return",
"_hw_addr_aix",
"iface_info",
",",
"error",
"=",
"_get_iface_info",
"(",
"iface",
")",
"if",
"error",
"is",
"False",
":",
"re... | Return the hardware address (a.k.a. MAC address) for a given interface
.. versionchanged:: 2016.11.4
Added support for AIX | [
"Return",
"the",
"hardware",
"address",
"(",
"a",
".",
"k",
".",
"a",
".",
"MAC",
"address",
")",
"for",
"a",
"given",
"interface"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1140-L1156 | train | Return the hardware address for a given interface | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | interface | def interface(iface):
'''
Return the details of `iface` or an error if it does not exist
'''
iface_info, error = _get_iface_info(iface)
if error is False:
return iface_info.get(iface, {}).get('inet', '')
else:
return error | python | def interface(iface):
'''
Return the details of `iface` or an error if it does not exist
'''
iface_info, error = _get_iface_info(iface)
if error is False:
return iface_info.get(iface, {}).get('inet', '')
else:
return error | [
"def",
"interface",
"(",
"iface",
")",
":",
"iface_info",
",",
"error",
"=",
"_get_iface_info",
"(",
"iface",
")",
"if",
"error",
"is",
"False",
":",
"return",
"iface_info",
".",
"get",
"(",
"iface",
",",
"{",
"}",
")",
".",
"get",
"(",
"'inet'",
","... | Return the details of `iface` or an error if it does not exist | [
"Return",
"the",
"details",
"of",
"iface",
"or",
"an",
"error",
"if",
"it",
"does",
"not",
"exist"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1159-L1168 | train | Return the details of iface or an error if it does not exist | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | interface_ip | def interface_ip(iface):
'''
Return `iface` IPv4 addr or an error if `iface` does not exist
'''
iface_info, error = _get_iface_info(iface)
if error is False:
inet = iface_info.get(iface, {}).get('inet', None)
return inet[0].get('address', '') if inet else ''
else:
return... | python | def interface_ip(iface):
'''
Return `iface` IPv4 addr or an error if `iface` does not exist
'''
iface_info, error = _get_iface_info(iface)
if error is False:
inet = iface_info.get(iface, {}).get('inet', None)
return inet[0].get('address', '') if inet else ''
else:
return... | [
"def",
"interface_ip",
"(",
"iface",
")",
":",
"iface_info",
",",
"error",
"=",
"_get_iface_info",
"(",
"iface",
")",
"if",
"error",
"is",
"False",
":",
"inet",
"=",
"iface_info",
".",
"get",
"(",
"iface",
",",
"{",
"}",
")",
".",
"get",
"(",
"'inet'... | Return `iface` IPv4 addr or an error if `iface` does not exist | [
"Return",
"iface",
"IPv4",
"addr",
"or",
"an",
"error",
"if",
"iface",
"does",
"not",
"exist"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1171-L1181 | train | Return the IPv4 addr of an interface. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | _subnets | def _subnets(proto='inet', interfaces_=None):
'''
Returns a list of subnets to which the host belongs
'''
if interfaces_ is None:
ifaces = interfaces()
elif isinstance(interfaces_, list):
ifaces = {}
for key, value in six.iteritems(interfaces()):
if key in interfa... | python | def _subnets(proto='inet', interfaces_=None):
'''
Returns a list of subnets to which the host belongs
'''
if interfaces_ is None:
ifaces = interfaces()
elif isinstance(interfaces_, list):
ifaces = {}
for key, value in six.iteritems(interfaces()):
if key in interfa... | [
"def",
"_subnets",
"(",
"proto",
"=",
"'inet'",
",",
"interfaces_",
"=",
"None",
")",
":",
"if",
"interfaces_",
"is",
"None",
":",
"ifaces",
"=",
"interfaces",
"(",
")",
"elif",
"isinstance",
"(",
"interfaces_",
",",
"list",
")",
":",
"ifaces",
"=",
"{... | Returns a list of subnets to which the host belongs | [
"Returns",
"a",
"list",
"of",
"subnets",
"to",
"which",
"the",
"host",
"belongs"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1184-L1221 | train | Returns a list of subnets to which the host belongs | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | in_subnet | def in_subnet(cidr, addr=None):
'''
Returns True if host or (any of) addrs is within specified subnet, otherwise False
'''
try:
cidr = ipaddress.ip_network(cidr)
except ValueError:
log.error('Invalid CIDR \'%s\'', cidr)
return False
if addr is None:
addr = ip_add... | python | def in_subnet(cidr, addr=None):
'''
Returns True if host or (any of) addrs is within specified subnet, otherwise False
'''
try:
cidr = ipaddress.ip_network(cidr)
except ValueError:
log.error('Invalid CIDR \'%s\'', cidr)
return False
if addr is None:
addr = ip_add... | [
"def",
"in_subnet",
"(",
"cidr",
",",
"addr",
"=",
"None",
")",
":",
"try",
":",
"cidr",
"=",
"ipaddress",
".",
"ip_network",
"(",
"cidr",
")",
"except",
"ValueError",
":",
"log",
".",
"error",
"(",
"'Invalid CIDR \\'%s\\''",
",",
"cidr",
")",
"return",
... | Returns True if host or (any of) addrs is within specified subnet, otherwise False | [
"Returns",
"True",
"if",
"host",
"or",
"(",
"any",
"of",
")",
"addrs",
"is",
"within",
"specified",
"subnet",
"otherwise",
"False"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1238-L1254 | train | Returns True if host or any of addrs is within specified subnet otherwise False. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | _ip_addrs | def _ip_addrs(interface=None, include_loopback=False, interface_data=None, proto='inet'):
'''
Return the full list of IP adresses matching the criteria
proto = inet|inet6
'''
ret = set()
ifaces = interface_data \
if isinstance(interface_data, dict) \
else interfaces()
if in... | python | def _ip_addrs(interface=None, include_loopback=False, interface_data=None, proto='inet'):
'''
Return the full list of IP adresses matching the criteria
proto = inet|inet6
'''
ret = set()
ifaces = interface_data \
if isinstance(interface_data, dict) \
else interfaces()
if in... | [
"def",
"_ip_addrs",
"(",
"interface",
"=",
"None",
",",
"include_loopback",
"=",
"False",
",",
"interface_data",
"=",
"None",
",",
"proto",
"=",
"'inet'",
")",
":",
"ret",
"=",
"set",
"(",
")",
"ifaces",
"=",
"interface_data",
"if",
"isinstance",
"(",
"i... | Return the full list of IP adresses matching the criteria
proto = inet|inet6 | [
"Return",
"the",
"full",
"list",
"of",
"IP",
"adresses",
"matching",
"the",
"criteria"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1257-L1283 | train | Return the full list of IP adresses matching the criteria. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | hex2ip | def hex2ip(hex_ip, invert=False):
'''
Convert a hex string to an ip, if a failure occurs the original hex is
returned. If 'invert=True' assume that ip from /proc/net/<proto>
'''
if len(hex_ip) == 32: # ipv6
ip = []
for i in range(0, 32, 8):
ip_part = hex_ip[i:i + 8]
... | python | def hex2ip(hex_ip, invert=False):
'''
Convert a hex string to an ip, if a failure occurs the original hex is
returned. If 'invert=True' assume that ip from /proc/net/<proto>
'''
if len(hex_ip) == 32: # ipv6
ip = []
for i in range(0, 32, 8):
ip_part = hex_ip[i:i + 8]
... | [
"def",
"hex2ip",
"(",
"hex_ip",
",",
"invert",
"=",
"False",
")",
":",
"if",
"len",
"(",
"hex_ip",
")",
"==",
"32",
":",
"# ipv6",
"ip",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"32",
",",
"8",
")",
":",
"ip_part",
"=",
"hex_i... | Convert a hex string to an ip, if a failure occurs the original hex is
returned. If 'invert=True' assume that ip from /proc/net/<proto> | [
"Convert",
"a",
"hex",
"string",
"to",
"an",
"ip",
"if",
"a",
"failure",
"occurs",
"the",
"original",
"hex",
"is",
"returned",
".",
"If",
"invert",
"=",
"True",
"assume",
"that",
"ip",
"from",
"/",
"proc",
"/",
"net",
"/",
"<proto",
">"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1304-L1340 | train | Convert a hex string to an ip | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | mac2eui64 | def mac2eui64(mac, prefix=None):
'''
Convert a MAC address to a EUI64 identifier
or, with prefix provided, a full IPv6 address
'''
# http://tools.ietf.org/html/rfc4291#section-2.5.1
eui64 = re.sub(r'[.:-]', '', mac).lower()
eui64 = eui64[0:6] + 'fffe' + eui64[6:]
eui64 = hex(int(eui64[0:... | python | def mac2eui64(mac, prefix=None):
'''
Convert a MAC address to a EUI64 identifier
or, with prefix provided, a full IPv6 address
'''
# http://tools.ietf.org/html/rfc4291#section-2.5.1
eui64 = re.sub(r'[.:-]', '', mac).lower()
eui64 = eui64[0:6] + 'fffe' + eui64[6:]
eui64 = hex(int(eui64[0:... | [
"def",
"mac2eui64",
"(",
"mac",
",",
"prefix",
"=",
"None",
")",
":",
"# http://tools.ietf.org/html/rfc4291#section-2.5.1",
"eui64",
"=",
"re",
".",
"sub",
"(",
"r'[.:-]'",
",",
"''",
",",
"mac",
")",
".",
"lower",
"(",
")",
"eui64",
"=",
"eui64",
"[",
"... | Convert a MAC address to a EUI64 identifier
or, with prefix provided, a full IPv6 address | [
"Convert",
"a",
"MAC",
"address",
"to",
"a",
"EUI64",
"identifier",
"or",
"with",
"prefix",
"provided",
"a",
"full",
"IPv6",
"address"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1343-L1361 | train | Convert a MAC address to an EUI64 identifier. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | active_tcp | def active_tcp():
'''
Return a dict describing all active tcp connections as quickly as possible
'''
ret = {}
for statf in ['/proc/net/tcp', '/proc/net/tcp6']:
if os.path.isfile(statf):
with salt.utils.files.fopen(statf, 'rb') as fp_:
for line in fp_:
... | python | def active_tcp():
'''
Return a dict describing all active tcp connections as quickly as possible
'''
ret = {}
for statf in ['/proc/net/tcp', '/proc/net/tcp6']:
if os.path.isfile(statf):
with salt.utils.files.fopen(statf, 'rb') as fp_:
for line in fp_:
... | [
"def",
"active_tcp",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"for",
"statf",
"in",
"[",
"'/proc/net/tcp'",
",",
"'/proc/net/tcp6'",
"]",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"statf",
")",
":",
"with",
"salt",
".",
"utils",
".",
"files",
"... | Return a dict describing all active tcp connections as quickly as possible | [
"Return",
"a",
"dict",
"describing",
"all",
"active",
"tcp",
"connections",
"as",
"quickly",
"as",
"possible"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1364-L1381 | train | Return a dict describing all active tcp connections as quickly as possible
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | _remotes_on | def _remotes_on(port, which_end):
'''
Return a set of ip addrs active tcp connections
'''
port = int(port)
ret = _netlink_tool_remote_on(port, which_end)
if ret is not None:
return ret
ret = set()
proc_available = False
for statf in ['/proc/net/tcp', '/proc/net/tcp6']:
... | python | def _remotes_on(port, which_end):
'''
Return a set of ip addrs active tcp connections
'''
port = int(port)
ret = _netlink_tool_remote_on(port, which_end)
if ret is not None:
return ret
ret = set()
proc_available = False
for statf in ['/proc/net/tcp', '/proc/net/tcp6']:
... | [
"def",
"_remotes_on",
"(",
"port",
",",
"which_end",
")",
":",
"port",
"=",
"int",
"(",
"port",
")",
"ret",
"=",
"_netlink_tool_remote_on",
"(",
"port",
",",
"which_end",
")",
"if",
"ret",
"is",
"not",
"None",
":",
"return",
"ret",
"ret",
"=",
"set",
... | Return a set of ip addrs active tcp connections | [
"Return",
"a",
"set",
"of",
"ip",
"addrs",
"active",
"tcp",
"connections"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1400-L1441 | train | Return a set of ip addrs active tcp connections | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | _parse_tcp_line | def _parse_tcp_line(line):
'''
Parse a single line from the contents of /proc/net/tcp or /proc/net/tcp6
'''
ret = {}
comps = line.strip().split()
sl = comps[0].rstrip(':')
ret[sl] = {}
l_addr, l_port = comps[1].split(':')
r_addr, r_port = comps[2].split(':')
ret[sl]['local_addr']... | python | def _parse_tcp_line(line):
'''
Parse a single line from the contents of /proc/net/tcp or /proc/net/tcp6
'''
ret = {}
comps = line.strip().split()
sl = comps[0].rstrip(':')
ret[sl] = {}
l_addr, l_port = comps[1].split(':')
r_addr, r_port = comps[2].split(':')
ret[sl]['local_addr']... | [
"def",
"_parse_tcp_line",
"(",
"line",
")",
":",
"ret",
"=",
"{",
"}",
"comps",
"=",
"line",
".",
"strip",
"(",
")",
".",
"split",
"(",
")",
"sl",
"=",
"comps",
"[",
"0",
"]",
".",
"rstrip",
"(",
"':'",
")",
"ret",
"[",
"sl",
"]",
"=",
"{",
... | Parse a single line from the contents of /proc/net/tcp or /proc/net/tcp6 | [
"Parse",
"a",
"single",
"line",
"from",
"the",
"contents",
"of",
"/",
"proc",
"/",
"net",
"/",
"tcp",
"or",
"/",
"proc",
"/",
"net",
"/",
"tcp6"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1444-L1459 | train | Parse a single line from the contents of tcp or tcp6
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | _netlink_tool_remote_on | def _netlink_tool_remote_on(port, which_end):
'''
Returns set of ipv4 host addresses of remote established connections
on local or remote tcp port.
Parses output of shell 'ss' to get connections
[root@salt-master ~]# ss -ant
State Recv-Q Send-Q Local Address:Port ... | python | def _netlink_tool_remote_on(port, which_end):
'''
Returns set of ipv4 host addresses of remote established connections
on local or remote tcp port.
Parses output of shell 'ss' to get connections
[root@salt-master ~]# ss -ant
State Recv-Q Send-Q Local Address:Port ... | [
"def",
"_netlink_tool_remote_on",
"(",
"port",
",",
"which_end",
")",
":",
"remotes",
"=",
"set",
"(",
")",
"valid",
"=",
"False",
"try",
":",
"data",
"=",
"subprocess",
".",
"check_output",
"(",
"[",
"'ss'",
",",
"'-ant'",
"]",
")",
"# pylint: disable=min... | Returns set of ipv4 host addresses of remote established connections
on local or remote tcp port.
Parses output of shell 'ss' to get connections
[root@salt-master ~]# ss -ant
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 511 ... | [
"Returns",
"set",
"of",
"ipv4",
"host",
"addresses",
"of",
"remote",
"established",
"connections",
"on",
"local",
"or",
"remote",
"tcp",
"port",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1462-L1504 | train | Returns set of ipv4 host addresses of remote established connections on local or remote tcp port. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | _netbsd_remotes_on | def _netbsd_remotes_on(port, which_end):
'''
Returns set of ipv4 host addresses of remote established connections
on local tcp port port.
Parses output of shell 'sockstat' (NetBSD)
to get connections
$ sudo sockstat -4 -n
USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDR... | python | def _netbsd_remotes_on(port, which_end):
'''
Returns set of ipv4 host addresses of remote established connections
on local tcp port port.
Parses output of shell 'sockstat' (NetBSD)
to get connections
$ sudo sockstat -4 -n
USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDR... | [
"def",
"_netbsd_remotes_on",
"(",
"port",
",",
"which_end",
")",
":",
"port",
"=",
"int",
"(",
"port",
")",
"remotes",
"=",
"set",
"(",
")",
"try",
":",
"cmd",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"shlex_split",
"(",
"'sockstat -4 -c -n -p {0}'",... | Returns set of ipv4 host addresses of remote established connections
on local tcp port port.
Parses output of shell 'sockstat' (NetBSD)
to get connections
$ sudo sockstat -4 -n
USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS
root python2.7 1456 29 tcp *.4505... | [
"Returns",
"set",
"of",
"ipv4",
"host",
"addresses",
"of",
"remote",
"established",
"connections",
"on",
"local",
"tcp",
"port",
"port",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1605-L1661 | train | Returns set of ipv4 host addresses of remote established connections on local tcp port port. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | _openbsd_remotes_on | def _openbsd_remotes_on(port, which_end):
'''
OpenBSD specific helper function.
Returns set of ipv4 host addresses of remote established connections
on local or remote tcp port.
Parses output of shell 'netstat' to get connections
$ netstat -nf inet
Active Internet connections
Proto R... | python | def _openbsd_remotes_on(port, which_end):
'''
OpenBSD specific helper function.
Returns set of ipv4 host addresses of remote established connections
on local or remote tcp port.
Parses output of shell 'netstat' to get connections
$ netstat -nf inet
Active Internet connections
Proto R... | [
"def",
"_openbsd_remotes_on",
"(",
"port",
",",
"which_end",
")",
":",
"remotes",
"=",
"set",
"(",
")",
"try",
":",
"data",
"=",
"subprocess",
".",
"check_output",
"(",
"[",
"'netstat'",
",",
"'-nf'",
",",
"'inet'",
"]",
")",
"# pylint: disable=minimum-pytho... | OpenBSD specific helper function.
Returns set of ipv4 host addresses of remote established connections
on local or remote tcp port.
Parses output of shell 'netstat' to get connections
$ netstat -nf inet
Active Internet connections
Proto Recv-Q Send-Q Local Address Foreign Address ... | [
"OpenBSD",
"specific",
"helper",
"function",
".",
"Returns",
"set",
"of",
"ipv4",
"host",
"addresses",
"of",
"remote",
"established",
"connections",
"on",
"local",
"or",
"remote",
"tcp",
"port",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1664-L1698 | train | Returns set of ipv4 host addresses of remote established connections on local or remote tcp port. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | _windows_remotes_on | def _windows_remotes_on(port, which_end):
r'''
Windows specific helper function.
Returns set of ipv4 host addresses of remote established connections
on local or remote tcp port.
Parses output of shell 'netstat' to get connections
C:\>netstat -n
Active Connections
Proto Local Add... | python | def _windows_remotes_on(port, which_end):
r'''
Windows specific helper function.
Returns set of ipv4 host addresses of remote established connections
on local or remote tcp port.
Parses output of shell 'netstat' to get connections
C:\>netstat -n
Active Connections
Proto Local Add... | [
"def",
"_windows_remotes_on",
"(",
"port",
",",
"which_end",
")",
":",
"remotes",
"=",
"set",
"(",
")",
"try",
":",
"data",
"=",
"subprocess",
".",
"check_output",
"(",
"[",
"'netstat'",
",",
"'-n'",
"]",
")",
"# pylint: disable=minimum-python-version",
"excep... | r'''
Windows specific helper function.
Returns set of ipv4 host addresses of remote established connections
on local or remote tcp port.
Parses output of shell 'netstat' to get connections
C:\>netstat -n
Active Connections
Proto Local Address Foreign Address State
... | [
"r",
"Windows",
"specific",
"helper",
"function",
".",
"Returns",
"set",
"of",
"ipv4",
"host",
"addresses",
"of",
"remote",
"established",
"connections",
"on",
"local",
"or",
"remote",
"tcp",
"port",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1701-L1736 | train | r Windows specific helper function. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | _linux_remotes_on | def _linux_remotes_on(port, which_end):
'''
Linux specific helper function.
Returns set of ip host addresses of remote established connections
on local tcp port port.
Parses output of shell 'lsof'
to get connections
$ sudo lsof -iTCP:4505 -n
COMMAND PID USER FD TYPE D... | python | def _linux_remotes_on(port, which_end):
'''
Linux specific helper function.
Returns set of ip host addresses of remote established connections
on local tcp port port.
Parses output of shell 'lsof'
to get connections
$ sudo lsof -iTCP:4505 -n
COMMAND PID USER FD TYPE D... | [
"def",
"_linux_remotes_on",
"(",
"port",
",",
"which_end",
")",
":",
"remotes",
"=",
"set",
"(",
")",
"try",
":",
"data",
"=",
"subprocess",
".",
"check_output",
"(",
"[",
"'lsof'",
",",
"'-iTCP:{0:d}'",
".",
"format",
"(",
"port",
")",
",",
"'-n'",
",... | Linux specific helper function.
Returns set of ip host addresses of remote established connections
on local tcp port port.
Parses output of shell 'lsof'
to get connections
$ sudo lsof -iTCP:4505 -n
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
Python 9971 root 35... | [
"Linux",
"specific",
"helper",
"function",
".",
"Returns",
"set",
"of",
"ip",
"host",
"addresses",
"of",
"remote",
"established",
"connections",
"on",
"local",
"tcp",
"port",
"port",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1739-L1793 | train | Linux specific helper function. Returns set of ip host addresses of remote established connections on local tcp port. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | gen_mac | def gen_mac(prefix='AC:DE:48'):
'''
Generates a MAC address with the defined OUI prefix.
Common prefixes:
- ``00:16:3E`` -- Xen
- ``00:18:51`` -- OpenVZ
- ``00:50:56`` -- VMware (manually generated)
- ``52:54:00`` -- QEMU/KVM
- ``AC:DE:48`` -- PRIVATE
References:
- http... | python | def gen_mac(prefix='AC:DE:48'):
'''
Generates a MAC address with the defined OUI prefix.
Common prefixes:
- ``00:16:3E`` -- Xen
- ``00:18:51`` -- OpenVZ
- ``00:50:56`` -- VMware (manually generated)
- ``52:54:00`` -- QEMU/KVM
- ``AC:DE:48`` -- PRIVATE
References:
- http... | [
"def",
"gen_mac",
"(",
"prefix",
"=",
"'AC:DE:48'",
")",
":",
"return",
"'{0}:{1:02X}:{2:02X}:{3:02X}'",
".",
"format",
"(",
"prefix",
",",
"random",
".",
"randint",
"(",
"0",
",",
"0xff",
")",
",",
"random",
".",
"randint",
"(",
"0",
",",
"0xff",
")",
... | Generates a MAC address with the defined OUI prefix.
Common prefixes:
- ``00:16:3E`` -- Xen
- ``00:18:51`` -- OpenVZ
- ``00:50:56`` -- VMware (manually generated)
- ``52:54:00`` -- QEMU/KVM
- ``AC:DE:48`` -- PRIVATE
References:
- http://standards.ieee.org/develop/regauth/oui/ou... | [
"Generates",
"a",
"MAC",
"address",
"with",
"the",
"defined",
"OUI",
"prefix",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1847-L1868 | train | Generates a MAC address with the defined OUI prefix. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | mac_str_to_bytes | def mac_str_to_bytes(mac_str):
'''
Convert a MAC address string into bytes. Works with or without separators:
b1 = mac_str_to_bytes('08:00:27:13:69:77')
b2 = mac_str_to_bytes('080027136977')
assert b1 == b2
assert isinstance(b1, bytes)
'''
if len(mac_str) == 12:
pass
elif le... | python | def mac_str_to_bytes(mac_str):
'''
Convert a MAC address string into bytes. Works with or without separators:
b1 = mac_str_to_bytes('08:00:27:13:69:77')
b2 = mac_str_to_bytes('080027136977')
assert b1 == b2
assert isinstance(b1, bytes)
'''
if len(mac_str) == 12:
pass
elif le... | [
"def",
"mac_str_to_bytes",
"(",
"mac_str",
")",
":",
"if",
"len",
"(",
"mac_str",
")",
"==",
"12",
":",
"pass",
"elif",
"len",
"(",
"mac_str",
")",
"==",
"17",
":",
"sep",
"=",
"mac_str",
"[",
"2",
"]",
"mac_str",
"=",
"mac_str",
".",
"replace",
"(... | Convert a MAC address string into bytes. Works with or without separators:
b1 = mac_str_to_bytes('08:00:27:13:69:77')
b2 = mac_str_to_bytes('080027136977')
assert b1 == b2
assert isinstance(b1, bytes) | [
"Convert",
"a",
"MAC",
"address",
"string",
"into",
"bytes",
".",
"Works",
"with",
"or",
"without",
"separators",
":"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1872-L1889 | train | Convert a MAC address string into bytes. Works with or without separators. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | connection_check | def connection_check(addr, port=80, safe=False, ipv6=None):
'''
Provides a convenient alias for the dns_check filter.
'''
return dns_check(addr, port, safe, ipv6) | python | def connection_check(addr, port=80, safe=False, ipv6=None):
'''
Provides a convenient alias for the dns_check filter.
'''
return dns_check(addr, port, safe, ipv6) | [
"def",
"connection_check",
"(",
"addr",
",",
"port",
"=",
"80",
",",
"safe",
"=",
"False",
",",
"ipv6",
"=",
"None",
")",
":",
"return",
"dns_check",
"(",
"addr",
",",
"port",
",",
"safe",
",",
"ipv6",
")"
] | Provides a convenient alias for the dns_check filter. | [
"Provides",
"a",
"convenient",
"alias",
"for",
"the",
"dns_check",
"filter",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1904-L1908 | train | A simple DNS connection check filter. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | dns_check | def dns_check(addr, port=80, safe=False, ipv6=None, attempt_connect=True):
'''
Return the ip resolved by dns, but do not exit on failure, only raise an
exception. Obeys system preference for IPv4/6 address resolution - this
can be overridden by the ipv6 flag.
Tries to connect to the address before c... | python | def dns_check(addr, port=80, safe=False, ipv6=None, attempt_connect=True):
'''
Return the ip resolved by dns, but do not exit on failure, only raise an
exception. Obeys system preference for IPv4/6 address resolution - this
can be overridden by the ipv6 flag.
Tries to connect to the address before c... | [
"def",
"dns_check",
"(",
"addr",
",",
"port",
"=",
"80",
",",
"safe",
"=",
"False",
",",
"ipv6",
"=",
"None",
",",
"attempt_connect",
"=",
"True",
")",
":",
"error",
"=",
"False",
"lookup",
"=",
"addr",
"seen_ipv6",
"=",
"False",
"family",
"=",
"sock... | Return the ip resolved by dns, but do not exit on failure, only raise an
exception. Obeys system preference for IPv4/6 address resolution - this
can be overridden by the ipv6 flag.
Tries to connect to the address before considering it useful. If no address
can be reached, the first one resolved is used ... | [
"Return",
"the",
"ip",
"resolved",
"by",
"dns",
"but",
"do",
"not",
"exit",
"on",
"failure",
"only",
"raise",
"an",
"exception",
".",
"Obeys",
"system",
"preference",
"for",
"IPv4",
"/",
"6",
"address",
"resolution",
"-",
"this",
"can",
"be",
"overridden",... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1912-L2002 | train | Check if an address is resolved by dns. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | parse_host_port | def parse_host_port(host_port):
"""
Takes a string argument specifying host or host:port.
Returns a (hostname, port) or (ip_address, port) tuple. If no port is given,
the second (port) element of the returned tuple will be None.
host:port argument, for example, is accepted in the forms of:
-... | python | def parse_host_port(host_port):
"""
Takes a string argument specifying host or host:port.
Returns a (hostname, port) or (ip_address, port) tuple. If no port is given,
the second (port) element of the returned tuple will be None.
host:port argument, for example, is accepted in the forms of:
-... | [
"def",
"parse_host_port",
"(",
"host_port",
")",
":",
"host",
",",
"port",
"=",
"None",
",",
"None",
"# default",
"_s_",
"=",
"host_port",
"[",
":",
"]",
"if",
"_s_",
"[",
"0",
"]",
"==",
"\"[\"",
":",
"if",
"\"]\"",
"in",
"host_port",
":",
"host",
... | Takes a string argument specifying host or host:port.
Returns a (hostname, port) or (ip_address, port) tuple. If no port is given,
the second (port) element of the returned tuple will be None.
host:port argument, for example, is accepted in the forms of:
- hostname
- hostname:1234
- host... | [
"Takes",
"a",
"string",
"argument",
"specifying",
"host",
"or",
"host",
":",
"port",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L2005-L2054 | train | Takes a string argument specifying host or host. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/utils/network.py | is_fqdn | def is_fqdn(hostname):
"""
Verify if hostname conforms to be a FQDN.
:param hostname: text string with the name of the host
:return: bool, True if hostname is correct FQDN, False otherwise
"""
compliant = re.compile(r"(?!-)[A-Z\d\-\_]{1,63}(?<!-)$", re.IGNORECASE)
return "." in hostname an... | python | def is_fqdn(hostname):
"""
Verify if hostname conforms to be a FQDN.
:param hostname: text string with the name of the host
:return: bool, True if hostname is correct FQDN, False otherwise
"""
compliant = re.compile(r"(?!-)[A-Z\d\-\_]{1,63}(?<!-)$", re.IGNORECASE)
return "." in hostname an... | [
"def",
"is_fqdn",
"(",
"hostname",
")",
":",
"compliant",
"=",
"re",
".",
"compile",
"(",
"r\"(?!-)[A-Z\\d\\-\\_]{1,63}(?<!-)$\"",
",",
"re",
".",
"IGNORECASE",
")",
"return",
"\".\"",
"in",
"hostname",
"and",
"len",
"(",
"hostname",
")",
"<",
"0xff",
"and",... | Verify if hostname conforms to be a FQDN.
:param hostname: text string with the name of the host
:return: bool, True if hostname is correct FQDN, False otherwise | [
"Verify",
"if",
"hostname",
"conforms",
"to",
"be",
"a",
"FQDN",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L2057-L2066 | train | Verify if hostname conforms to a FQDN. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/modules/mount.py | _active_mounts | def _active_mounts(ret):
'''
List active mounts on Linux systems
'''
_list = _list_mounts()
filename = '/proc/self/mounts'
if not os.access(filename, os.R_OK):
msg = 'File not readable {0}'
raise CommandExecutionError(msg.format(filename))
with salt.utils.files.fopen(filenam... | python | def _active_mounts(ret):
'''
List active mounts on Linux systems
'''
_list = _list_mounts()
filename = '/proc/self/mounts'
if not os.access(filename, os.R_OK):
msg = 'File not readable {0}'
raise CommandExecutionError(msg.format(filename))
with salt.utils.files.fopen(filenam... | [
"def",
"_active_mounts",
"(",
"ret",
")",
":",
"_list",
"=",
"_list_mounts",
"(",
")",
"filename",
"=",
"'/proc/self/mounts'",
"if",
"not",
"os",
".",
"access",
"(",
"filename",
",",
"os",
".",
"R_OK",
")",
":",
"msg",
"=",
"'File not readable {0}'",
"rais... | List active mounts on Linux systems | [
"List",
"active",
"mounts",
"on",
"Linux",
"systems"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L102-L119 | train | Return a dictionary of active mounts on Linux systems | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/modules/mount.py | _active_mounts_aix | def _active_mounts_aix(ret):
'''
List active mounts on AIX systems
'''
for line in __salt__['cmd.run_stdout']('mount -p').split('\n'):
comps = re.sub(r"\s+", " ", line).split()
if comps:
if comps[0] == 'node' or comps[0] == '--------':
continue
com... | python | def _active_mounts_aix(ret):
'''
List active mounts on AIX systems
'''
for line in __salt__['cmd.run_stdout']('mount -p').split('\n'):
comps = re.sub(r"\s+", " ", line).split()
if comps:
if comps[0] == 'node' or comps[0] == '--------':
continue
com... | [
"def",
"_active_mounts_aix",
"(",
"ret",
")",
":",
"for",
"line",
"in",
"__salt__",
"[",
"'cmd.run_stdout'",
"]",
"(",
"'mount -p'",
")",
".",
"split",
"(",
"'\\n'",
")",
":",
"comps",
"=",
"re",
".",
"sub",
"(",
"r\"\\s+\"",
",",
"\" \"",
",",
"line",... | List active mounts on AIX systems | [
"List",
"active",
"mounts",
"on",
"AIX",
"systems"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L122-L152 | train | Return a list of active mounts on AIX systems | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/modules/mount.py | _active_mounts_freebsd | def _active_mounts_freebsd(ret):
'''
List active mounts on FreeBSD systems
'''
for line in __salt__['cmd.run_stdout']('mount -p').split('\n'):
comps = re.sub(r"\s+", " ", line).split()
ret[comps[1]] = {'device': comps[0],
'fstype': comps[2],
... | python | def _active_mounts_freebsd(ret):
'''
List active mounts on FreeBSD systems
'''
for line in __salt__['cmd.run_stdout']('mount -p').split('\n'):
comps = re.sub(r"\s+", " ", line).split()
ret[comps[1]] = {'device': comps[0],
'fstype': comps[2],
... | [
"def",
"_active_mounts_freebsd",
"(",
"ret",
")",
":",
"for",
"line",
"in",
"__salt__",
"[",
"'cmd.run_stdout'",
"]",
"(",
"'mount -p'",
")",
".",
"split",
"(",
"'\\n'",
")",
":",
"comps",
"=",
"re",
".",
"sub",
"(",
"r\"\\s+\"",
",",
"\" \"",
",",
"li... | List active mounts on FreeBSD systems | [
"List",
"active",
"mounts",
"on",
"FreeBSD",
"systems"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L155-L164 | train | Return a dict of active mounts on FreeBSD systems | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/modules/mount.py | _active_mounts_openbsd | def _active_mounts_openbsd(ret):
'''
List active mounts on OpenBSD systems
'''
for line in __salt__['cmd.run_stdout']('mount -v').split('\n'):
comps = re.sub(r"\s+", " ", line).split()
parens = re.findall(r'\((.*?)\)', line, re.DOTALL)
if len(parens) > 1:
nod = __salt... | python | def _active_mounts_openbsd(ret):
'''
List active mounts on OpenBSD systems
'''
for line in __salt__['cmd.run_stdout']('mount -v').split('\n'):
comps = re.sub(r"\s+", " ", line).split()
parens = re.findall(r'\((.*?)\)', line, re.DOTALL)
if len(parens) > 1:
nod = __salt... | [
"def",
"_active_mounts_openbsd",
"(",
"ret",
")",
":",
"for",
"line",
"in",
"__salt__",
"[",
"'cmd.run_stdout'",
"]",
"(",
"'mount -v'",
")",
".",
"split",
"(",
"'\\n'",
")",
":",
"comps",
"=",
"re",
".",
"sub",
"(",
"r\"\\s+\"",
",",
"\" \"",
",",
"li... | List active mounts on OpenBSD systems | [
"List",
"active",
"mounts",
"on",
"OpenBSD",
"systems"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L179-L199 | train | List active mounts on OpenBSD systems | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/modules/mount.py | _active_mounts_darwin | def _active_mounts_darwin(ret):
'''
List active mounts on Mac OS systems
'''
for line in __salt__['cmd.run_stdout']('mount').split('\n'):
comps = re.sub(r"\s+", " ", line).split()
parens = re.findall(r'\((.*?)\)', line, re.DOTALL)[0].split(", ")
ret[comps[2]] = {'device': comps[0... | python | def _active_mounts_darwin(ret):
'''
List active mounts on Mac OS systems
'''
for line in __salt__['cmd.run_stdout']('mount').split('\n'):
comps = re.sub(r"\s+", " ", line).split()
parens = re.findall(r'\((.*?)\)', line, re.DOTALL)[0].split(", ")
ret[comps[2]] = {'device': comps[0... | [
"def",
"_active_mounts_darwin",
"(",
"ret",
")",
":",
"for",
"line",
"in",
"__salt__",
"[",
"'cmd.run_stdout'",
"]",
"(",
"'mount'",
")",
".",
"split",
"(",
"'\\n'",
")",
":",
"comps",
"=",
"re",
".",
"sub",
"(",
"r\"\\s+\"",
",",
"\" \"",
",",
"line",... | List active mounts on Mac OS systems | [
"List",
"active",
"mounts",
"on",
"Mac",
"OS",
"systems"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L202-L212 | train | List active mounts on Mac OS systems
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/modules/mount.py | _resolve_user_group_names | def _resolve_user_group_names(opts):
'''
Resolve user and group names in related opts
'''
name_id_opts = {'uid': 'user.info',
'gid': 'group.info'}
for ind, opt in enumerate(opts):
if opt.split('=')[0] in name_id_opts:
_givenid = opt.split('=')[1]
_... | python | def _resolve_user_group_names(opts):
'''
Resolve user and group names in related opts
'''
name_id_opts = {'uid': 'user.info',
'gid': 'group.info'}
for ind, opt in enumerate(opts):
if opt.split('=')[0] in name_id_opts:
_givenid = opt.split('=')[1]
_... | [
"def",
"_resolve_user_group_names",
"(",
"opts",
")",
":",
"name_id_opts",
"=",
"{",
"'uid'",
":",
"'user.info'",
",",
"'gid'",
":",
"'group.info'",
"}",
"for",
"ind",
",",
"opt",
"in",
"enumerate",
"(",
"opts",
")",
":",
"if",
"opt",
".",
"split",
"(",
... | Resolve user and group names in related opts | [
"Resolve",
"user",
"and",
"group",
"names",
"in",
"related",
"opts"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L215-L232 | train | Resolve user and group names in related opts
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/modules/mount.py | active | def active(extended=False):
'''
List the active mounts.
CLI Example:
.. code-block:: bash
salt '*' mount.active
'''
ret = {}
if __grains__['os'] == 'FreeBSD':
_active_mounts_freebsd(ret)
elif 'AIX' in __grains__['kernel']:
_active_mounts_aix(ret)
elif __gra... | python | def active(extended=False):
'''
List the active mounts.
CLI Example:
.. code-block:: bash
salt '*' mount.active
'''
ret = {}
if __grains__['os'] == 'FreeBSD':
_active_mounts_freebsd(ret)
elif 'AIX' in __grains__['kernel']:
_active_mounts_aix(ret)
elif __gra... | [
"def",
"active",
"(",
"extended",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"__grains__",
"[",
"'os'",
"]",
"==",
"'FreeBSD'",
":",
"_active_mounts_freebsd",
"(",
"ret",
")",
"elif",
"'AIX'",
"in",
"__grains__",
"[",
"'kernel'",
"]",
":",
"_a... | List the active mounts.
CLI Example:
.. code-block:: bash
salt '*' mount.active | [
"List",
"the",
"active",
"mounts",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L235-L264 | train | Return the active mounts. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/modules/mount.py | fstab | def fstab(config='/etc/fstab'):
'''
.. versionchanged:: 2016.3.2
List the contents of the fstab
CLI Example:
.. code-block:: bash
salt '*' mount.fstab
'''
ret = {}
if not os.path.isfile(config):
return ret
with salt.utils.files.fopen(config) as ifile:
for ... | python | def fstab(config='/etc/fstab'):
'''
.. versionchanged:: 2016.3.2
List the contents of the fstab
CLI Example:
.. code-block:: bash
salt '*' mount.fstab
'''
ret = {}
if not os.path.isfile(config):
return ret
with salt.utils.files.fopen(config) as ifile:
for ... | [
"def",
"fstab",
"(",
"config",
"=",
"'/etc/fstab'",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"config",
")",
":",
"return",
"ret",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"config",
... | .. versionchanged:: 2016.3.2
List the contents of the fstab
CLI Example:
.. code-block:: bash
salt '*' mount.fstab | [
"..",
"versionchanged",
"::",
"2016",
".",
"3",
".",
"2"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L577-L617 | train | Return the contents of the fstab file | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/modules/mount.py | rm_fstab | def rm_fstab(name, device, config='/etc/fstab'):
'''
.. versionchanged:: 2016.3.2
Remove the mount point from the fstab
CLI Example:
.. code-block:: bash
salt '*' mount.rm_fstab /mnt/foo /dev/sdg
'''
modified = False
if __grains__['kernel'] == 'SunOS':
criteria = _vf... | python | def rm_fstab(name, device, config='/etc/fstab'):
'''
.. versionchanged:: 2016.3.2
Remove the mount point from the fstab
CLI Example:
.. code-block:: bash
salt '*' mount.rm_fstab /mnt/foo /dev/sdg
'''
modified = False
if __grains__['kernel'] == 'SunOS':
criteria = _vf... | [
"def",
"rm_fstab",
"(",
"name",
",",
"device",
",",
"config",
"=",
"'/etc/fstab'",
")",
":",
"modified",
"=",
"False",
"if",
"__grains__",
"[",
"'kernel'",
"]",
"==",
"'SunOS'",
":",
"criteria",
"=",
"_vfstab_entry",
"(",
"name",
"=",
"name",
",",
"devic... | .. versionchanged:: 2016.3.2
Remove the mount point from the fstab
CLI Example:
.. code-block:: bash
salt '*' mount.rm_fstab /mnt/foo /dev/sdg | [
"..",
"versionchanged",
"::",
"2016",
".",
"3",
".",
"2"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L636-L685 | train | Remove the mount point from the fstab | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/modules/mount.py | set_fstab | def set_fstab(
name,
device,
fstype,
opts='defaults',
dump=0,
pass_num=0,
config='/etc/fstab',
test=False,
match_on='auto',
**kwargs):
'''
Verify that this mount is represented in the fstab, change the mount
to match the data pa... | python | def set_fstab(
name,
device,
fstype,
opts='defaults',
dump=0,
pass_num=0,
config='/etc/fstab',
test=False,
match_on='auto',
**kwargs):
'''
Verify that this mount is represented in the fstab, change the mount
to match the data pa... | [
"def",
"set_fstab",
"(",
"name",
",",
"device",
",",
"fstype",
",",
"opts",
"=",
"'defaults'",
",",
"dump",
"=",
"0",
",",
"pass_num",
"=",
"0",
",",
"config",
"=",
"'/etc/fstab'",
",",
"test",
"=",
"False",
",",
"match_on",
"=",
"'auto'",
",",
"*",
... | Verify that this mount is represented in the fstab, change the mount
to match the data passed, or add the mount if it is not present.
CLI Example:
.. code-block:: bash
salt '*' mount.set_fstab /mnt/foo /dev/sdz1 ext4 | [
"Verify",
"that",
"this",
"mount",
"is",
"represented",
"in",
"the",
"fstab",
"change",
"the",
"mount",
"to",
"match",
"the",
"data",
"passed",
"or",
"add",
"the",
"mount",
"if",
"it",
"is",
"not",
"present",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L704-L826 | train | Set the fstab entry for the specified mount. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/modules/mount.py | rm_automaster | def rm_automaster(name, device, config='/etc/auto_salt'):
'''
Remove the mount point from the auto_master
CLI Example:
.. code-block:: bash
salt '*' mount.rm_automaster /mnt/foo /dev/sdg
'''
contents = automaster(config)
if name not in contents:
return True
# The entry... | python | def rm_automaster(name, device, config='/etc/auto_salt'):
'''
Remove the mount point from the auto_master
CLI Example:
.. code-block:: bash
salt '*' mount.rm_automaster /mnt/foo /dev/sdg
'''
contents = automaster(config)
if name not in contents:
return True
# The entry... | [
"def",
"rm_automaster",
"(",
"name",
",",
"device",
",",
"config",
"=",
"'/etc/auto_salt'",
")",
":",
"contents",
"=",
"automaster",
"(",
"config",
")",
"if",
"name",
"not",
"in",
"contents",
":",
"return",
"True",
"# The entry is present, get rid of it",
"lines... | Remove the mount point from the auto_master
CLI Example:
.. code-block:: bash
salt '*' mount.rm_automaster /mnt/foo /dev/sdg | [
"Remove",
"the",
"mount",
"point",
"from",
"the",
"auto_master"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L958-L1016 | train | Remove the mount point from the auto_master | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/modules/mount.py | set_automaster | def set_automaster(
name,
device,
fstype,
opts='',
config='/etc/auto_salt',
test=False,
**kwargs):
'''
Verify that this mount is represented in the auto_salt, change the mount
to match the data passed, or add the mount if it is not present.
CLI Ex... | python | def set_automaster(
name,
device,
fstype,
opts='',
config='/etc/auto_salt',
test=False,
**kwargs):
'''
Verify that this mount is represented in the auto_salt, change the mount
to match the data passed, or add the mount if it is not present.
CLI Ex... | [
"def",
"set_automaster",
"(",
"name",
",",
"device",
",",
"fstype",
",",
"opts",
"=",
"''",
",",
"config",
"=",
"'/etc/auto_salt'",
",",
"test",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# Fix the opts type if it is a list",
"if",
"isinstance",
"(",
... | Verify that this mount is represented in the auto_salt, change the mount
to match the data passed, or add the mount if it is not present.
CLI Example:
.. code-block:: bash
salt '*' mount.set_automaster /mnt/foo /dev/sdz1 ext4 | [
"Verify",
"that",
"this",
"mount",
"is",
"represented",
"in",
"the",
"auto_salt",
"change",
"the",
"mount",
"to",
"match",
"the",
"data",
"passed",
"or",
"add",
"the",
"mount",
"if",
"it",
"is",
"not",
"present",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L1019-L1136 | train | Set the auto_master file for the specified mount. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/modules/mount.py | mount | def mount(name, device, mkmnt=False, fstype='', opts='defaults', user=None, util='mount'):
'''
Mount a device
CLI Example:
.. code-block:: bash
salt '*' mount.mount /mnt/foo /dev/sdz1 True
'''
if util != 'mount':
# This functionality used to live in img.mount_image
if ... | python | def mount(name, device, mkmnt=False, fstype='', opts='defaults', user=None, util='mount'):
'''
Mount a device
CLI Example:
.. code-block:: bash
salt '*' mount.mount /mnt/foo /dev/sdz1 True
'''
if util != 'mount':
# This functionality used to live in img.mount_image
if ... | [
"def",
"mount",
"(",
"name",
",",
"device",
",",
"mkmnt",
"=",
"False",
",",
"fstype",
"=",
"''",
",",
"opts",
"=",
"'defaults'",
",",
"user",
"=",
"None",
",",
"util",
"=",
"'mount'",
")",
":",
"if",
"util",
"!=",
"'mount'",
":",
"# This functionali... | Mount a device
CLI Example:
.. code-block:: bash
salt '*' mount.mount /mnt/foo /dev/sdz1 True | [
"Mount",
"a",
"device"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L1177-L1230 | train | Mounts a device and returns the new device path | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/modules/mount.py | remount | def remount(name, device, mkmnt=False, fstype='', opts='defaults', user=None):
'''
Attempt to remount a device, if the device is not already mounted, mount
is called
CLI Example:
.. code-block:: bash
salt '*' mount.remount /mnt/foo /dev/sdz1 True
'''
force_mount = False
if __g... | python | def remount(name, device, mkmnt=False, fstype='', opts='defaults', user=None):
'''
Attempt to remount a device, if the device is not already mounted, mount
is called
CLI Example:
.. code-block:: bash
salt '*' mount.remount /mnt/foo /dev/sdz1 True
'''
force_mount = False
if __g... | [
"def",
"remount",
"(",
"name",
",",
"device",
",",
"mkmnt",
"=",
"False",
",",
"fstype",
"=",
"''",
",",
"opts",
"=",
"'defaults'",
",",
"user",
"=",
"None",
")",
":",
"force_mount",
"=",
"False",
"if",
"__grains__",
"[",
"'os'",
"]",
"in",
"[",
"'... | Attempt to remount a device, if the device is not already mounted, mount
is called
CLI Example:
.. code-block:: bash
salt '*' mount.remount /mnt/foo /dev/sdz1 True | [
"Attempt",
"to",
"remount",
"a",
"device",
"if",
"the",
"device",
"is",
"not",
"already",
"mounted",
"mount",
"is",
"called"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L1233-L1288 | train | Mounts a specific mount point on the given device. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/modules/mount.py | umount | def umount(name, device=None, user=None, util='mount'):
'''
Attempt to unmount a device by specifying the directory it is mounted on
CLI Example:
.. code-block:: bash
salt '*' mount.umount /mnt/foo
.. versionadded:: 2015.5.0
.. code-block:: bash
salt '*' mount.umount /mnt/fo... | python | def umount(name, device=None, user=None, util='mount'):
'''
Attempt to unmount a device by specifying the directory it is mounted on
CLI Example:
.. code-block:: bash
salt '*' mount.umount /mnt/foo
.. versionadded:: 2015.5.0
.. code-block:: bash
salt '*' mount.umount /mnt/fo... | [
"def",
"umount",
"(",
"name",
",",
"device",
"=",
"None",
",",
"user",
"=",
"None",
",",
"util",
"=",
"'mount'",
")",
":",
"if",
"util",
"!=",
"'mount'",
":",
"# This functionality used to live in img.umount_image",
"if",
"'qemu_nbd.clear'",
"in",
"__salt__",
... | Attempt to unmount a device by specifying the directory it is mounted on
CLI Example:
.. code-block:: bash
salt '*' mount.umount /mnt/foo
.. versionadded:: 2015.5.0
.. code-block:: bash
salt '*' mount.umount /mnt/foo /dev/xvdc1 | [
"Attempt",
"to",
"unmount",
"a",
"device",
"by",
"specifying",
"the",
"directory",
"it",
"is",
"mounted",
"on"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L1291-L1324 | train | Unmount a virtual image on a specific device | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/modules/mount.py | is_fuse_exec | def is_fuse_exec(cmd):
'''
Returns true if the command passed is a fuse mountable application.
CLI Example:
.. code-block:: bash
salt '*' mount.is_fuse_exec sshfs
'''
cmd_path = salt.utils.path.which(cmd)
# No point in running ldd on a command that doesn't exist
if not cmd_pa... | python | def is_fuse_exec(cmd):
'''
Returns true if the command passed is a fuse mountable application.
CLI Example:
.. code-block:: bash
salt '*' mount.is_fuse_exec sshfs
'''
cmd_path = salt.utils.path.which(cmd)
# No point in running ldd on a command that doesn't exist
if not cmd_pa... | [
"def",
"is_fuse_exec",
"(",
"cmd",
")",
":",
"cmd_path",
"=",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"cmd",
")",
"# No point in running ldd on a command that doesn't exist",
"if",
"not",
"cmd_path",
":",
"return",
"False",
"elif",
"not",
"salt",
... | Returns true if the command passed is a fuse mountable application.
CLI Example:
.. code-block:: bash
salt '*' mount.is_fuse_exec sshfs | [
"Returns",
"true",
"if",
"the",
"command",
"passed",
"is",
"a",
"fuse",
"mountable",
"application",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L1327-L1346 | train | Returns true if the passed command is a fuse mountable application. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/modules/mount.py | swaps | def swaps():
'''
Return a dict containing information on active swap
.. versionchanged:: 2016.3.2
CLI Example:
.. code-block:: bash
salt '*' mount.swaps
'''
ret = {}
if __grains__['kernel'] == 'SunOS':
for line in __salt__['cmd.run_stdout']('swap -l').splitlines():
... | python | def swaps():
'''
Return a dict containing information on active swap
.. versionchanged:: 2016.3.2
CLI Example:
.. code-block:: bash
salt '*' mount.swaps
'''
ret = {}
if __grains__['kernel'] == 'SunOS':
for line in __salt__['cmd.run_stdout']('swap -l').splitlines():
... | [
"def",
"swaps",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"__grains__",
"[",
"'kernel'",
"]",
"==",
"'SunOS'",
":",
"for",
"line",
"in",
"__salt__",
"[",
"'cmd.run_stdout'",
"]",
"(",
"'swap -l'",
")",
".",
"splitlines",
"(",
")",
":",
"if",
"line",... | Return a dict containing information on active swap
.. versionchanged:: 2016.3.2
CLI Example:
.. code-block:: bash
salt '*' mount.swaps | [
"Return",
"a",
"dict",
"containing",
"information",
"on",
"active",
"swap"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L1349-L1405 | train | Return a dict containing information on active swap items | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/modules/mount.py | swapon | def swapon(name, priority=None):
'''
Activate a swap disk
.. versionchanged:: 2016.3.2
CLI Example:
.. code-block:: bash
salt '*' mount.swapon /root/swapfile
'''
ret = {}
on_ = swaps()
if name in on_:
ret['stats'] = on_[name]
ret['new'] = False
ret... | python | def swapon(name, priority=None):
'''
Activate a swap disk
.. versionchanged:: 2016.3.2
CLI Example:
.. code-block:: bash
salt '*' mount.swapon /root/swapfile
'''
ret = {}
on_ = swaps()
if name in on_:
ret['stats'] = on_[name]
ret['new'] = False
ret... | [
"def",
"swapon",
"(",
"name",
",",
"priority",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"on_",
"=",
"swaps",
"(",
")",
"if",
"name",
"in",
"on_",
":",
"ret",
"[",
"'stats'",
"]",
"=",
"on_",
"[",
"name",
"]",
"ret",
"[",
"'new'",
"]",
"="... | Activate a swap disk
.. versionchanged:: 2016.3.2
CLI Example:
.. code-block:: bash
salt '*' mount.swapon /root/swapfile | [
"Activate",
"a",
"swap",
"disk"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L1408-L1444 | train | Activate a swap disk
.. versionchanged :: 2016. 3. 2 | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/modules/mount.py | swapoff | def swapoff(name):
'''
Deactivate a named swap mount
.. versionchanged:: 2016.3.2
CLI Example:
.. code-block:: bash
salt '*' mount.swapoff /root/swapfile
'''
on_ = swaps()
if name in on_:
if __grains__['kernel'] == 'SunOS':
if __grains__['virtual'] != 'zon... | python | def swapoff(name):
'''
Deactivate a named swap mount
.. versionchanged:: 2016.3.2
CLI Example:
.. code-block:: bash
salt '*' mount.swapoff /root/swapfile
'''
on_ = swaps()
if name in on_:
if __grains__['kernel'] == 'SunOS':
if __grains__['virtual'] != 'zon... | [
"def",
"swapoff",
"(",
"name",
")",
":",
"on_",
"=",
"swaps",
"(",
")",
"if",
"name",
"in",
"on_",
":",
"if",
"__grains__",
"[",
"'kernel'",
"]",
"==",
"'SunOS'",
":",
"if",
"__grains__",
"[",
"'virtual'",
"]",
"!=",
"'zone'",
":",
"__salt__",
"[",
... | Deactivate a named swap mount
.. versionchanged:: 2016.3.2
CLI Example:
.. code-block:: bash
salt '*' mount.swapoff /root/swapfile | [
"Deactivate",
"a",
"named",
"swap",
"mount"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L1447-L1475 | train | Deactivate a named swap mount
.. versionchanged :: 2016. 3. 2 | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/modules/mount.py | read_mount_cache | def read_mount_cache(name):
'''
.. versionadded:: 2018.3.0
Provide information if the path is mounted
CLI Example:
.. code-block:: bash
salt '*' mount.read_mount_cache /mnt/share
'''
cache = salt.utils.mount.read_cache(__opts__)
if cache:
if 'mounts' in cache and cach... | python | def read_mount_cache(name):
'''
.. versionadded:: 2018.3.0
Provide information if the path is mounted
CLI Example:
.. code-block:: bash
salt '*' mount.read_mount_cache /mnt/share
'''
cache = salt.utils.mount.read_cache(__opts__)
if cache:
if 'mounts' in cache and cach... | [
"def",
"read_mount_cache",
"(",
"name",
")",
":",
"cache",
"=",
"salt",
".",
"utils",
".",
"mount",
".",
"read_cache",
"(",
"__opts__",
")",
"if",
"cache",
":",
"if",
"'mounts'",
"in",
"cache",
"and",
"cache",
"[",
"'mounts'",
"]",
":",
"if",
"name",
... | .. versionadded:: 2018.3.0
Provide information if the path is mounted
CLI Example:
.. code-block:: bash
salt '*' mount.read_mount_cache /mnt/share | [
"..",
"versionadded",
"::",
"2018",
".",
"3",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L1497-L1514 | train | Return the mounted item if it exists | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/modules/mount.py | write_mount_cache | def write_mount_cache(real_name,
device,
mkmnt,
fstype,
mount_opts):
'''
.. versionadded:: 2018.3.0
Provide information if the path is mounted
:param real_name: The real name of the mount point where the device... | python | def write_mount_cache(real_name,
device,
mkmnt,
fstype,
mount_opts):
'''
.. versionadded:: 2018.3.0
Provide information if the path is mounted
:param real_name: The real name of the mount point where the device... | [
"def",
"write_mount_cache",
"(",
"real_name",
",",
"device",
",",
"mkmnt",
",",
"fstype",
",",
"mount_opts",
")",
":",
"cache",
"=",
"salt",
".",
"utils",
".",
"mount",
".",
"read_cache",
"(",
"__opts__",
")",
"if",
"not",
"cache",
":",
"cache",
"=",
"... | .. versionadded:: 2018.3.0
Provide information if the path is mounted
:param real_name: The real name of the mount point where the device is mounted.
:param device: The device that is being mounted.
:param mkmnt: Whether or not the mount point should be created.
:param fstype: ... | [
"..",
"versionadded",
"::",
"2018",
".",
"3",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L1517-L1558 | train | Write the mount cache for a given device. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/modules/mount.py | delete_mount_cache | def delete_mount_cache(real_name):
'''
.. versionadded:: 2018.3.0
Provide information if the path is mounted
CLI Example:
.. code-block:: bash
salt '*' mount.delete_mount_cache /mnt/share
'''
cache = salt.utils.mount.read_cache(__opts__)
if cache:
if 'mounts' in cach... | python | def delete_mount_cache(real_name):
'''
.. versionadded:: 2018.3.0
Provide information if the path is mounted
CLI Example:
.. code-block:: bash
salt '*' mount.delete_mount_cache /mnt/share
'''
cache = salt.utils.mount.read_cache(__opts__)
if cache:
if 'mounts' in cach... | [
"def",
"delete_mount_cache",
"(",
"real_name",
")",
":",
"cache",
"=",
"salt",
".",
"utils",
".",
"mount",
".",
"read_cache",
"(",
"__opts__",
")",
"if",
"cache",
":",
"if",
"'mounts'",
"in",
"cache",
":",
"if",
"real_name",
"in",
"cache",
"[",
"'mounts'... | .. versionadded:: 2018.3.0
Provide information if the path is mounted
CLI Example:
.. code-block:: bash
salt '*' mount.delete_mount_cache /mnt/share | [
"..",
"versionadded",
"::",
"2018",
".",
"3",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L1561-L1582 | train | Delete the mount cache for the specified real_name | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/modules/mount.py | _filesystems | def _filesystems(config='/etc/filesystems', leading_key=True):
'''
Return the contents of the filesystems in an OrderedDict
config
File containing filesystem infomation
leading_key
True return dictionary keyed by 'name' and value as dictionary with other keys, values (name excluded)... | python | def _filesystems(config='/etc/filesystems', leading_key=True):
'''
Return the contents of the filesystems in an OrderedDict
config
File containing filesystem infomation
leading_key
True return dictionary keyed by 'name' and value as dictionary with other keys, values (name excluded)... | [
"def",
"_filesystems",
"(",
"config",
"=",
"'/etc/filesystems'",
",",
"leading_key",
"=",
"True",
")",
":",
"ret",
"=",
"OrderedDict",
"(",
")",
"lines",
"=",
"[",
"]",
"parsing_block",
"=",
"False",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
... | Return the contents of the filesystems in an OrderedDict
config
File containing filesystem infomation
leading_key
True return dictionary keyed by 'name' and value as dictionary with other keys, values (name excluded)
OrderedDict({ '/dir' : OrderedDict({'dev': '/dev/hd8', ...... | [
"Return",
"the",
"contents",
"of",
"the",
"filesystems",
"in",
"an",
"OrderedDict"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L1585-L1639 | train | Return the contents of the filesystems in an OrderedDict | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
saltstack/salt | salt/modules/mount.py | filesystems | def filesystems(config='/etc/filesystems'):
'''
.. versionadded:: 2018.3.3
List the contents of the filesystems
CLI Example:
.. code-block:: bash
salt '*' mount.filesystems
'''
ret = {}
if 'AIX' not in __grains__['kernel']:
return ret
ret_dict = _filesystems(conf... | python | def filesystems(config='/etc/filesystems'):
'''
.. versionadded:: 2018.3.3
List the contents of the filesystems
CLI Example:
.. code-block:: bash
salt '*' mount.filesystems
'''
ret = {}
if 'AIX' not in __grains__['kernel']:
return ret
ret_dict = _filesystems(conf... | [
"def",
"filesystems",
"(",
"config",
"=",
"'/etc/filesystems'",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"'AIX'",
"not",
"in",
"__grains__",
"[",
"'kernel'",
"]",
":",
"return",
"ret",
"ret_dict",
"=",
"_filesystems",
"(",
"config",
")",
"if",
"ret_dict",
"... | .. versionadded:: 2018.3.3
List the contents of the filesystems
CLI Example:
.. code-block:: bash
salt '*' mount.filesystems | [
"..",
"versionadded",
"::",
"2018",
".",
"3",
".",
"3"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L1642-L1663 | train | Return the contents of the filesystems | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.