id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
36,000 | saltstack/salt | salt/modules/djangomod.py | collectstatic | def collectstatic(settings_module,
bin_env=None,
no_post_process=False,
ignore=None,
dry_run=False,
clear=False,
link=False,
no_default_ignore=False,
pythonpath=None,
... | python | def collectstatic(settings_module,
bin_env=None,
no_post_process=False,
ignore=None,
dry_run=False,
clear=False,
link=False,
no_default_ignore=False,
pythonpath=None,
... | [
"def",
"collectstatic",
"(",
"settings_module",
",",
"bin_env",
"=",
"None",
",",
"no_post_process",
"=",
"False",
",",
"ignore",
"=",
"None",
",",
"dry_run",
"=",
"False",
",",
"clear",
"=",
"False",
",",
"link",
"=",
"False",
",",
"no_default_ignore",
"=... | Collect static files from each of your applications into a single location
that can easily be served in production.
CLI Example:
.. code-block:: bash
salt '*' django.collectstatic <settings_module> | [
"Collect",
"static",
"files",
"from",
"each",
"of",
"your",
"applications",
"into",
"a",
"single",
"location",
"that",
"can",
"easily",
"be",
"served",
"in",
"production",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/djangomod.py#L283-L325 |
36,001 | saltstack/salt | salt/modules/nfs3.py | list_exports | def list_exports(exports='/etc/exports'):
'''
List configured exports
CLI Example:
.. code-block:: bash
salt '*' nfs.list_exports
'''
ret = {}
with salt.utils.files.fopen(exports, 'r') as efl:
for line in salt.utils.stringutils.to_unicode(efl.read()).splitlines():
... | python | def list_exports(exports='/etc/exports'):
'''
List configured exports
CLI Example:
.. code-block:: bash
salt '*' nfs.list_exports
'''
ret = {}
with salt.utils.files.fopen(exports, 'r') as efl:
for line in salt.utils.stringutils.to_unicode(efl.read()).splitlines():
... | [
"def",
"list_exports",
"(",
"exports",
"=",
"'/etc/exports'",
")",
":",
"ret",
"=",
"{",
"}",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"exports",
",",
"'r'",
")",
"as",
"efl",
":",
"for",
"line",
"in",
"salt",
".",
"utils",
".... | List configured exports
CLI Example:
.. code-block:: bash
salt '*' nfs.list_exports | [
"List",
"configured",
"exports"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nfs3.py#L28-L66 |
36,002 | saltstack/salt | salt/modules/nfs3.py | del_export | def del_export(exports='/etc/exports', path=None):
'''
Remove an export
CLI Example:
.. code-block:: bash
salt '*' nfs.del_export /media/storage
'''
edict = list_exports(exports)
del edict[path]
_write_exports(exports, edict)
return edict | python | def del_export(exports='/etc/exports', path=None):
'''
Remove an export
CLI Example:
.. code-block:: bash
salt '*' nfs.del_export /media/storage
'''
edict = list_exports(exports)
del edict[path]
_write_exports(exports, edict)
return edict | [
"def",
"del_export",
"(",
"exports",
"=",
"'/etc/exports'",
",",
"path",
"=",
"None",
")",
":",
"edict",
"=",
"list_exports",
"(",
"exports",
")",
"del",
"edict",
"[",
"path",
"]",
"_write_exports",
"(",
"exports",
",",
"edict",
")",
"return",
"edict"
] | Remove an export
CLI Example:
.. code-block:: bash
salt '*' nfs.del_export /media/storage | [
"Remove",
"an",
"export"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nfs3.py#L69-L82 |
36,003 | saltstack/salt | salt/modules/nfs3.py | add_export | def add_export(exports='/etc/exports', path=None, hosts=None, options=None):
'''
Add an export
CLI Example:
.. code-block:: bash
salt '*' nfs3.add_export path='/srv/test' hosts='127.0.0.1' options=['rw']
'''
if options is None:
options = []
if not isinstance(hosts, six.str... | python | def add_export(exports='/etc/exports', path=None, hosts=None, options=None):
'''
Add an export
CLI Example:
.. code-block:: bash
salt '*' nfs3.add_export path='/srv/test' hosts='127.0.0.1' options=['rw']
'''
if options is None:
options = []
if not isinstance(hosts, six.str... | [
"def",
"add_export",
"(",
"exports",
"=",
"'/etc/exports'",
",",
"path",
"=",
"None",
",",
"hosts",
"=",
"None",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"[",
"]",
"if",
"not",
"isinstance",
"(",
"hos... | Add an export
CLI Example:
.. code-block:: bash
salt '*' nfs3.add_export path='/srv/test' hosts='127.0.0.1' options=['rw'] | [
"Add",
"an",
"export"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nfs3.py#L85-L107 |
36,004 | saltstack/salt | salt/modules/nfs3.py | _write_exports | def _write_exports(exports, edict):
'''
Write an exports file to disk
If multiple shares were initially configured per line, like:
/media/storage /media/data *(ro,sync,no_subtree_check)
...then they will be saved to disk with only one share per line:
/media/storage *(ro,sync,no_subtr... | python | def _write_exports(exports, edict):
'''
Write an exports file to disk
If multiple shares were initially configured per line, like:
/media/storage /media/data *(ro,sync,no_subtree_check)
...then they will be saved to disk with only one share per line:
/media/storage *(ro,sync,no_subtr... | [
"def",
"_write_exports",
"(",
"exports",
",",
"edict",
")",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"exports",
",",
"'w'",
")",
"as",
"efh",
":",
"for",
"export",
"in",
"edict",
":",
"line",
"=",
"salt",
".",
"utils",
".... | Write an exports file to disk
If multiple shares were initially configured per line, like:
/media/storage /media/data *(ro,sync,no_subtree_check)
...then they will be saved to disk with only one share per line:
/media/storage *(ro,sync,no_subtree_check)
/media/data *(ro,sync,no_subtr... | [
"Write",
"an",
"exports",
"file",
"to",
"disk"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nfs3.py#L110-L130 |
36,005 | saltstack/salt | salt/modules/nfs3.py | reload_exports | def reload_exports():
'''
Trigger a reload of the exports file to apply changes
CLI Example:
.. code-block:: bash
salt '*' nfs3.reload_exports
'''
ret = {}
command = 'exportfs -r'
output = __salt__['cmd.run_all'](command)
ret['stdout'] = output['stdout']
ret['stderr'... | python | def reload_exports():
'''
Trigger a reload of the exports file to apply changes
CLI Example:
.. code-block:: bash
salt '*' nfs3.reload_exports
'''
ret = {}
command = 'exportfs -r'
output = __salt__['cmd.run_all'](command)
ret['stdout'] = output['stdout']
ret['stderr'... | [
"def",
"reload_exports",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"command",
"=",
"'exportfs -r'",
"output",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"command",
")",
"ret",
"[",
"'stdout'",
"]",
"=",
"output",
"[",
"'stdout'",
"]",
"ret",
"[",
"'st... | Trigger a reload of the exports file to apply changes
CLI Example:
.. code-block:: bash
salt '*' nfs3.reload_exports | [
"Trigger",
"a",
"reload",
"of",
"the",
"exports",
"file",
"to",
"apply",
"changes"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nfs3.py#L133-L154 |
36,006 | saltstack/salt | salt/states/docker_image.py | mod_watch | def mod_watch(name, sfun=None, **kwargs):
'''
The docker_image watcher, called to invoke the watch command.
.. note::
This state exists to support special handling of the ``watch``
:ref:`requisite <requisites>`. It should not be called directly.
Parameters for this function should... | python | def mod_watch(name, sfun=None, **kwargs):
'''
The docker_image watcher, called to invoke the watch command.
.. note::
This state exists to support special handling of the ``watch``
:ref:`requisite <requisites>`. It should not be called directly.
Parameters for this function should... | [
"def",
"mod_watch",
"(",
"name",
",",
"sfun",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"sfun",
"==",
"'present'",
":",
"# Force image to be updated",
"kwargs",
"[",
"'force'",
"]",
"=",
"True",
"return",
"present",
"(",
"name",
",",
"*",
"... | The docker_image watcher, called to invoke the watch command.
.. note::
This state exists to support special handling of the ``watch``
:ref:`requisite <requisites>`. It should not be called directly.
Parameters for this function should be set by the state being triggered. | [
"The",
"docker_image",
"watcher",
"called",
"to",
"invoke",
"the",
"watch",
"command",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/docker_image.py#L505-L524 |
36,007 | saltstack/salt | salt/output/nested.py | output | def output(ret, **kwargs):
'''
Display ret data
'''
# Prefer kwargs before opts
retcode = kwargs.get('_retcode', 0)
base_indent = kwargs.get('nested_indent', 0) \
or __opts__.get('nested_indent', 0)
nest = NestDisplay(retcode=retcode)
lines = nest.display(ret, base_indent, '', []... | python | def output(ret, **kwargs):
'''
Display ret data
'''
# Prefer kwargs before opts
retcode = kwargs.get('_retcode', 0)
base_indent = kwargs.get('nested_indent', 0) \
or __opts__.get('nested_indent', 0)
nest = NestDisplay(retcode=retcode)
lines = nest.display(ret, base_indent, '', []... | [
"def",
"output",
"(",
"ret",
",",
"*",
"*",
"kwargs",
")",
":",
"# Prefer kwargs before opts",
"retcode",
"=",
"kwargs",
".",
"get",
"(",
"'_retcode'",
",",
"0",
")",
"base_indent",
"=",
"kwargs",
".",
"get",
"(",
"'nested_indent'",
",",
"0",
")",
"or",
... | Display ret data | [
"Display",
"ret",
"data"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/nested.py#L208-L224 |
36,008 | saltstack/salt | salt/utils/mount.py | write_cache | def write_cache(cache, opts):
'''
Write the mount cache file.
'''
cache_file = get_cache(opts)
try:
_cache = salt.utils.stringutils.to_bytes(
salt.utils.yaml.safe_dump(cache)
)
with salt.utils.files.fopen(cache_file, 'wb+') as fp_:
fp_.write(_cache)
... | python | def write_cache(cache, opts):
'''
Write the mount cache file.
'''
cache_file = get_cache(opts)
try:
_cache = salt.utils.stringutils.to_bytes(
salt.utils.yaml.safe_dump(cache)
)
with salt.utils.files.fopen(cache_file, 'wb+') as fp_:
fp_.write(_cache)
... | [
"def",
"write_cache",
"(",
"cache",
",",
"opts",
")",
":",
"cache_file",
"=",
"get_cache",
"(",
"opts",
")",
"try",
":",
"_cache",
"=",
"salt",
".",
"utils",
".",
"stringutils",
".",
"to_bytes",
"(",
"salt",
".",
"utils",
".",
"yaml",
".",
"safe_dump",... | Write the mount cache file. | [
"Write",
"the",
"mount",
"cache",
"file",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/mount.py#L46-L62 |
36,009 | saltstack/salt | salt/modules/iosconfig.py | _get_diff_text | def _get_diff_text(old, new):
'''
Returns the diff of two text blobs.
'''
diff = difflib.unified_diff(old.splitlines(1),
new.splitlines(1))
return ''.join([x.replace('\r', '') for x in diff]) | python | def _get_diff_text(old, new):
'''
Returns the diff of two text blobs.
'''
diff = difflib.unified_diff(old.splitlines(1),
new.splitlines(1))
return ''.join([x.replace('\r', '') for x in diff]) | [
"def",
"_get_diff_text",
"(",
"old",
",",
"new",
")",
":",
"diff",
"=",
"difflib",
".",
"unified_diff",
"(",
"old",
".",
"splitlines",
"(",
"1",
")",
",",
"new",
".",
"splitlines",
"(",
"1",
")",
")",
"return",
"''",
".",
"join",
"(",
"[",
"x",
"... | Returns the diff of two text blobs. | [
"Returns",
"the",
"diff",
"of",
"two",
"text",
"blobs",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iosconfig.py#L116-L122 |
36,010 | saltstack/salt | salt/modules/iosconfig.py | _print_config_text | def _print_config_text(tree, indentation=0):
'''
Return the config as text from a config tree.
'''
config = ''
for key, value in six.iteritems(tree):
config += '{indent}{line}\n'.format(indent=' '*indentation, line=key)
if value:
config += _print_config_text(value, indent... | python | def _print_config_text(tree, indentation=0):
'''
Return the config as text from a config tree.
'''
config = ''
for key, value in six.iteritems(tree):
config += '{indent}{line}\n'.format(indent=' '*indentation, line=key)
if value:
config += _print_config_text(value, indent... | [
"def",
"_print_config_text",
"(",
"tree",
",",
"indentation",
"=",
"0",
")",
":",
"config",
"=",
"''",
"for",
"key",
",",
"value",
"in",
"six",
".",
"iteritems",
"(",
"tree",
")",
":",
"config",
"+=",
"'{indent}{line}\\n'",
".",
"format",
"(",
"indent",
... | Return the config as text from a config tree. | [
"Return",
"the",
"config",
"as",
"text",
"from",
"a",
"config",
"tree",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iosconfig.py#L125-L134 |
36,011 | saltstack/salt | salt/modules/iosconfig.py | tree | def tree(config=None,
path=None,
with_tags=False,
saltenv='base'):
'''
Transform Cisco IOS style configuration to structured Python dictionary.
Depending on the value of the ``with_tags`` argument, this function may
provide different views, valuable in different situations.
... | python | def tree(config=None,
path=None,
with_tags=False,
saltenv='base'):
'''
Transform Cisco IOS style configuration to structured Python dictionary.
Depending on the value of the ``with_tags`` argument, this function may
provide different views, valuable in different situations.
... | [
"def",
"tree",
"(",
"config",
"=",
"None",
",",
"path",
"=",
"None",
",",
"with_tags",
"=",
"False",
",",
"saltenv",
"=",
"'base'",
")",
":",
"if",
"path",
":",
"config",
"=",
"__salt__",
"[",
"'cp.get_file_str'",
"]",
"(",
"path",
",",
"saltenv",
"=... | Transform Cisco IOS style configuration to structured Python dictionary.
Depending on the value of the ``with_tags`` argument, this function may
provide different views, valuable in different situations.
config
The configuration sent as text. This argument is ignored when ``path``
is config... | [
"Transform",
"Cisco",
"IOS",
"style",
"configuration",
"to",
"structured",
"Python",
"dictionary",
".",
"Depending",
"on",
"the",
"value",
"of",
"the",
"with_tags",
"argument",
"this",
"function",
"may",
"provide",
"different",
"views",
"valuable",
"in",
"differen... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iosconfig.py#L141-L179 |
36,012 | saltstack/salt | salt/modules/iosconfig.py | merge_tree | def merge_tree(initial_config=None,
initial_path=None,
merge_config=None,
merge_path=None,
saltenv='base'):
'''
Return the merge tree of the ``initial_config`` with the ``merge_config``,
as a Python dictionary.
initial_config
The initi... | python | def merge_tree(initial_config=None,
initial_path=None,
merge_config=None,
merge_path=None,
saltenv='base'):
'''
Return the merge tree of the ``initial_config`` with the ``merge_config``,
as a Python dictionary.
initial_config
The initi... | [
"def",
"merge_tree",
"(",
"initial_config",
"=",
"None",
",",
"initial_path",
"=",
"None",
",",
"merge_config",
"=",
"None",
",",
"merge_path",
"=",
"None",
",",
"saltenv",
"=",
"'base'",
")",
":",
"merge_tree",
"=",
"tree",
"(",
"config",
"=",
"merge_conf... | Return the merge tree of the ``initial_config`` with the ``merge_config``,
as a Python dictionary.
initial_config
The initial configuration sent as text. This argument is ignored when
``initial_path`` is set.
initial_path
Absolute or remote path from where to load the initial confi... | [
"Return",
"the",
"merge",
"tree",
"of",
"the",
"initial_config",
"with",
"the",
"merge_config",
"as",
"a",
"Python",
"dictionary",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iosconfig.py#L213-L258 |
36,013 | saltstack/salt | salt/modules/iosconfig.py | merge_text | def merge_text(initial_config=None,
initial_path=None,
merge_config=None,
merge_path=None,
saltenv='base'):
'''
Return the merge result of the ``initial_config`` with the ``merge_config``,
as plain text.
initial_config
The initial conf... | python | def merge_text(initial_config=None,
initial_path=None,
merge_config=None,
merge_path=None,
saltenv='base'):
'''
Return the merge result of the ``initial_config`` with the ``merge_config``,
as plain text.
initial_config
The initial conf... | [
"def",
"merge_text",
"(",
"initial_config",
"=",
"None",
",",
"initial_path",
"=",
"None",
",",
"merge_config",
"=",
"None",
",",
"merge_path",
"=",
"None",
",",
"saltenv",
"=",
"'base'",
")",
":",
"candidate_tree",
"=",
"merge_tree",
"(",
"initial_config",
... | Return the merge result of the ``initial_config`` with the ``merge_config``,
as plain text.
initial_config
The initial configuration sent as text. This argument is ignored when
``initial_path`` is set.
initial_path
Absolute or remote path from where to load the initial configuratio... | [
"Return",
"the",
"merge",
"result",
"of",
"the",
"initial_config",
"with",
"the",
"merge_config",
"as",
"plain",
"text",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iosconfig.py#L261-L305 |
36,014 | saltstack/salt | salt/modules/iosconfig.py | merge_diff | def merge_diff(initial_config=None,
initial_path=None,
merge_config=None,
merge_path=None,
saltenv='base'):
'''
Return the merge diff, as text, after merging the merge config into the
initial config.
initial_config
The initial configur... | python | def merge_diff(initial_config=None,
initial_path=None,
merge_config=None,
merge_path=None,
saltenv='base'):
'''
Return the merge diff, as text, after merging the merge config into the
initial config.
initial_config
The initial configur... | [
"def",
"merge_diff",
"(",
"initial_config",
"=",
"None",
",",
"initial_path",
"=",
"None",
",",
"merge_config",
"=",
"None",
",",
"merge_path",
"=",
"None",
",",
"saltenv",
"=",
"'base'",
")",
":",
"if",
"initial_path",
":",
"initial_config",
"=",
"__salt__"... | Return the merge diff, as text, after merging the merge config into the
initial config.
initial_config
The initial configuration sent as text. This argument is ignored when
``initial_path`` is set.
initial_path
Absolute or remote path from where to load the initial configuration
... | [
"Return",
"the",
"merge",
"diff",
"as",
"text",
"after",
"merging",
"the",
"merge",
"config",
"into",
"the",
"initial",
"config",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iosconfig.py#L308-L355 |
36,015 | saltstack/salt | salt/modules/iosconfig.py | diff_tree | def diff_tree(candidate_config=None,
candidate_path=None,
running_config=None,
running_path=None,
saltenv='base'):
'''
Return the diff, as Python dictionary, between the candidate and the running
configuration.
candidate_config
The candida... | python | def diff_tree(candidate_config=None,
candidate_path=None,
running_config=None,
running_path=None,
saltenv='base'):
'''
Return the diff, as Python dictionary, between the candidate and the running
configuration.
candidate_config
The candida... | [
"def",
"diff_tree",
"(",
"candidate_config",
"=",
"None",
",",
"candidate_path",
"=",
"None",
",",
"running_config",
"=",
"None",
",",
"running_path",
"=",
"None",
",",
"saltenv",
"=",
"'base'",
")",
":",
"candidate_tree",
"=",
"tree",
"(",
"config",
"=",
... | Return the diff, as Python dictionary, between the candidate and the running
configuration.
candidate_config
The candidate configuration sent as text. This argument is ignored when
``candidate_path`` is set.
candidate_path
Absolute or remote path from where to load the candidate co... | [
"Return",
"the",
"diff",
"as",
"Python",
"dictionary",
"between",
"the",
"candidate",
"and",
"the",
"running",
"configuration",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iosconfig.py#L358-L404 |
36,016 | saltstack/salt | salt/modules/iosconfig.py | diff_text | def diff_text(candidate_config=None,
candidate_path=None,
running_config=None,
running_path=None,
saltenv='base'):
'''
Return the diff, as text, between the candidate and the running config.
candidate_config
The candidate configuration sent as... | python | def diff_text(candidate_config=None,
candidate_path=None,
running_config=None,
running_path=None,
saltenv='base'):
'''
Return the diff, as text, between the candidate and the running config.
candidate_config
The candidate configuration sent as... | [
"def",
"diff_text",
"(",
"candidate_config",
"=",
"None",
",",
"candidate_path",
"=",
"None",
",",
"running_config",
"=",
"None",
",",
"running_path",
"=",
"None",
",",
"saltenv",
"=",
"'base'",
")",
":",
"candidate_text",
"=",
"clean",
"(",
"config",
"=",
... | Return the diff, as text, between the candidate and the running config.
candidate_config
The candidate configuration sent as text. This argument is ignored when
``candidate_path`` is set.
candidate_path
Absolute or remote path from where to load the candidate configuration
text... | [
"Return",
"the",
"diff",
"as",
"text",
"between",
"the",
"candidate",
"and",
"the",
"running",
"config",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iosconfig.py#L407-L452 |
36,017 | saltstack/salt | salt/modules/pcs.py | auth | def auth(nodes, pcsuser='hacluster', pcspasswd='hacluster', extra_args=None):
'''
Authorize nodes to the cluster
nodes
a list of nodes which should be authorized to the cluster
pcsuser
user for communitcation with PCS (default: hacluster)
pcspasswd
password for pcsuser (defa... | python | def auth(nodes, pcsuser='hacluster', pcspasswd='hacluster', extra_args=None):
'''
Authorize nodes to the cluster
nodes
a list of nodes which should be authorized to the cluster
pcsuser
user for communitcation with PCS (default: hacluster)
pcspasswd
password for pcsuser (defa... | [
"def",
"auth",
"(",
"nodes",
",",
"pcsuser",
"=",
"'hacluster'",
",",
"pcspasswd",
"=",
"'hacluster'",
",",
"extra_args",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"'pcs'",
",",
"'cluster'",
",",
"'auth'",
"]",
"if",
"pcsuser",
":",
"cmd",
"+=",
"[",
"... | Authorize nodes to the cluster
nodes
a list of nodes which should be authorized to the cluster
pcsuser
user for communitcation with PCS (default: hacluster)
pcspasswd
password for pcsuser (default: hacluster)
extra_args
list of extra option for the \'pcs cluster auth\' c... | [
"Authorize",
"nodes",
"to",
"the",
"cluster"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pcs.py#L133-L164 |
36,018 | saltstack/salt | salt/modules/pcs.py | is_auth | def is_auth(nodes):
'''
Check if nodes are already authorized
nodes
a list of nodes to be checked for authorization to the cluster
CLI Example:
.. code-block:: bash
salt '*' pcs.is_auth nodes='[node1.example.org node2.example.org]'
'''
cmd = ['pcs', 'cluster', 'auth']
... | python | def is_auth(nodes):
'''
Check if nodes are already authorized
nodes
a list of nodes to be checked for authorization to the cluster
CLI Example:
.. code-block:: bash
salt '*' pcs.is_auth nodes='[node1.example.org node2.example.org]'
'''
cmd = ['pcs', 'cluster', 'auth']
... | [
"def",
"is_auth",
"(",
"nodes",
")",
":",
"cmd",
"=",
"[",
"'pcs'",
",",
"'cluster'",
",",
"'auth'",
"]",
"cmd",
"+=",
"nodes",
"return",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
",",
"stdin",
"=",
"'\\n\\n'",
",",
"output_loglevel",
"=",
"'t... | Check if nodes are already authorized
nodes
a list of nodes to be checked for authorization to the cluster
CLI Example:
.. code-block:: bash
salt '*' pcs.is_auth nodes='[node1.example.org node2.example.org]' | [
"Check",
"if",
"nodes",
"are",
"already",
"authorized"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pcs.py#L167-L183 |
36,019 | saltstack/salt | salt/modules/pcs.py | cluster_setup | def cluster_setup(nodes, pcsclustername='pcscluster', extra_args=None):
'''
Setup pacemaker cluster via pcs command
nodes
a list of nodes which should be set up
pcsclustername
Name of the Pacemaker cluster (default: pcscluster)
extra_args
list of extra option for the \'pcs c... | python | def cluster_setup(nodes, pcsclustername='pcscluster', extra_args=None):
'''
Setup pacemaker cluster via pcs command
nodes
a list of nodes which should be set up
pcsclustername
Name of the Pacemaker cluster (default: pcscluster)
extra_args
list of extra option for the \'pcs c... | [
"def",
"cluster_setup",
"(",
"nodes",
",",
"pcsclustername",
"=",
"'pcscluster'",
",",
"extra_args",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"'pcs'",
",",
"'cluster'",
",",
"'setup'",
"]",
"cmd",
"+=",
"[",
"'--name'",
",",
"pcsclustername",
"]",
"cmd",
... | Setup pacemaker cluster via pcs command
nodes
a list of nodes which should be set up
pcsclustername
Name of the Pacemaker cluster (default: pcscluster)
extra_args
list of extra option for the \'pcs cluster setup\' command
CLI Example:
.. code-block:: bash
salt '*'... | [
"Setup",
"pacemaker",
"cluster",
"via",
"pcs",
"command"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pcs.py#L186-L211 |
36,020 | saltstack/salt | salt/modules/pcs.py | cluster_node_add | def cluster_node_add(node, extra_args=None):
'''
Add a node to the pacemaker cluster via pcs command
node
node that should be added
extra_args
list of extra option for the \'pcs cluster node add\' command
CLI Example:
.. code-block:: bash
salt '*' pcs.cluster_node_add... | python | def cluster_node_add(node, extra_args=None):
'''
Add a node to the pacemaker cluster via pcs command
node
node that should be added
extra_args
list of extra option for the \'pcs cluster node add\' command
CLI Example:
.. code-block:: bash
salt '*' pcs.cluster_node_add... | [
"def",
"cluster_node_add",
"(",
"node",
",",
"extra_args",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"'pcs'",
",",
"'cluster'",
",",
"'node'",
",",
"'add'",
"]",
"cmd",
"+=",
"[",
"node",
"]",
"if",
"isinstance",
"(",
"extra_args",
",",
"(",
"list",
",... | Add a node to the pacemaker cluster via pcs command
node
node that should be added
extra_args
list of extra option for the \'pcs cluster node add\' command
CLI Example:
.. code-block:: bash
salt '*' pcs.cluster_node_add node=node2.example.org | [
"Add",
"a",
"node",
"to",
"the",
"pacemaker",
"cluster",
"via",
"pcs",
"command"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pcs.py#L214-L235 |
36,021 | saltstack/salt | salt/modules/pcs.py | cib_create | def cib_create(cibfile, scope='configuration', extra_args=None):
'''
Create a CIB-file from the current CIB of the cluster
cibfile
name/path of the file containing the CIB
scope
specific section of the CIB (default: configuration)
extra_args
additional options for creating t... | python | def cib_create(cibfile, scope='configuration', extra_args=None):
'''
Create a CIB-file from the current CIB of the cluster
cibfile
name/path of the file containing the CIB
scope
specific section of the CIB (default: configuration)
extra_args
additional options for creating t... | [
"def",
"cib_create",
"(",
"cibfile",
",",
"scope",
"=",
"'configuration'",
",",
"extra_args",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"'pcs'",
",",
"'cluster'",
",",
"'cib'",
",",
"cibfile",
"]",
"if",
"isinstance",
"(",
"scope",
",",
"six",
".",
"stri... | Create a CIB-file from the current CIB of the cluster
cibfile
name/path of the file containing the CIB
scope
specific section of the CIB (default: configuration)
extra_args
additional options for creating the CIB-file
CLI Example:
.. code-block:: bash
salt '*' pcs... | [
"Create",
"a",
"CIB",
"-",
"file",
"from",
"the",
"current",
"CIB",
"of",
"the",
"cluster"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pcs.py#L238-L261 |
36,022 | saltstack/salt | salt/modules/pcs.py | prop_show | def prop_show(prop, extra_args=None, cibfile=None):
'''
Show the value of a cluster property
prop
name of the property
extra_args
additional options for the pcs property command
cibfile
use cibfile instead of the live CIB
CLI Example:
.. code-block:: bash
... | python | def prop_show(prop, extra_args=None, cibfile=None):
'''
Show the value of a cluster property
prop
name of the property
extra_args
additional options for the pcs property command
cibfile
use cibfile instead of the live CIB
CLI Example:
.. code-block:: bash
... | [
"def",
"prop_show",
"(",
"prop",
",",
"extra_args",
"=",
"None",
",",
"cibfile",
"=",
"None",
")",
":",
"return",
"item_show",
"(",
"item",
"=",
"'property'",
",",
"item_id",
"=",
"prop",
",",
"extra_args",
"=",
"extra_args",
",",
"cibfile",
"=",
"cibfil... | Show the value of a cluster property
prop
name of the property
extra_args
additional options for the pcs property command
cibfile
use cibfile instead of the live CIB
CLI Example:
.. code-block:: bash
salt '*' pcs.prop_show cibfile='/tmp/2_node_cluster.cib' prop='n... | [
"Show",
"the",
"value",
"of",
"a",
"cluster",
"property"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pcs.py#L306-L323 |
36,023 | saltstack/salt | salt/modules/pcs.py | prop_set | def prop_set(prop, value, extra_args=None, cibfile=None):
'''
Set the value of a cluster property
prop
name of the property
value
value of the property prop
extra_args
additional options for the pcs property command
cibfile
use cibfile instead of the live CIB
... | python | def prop_set(prop, value, extra_args=None, cibfile=None):
'''
Set the value of a cluster property
prop
name of the property
value
value of the property prop
extra_args
additional options for the pcs property command
cibfile
use cibfile instead of the live CIB
... | [
"def",
"prop_set",
"(",
"prop",
",",
"value",
",",
"extra_args",
"=",
"None",
",",
"cibfile",
"=",
"None",
")",
":",
"return",
"item_create",
"(",
"item",
"=",
"'property'",
",",
"item_id",
"=",
"'{0}={1}'",
".",
"format",
"(",
"prop",
",",
"value",
")... | Set the value of a cluster property
prop
name of the property
value
value of the property prop
extra_args
additional options for the pcs property command
cibfile
use cibfile instead of the live CIB
CLI Example:
.. code-block:: bash
salt '*' pcs.prop_se... | [
"Set",
"the",
"value",
"of",
"a",
"cluster",
"property"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pcs.py#L326-L350 |
36,024 | saltstack/salt | salt/modules/pcs.py | stonith_show | def stonith_show(stonith_id, extra_args=None, cibfile=None):
'''
Show the value of a cluster stonith
stonith_id
name for the stonith resource
extra_args
additional options for the pcs stonith command
cibfile
use cibfile instead of the live CIB
CLI Example:
.. code-... | python | def stonith_show(stonith_id, extra_args=None, cibfile=None):
'''
Show the value of a cluster stonith
stonith_id
name for the stonith resource
extra_args
additional options for the pcs stonith command
cibfile
use cibfile instead of the live CIB
CLI Example:
.. code-... | [
"def",
"stonith_show",
"(",
"stonith_id",
",",
"extra_args",
"=",
"None",
",",
"cibfile",
"=",
"None",
")",
":",
"return",
"item_show",
"(",
"item",
"=",
"'stonith'",
",",
"item_id",
"=",
"stonith_id",
",",
"extra_args",
"=",
"extra_args",
",",
"cibfile",
... | Show the value of a cluster stonith
stonith_id
name for the stonith resource
extra_args
additional options for the pcs stonith command
cibfile
use cibfile instead of the live CIB
CLI Example:
.. code-block:: bash
salt '*' pcs.stonith_show stonith_id='eps_fence' ci... | [
"Show",
"the",
"value",
"of",
"a",
"cluster",
"stonith"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pcs.py#L353-L370 |
36,025 | saltstack/salt | salt/modules/pcs.py | stonith_create | def stonith_create(stonith_id, stonith_device_type, stonith_device_options=None, cibfile=None):
'''
Create a stonith resource via pcs command
stonith_id
name for the stonith resource
stonith_device_type
name of the stonith agent fence_eps, fence_xvm f.e.
stonith_device_options
... | python | def stonith_create(stonith_id, stonith_device_type, stonith_device_options=None, cibfile=None):
'''
Create a stonith resource via pcs command
stonith_id
name for the stonith resource
stonith_device_type
name of the stonith agent fence_eps, fence_xvm f.e.
stonith_device_options
... | [
"def",
"stonith_create",
"(",
"stonith_id",
",",
"stonith_device_type",
",",
"stonith_device_options",
"=",
"None",
",",
"cibfile",
"=",
"None",
")",
":",
"return",
"item_create",
"(",
"item",
"=",
"'stonith'",
",",
"item_id",
"=",
"stonith_id",
",",
"item_type"... | Create a stonith resource via pcs command
stonith_id
name for the stonith resource
stonith_device_type
name of the stonith agent fence_eps, fence_xvm f.e.
stonith_device_options
additional options for creating the stonith resource
cibfile
use cibfile instead of the live ... | [
"Create",
"a",
"stonith",
"resource",
"via",
"pcs",
"command"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pcs.py#L373-L397 |
36,026 | saltstack/salt | salt/modules/pcs.py | resource_show | def resource_show(resource_id, extra_args=None, cibfile=None):
'''
Show a resource via pcs command
resource_id
name of the resource
extra_args
additional options for the pcs command
cibfile
use cibfile instead of the live CIB
CLI Example:
.. code-block:: bash
... | python | def resource_show(resource_id, extra_args=None, cibfile=None):
'''
Show a resource via pcs command
resource_id
name of the resource
extra_args
additional options for the pcs command
cibfile
use cibfile instead of the live CIB
CLI Example:
.. code-block:: bash
... | [
"def",
"resource_show",
"(",
"resource_id",
",",
"extra_args",
"=",
"None",
",",
"cibfile",
"=",
"None",
")",
":",
"return",
"item_show",
"(",
"item",
"=",
"'resource'",
",",
"item_id",
"=",
"resource_id",
",",
"extra_args",
"=",
"extra_args",
",",
"cibfile"... | Show a resource via pcs command
resource_id
name of the resource
extra_args
additional options for the pcs command
cibfile
use cibfile instead of the live CIB
CLI Example:
.. code-block:: bash
salt '*' pcs.resource_show resource_id='galera' cibfile='/tmp/cib_for_g... | [
"Show",
"a",
"resource",
"via",
"pcs",
"command"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pcs.py#L400-L417 |
36,027 | saltstack/salt | salt/modules/pcs.py | resource_create | def resource_create(resource_id, resource_type, resource_options=None, cibfile=None):
'''
Create a resource via pcs command
resource_id
name for the resource
resource_type
resource type (f.e. ocf:heartbeat:IPaddr2 or VirtualIP)
resource_options
additional options for creatin... | python | def resource_create(resource_id, resource_type, resource_options=None, cibfile=None):
'''
Create a resource via pcs command
resource_id
name for the resource
resource_type
resource type (f.e. ocf:heartbeat:IPaddr2 or VirtualIP)
resource_options
additional options for creatin... | [
"def",
"resource_create",
"(",
"resource_id",
",",
"resource_type",
",",
"resource_options",
"=",
"None",
",",
"cibfile",
"=",
"None",
")",
":",
"return",
"item_create",
"(",
"item",
"=",
"'resource'",
",",
"item_id",
"=",
"resource_id",
",",
"item_type",
"=",... | Create a resource via pcs command
resource_id
name for the resource
resource_type
resource type (f.e. ocf:heartbeat:IPaddr2 or VirtualIP)
resource_options
additional options for creating the resource
cibfile
use cibfile instead of the live CIB for manipulation
CLI E... | [
"Create",
"a",
"resource",
"via",
"pcs",
"command"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pcs.py#L420-L443 |
36,028 | saltstack/salt | salt/cli/support/console.py | wrap | def wrap(txt, width=80, ident=0):
'''
Wrap text to the required dimensions and clean it up, prepare for display.
:param txt:
:param width:
:return:
'''
ident = ' ' * ident
txt = (txt or '').replace(os.linesep, ' ').strip()
wrapper = textwrap.TextWrapper()
wrapper.fix_sentence_e... | python | def wrap(txt, width=80, ident=0):
'''
Wrap text to the required dimensions and clean it up, prepare for display.
:param txt:
:param width:
:return:
'''
ident = ' ' * ident
txt = (txt or '').replace(os.linesep, ' ').strip()
wrapper = textwrap.TextWrapper()
wrapper.fix_sentence_e... | [
"def",
"wrap",
"(",
"txt",
",",
"width",
"=",
"80",
",",
"ident",
"=",
"0",
")",
":",
"ident",
"=",
"' '",
"*",
"ident",
"txt",
"=",
"(",
"txt",
"or",
"''",
")",
".",
"replace",
"(",
"os",
".",
"linesep",
",",
"' '",
")",
".",
"strip",
"(",
... | Wrap text to the required dimensions and clean it up, prepare for display.
:param txt:
:param width:
:return: | [
"Wrap",
"text",
"to",
"the",
"required",
"dimensions",
"and",
"clean",
"it",
"up",
"prepare",
"for",
"display",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/console.py#L150-L165 |
36,029 | saltstack/salt | salt/cli/support/console.py | IndentOutput.put | def put(self, message, indent=0):
'''
Print message with an indent.
:param message:
:param indent:
:return:
'''
color = self._colors_conf.get(indent + indent % 2, self._colors_conf.get(0, self._default_color))
for chunk in [' ' * indent, self._colors[col... | python | def put(self, message, indent=0):
'''
Print message with an indent.
:param message:
:param indent:
:return:
'''
color = self._colors_conf.get(indent + indent % 2, self._colors_conf.get(0, self._default_color))
for chunk in [' ' * indent, self._colors[col... | [
"def",
"put",
"(",
"self",
",",
"message",
",",
"indent",
"=",
"0",
")",
":",
"color",
"=",
"self",
".",
"_colors_conf",
".",
"get",
"(",
"indent",
"+",
"indent",
"%",
"2",
",",
"self",
".",
"_colors_conf",
".",
"get",
"(",
"0",
",",
"self",
".",... | Print message with an indent.
:param message:
:param indent:
:return: | [
"Print",
"message",
"with",
"an",
"indent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/console.py#L30-L43 |
36,030 | saltstack/salt | salt/cli/support/console.py | MessagesOutput.msg | def msg(self, message, title=None, title_color=None, color='BLUE', ident=0):
'''
Hint message.
:param message:
:param title:
:param title_color:
:param color:
:param ident:
:return:
'''
if title and not title_color:
title_color... | python | def msg(self, message, title=None, title_color=None, color='BLUE', ident=0):
'''
Hint message.
:param message:
:param title:
:param title_color:
:param color:
:param ident:
:return:
'''
if title and not title_color:
title_color... | [
"def",
"msg",
"(",
"self",
",",
"message",
",",
"title",
"=",
"None",
",",
"title_color",
"=",
"None",
",",
"color",
"=",
"'BLUE'",
",",
"ident",
"=",
"0",
")",
":",
"if",
"title",
"and",
"not",
"title_color",
":",
"title_color",
"=",
"color",
"if",
... | Hint message.
:param message:
:param title:
:param title_color:
:param color:
:param ident:
:return: | [
"Hint",
"message",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/console.py#L50-L66 |
36,031 | saltstack/salt | salt/cli/support/console.py | MessagesOutput.highlight | def highlight(self, message, *values, **colors):
'''
Highlighter works the way that message parameter is a template,
the "values" is a list of arguments going one after another as values there.
And so the "colors" should designate either highlight color or alternate for each.
Ex... | python | def highlight(self, message, *values, **colors):
'''
Highlighter works the way that message parameter is a template,
the "values" is a list of arguments going one after another as values there.
And so the "colors" should designate either highlight color or alternate for each.
Ex... | [
"def",
"highlight",
"(",
"self",
",",
"message",
",",
"*",
"values",
",",
"*",
"*",
"colors",
")",
":",
"m_color",
"=",
"colors",
".",
"get",
"(",
"'_main'",
",",
"self",
".",
"_default_color",
")",
"h_color",
"=",
"colors",
".",
"get",
"(",
"'_highl... | Highlighter works the way that message parameter is a template,
the "values" is a list of arguments going one after another as values there.
And so the "colors" should designate either highlight color or alternate for each.
Example:
highlight('Hello {}, there! It is {}.', 'user', 'd... | [
"Highlighter",
"works",
"the",
"way",
"that",
"message",
"parameter",
"is",
"a",
"template",
"the",
"values",
"is",
"a",
"list",
"of",
"arguments",
"going",
"one",
"after",
"another",
"as",
"values",
"there",
".",
"And",
"so",
"the",
"colors",
"should",
"d... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/console.py#L110-L147 |
36,032 | saltstack/salt | salt/modules/nspawn.py | _ensure_exists | def _ensure_exists(wrapped):
'''
Decorator to ensure that the named container exists.
'''
@functools.wraps(wrapped)
def check_exists(name, *args, **kwargs):
if not exists(name):
raise CommandExecutionError(
'Container \'{0}\' does not exist'.format(name)
... | python | def _ensure_exists(wrapped):
'''
Decorator to ensure that the named container exists.
'''
@functools.wraps(wrapped)
def check_exists(name, *args, **kwargs):
if not exists(name):
raise CommandExecutionError(
'Container \'{0}\' does not exist'.format(name)
... | [
"def",
"_ensure_exists",
"(",
"wrapped",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"wrapped",
")",
"def",
"check_exists",
"(",
"name",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"exists",
"(",
"name",
")",
":",
"raise",
... | Decorator to ensure that the named container exists. | [
"Decorator",
"to",
"ensure",
"that",
"the",
"named",
"container",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L79-L90 |
36,033 | saltstack/salt | salt/modules/nspawn.py | _make_container_root | def _make_container_root(name):
'''
Make the container root directory
'''
path = _root(name)
if os.path.exists(path):
__context__['retcode'] = salt.defaults.exitcodes.SALT_BUILD_FAIL
raise CommandExecutionError(
'Container {0} already exists'.format(name)
)
el... | python | def _make_container_root(name):
'''
Make the container root directory
'''
path = _root(name)
if os.path.exists(path):
__context__['retcode'] = salt.defaults.exitcodes.SALT_BUILD_FAIL
raise CommandExecutionError(
'Container {0} already exists'.format(name)
)
el... | [
"def",
"_make_container_root",
"(",
"name",
")",
":",
"path",
"=",
"_root",
"(",
"name",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"__context__",
"[",
"'retcode'",
"]",
"=",
"salt",
".",
"defaults",
".",
"exitcodes",
".",
"S... | Make the container root directory | [
"Make",
"the",
"container",
"root",
"directory"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L112-L130 |
36,034 | saltstack/salt | salt/modules/nspawn.py | _bootstrap_arch | def _bootstrap_arch(name, **kwargs):
'''
Bootstrap an Arch Linux container
'''
if not salt.utils.path.which('pacstrap'):
raise CommandExecutionError(
'pacstrap not found, is the arch-install-scripts package '
'installed?'
)
dst = _make_container_root(name)
... | python | def _bootstrap_arch(name, **kwargs):
'''
Bootstrap an Arch Linux container
'''
if not salt.utils.path.which('pacstrap'):
raise CommandExecutionError(
'pacstrap not found, is the arch-install-scripts package '
'installed?'
)
dst = _make_container_root(name)
... | [
"def",
"_bootstrap_arch",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"'pacstrap'",
")",
":",
"raise",
"CommandExecutionError",
"(",
"'pacstrap not found, is the arch-install-scripts package '"... | Bootstrap an Arch Linux container | [
"Bootstrap",
"an",
"Arch",
"Linux",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L147-L161 |
36,035 | saltstack/salt | salt/modules/nspawn.py | _bootstrap_debian | def _bootstrap_debian(name, **kwargs):
'''
Bootstrap a Debian Linux container
'''
version = kwargs.get('version', False)
if not version:
if __grains__['os'].lower() == 'debian':
version = __grains__['osrelease']
else:
version = 'stable'
release_blacklist ... | python | def _bootstrap_debian(name, **kwargs):
'''
Bootstrap a Debian Linux container
'''
version = kwargs.get('version', False)
if not version:
if __grains__['os'].lower() == 'debian':
version = __grains__['osrelease']
else:
version = 'stable'
release_blacklist ... | [
"def",
"_bootstrap_debian",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"version",
"=",
"kwargs",
".",
"get",
"(",
"'version'",
",",
"False",
")",
"if",
"not",
"version",
":",
"if",
"__grains__",
"[",
"'os'",
"]",
".",
"lower",
"(",
")",
"==",
... | Bootstrap a Debian Linux container | [
"Bootstrap",
"a",
"Debian",
"Linux",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L164-L187 |
36,036 | saltstack/salt | salt/modules/nspawn.py | _bootstrap_fedora | def _bootstrap_fedora(name, **kwargs):
'''
Bootstrap a Fedora container
'''
dst = _make_container_root(name)
if not kwargs.get('version', False):
if __grains__['os'].lower() == 'fedora':
version = __grains__['osrelease']
else:
version = '21'
else:
... | python | def _bootstrap_fedora(name, **kwargs):
'''
Bootstrap a Fedora container
'''
dst = _make_container_root(name)
if not kwargs.get('version', False):
if __grains__['os'].lower() == 'fedora':
version = __grains__['osrelease']
else:
version = '21'
else:
... | [
"def",
"_bootstrap_fedora",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"dst",
"=",
"_make_container_root",
"(",
"name",
")",
"if",
"not",
"kwargs",
".",
"get",
"(",
"'version'",
",",
"False",
")",
":",
"if",
"__grains__",
"[",
"'os'",
"]",
".",
... | Bootstrap a Fedora container | [
"Bootstrap",
"a",
"Fedora",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L190-L208 |
36,037 | saltstack/salt | salt/modules/nspawn.py | _ensure_systemd | def _ensure_systemd(version):
'''
Raises an exception if the systemd version is not greater than the
passed version.
'''
try:
version = int(version)
except ValueError:
raise CommandExecutionError('Invalid version \'{0}\''.format(version))
try:
installed = _sd_version... | python | def _ensure_systemd(version):
'''
Raises an exception if the systemd version is not greater than the
passed version.
'''
try:
version = int(version)
except ValueError:
raise CommandExecutionError('Invalid version \'{0}\''.format(version))
try:
installed = _sd_version... | [
"def",
"_ensure_systemd",
"(",
"version",
")",
":",
"try",
":",
"version",
"=",
"int",
"(",
"version",
")",
"except",
"ValueError",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid version \\'{0}\\''",
".",
"format",
"(",
"version",
")",
")",
"try",
":",
... | Raises an exception if the systemd version is not greater than the
passed version. | [
"Raises",
"an",
"exception",
"if",
"the",
"systemd",
"version",
"is",
"not",
"greater",
"than",
"the",
"passed",
"version",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L248-L268 |
36,038 | saltstack/salt | salt/modules/nspawn.py | _machinectl | def _machinectl(cmd,
output_loglevel='debug',
ignore_retcode=False,
use_vt=False):
'''
Helper function to run machinectl
'''
prefix = 'machinectl --no-legend --no-pager'
return __salt__['cmd.run_all']('{0} {1}'.format(prefix, cmd),
... | python | def _machinectl(cmd,
output_loglevel='debug',
ignore_retcode=False,
use_vt=False):
'''
Helper function to run machinectl
'''
prefix = 'machinectl --no-legend --no-pager'
return __salt__['cmd.run_all']('{0} {1}'.format(prefix, cmd),
... | [
"def",
"_machinectl",
"(",
"cmd",
",",
"output_loglevel",
"=",
"'debug'",
",",
"ignore_retcode",
"=",
"False",
",",
"use_vt",
"=",
"False",
")",
":",
"prefix",
"=",
"'machinectl --no-legend --no-pager'",
"return",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"'{0... | Helper function to run machinectl | [
"Helper",
"function",
"to",
"run",
"machinectl"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L271-L282 |
36,039 | saltstack/salt | salt/modules/nspawn.py | _run | def _run(name,
cmd,
output=None,
no_start=False,
stdin=None,
python_shell=True,
preserve_state=False,
output_loglevel='debug',
ignore_retcode=False,
use_vt=False,
keep_env=None):
'''
Common logic for nspawn.run functions
... | python | def _run(name,
cmd,
output=None,
no_start=False,
stdin=None,
python_shell=True,
preserve_state=False,
output_loglevel='debug',
ignore_retcode=False,
use_vt=False,
keep_env=None):
'''
Common logic for nspawn.run functions
... | [
"def",
"_run",
"(",
"name",
",",
"cmd",
",",
"output",
"=",
"None",
",",
"no_start",
"=",
"False",
",",
"stdin",
"=",
"None",
",",
"python_shell",
"=",
"True",
",",
"preserve_state",
"=",
"False",
",",
"output_loglevel",
"=",
"'debug'",
",",
"ignore_retc... | Common logic for nspawn.run functions | [
"Common",
"logic",
"for",
"nspawn",
".",
"run",
"functions"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L286-L329 |
36,040 | saltstack/salt | salt/modules/nspawn.py | pid | def pid(name):
'''
Returns the PID of a container
name
Container name
CLI Example:
.. code-block:: bash
salt myminion nspawn.pid arch1
'''
try:
return int(info(name).get('PID'))
except (TypeError, ValueError) as exc:
raise CommandExecutionError(
... | python | def pid(name):
'''
Returns the PID of a container
name
Container name
CLI Example:
.. code-block:: bash
salt myminion nspawn.pid arch1
'''
try:
return int(info(name).get('PID'))
except (TypeError, ValueError) as exc:
raise CommandExecutionError(
... | [
"def",
"pid",
"(",
"name",
")",
":",
"try",
":",
"return",
"int",
"(",
"info",
"(",
"name",
")",
".",
"get",
"(",
"'PID'",
")",
")",
"except",
"(",
"TypeError",
",",
"ValueError",
")",
"as",
"exc",
":",
"raise",
"CommandExecutionError",
"(",
"'Unable... | Returns the PID of a container
name
Container name
CLI Example:
.. code-block:: bash
salt myminion nspawn.pid arch1 | [
"Returns",
"the",
"PID",
"of",
"a",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L333-L351 |
36,041 | saltstack/salt | salt/modules/nspawn.py | list_all | def list_all():
'''
Lists all nspawn containers
CLI Example:
.. code-block:: bash
salt myminion nspawn.list_all
'''
ret = []
if _sd_version() >= 219:
for line in _machinectl('list-images')['stdout'].splitlines():
try:
ret.append(line.split()[0])... | python | def list_all():
'''
Lists all nspawn containers
CLI Example:
.. code-block:: bash
salt myminion nspawn.list_all
'''
ret = []
if _sd_version() >= 219:
for line in _machinectl('list-images')['stdout'].splitlines():
try:
ret.append(line.split()[0])... | [
"def",
"list_all",
"(",
")",
":",
"ret",
"=",
"[",
"]",
"if",
"_sd_version",
"(",
")",
">=",
"219",
":",
"for",
"line",
"in",
"_machinectl",
"(",
"'list-images'",
")",
"[",
"'stdout'",
"]",
".",
"splitlines",
"(",
")",
":",
"try",
":",
"ret",
".",
... | Lists all nspawn containers
CLI Example:
.. code-block:: bash
salt myminion nspawn.list_all | [
"Lists",
"all",
"nspawn",
"containers"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L834-L859 |
36,042 | saltstack/salt | salt/modules/nspawn.py | list_running | def list_running():
'''
Lists running nspawn containers
.. note::
``nspawn.list`` also works to list running containers
CLI Example:
.. code-block:: bash
salt myminion nspawn.list_running
salt myminion nspawn.list
'''
ret = []
for line in _machinectl('list')[... | python | def list_running():
'''
Lists running nspawn containers
.. note::
``nspawn.list`` also works to list running containers
CLI Example:
.. code-block:: bash
salt myminion nspawn.list_running
salt myminion nspawn.list
'''
ret = []
for line in _machinectl('list')[... | [
"def",
"list_running",
"(",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"line",
"in",
"_machinectl",
"(",
"'list'",
")",
"[",
"'stdout'",
"]",
".",
"splitlines",
"(",
")",
":",
"try",
":",
"ret",
".",
"append",
"(",
"line",
".",
"split",
"(",
")",
"["... | Lists running nspawn containers
.. note::
``nspawn.list`` also works to list running containers
CLI Example:
.. code-block:: bash
salt myminion nspawn.list_running
salt myminion nspawn.list | [
"Lists",
"running",
"nspawn",
"containers"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L862-L883 |
36,043 | saltstack/salt | salt/modules/nspawn.py | exists | def exists(name):
'''
Returns true if the named container exists
CLI Example:
.. code-block:: bash
salt myminion nspawn.exists <name>
'''
contextkey = 'nspawn.exists.{0}'.format(name)
if contextkey in __context__:
return __context__[contextkey]
__context__[contextkey] ... | python | def exists(name):
'''
Returns true if the named container exists
CLI Example:
.. code-block:: bash
salt myminion nspawn.exists <name>
'''
contextkey = 'nspawn.exists.{0}'.format(name)
if contextkey in __context__:
return __context__[contextkey]
__context__[contextkey] ... | [
"def",
"exists",
"(",
"name",
")",
":",
"contextkey",
"=",
"'nspawn.exists.{0}'",
".",
"format",
"(",
"name",
")",
"if",
"contextkey",
"in",
"__context__",
":",
"return",
"__context__",
"[",
"contextkey",
"]",
"__context__",
"[",
"contextkey",
"]",
"=",
"nam... | Returns true if the named container exists
CLI Example:
.. code-block:: bash
salt myminion nspawn.exists <name> | [
"Returns",
"true",
"if",
"the",
"named",
"container",
"exists"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L904-L918 |
36,044 | saltstack/salt | salt/modules/nspawn.py | info | def info(name, **kwargs):
'''
Return info about a container
.. note::
The container must be running for ``machinectl`` to gather information
about it. If the container is stopped, then this function will start
it.
start : False
If ``True``, then the container will be s... | python | def info(name, **kwargs):
'''
Return info about a container
.. note::
The container must be running for ``machinectl`` to gather information
about it. If the container is stopped, then this function will start
it.
start : False
If ``True``, then the container will be s... | [
"def",
"info",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"start_",
"=",
"kwargs",
".",
"pop",
"(",
"'start'",
",",
"False",
")",
"if",
"kwa... | Return info about a container
.. note::
The container must be running for ``machinectl`` to gather information
about it. If the container is stopped, then this function will start
it.
start : False
If ``True``, then the container will be started to retrieve the info. A
... | [
"Return",
"info",
"about",
"a",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L939-L1019 |
36,045 | saltstack/salt | salt/modules/nspawn.py | enable | def enable(name):
'''
Set the named container to be launched at boot
CLI Example:
.. code-block:: bash
salt myminion nspawn.enable <name>
'''
cmd = 'systemctl enable systemd-nspawn@{0}'.format(name)
if __salt__['cmd.retcode'](cmd, python_shell=False) != 0:
__context__['ret... | python | def enable(name):
'''
Set the named container to be launched at boot
CLI Example:
.. code-block:: bash
salt myminion nspawn.enable <name>
'''
cmd = 'systemctl enable systemd-nspawn@{0}'.format(name)
if __salt__['cmd.retcode'](cmd, python_shell=False) != 0:
__context__['ret... | [
"def",
"enable",
"(",
"name",
")",
":",
"cmd",
"=",
"'systemctl enable systemd-nspawn@{0}'",
".",
"format",
"(",
"name",
")",
"if",
"__salt__",
"[",
"'cmd.retcode'",
"]",
"(",
"cmd",
",",
"python_shell",
"=",
"False",
")",
"!=",
"0",
":",
"__context__",
"[... | Set the named container to be launched at boot
CLI Example:
.. code-block:: bash
salt myminion nspawn.enable <name> | [
"Set",
"the",
"named",
"container",
"to",
"be",
"launched",
"at",
"boot"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L1023-L1037 |
36,046 | saltstack/salt | salt/modules/nspawn.py | stop | def stop(name, kill=False):
'''
This is a compatibility function which provides the logic for
nspawn.poweroff and nspawn.terminate.
'''
if _sd_version() >= 219:
if kill:
action = 'terminate'
else:
action = 'poweroff'
ret = _machinectl('{0} {1}'.format(... | python | def stop(name, kill=False):
'''
This is a compatibility function which provides the logic for
nspawn.poweroff and nspawn.terminate.
'''
if _sd_version() >= 219:
if kill:
action = 'terminate'
else:
action = 'poweroff'
ret = _machinectl('{0} {1}'.format(... | [
"def",
"stop",
"(",
"name",
",",
"kill",
"=",
"False",
")",
":",
"if",
"_sd_version",
"(",
")",
">=",
"219",
":",
"if",
"kill",
":",
"action",
"=",
"'terminate'",
"else",
":",
"action",
"=",
"'poweroff'",
"ret",
"=",
"_machinectl",
"(",
"'{0} {1}'",
... | This is a compatibility function which provides the logic for
nspawn.poweroff and nspawn.terminate. | [
"This",
"is",
"a",
"compatibility",
"function",
"which",
"provides",
"the",
"logic",
"for",
"nspawn",
".",
"poweroff",
"and",
"nspawn",
".",
"terminate",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L1083-L1101 |
36,047 | saltstack/salt | salt/modules/nspawn.py | reboot | def reboot(name, kill=False):
'''
Reboot the container by sending a SIGINT to its init process. Equivalent
to running ``machinectl reboot`` on the named container.
For convenience, running ``nspawn.restart`` (as shown in the CLI examples
below) is equivalent to running ``nspawn.reboot``.
.. no... | python | def reboot(name, kill=False):
'''
Reboot the container by sending a SIGINT to its init process. Equivalent
to running ``machinectl reboot`` on the named container.
For convenience, running ``nspawn.restart`` (as shown in the CLI examples
below) is equivalent to running ``nspawn.reboot``.
.. no... | [
"def",
"reboot",
"(",
"name",
",",
"kill",
"=",
"False",
")",
":",
"if",
"_sd_version",
"(",
")",
">=",
"219",
":",
"if",
"state",
"(",
"name",
")",
"==",
"'running'",
":",
"ret",
"=",
"_machinectl",
"(",
"'reboot {0}'",
".",
"format",
"(",
"name",
... | Reboot the container by sending a SIGINT to its init process. Equivalent
to running ``machinectl reboot`` on the named container.
For convenience, running ``nspawn.restart`` (as shown in the CLI examples
below) is equivalent to running ``nspawn.reboot``.
.. note::
``machinectl reboot`` is onl... | [
"Reboot",
"the",
"container",
"by",
"sending",
"a",
"SIGINT",
"to",
"its",
"init",
"process",
".",
"Equivalent",
"to",
"running",
"machinectl",
"reboot",
"on",
"the",
"named",
"container",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L1162-L1209 |
36,048 | saltstack/salt | salt/modules/nspawn.py | remove | def remove(name, stop=False):
'''
Remove the named container
.. warning::
This function will remove all data associated with the container. It
will not, however, remove the btrfs subvolumes created by pulling
container images (:mod:`nspawn.pull_raw
<salt.modules.nspawn.pull... | python | def remove(name, stop=False):
'''
Remove the named container
.. warning::
This function will remove all data associated with the container. It
will not, however, remove the btrfs subvolumes created by pulling
container images (:mod:`nspawn.pull_raw
<salt.modules.nspawn.pull... | [
"def",
"remove",
"(",
"name",
",",
"stop",
"=",
"False",
")",
":",
"if",
"not",
"stop",
"and",
"state",
"(",
"name",
")",
"!=",
"'stopped'",
":",
"raise",
"CommandExecutionError",
"(",
"'Container \\'{0}\\' is not stopped'",
".",
"format",
"(",
"name",
")",
... | Remove the named container
.. warning::
This function will remove all data associated with the container. It
will not, however, remove the btrfs subvolumes created by pulling
container images (:mod:`nspawn.pull_raw
<salt.modules.nspawn.pull_raw>`, :mod:`nspawn.pull_tar
<sal... | [
"Remove",
"the",
"named",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L1213-L1257 |
36,049 | saltstack/salt | salt/states/boto_s3_bucket.py | _prep_acl_for_compare | def _prep_acl_for_compare(ACL):
'''
Prepares the ACL returned from the AWS API for comparison with a given one.
'''
ret = copy.deepcopy(ACL)
ret['Owner'] = _normalize_user(ret['Owner'])
for item in ret.get('Grants', ()):
item['Grantee'] = _normalize_user(item.get('Grantee'))
return r... | python | def _prep_acl_for_compare(ACL):
'''
Prepares the ACL returned from the AWS API for comparison with a given one.
'''
ret = copy.deepcopy(ACL)
ret['Owner'] = _normalize_user(ret['Owner'])
for item in ret.get('Grants', ()):
item['Grantee'] = _normalize_user(item.get('Grantee'))
return r... | [
"def",
"_prep_acl_for_compare",
"(",
"ACL",
")",
":",
"ret",
"=",
"copy",
".",
"deepcopy",
"(",
"ACL",
")",
"ret",
"[",
"'Owner'",
"]",
"=",
"_normalize_user",
"(",
"ret",
"[",
"'Owner'",
"]",
")",
"for",
"item",
"in",
"ret",
".",
"get",
"(",
"'Grant... | Prepares the ACL returned from the AWS API for comparison with a given one. | [
"Prepares",
"the",
"ACL",
"returned",
"from",
"the",
"AWS",
"API",
"for",
"comparison",
"with",
"a",
"given",
"one",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_s3_bucket.py#L178-L186 |
36,050 | saltstack/salt | salt/states/boto_s3_bucket.py | _compare_acl | def _compare_acl(current, desired, region, key, keyid, profile):
'''
ACLs can be specified using macro-style names that get expanded to
something more complex. There's no predictable way to reverse it.
So expand all syntactic sugar in our input, and compare against that
rather than the input itself.... | python | def _compare_acl(current, desired, region, key, keyid, profile):
'''
ACLs can be specified using macro-style names that get expanded to
something more complex. There's no predictable way to reverse it.
So expand all syntactic sugar in our input, and compare against that
rather than the input itself.... | [
"def",
"_compare_acl",
"(",
"current",
",",
"desired",
",",
"region",
",",
"key",
",",
"keyid",
",",
"profile",
")",
":",
"ocid",
"=",
"_get_canonical_id",
"(",
"region",
",",
"key",
",",
"keyid",
",",
"profile",
")",
"return",
"__utils__",
"[",
"'boto3.... | ACLs can be specified using macro-style names that get expanded to
something more complex. There's no predictable way to reverse it.
So expand all syntactic sugar in our input, and compare against that
rather than the input itself. | [
"ACLs",
"can",
"be",
"specified",
"using",
"macro",
"-",
"style",
"names",
"that",
"get",
"expanded",
"to",
"something",
"more",
"complex",
".",
"There",
"s",
"no",
"predictable",
"way",
"to",
"reverse",
"it",
".",
"So",
"expand",
"all",
"syntactic",
"suga... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_s3_bucket.py#L311-L319 |
36,051 | saltstack/salt | salt/states/boto_s3_bucket.py | _compare_replication | def _compare_replication(current, desired, region, key, keyid, profile):
'''
Replication accepts a non-ARN role name, but always returns an ARN
'''
if desired is not None and desired.get('Role'):
desired = copy.deepcopy(desired)
desired['Role'] = _get_role_arn(desired['Role'],
... | python | def _compare_replication(current, desired, region, key, keyid, profile):
'''
Replication accepts a non-ARN role name, but always returns an ARN
'''
if desired is not None and desired.get('Role'):
desired = copy.deepcopy(desired)
desired['Role'] = _get_role_arn(desired['Role'],
... | [
"def",
"_compare_replication",
"(",
"current",
",",
"desired",
",",
"region",
",",
"key",
",",
"keyid",
",",
"profile",
")",
":",
"if",
"desired",
"is",
"not",
"None",
"and",
"desired",
".",
"get",
"(",
"'Role'",
")",
":",
"desired",
"=",
"copy",
".",
... | Replication accepts a non-ARN role name, but always returns an ARN | [
"Replication",
"accepts",
"a",
"non",
"-",
"ARN",
"role",
"name",
"but",
"always",
"returns",
"an",
"ARN"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_s3_bucket.py#L326-L334 |
36,052 | saltstack/salt | salt/modules/pkgin.py | _check_pkgin | def _check_pkgin():
'''
Looks to see if pkgin is present on the system, return full path
'''
ppath = salt.utils.path.which('pkgin')
if ppath is None:
# pkgin was not found in $PATH, try to find it via LOCALBASE
try:
localbase = __salt__['cmd.run'](
'pkg_inf... | python | def _check_pkgin():
'''
Looks to see if pkgin is present on the system, return full path
'''
ppath = salt.utils.path.which('pkgin')
if ppath is None:
# pkgin was not found in $PATH, try to find it via LOCALBASE
try:
localbase = __salt__['cmd.run'](
'pkg_inf... | [
"def",
"_check_pkgin",
"(",
")",
":",
"ppath",
"=",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"'pkgin'",
")",
"if",
"ppath",
"is",
"None",
":",
"# pkgin was not found in $PATH, try to find it via LOCALBASE",
"try",
":",
"localbase",
"=",
"__salt__",
... | Looks to see if pkgin is present on the system, return full path | [
"Looks",
"to",
"see",
"if",
"pkgin",
"is",
"present",
"on",
"the",
"system",
"return",
"full",
"path"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgin.py#L38-L56 |
36,053 | saltstack/salt | salt/modules/pkgin.py | _get_version | def _get_version():
'''
Get the pkgin version
'''
version_string = __salt__['cmd.run'](
[_check_pkgin(), '-v'],
output_loglevel='trace')
if version_string is None:
# Dunno why it would, but...
return False
version_match = VERSION_MATCH.search(version_string)
... | python | def _get_version():
'''
Get the pkgin version
'''
version_string = __salt__['cmd.run'](
[_check_pkgin(), '-v'],
output_loglevel='trace')
if version_string is None:
# Dunno why it would, but...
return False
version_match = VERSION_MATCH.search(version_string)
... | [
"def",
"_get_version",
"(",
")",
":",
"version_string",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"[",
"_check_pkgin",
"(",
")",
",",
"'-v'",
"]",
",",
"output_loglevel",
"=",
"'trace'",
")",
"if",
"version_string",
"is",
"None",
":",
"# Dunno why it woul... | Get the pkgin version | [
"Get",
"the",
"pkgin",
"version"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgin.py#L60-L75 |
36,054 | saltstack/salt | salt/modules/pkgin.py | refresh_db | def refresh_db(force=False, **kwargs):
'''
Use pkg update to get latest pkg_summary
force
Pass -f so that the cache is always refreshed.
.. versionadded:: 2018.3.0
CLI Example:
.. code-block:: bash
salt '*' pkg.refresh_db
'''
# Remove rtag file to keep multiple ... | python | def refresh_db(force=False, **kwargs):
'''
Use pkg update to get latest pkg_summary
force
Pass -f so that the cache is always refreshed.
.. versionadded:: 2018.3.0
CLI Example:
.. code-block:: bash
salt '*' pkg.refresh_db
'''
# Remove rtag file to keep multiple ... | [
"def",
"refresh_db",
"(",
"force",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# Remove rtag file to keep multiple refreshes from happening in pkg states",
"salt",
".",
"utils",
".",
"pkg",
".",
"clear_rtag",
"(",
"__opts__",
")",
"pkgin",
"=",
"_check_pkgin",... | Use pkg update to get latest pkg_summary
force
Pass -f so that the cache is always refreshed.
.. versionadded:: 2018.3.0
CLI Example:
.. code-block:: bash
salt '*' pkg.refresh_db | [
"Use",
"pkg",
"update",
"to",
"get",
"latest",
"pkg_summary"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgin.py#L233-L266 |
36,055 | saltstack/salt | salt/modules/pkgin.py | upgrade | def upgrade(refresh=True, pkgs=None, **kwargs):
'''
Run pkg upgrade, if pkgin used. Otherwise do nothing
refresh
Whether or not to refresh the package database before installing.
Multiple Package Upgrade Options:
pkgs
A list of packages to upgrade from a software repository. Must ... | python | def upgrade(refresh=True, pkgs=None, **kwargs):
'''
Run pkg upgrade, if pkgin used. Otherwise do nothing
refresh
Whether or not to refresh the package database before installing.
Multiple Package Upgrade Options:
pkgs
A list of packages to upgrade from a software repository. Must ... | [
"def",
"upgrade",
"(",
"refresh",
"=",
"True",
",",
"pkgs",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"pkgin",
"=",
"_check_pkgin",
"(",
")",
"if",
"not",
"pkgin",
":",
"# There is not easy way to upgrade packages with old package system",
"return",
"{",
... | Run pkg upgrade, if pkgin used. Otherwise do nothing
refresh
Whether or not to refresh the package database before installing.
Multiple Package Upgrade Options:
pkgs
A list of packages to upgrade from a software repository. Must be
passed as a python list.
CLI Example:
... | [
"Run",
"pkg",
"upgrade",
"if",
"pkgin",
"used",
".",
"Otherwise",
"do",
"nothing"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgin.py#L456-L526 |
36,056 | saltstack/salt | salt/modules/pkgin.py | file_list | def file_list(package, **kwargs):
'''
List the files that belong to a package.
CLI Examples:
.. code-block:: bash
salt '*' pkg.file_list nginx
'''
ret = file_dict(package)
files = []
for pkg_files in six.itervalues(ret['files']):
files.extend(pkg_files)
ret['files'... | python | def file_list(package, **kwargs):
'''
List the files that belong to a package.
CLI Examples:
.. code-block:: bash
salt '*' pkg.file_list nginx
'''
ret = file_dict(package)
files = []
for pkg_files in six.itervalues(ret['files']):
files.extend(pkg_files)
ret['files'... | [
"def",
"file_list",
"(",
"package",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"file_dict",
"(",
"package",
")",
"files",
"=",
"[",
"]",
"for",
"pkg_files",
"in",
"six",
".",
"itervalues",
"(",
"ret",
"[",
"'files'",
"]",
")",
":",
"files",
"."... | List the files that belong to a package.
CLI Examples:
.. code-block:: bash
salt '*' pkg.file_list nginx | [
"List",
"the",
"files",
"that",
"belong",
"to",
"a",
"package",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgin.py#L645-L660 |
36,057 | saltstack/salt | salt/states/mount.py | swap | def swap(name, persist=True, config='/etc/fstab'):
'''
Activates a swap device
.. code-block:: yaml
/root/swapfile:
mount.swap
.. note::
``swap`` does not currently support LABEL
'''
ret = {'name': name,
'changes': {},
'result': True,
... | python | def swap(name, persist=True, config='/etc/fstab'):
'''
Activates a swap device
.. code-block:: yaml
/root/swapfile:
mount.swap
.. note::
``swap`` does not currently support LABEL
'''
ret = {'name': name,
'changes': {},
'result': True,
... | [
"def",
"swap",
"(",
"name",
",",
"persist",
"=",
"True",
",",
"config",
"=",
"'/etc/fstab'",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"on_",
... | Activates a swap device
.. code-block:: yaml
/root/swapfile:
mount.swap
.. note::
``swap`` does not currently support LABEL | [
"Activates",
"a",
"swap",
"device"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mount.py#L731-L827 |
36,058 | saltstack/salt | salt/states/mount.py | mod_watch | def mod_watch(name, user=None, **kwargs):
'''
The mounted watcher, called to invoke the watch command.
.. note::
This state exists to support special handling of the ``watch``
:ref:`requisite <requisites>`. It should not be called directly.
Parameters for this function should be se... | python | def mod_watch(name, user=None, **kwargs):
'''
The mounted watcher, called to invoke the watch command.
.. note::
This state exists to support special handling of the ``watch``
:ref:`requisite <requisites>`. It should not be called directly.
Parameters for this function should be se... | [
"def",
"mod_watch",
"(",
"name",
",",
"user",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"if",
"kwargs",... | The mounted watcher, called to invoke the watch command.
.. note::
This state exists to support special handling of the ``watch``
:ref:`requisite <requisites>`. It should not be called directly.
Parameters for this function should be set by the state being triggered.
name
The ... | [
"The",
"mounted",
"watcher",
"called",
"to",
"invoke",
"the",
"watch",
"command",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mount.py#L955-L983 |
36,059 | saltstack/salt | salt/states/mount.py | _convert_to | def _convert_to(maybe_device, convert_to):
'''
Convert a device name, UUID or LABEL to a device name, UUID or
LABEL.
Return the fs_spec required for fstab.
'''
# Fast path. If we already have the information required, we can
# save one blkid call
if not convert_to or \
(convert... | python | def _convert_to(maybe_device, convert_to):
'''
Convert a device name, UUID or LABEL to a device name, UUID or
LABEL.
Return the fs_spec required for fstab.
'''
# Fast path. If we already have the information required, we can
# save one blkid call
if not convert_to or \
(convert... | [
"def",
"_convert_to",
"(",
"maybe_device",
",",
"convert_to",
")",
":",
"# Fast path. If we already have the information required, we can",
"# save one blkid call",
"if",
"not",
"convert_to",
"or",
"(",
"convert_to",
"==",
"'device'",
"and",
"maybe_device",
".",
"startswith... | Convert a device name, UUID or LABEL to a device name, UUID or
LABEL.
Return the fs_spec required for fstab. | [
"Convert",
"a",
"device",
"name",
"UUID",
"or",
"LABEL",
"to",
"a",
"device",
"name",
"UUID",
"or",
"LABEL",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mount.py#L986-L1016 |
36,060 | saltstack/salt | salt/states/mount.py | fstab_absent | def fstab_absent(name, fs_file, mount_by=None, config='/etc/fstab'):
'''
Makes sure that a fstab mount point is absent.
name
The name of block device. Can be any valid fs_spec value.
fs_file
Mount point (target) for the filesystem.
mount_by
Select the final value for fs_sp... | python | def fstab_absent(name, fs_file, mount_by=None, config='/etc/fstab'):
'''
Makes sure that a fstab mount point is absent.
name
The name of block device. Can be any valid fs_spec value.
fs_file
Mount point (target) for the filesystem.
mount_by
Select the final value for fs_sp... | [
"def",
"fstab_absent",
"(",
"name",
",",
"fs_file",
",",
"mount_by",
"=",
"None",
",",
"config",
"=",
"'/etc/fstab'",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"False",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
... | Makes sure that a fstab mount point is absent.
name
The name of block device. Can be any valid fs_spec value.
fs_file
Mount point (target) for the filesystem.
mount_by
Select the final value for fs_spec. Can be [``None``,
``device``, ``label``, ``uuid``, ``partlabel``,
... | [
"Makes",
"sure",
"that",
"a",
"fstab",
"mount",
"point",
"is",
"absent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mount.py#L1188-L1275 |
36,061 | saltstack/salt | salt/modules/win_snmp.py | get_agent_settings | def get_agent_settings():
'''
Determine the value of the SNMP sysContact, sysLocation, and sysServices
settings.
Returns:
dict: A dictionary of the agent settings.
CLI Example:
.. code-block:: bash
salt '*' win_snmp.get_agent_settings
'''
ret = dict()
sorted_types... | python | def get_agent_settings():
'''
Determine the value of the SNMP sysContact, sysLocation, and sysServices
settings.
Returns:
dict: A dictionary of the agent settings.
CLI Example:
.. code-block:: bash
salt '*' win_snmp.get_agent_settings
'''
ret = dict()
sorted_types... | [
"def",
"get_agent_settings",
"(",
")",
":",
"ret",
"=",
"dict",
"(",
")",
"sorted_types",
"=",
"sorted",
"(",
"_SERVICE_TYPES",
".",
"items",
"(",
")",
",",
"key",
"=",
"lambda",
"x",
":",
"(",
"-",
"x",
"[",
"1",
"]",
",",
"x",
"[",
"0",
"]",
... | Determine the value of the SNMP sysContact, sysLocation, and sysServices
settings.
Returns:
dict: A dictionary of the agent settings.
CLI Example:
.. code-block:: bash
salt '*' win_snmp.get_agent_settings | [
"Determine",
"the",
"value",
"of",
"the",
"SNMP",
"sysContact",
"sysLocation",
"and",
"sysServices",
"settings",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_snmp.py#L101-L143 |
36,062 | saltstack/salt | salt/modules/win_snmp.py | get_community_names | def get_community_names():
'''
Get the current accepted SNMP community names and their permissions.
If community names are being managed by Group Policy, those values will be
returned instead like this:
.. code-block:: bash
TestCommunity:
Managed by GPO
Community names ma... | python | def get_community_names():
'''
Get the current accepted SNMP community names and their permissions.
If community names are being managed by Group Policy, those values will be
returned instead like this:
.. code-block:: bash
TestCommunity:
Managed by GPO
Community names ma... | [
"def",
"get_community_names",
"(",
")",
":",
"ret",
"=",
"dict",
"(",
")",
"# Look in GPO settings first",
"if",
"__utils__",
"[",
"'reg.key_exists'",
"]",
"(",
"_HKEY",
",",
"_COMMUNITIES_GPO_KEY",
")",
":",
"_LOG",
".",
"debug",
"(",
"'Loading communities from G... | Get the current accepted SNMP community names and their permissions.
If community names are being managed by Group Policy, those values will be
returned instead like this:
.. code-block:: bash
TestCommunity:
Managed by GPO
Community names managed normally will denote the permissi... | [
"Get",
"the",
"current",
"accepted",
"SNMP",
"community",
"names",
"and",
"their",
"permissions",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_snmp.py#L287-L382 |
36,063 | saltstack/salt | salt/states/win_smtp_server.py | _merge_dicts | def _merge_dicts(*args):
'''
Shallow copy and merge dicts together, giving precedence to last in.
'''
ret = dict()
for arg in args:
ret.update(arg)
return ret | python | def _merge_dicts(*args):
'''
Shallow copy and merge dicts together, giving precedence to last in.
'''
ret = dict()
for arg in args:
ret.update(arg)
return ret | [
"def",
"_merge_dicts",
"(",
"*",
"args",
")",
":",
"ret",
"=",
"dict",
"(",
")",
"for",
"arg",
"in",
"args",
":",
"ret",
".",
"update",
"(",
"arg",
")",
"return",
"ret"
] | Shallow copy and merge dicts together, giving precedence to last in. | [
"Shallow",
"copy",
"and",
"merge",
"dicts",
"together",
"giving",
"precedence",
"to",
"last",
"in",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_smtp_server.py#L27-L34 |
36,064 | saltstack/salt | salt/states/win_smtp_server.py | _normalize_server_settings | def _normalize_server_settings(**settings):
'''
Convert setting values that has been improperly converted to a dict back to a string.
'''
ret = dict()
settings = salt.utils.args.clean_kwargs(**settings)
for setting in settings:
if isinstance(settings[setting], dict):
value_f... | python | def _normalize_server_settings(**settings):
'''
Convert setting values that has been improperly converted to a dict back to a string.
'''
ret = dict()
settings = salt.utils.args.clean_kwargs(**settings)
for setting in settings:
if isinstance(settings[setting], dict):
value_f... | [
"def",
"_normalize_server_settings",
"(",
"*",
"*",
"settings",
")",
":",
"ret",
"=",
"dict",
"(",
")",
"settings",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",
"*",
"settings",
")",
"for",
"setting",
"in",
"settings",
":",
"i... | Convert setting values that has been improperly converted to a dict back to a string. | [
"Convert",
"setting",
"values",
"that",
"has",
"been",
"improperly",
"converted",
"to",
"a",
"dict",
"back",
"to",
"a",
"string",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_smtp_server.py#L37-L51 |
36,065 | saltstack/salt | salt/states/win_smtp_server.py | server_setting | def server_setting(name, settings=None, server=_DEFAULT_SERVER):
'''
Ensure the value is set for the specified setting.
.. note::
The setting names are case-sensitive.
:param str settings: A dictionary of the setting names and their values.
:param str server: The SMTP server name.
Ex... | python | def server_setting(name, settings=None, server=_DEFAULT_SERVER):
'''
Ensure the value is set for the specified setting.
.. note::
The setting names are case-sensitive.
:param str settings: A dictionary of the setting names and their values.
:param str server: The SMTP server name.
Ex... | [
"def",
"server_setting",
"(",
"name",
",",
"settings",
"=",
"None",
",",
"server",
"=",
"_DEFAULT_SERVER",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"six",
".",
"text_type",
"(",
")",
",... | Ensure the value is set for the specified setting.
.. note::
The setting names are case-sensitive.
:param str settings: A dictionary of the setting names and their values.
:param str server: The SMTP server name.
Example of usage:
.. code-block:: yaml
smtp-settings:
... | [
"Ensure",
"the",
"value",
"is",
"set",
"for",
"the",
"specified",
"setting",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_smtp_server.py#L54-L128 |
36,066 | saltstack/salt | salt/states/win_smtp_server.py | active_log_format | def active_log_format(name, log_format, server=_DEFAULT_SERVER):
'''
Manage the active log format for the SMTP server.
:param str log_format: The log format name.
:param str server: The SMTP server name.
Example of usage:
.. code-block:: yaml
smtp-log-format:
win_smtp_ser... | python | def active_log_format(name, log_format, server=_DEFAULT_SERVER):
'''
Manage the active log format for the SMTP server.
:param str log_format: The log format name.
:param str server: The SMTP server name.
Example of usage:
.. code-block:: yaml
smtp-log-format:
win_smtp_ser... | [
"def",
"active_log_format",
"(",
"name",
",",
"log_format",
",",
"server",
"=",
"_DEFAULT_SERVER",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"six",
".",
"text_type",
"(",
")",
",",
"'resul... | Manage the active log format for the SMTP server.
:param str log_format: The log format name.
:param str server: The SMTP server name.
Example of usage:
.. code-block:: yaml
smtp-log-format:
win_smtp_server.active_log_format:
- log_format: Microsoft IIS Log File F... | [
"Manage",
"the",
"active",
"log",
"format",
"for",
"the",
"SMTP",
"server",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_smtp_server.py#L131-L164 |
36,067 | saltstack/salt | salt/states/win_smtp_server.py | connection_ip_list | def connection_ip_list(name, addresses=None, grant_by_default=False, server=_DEFAULT_SERVER):
'''
Manage IP list for SMTP connections.
:param str addresses: A dictionary of IP + subnet pairs.
:param bool grant_by_default: Whether the addresses should be a blacklist or whitelist.
:param str server: ... | python | def connection_ip_list(name, addresses=None, grant_by_default=False, server=_DEFAULT_SERVER):
'''
Manage IP list for SMTP connections.
:param str addresses: A dictionary of IP + subnet pairs.
:param bool grant_by_default: Whether the addresses should be a blacklist or whitelist.
:param str server: ... | [
"def",
"connection_ip_list",
"(",
"name",
",",
"addresses",
"=",
"None",
",",
"grant_by_default",
"=",
"False",
",",
"server",
"=",
"_DEFAULT_SERVER",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":... | Manage IP list for SMTP connections.
:param str addresses: A dictionary of IP + subnet pairs.
:param bool grant_by_default: Whether the addresses should be a blacklist or whitelist.
:param str server: The SMTP server name.
Example of usage for creating a whitelist:
.. code-block:: yaml
s... | [
"Manage",
"IP",
"list",
"for",
"SMTP",
"connections",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_smtp_server.py#L167-L230 |
36,068 | saltstack/salt | salt/states/win_smtp_server.py | relay_ip_list | def relay_ip_list(name, addresses=None, server=_DEFAULT_SERVER):
'''
Manage IP list for SMTP relay connections.
Due to the unusual way that Windows stores the relay IPs, it is advisable to retrieve
the existing list you wish to set from a pre-configured server.
For example, setting '127.0.0.1' as ... | python | def relay_ip_list(name, addresses=None, server=_DEFAULT_SERVER):
'''
Manage IP list for SMTP relay connections.
Due to the unusual way that Windows stores the relay IPs, it is advisable to retrieve
the existing list you wish to set from a pre-configured server.
For example, setting '127.0.0.1' as ... | [
"def",
"relay_ip_list",
"(",
"name",
",",
"addresses",
"=",
"None",
",",
"server",
"=",
"_DEFAULT_SERVER",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"six",
".",
"text_type",
"(",
")",
",... | Manage IP list for SMTP relay connections.
Due to the unusual way that Windows stores the relay IPs, it is advisable to retrieve
the existing list you wish to set from a pre-configured server.
For example, setting '127.0.0.1' as an allowed relay IP through the GUI would generate
an actual relay IP lis... | [
"Manage",
"IP",
"list",
"for",
"SMTP",
"relay",
"connections",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_smtp_server.py#L233-L328 |
36,069 | saltstack/salt | salt/runners/digicertapi.py | _paginate | def _paginate(url, topkey, *args, **kwargs):
'''
Wrapper to assist with paginated responses from Digicert's REST API.
'''
ret = salt.utils.http.query(url, **kwargs)
if 'errors' in ret['dict']:
return ret['dict']
lim = int(ret['dict']['page']['limit'])
total = int(ret['dict']['page'... | python | def _paginate(url, topkey, *args, **kwargs):
'''
Wrapper to assist with paginated responses from Digicert's REST API.
'''
ret = salt.utils.http.query(url, **kwargs)
if 'errors' in ret['dict']:
return ret['dict']
lim = int(ret['dict']['page']['limit'])
total = int(ret['dict']['page'... | [
"def",
"_paginate",
"(",
"url",
",",
"topkey",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"salt",
".",
"utils",
".",
"http",
".",
"query",
"(",
"url",
",",
"*",
"*",
"kwargs",
")",
"if",
"'errors'",
"in",
"ret",
"[",
"'dic... | Wrapper to assist with paginated responses from Digicert's REST API. | [
"Wrapper",
"to",
"assist",
"with",
"paginated",
"responses",
"from",
"Digicert",
"s",
"REST",
"API",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/digicertapi.py#L92-L120 |
36,070 | saltstack/salt | salt/runners/digicertapi.py | gen_key | def gen_key(minion_id, dns_name=None, password=None, key_len=2048):
'''
Generate and return a private_key. If a ``dns_name`` is passed in, the
private_key will be cached under that name.
CLI Example:
.. code-block:: bash
salt-run digicert.gen_key <minion_id> [dns_name] [password]
'''
... | python | def gen_key(minion_id, dns_name=None, password=None, key_len=2048):
'''
Generate and return a private_key. If a ``dns_name`` is passed in, the
private_key will be cached under that name.
CLI Example:
.. code-block:: bash
salt-run digicert.gen_key <minion_id> [dns_name] [password]
'''
... | [
"def",
"gen_key",
"(",
"minion_id",
",",
"dns_name",
"=",
"None",
",",
"password",
"=",
"None",
",",
"key_len",
"=",
"2048",
")",
":",
"keygen_type",
"=",
"'RSA'",
"if",
"keygen_type",
"==",
"\"RSA\"",
":",
"if",
"HAS_M2",
":",
"gen",
"=",
"RSA",
".",
... | Generate and return a private_key. If a ``dns_name`` is passed in, the
private_key will be cached under that name.
CLI Example:
.. code-block:: bash
salt-run digicert.gen_key <minion_id> [dns_name] [password] | [
"Generate",
"and",
"return",
"a",
"private_key",
".",
"If",
"a",
"dns_name",
"is",
"passed",
"in",
"the",
"private_key",
"will",
"be",
"cached",
"under",
"that",
"name",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/digicertapi.py#L487-L518 |
36,071 | saltstack/salt | salt/runners/digicertapi.py | get_org_details | def get_org_details(organization_id):
'''
Return the details for an organization
CLI Example:
.. code-block:: bash
salt-run digicert.get_org_details 34
Returns a dictionary with the org details, or with 'error' and 'status' keys.
'''
qdata = salt.utils.http.query(
'{0}/o... | python | def get_org_details(organization_id):
'''
Return the details for an organization
CLI Example:
.. code-block:: bash
salt-run digicert.get_org_details 34
Returns a dictionary with the org details, or with 'error' and 'status' keys.
'''
qdata = salt.utils.http.query(
'{0}/o... | [
"def",
"get_org_details",
"(",
"organization_id",
")",
":",
"qdata",
"=",
"salt",
".",
"utils",
".",
"http",
".",
"query",
"(",
"'{0}/organization/{1}'",
".",
"format",
"(",
"_base_url",
"(",
")",
",",
"organization_id",
")",
",",
"method",
"=",
"'GET'",
"... | Return the details for an organization
CLI Example:
.. code-block:: bash
salt-run digicert.get_org_details 34
Returns a dictionary with the org details, or with 'error' and 'status' keys. | [
"Return",
"the",
"details",
"for",
"an",
"organization"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/digicertapi.py#L521-L544 |
36,072 | saltstack/salt | salt/runners/digicertapi.py | _id_map | def _id_map(minion_id, dns_name):
'''
Maintain a relationship between a minion and a dns name
'''
bank = 'digicert/minions'
cache = salt.cache.Cache(__opts__, syspaths.CACHE_DIR)
dns_names = cache.fetch(bank, minion_id)
if not isinstance(dns_names, list):
dns_names = []
if dns_na... | python | def _id_map(minion_id, dns_name):
'''
Maintain a relationship between a minion and a dns name
'''
bank = 'digicert/minions'
cache = salt.cache.Cache(__opts__, syspaths.CACHE_DIR)
dns_names = cache.fetch(bank, minion_id)
if not isinstance(dns_names, list):
dns_names = []
if dns_na... | [
"def",
"_id_map",
"(",
"minion_id",
",",
"dns_name",
")",
":",
"bank",
"=",
"'digicert/minions'",
"cache",
"=",
"salt",
".",
"cache",
".",
"Cache",
"(",
"__opts__",
",",
"syspaths",
".",
"CACHE_DIR",
")",
"dns_names",
"=",
"cache",
".",
"fetch",
"(",
"ba... | Maintain a relationship between a minion and a dns name | [
"Maintain",
"a",
"relationship",
"between",
"a",
"minion",
"and",
"a",
"dns",
"name"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/digicertapi.py#L624-L635 |
36,073 | saltstack/salt | salt/runners/digicertapi.py | show_rsa | def show_rsa(minion_id, dns_name):
'''
Show a private RSA key
CLI Example:
.. code-block:: bash
salt-run digicert.show_rsa myminion domain.example.com
'''
cache = salt.cache.Cache(__opts__, syspaths.CACHE_DIR)
bank = 'digicert/domains'
data = cache.fetch(
bank, dns_nam... | python | def show_rsa(minion_id, dns_name):
'''
Show a private RSA key
CLI Example:
.. code-block:: bash
salt-run digicert.show_rsa myminion domain.example.com
'''
cache = salt.cache.Cache(__opts__, syspaths.CACHE_DIR)
bank = 'digicert/domains'
data = cache.fetch(
bank, dns_nam... | [
"def",
"show_rsa",
"(",
"minion_id",
",",
"dns_name",
")",
":",
"cache",
"=",
"salt",
".",
"cache",
".",
"Cache",
"(",
"__opts__",
",",
"syspaths",
".",
"CACHE_DIR",
")",
"bank",
"=",
"'digicert/domains'",
"data",
"=",
"cache",
".",
"fetch",
"(",
"bank",... | Show a private RSA key
CLI Example:
.. code-block:: bash
salt-run digicert.show_rsa myminion domain.example.com | [
"Show",
"a",
"private",
"RSA",
"key"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/digicertapi.py#L692-L707 |
36,074 | saltstack/salt | salt/modules/minion.py | list_ | def list_():
'''
Return a list of accepted, denied, unaccepted and rejected keys.
This is the same output as `salt-key -L`
CLI Example:
.. code-block:: bash
salt 'master' minion.list
'''
pki_dir = __salt__['config.get']('pki_dir', '')
# We have to replace the minion/master di... | python | def list_():
'''
Return a list of accepted, denied, unaccepted and rejected keys.
This is the same output as `salt-key -L`
CLI Example:
.. code-block:: bash
salt 'master' minion.list
'''
pki_dir = __salt__['config.get']('pki_dir', '')
# We have to replace the minion/master di... | [
"def",
"list_",
"(",
")",
":",
"pki_dir",
"=",
"__salt__",
"[",
"'config.get'",
"]",
"(",
"'pki_dir'",
",",
"''",
")",
"# We have to replace the minion/master directories",
"pki_dir",
"=",
"pki_dir",
".",
"replace",
"(",
"'minion'",
",",
"'master'",
")",
"# The ... | Return a list of accepted, denied, unaccepted and rejected keys.
This is the same output as `salt-key -L`
CLI Example:
.. code-block:: bash
salt 'master' minion.list | [
"Return",
"a",
"list",
"of",
"accepted",
"denied",
"unaccepted",
"and",
"rejected",
"keys",
".",
"This",
"is",
"the",
"same",
"output",
"as",
"salt",
"-",
"key",
"-",
"L"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/minion.py#L26-L58 |
36,075 | saltstack/salt | salt/modules/minion.py | _check_minions_directories | def _check_minions_directories(pki_dir):
'''
Return the minion keys directory paths.
This function is a copy of salt.key.Key._check_minions_directories.
'''
minions_accepted = os.path.join(pki_dir, salt.key.Key.ACC)
minions_pre = os.path.join(pki_dir, salt.key.Key.PEND)
minions_rejected = o... | python | def _check_minions_directories(pki_dir):
'''
Return the minion keys directory paths.
This function is a copy of salt.key.Key._check_minions_directories.
'''
minions_accepted = os.path.join(pki_dir, salt.key.Key.ACC)
minions_pre = os.path.join(pki_dir, salt.key.Key.PEND)
minions_rejected = o... | [
"def",
"_check_minions_directories",
"(",
"pki_dir",
")",
":",
"minions_accepted",
"=",
"os",
".",
"path",
".",
"join",
"(",
"pki_dir",
",",
"salt",
".",
"key",
".",
"Key",
".",
"ACC",
")",
"minions_pre",
"=",
"os",
".",
"path",
".",
"join",
"(",
"pki_... | Return the minion keys directory paths.
This function is a copy of salt.key.Key._check_minions_directories. | [
"Return",
"the",
"minion",
"keys",
"directory",
"paths",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/minion.py#L61-L72 |
36,076 | saltstack/salt | salt/modules/minion.py | kill | def kill(timeout=15):
'''
Kill the salt minion.
timeout
int seconds to wait for the minion to die.
If you have a monitor that restarts ``salt-minion`` when it dies then this is
a great way to restart after a minion upgrade.
CLI example::
>$ salt minion[12] minion.kill
... | python | def kill(timeout=15):
'''
Kill the salt minion.
timeout
int seconds to wait for the minion to die.
If you have a monitor that restarts ``salt-minion`` when it dies then this is
a great way to restart after a minion upgrade.
CLI example::
>$ salt minion[12] minion.kill
... | [
"def",
"kill",
"(",
"timeout",
"=",
"15",
")",
":",
"ret",
"=",
"{",
"'killed'",
":",
"None",
",",
"'retcode'",
":",
"1",
",",
"}",
"comment",
"=",
"[",
"]",
"pid",
"=",
"__grains__",
".",
"get",
"(",
"'pid'",
")",
"if",
"not",
"pid",
":",
"com... | Kill the salt minion.
timeout
int seconds to wait for the minion to die.
If you have a monitor that restarts ``salt-minion`` when it dies then this is
a great way to restart after a minion upgrade.
CLI example::
>$ salt minion[12] minion.kill
minion1:
----------
... | [
"Kill",
"the",
"salt",
"minion",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/minion.py#L75-L142 |
36,077 | saltstack/salt | salt/modules/minion.py | restart | def restart():
'''
Kill and restart the salt minion.
The configuration key ``minion_restart_command`` is an argv list for the
command to restart the minion. If ``minion_restart_command`` is not
specified or empty then the ``argv`` of the current process will be used.
if the configuration valu... | python | def restart():
'''
Kill and restart the salt minion.
The configuration key ``minion_restart_command`` is an argv list for the
command to restart the minion. If ``minion_restart_command`` is not
specified or empty then the ``argv`` of the current process will be used.
if the configuration valu... | [
"def",
"restart",
"(",
")",
":",
"should_kill",
"=",
"True",
"should_restart",
"=",
"True",
"comment",
"=",
"[",
"]",
"ret",
"=",
"{",
"'killed'",
":",
"None",
",",
"'restart'",
":",
"{",
"}",
",",
"'retcode'",
":",
"0",
",",
"}",
"restart_cmd",
"=",... | Kill and restart the salt minion.
The configuration key ``minion_restart_command`` is an argv list for the
command to restart the minion. If ``minion_restart_command`` is not
specified or empty then the ``argv`` of the current process will be used.
if the configuration value ``minion_restart_command`... | [
"Kill",
"and",
"restart",
"the",
"salt",
"minion",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/minion.py#L145-L257 |
36,078 | saltstack/salt | salt/modules/saltcheck.py | _generate_out_list | def _generate_out_list(results):
'''
generate test results output list
'''
passed = 0
failed = 0
skipped = 0
missing_tests = 0
total_time = 0.0
for state in results:
if not results[state].items():
missing_tests = missing_tests + 1
else:
for dum... | python | def _generate_out_list(results):
'''
generate test results output list
'''
passed = 0
failed = 0
skipped = 0
missing_tests = 0
total_time = 0.0
for state in results:
if not results[state].items():
missing_tests = missing_tests + 1
else:
for dum... | [
"def",
"_generate_out_list",
"(",
"results",
")",
":",
"passed",
"=",
"0",
"failed",
"=",
"0",
"skipped",
"=",
"0",
"missing_tests",
"=",
"0",
"total_time",
"=",
"0.0",
"for",
"state",
"in",
"results",
":",
"if",
"not",
"results",
"[",
"state",
"]",
".... | generate test results output list | [
"generate",
"test",
"results",
"output",
"list"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L356-L385 |
36,079 | saltstack/salt | salt/modules/saltcheck.py | _is_valid_function | def _is_valid_function(module_name, function):
'''
Determine if a function is valid for a module
'''
try:
functions = __salt__['sys.list_functions'](module_name)
except salt.exceptions.SaltException:
functions = ["unable to look up functions"]
return "{0}.{1}".format(module_name,... | python | def _is_valid_function(module_name, function):
'''
Determine if a function is valid for a module
'''
try:
functions = __salt__['sys.list_functions'](module_name)
except salt.exceptions.SaltException:
functions = ["unable to look up functions"]
return "{0}.{1}".format(module_name,... | [
"def",
"_is_valid_function",
"(",
"module_name",
",",
"function",
")",
":",
"try",
":",
"functions",
"=",
"__salt__",
"[",
"'sys.list_functions'",
"]",
"(",
"module_name",
")",
"except",
"salt",
".",
"exceptions",
".",
"SaltException",
":",
"functions",
"=",
"... | Determine if a function is valid for a module | [
"Determine",
"if",
"a",
"function",
"is",
"valid",
"for",
"a",
"module"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L416-L424 |
36,080 | saltstack/salt | salt/modules/saltcheck.py | SaltCheck._call_salt_command | def _call_salt_command(self,
fun,
args,
kwargs,
assertion_section=None):
'''
Generic call of salt Caller command
'''
value = False
try:
if args and kwargs:
... | python | def _call_salt_command(self,
fun,
args,
kwargs,
assertion_section=None):
'''
Generic call of salt Caller command
'''
value = False
try:
if args and kwargs:
... | [
"def",
"_call_salt_command",
"(",
"self",
",",
"fun",
",",
"args",
",",
"kwargs",
",",
"assertion_section",
"=",
"None",
")",
":",
"value",
"=",
"False",
"try",
":",
"if",
"args",
"and",
"kwargs",
":",
"value",
"=",
"self",
".",
"salt_lc",
".",
"cmd",
... | Generic call of salt Caller command | [
"Generic",
"call",
"of",
"salt",
"Caller",
"command"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L520-L545 |
36,081 | saltstack/salt | salt/modules/saltcheck.py | SaltCheck._cast_expected_to_returned_type | def _cast_expected_to_returned_type(expected, returned):
'''
Determine the type of variable returned
Cast the expected to the type of variable returned
'''
ret_type = type(returned)
new_expected = expected
if expected == "False" and ret_type == bool:
e... | python | def _cast_expected_to_returned_type(expected, returned):
'''
Determine the type of variable returned
Cast the expected to the type of variable returned
'''
ret_type = type(returned)
new_expected = expected
if expected == "False" and ret_type == bool:
e... | [
"def",
"_cast_expected_to_returned_type",
"(",
"expected",
",",
"returned",
")",
":",
"ret_type",
"=",
"type",
"(",
"returned",
")",
"new_expected",
"=",
"expected",
"if",
"expected",
"==",
"\"False\"",
"and",
"ret_type",
"==",
"bool",
":",
"expected",
"=",
"F... | Determine the type of variable returned
Cast the expected to the type of variable returned | [
"Determine",
"the",
"type",
"of",
"variable",
"returned",
"Cast",
"the",
"expected",
"to",
"the",
"type",
"of",
"variable",
"returned"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L615-L632 |
36,082 | saltstack/salt | salt/modules/saltcheck.py | SaltCheck.__assert_equal | def __assert_equal(expected, returned, assert_print_result=True):
'''
Test if two objects are equal
'''
result = "Pass"
try:
if assert_print_result:
assert (expected == returned), "{0} is not equal to {1}".format(expected, returned)
else:
... | python | def __assert_equal(expected, returned, assert_print_result=True):
'''
Test if two objects are equal
'''
result = "Pass"
try:
if assert_print_result:
assert (expected == returned), "{0} is not equal to {1}".format(expected, returned)
else:
... | [
"def",
"__assert_equal",
"(",
"expected",
",",
"returned",
",",
"assert_print_result",
"=",
"True",
")",
":",
"result",
"=",
"\"Pass\"",
"try",
":",
"if",
"assert_print_result",
":",
"assert",
"(",
"expected",
"==",
"returned",
")",
",",
"\"{0} is not equal to {... | Test if two objects are equal | [
"Test",
"if",
"two",
"objects",
"are",
"equal"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L635-L648 |
36,083 | saltstack/salt | salt/modules/saltcheck.py | SaltCheck.__assert_true | def __assert_true(returned):
'''
Test if an boolean is True
'''
result = "Pass"
try:
assert (returned is True), "{0} not True".format(returned)
except AssertionError as err:
result = "Fail: " + six.text_type(err)
return result | python | def __assert_true(returned):
'''
Test if an boolean is True
'''
result = "Pass"
try:
assert (returned is True), "{0} not True".format(returned)
except AssertionError as err:
result = "Fail: " + six.text_type(err)
return result | [
"def",
"__assert_true",
"(",
"returned",
")",
":",
"result",
"=",
"\"Pass\"",
"try",
":",
"assert",
"(",
"returned",
"is",
"True",
")",
",",
"\"{0} not True\"",
".",
"format",
"(",
"returned",
")",
"except",
"AssertionError",
"as",
"err",
":",
"result",
"=... | Test if an boolean is True | [
"Test",
"if",
"an",
"boolean",
"is",
"True"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L666-L675 |
36,084 | saltstack/salt | salt/modules/saltcheck.py | SaltCheck.__assert_false | def __assert_false(returned):
'''
Test if an boolean is False
'''
result = "Pass"
if isinstance(returned, str):
try:
returned = bool(returned)
except ValueError:
raise
try:
assert (returned is False), "{0... | python | def __assert_false(returned):
'''
Test if an boolean is False
'''
result = "Pass"
if isinstance(returned, str):
try:
returned = bool(returned)
except ValueError:
raise
try:
assert (returned is False), "{0... | [
"def",
"__assert_false",
"(",
"returned",
")",
":",
"result",
"=",
"\"Pass\"",
"if",
"isinstance",
"(",
"returned",
",",
"str",
")",
":",
"try",
":",
"returned",
"=",
"bool",
"(",
"returned",
")",
"except",
"ValueError",
":",
"raise",
"try",
":",
"assert... | Test if an boolean is False | [
"Test",
"if",
"an",
"boolean",
"is",
"False"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L678-L692 |
36,085 | saltstack/salt | salt/modules/saltcheck.py | SaltCheck.__assert_less | def __assert_less(expected, returned):
'''
Test if a value is less than the returned value
'''
result = "Pass"
try:
assert (expected < returned), "{0} not False".format(returned)
except AssertionError as err:
result = "Fail: " + six.text_type(err)
... | python | def __assert_less(expected, returned):
'''
Test if a value is less than the returned value
'''
result = "Pass"
try:
assert (expected < returned), "{0} not False".format(returned)
except AssertionError as err:
result = "Fail: " + six.text_type(err)
... | [
"def",
"__assert_less",
"(",
"expected",
",",
"returned",
")",
":",
"result",
"=",
"\"Pass\"",
"try",
":",
"assert",
"(",
"expected",
"<",
"returned",
")",
",",
"\"{0} not False\"",
".",
"format",
"(",
"returned",
")",
"except",
"AssertionError",
"as",
"err"... | Test if a value is less than the returned value | [
"Test",
"if",
"a",
"value",
"is",
"less",
"than",
"the",
"returned",
"value"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L749-L758 |
36,086 | saltstack/salt | salt/modules/saltcheck.py | SaltCheck.__assert_empty | def __assert_empty(returned):
'''
Test if a returned value is empty
'''
result = "Pass"
try:
assert (not returned), "{0} is not empty".format(returned)
except AssertionError as err:
result = "Fail: " + six.text_type(err)
return result | python | def __assert_empty(returned):
'''
Test if a returned value is empty
'''
result = "Pass"
try:
assert (not returned), "{0} is not empty".format(returned)
except AssertionError as err:
result = "Fail: " + six.text_type(err)
return result | [
"def",
"__assert_empty",
"(",
"returned",
")",
":",
"result",
"=",
"\"Pass\"",
"try",
":",
"assert",
"(",
"not",
"returned",
")",
",",
"\"{0} is not empty\"",
".",
"format",
"(",
"returned",
")",
"except",
"AssertionError",
"as",
"err",
":",
"result",
"=",
... | Test if a returned value is empty | [
"Test",
"if",
"a",
"returned",
"value",
"is",
"empty"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L773-L782 |
36,087 | saltstack/salt | salt/modules/saltcheck.py | SaltCheck.__assert_not_empty | def __assert_not_empty(returned):
'''
Test if a returned value is not empty
'''
result = "Pass"
try:
assert (returned), "value is empty"
except AssertionError as err:
result = "Fail: " + six.text_type(err)
return result | python | def __assert_not_empty(returned):
'''
Test if a returned value is not empty
'''
result = "Pass"
try:
assert (returned), "value is empty"
except AssertionError as err:
result = "Fail: " + six.text_type(err)
return result | [
"def",
"__assert_not_empty",
"(",
"returned",
")",
":",
"result",
"=",
"\"Pass\"",
"try",
":",
"assert",
"(",
"returned",
")",
",",
"\"value is empty\"",
"except",
"AssertionError",
"as",
"err",
":",
"result",
"=",
"\"Fail: \"",
"+",
"six",
".",
"text_type",
... | Test if a returned value is not empty | [
"Test",
"if",
"a",
"returned",
"value",
"is",
"not",
"empty"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L785-L794 |
36,088 | saltstack/salt | salt/modules/saltcheck.py | SaltCheck.get_state_search_path_list | def get_state_search_path_list(saltenv='base'):
'''
For the state file system, return a list of paths to search for states
'''
# state cache should be updated before running this method
search_list = []
cachedir = __opts__.get('cachedir', None)
log.info("Searching... | python | def get_state_search_path_list(saltenv='base'):
'''
For the state file system, return a list of paths to search for states
'''
# state cache should be updated before running this method
search_list = []
cachedir = __opts__.get('cachedir', None)
log.info("Searching... | [
"def",
"get_state_search_path_list",
"(",
"saltenv",
"=",
"'base'",
")",
":",
"# state cache should be updated before running this method",
"search_list",
"=",
"[",
"]",
"cachedir",
"=",
"__opts__",
".",
"get",
"(",
"'cachedir'",
",",
"None",
")",
"log",
".",
"info"... | For the state file system, return a list of paths to search for states | [
"For",
"the",
"state",
"file",
"system",
"return",
"a",
"list",
"of",
"paths",
"to",
"search",
"for",
"states"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L797-L807 |
36,089 | saltstack/salt | salt/modules/vbox_guest.py | additions_mount | def additions_mount():
'''
Mount VirtualBox Guest Additions CD to the temp directory.
To connect VirtualBox Guest Additions via VirtualBox graphical interface
press 'Host+D' ('Host' is usually 'Right Ctrl').
CLI Example:
.. code-block:: bash
salt '*' vbox_guest.additions_mount
:... | python | def additions_mount():
'''
Mount VirtualBox Guest Additions CD to the temp directory.
To connect VirtualBox Guest Additions via VirtualBox graphical interface
press 'Host+D' ('Host' is usually 'Right Ctrl').
CLI Example:
.. code-block:: bash
salt '*' vbox_guest.additions_mount
:... | [
"def",
"additions_mount",
"(",
")",
":",
"mount_point",
"=",
"tempfile",
".",
"mkdtemp",
"(",
")",
"ret",
"=",
"__salt__",
"[",
"'mount.mount'",
"]",
"(",
"mount_point",
",",
"'/dev/cdrom'",
")",
"if",
"ret",
"is",
"True",
":",
"return",
"mount_point",
"el... | Mount VirtualBox Guest Additions CD to the temp directory.
To connect VirtualBox Guest Additions via VirtualBox graphical interface
press 'Host+D' ('Host' is usually 'Right Ctrl').
CLI Example:
.. code-block:: bash
salt '*' vbox_guest.additions_mount
:return: True or OSError exception | [
"Mount",
"VirtualBox",
"Guest",
"Additions",
"CD",
"to",
"the",
"temp",
"directory",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vbox_guest.py#L35-L55 |
36,090 | saltstack/salt | salt/modules/vbox_guest.py | additions_umount | def additions_umount(mount_point):
'''
Unmount VirtualBox Guest Additions CD from the temp directory.
CLI Example:
.. code-block:: bash
salt '*' vbox_guest.additions_umount
:param mount_point: directory VirtualBox Guest Additions is mounted to
:return: True or an string with error
... | python | def additions_umount(mount_point):
'''
Unmount VirtualBox Guest Additions CD from the temp directory.
CLI Example:
.. code-block:: bash
salt '*' vbox_guest.additions_umount
:param mount_point: directory VirtualBox Guest Additions is mounted to
:return: True or an string with error
... | [
"def",
"additions_umount",
"(",
"mount_point",
")",
":",
"ret",
"=",
"__salt__",
"[",
"'mount.umount'",
"]",
"(",
"mount_point",
")",
"if",
"ret",
":",
"os",
".",
"rmdir",
"(",
"mount_point",
")",
"return",
"ret"
] | Unmount VirtualBox Guest Additions CD from the temp directory.
CLI Example:
.. code-block:: bash
salt '*' vbox_guest.additions_umount
:param mount_point: directory VirtualBox Guest Additions is mounted to
:return: True or an string with error | [
"Unmount",
"VirtualBox",
"Guest",
"Additions",
"CD",
"from",
"the",
"temp",
"directory",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vbox_guest.py#L58-L74 |
36,091 | saltstack/salt | salt/modules/vbox_guest.py | additions_install | def additions_install(**kwargs):
'''
Install VirtualBox Guest Additions. Uses the CD, connected by VirtualBox.
To connect VirtualBox Guest Additions via VirtualBox graphical interface
press 'Host+D' ('Host' is usually 'Right Ctrl').
See https://www.virtualbox.org/manual/ch04.html#idp52733088 for m... | python | def additions_install(**kwargs):
'''
Install VirtualBox Guest Additions. Uses the CD, connected by VirtualBox.
To connect VirtualBox Guest Additions via VirtualBox graphical interface
press 'Host+D' ('Host' is usually 'Right Ctrl').
See https://www.virtualbox.org/manual/ch04.html#idp52733088 for m... | [
"def",
"additions_install",
"(",
"*",
"*",
"kwargs",
")",
":",
"with",
"_additions_mounted",
"(",
")",
"as",
"mount_point",
":",
"kernel",
"=",
"__grains__",
".",
"get",
"(",
"'kernel'",
",",
"''",
")",
"if",
"kernel",
"==",
"'Linux'",
":",
"return",
"_a... | Install VirtualBox Guest Additions. Uses the CD, connected by VirtualBox.
To connect VirtualBox Guest Additions via VirtualBox graphical interface
press 'Host+D' ('Host' is usually 'Right Ctrl').
See https://www.virtualbox.org/manual/ch04.html#idp52733088 for more details.
CLI Example:
.. code-b... | [
"Install",
"VirtualBox",
"Guest",
"Additions",
".",
"Uses",
"the",
"CD",
"connected",
"by",
"VirtualBox",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vbox_guest.py#L156-L182 |
36,092 | saltstack/salt | salt/modules/vbox_guest.py | additions_version | def additions_version():
'''
Check VirtualBox Guest Additions version.
CLI Example:
.. code-block:: bash
salt '*' vbox_guest.additions_version
:return: version of VirtualBox Guest Additions or False if they are not installed
'''
try:
d = _additions_dir()
except Enviro... | python | def additions_version():
'''
Check VirtualBox Guest Additions version.
CLI Example:
.. code-block:: bash
salt '*' vbox_guest.additions_version
:return: version of VirtualBox Guest Additions or False if they are not installed
'''
try:
d = _additions_dir()
except Enviro... | [
"def",
"additions_version",
"(",
")",
":",
"try",
":",
"d",
"=",
"_additions_dir",
"(",
")",
"except",
"EnvironmentError",
":",
"return",
"False",
"if",
"d",
"and",
"os",
".",
"listdir",
"(",
"d",
")",
":",
"return",
"re",
".",
"sub",
"(",
"r'^{0}-'",
... | Check VirtualBox Guest Additions version.
CLI Example:
.. code-block:: bash
salt '*' vbox_guest.additions_version
:return: version of VirtualBox Guest Additions or False if they are not installed | [
"Check",
"VirtualBox",
"Guest",
"Additions",
"version",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vbox_guest.py#L258-L277 |
36,093 | saltstack/salt | salt/modules/inspectlib/query.py | SysInfo._get_disk_size | def _get_disk_size(self, device):
'''
Get a size of a disk.
'''
out = __salt__['cmd.run_all']("df {0}".format(device))
if out['retcode']:
msg = "Disk size info error: {0}".format(out['stderr'])
log.error(msg)
raise SIException(msg)
dev... | python | def _get_disk_size(self, device):
'''
Get a size of a disk.
'''
out = __salt__['cmd.run_all']("df {0}".format(device))
if out['retcode']:
msg = "Disk size info error: {0}".format(out['stderr'])
log.error(msg)
raise SIException(msg)
dev... | [
"def",
"_get_disk_size",
"(",
"self",
",",
"device",
")",
":",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"\"df {0}\"",
".",
"format",
"(",
"device",
")",
")",
"if",
"out",
"[",
"'retcode'",
"]",
":",
"msg",
"=",
"\"Disk size info error: {0}\"... | Get a size of a disk. | [
"Get",
"a",
"size",
"of",
"a",
"disk",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L49-L64 |
36,094 | saltstack/salt | salt/modules/inspectlib/query.py | SysInfo._get_fs | def _get_fs(self):
'''
Get available file systems and their types.
'''
data = dict()
for dev, dev_data in salt.utils.fsutils._blkid().items():
dev = self._get_disk_size(dev)
device = dev.pop('device')
dev['type'] = dev_data['type']
... | python | def _get_fs(self):
'''
Get available file systems and their types.
'''
data = dict()
for dev, dev_data in salt.utils.fsutils._blkid().items():
dev = self._get_disk_size(dev)
device = dev.pop('device')
dev['type'] = dev_data['type']
... | [
"def",
"_get_fs",
"(",
"self",
")",
":",
"data",
"=",
"dict",
"(",
")",
"for",
"dev",
",",
"dev_data",
"in",
"salt",
".",
"utils",
".",
"fsutils",
".",
"_blkid",
"(",
")",
".",
"items",
"(",
")",
":",
"dev",
"=",
"self",
".",
"_get_disk_size",
"(... | Get available file systems and their types. | [
"Get",
"available",
"file",
"systems",
"and",
"their",
"types",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L66-L78 |
36,095 | saltstack/salt | salt/modules/inspectlib/query.py | SysInfo._get_cpu | def _get_cpu(self):
'''
Get available CPU information.
'''
# CPU data in grains is OK-ish, but lscpu is still better in this case
out = __salt__['cmd.run_all']("lscpu")
salt.utils.fsutils._verify_run(out)
data = dict()
for descr, value in [elm.split(":", 1... | python | def _get_cpu(self):
'''
Get available CPU information.
'''
# CPU data in grains is OK-ish, but lscpu is still better in this case
out = __salt__['cmd.run_all']("lscpu")
salt.utils.fsutils._verify_run(out)
data = dict()
for descr, value in [elm.split(":", 1... | [
"def",
"_get_cpu",
"(",
"self",
")",
":",
"# CPU data in grains is OK-ish, but lscpu is still better in this case",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"\"lscpu\"",
")",
"salt",
".",
"utils",
".",
"fsutils",
".",
"_verify_run",
"(",
"out",
")",
... | Get available CPU information. | [
"Get",
"available",
"CPU",
"information",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L86-L97 |
36,096 | saltstack/salt | salt/modules/inspectlib/query.py | SysInfo._get_mem | def _get_mem(self):
'''
Get memory.
'''
out = __salt__['cmd.run_all']("vmstat -s")
if out['retcode']:
raise SIException("Memory info error: {0}".format(out['stderr']))
ret = dict()
for line in out['stdout'].split(os.linesep):
line = line.s... | python | def _get_mem(self):
'''
Get memory.
'''
out = __salt__['cmd.run_all']("vmstat -s")
if out['retcode']:
raise SIException("Memory info error: {0}".format(out['stderr']))
ret = dict()
for line in out['stdout'].split(os.linesep):
line = line.s... | [
"def",
"_get_mem",
"(",
"self",
")",
":",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"\"vmstat -s\"",
")",
"if",
"out",
"[",
"'retcode'",
"]",
":",
"raise",
"SIException",
"(",
"\"Memory info error: {0}\"",
".",
"format",
"(",
"out",
"[",
"'st... | Get memory. | [
"Get",
"memory",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L99-L117 |
36,097 | saltstack/salt | salt/modules/inspectlib/query.py | SysInfo._get_network | def _get_network(self):
'''
Get network configuration.
'''
data = dict()
data['interfaces'] = salt.utils.network.interfaces()
data['subnets'] = salt.utils.network.subnets()
return data | python | def _get_network(self):
'''
Get network configuration.
'''
data = dict()
data['interfaces'] = salt.utils.network.interfaces()
data['subnets'] = salt.utils.network.subnets()
return data | [
"def",
"_get_network",
"(",
"self",
")",
":",
"data",
"=",
"dict",
"(",
")",
"data",
"[",
"'interfaces'",
"]",
"=",
"salt",
".",
"utils",
".",
"network",
".",
"interfaces",
"(",
")",
"data",
"[",
"'subnets'",
"]",
"=",
"salt",
".",
"utils",
".",
"n... | Get network configuration. | [
"Get",
"network",
"configuration",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L119-L127 |
36,098 | saltstack/salt | salt/modules/inspectlib/query.py | SysInfo._get_os | def _get_os(self):
'''
Get operating system summary
'''
return {
'name': self._grain('os'),
'family': self._grain('os_family'),
'arch': self._grain('osarch'),
'release': self._grain('osrelease'),
} | python | def _get_os(self):
'''
Get operating system summary
'''
return {
'name': self._grain('os'),
'family': self._grain('os_family'),
'arch': self._grain('osarch'),
'release': self._grain('osrelease'),
} | [
"def",
"_get_os",
"(",
"self",
")",
":",
"return",
"{",
"'name'",
":",
"self",
".",
"_grain",
"(",
"'os'",
")",
",",
"'family'",
":",
"self",
".",
"_grain",
"(",
"'os_family'",
")",
",",
"'arch'",
":",
"self",
".",
"_grain",
"(",
"'osarch'",
")",
"... | Get operating system summary | [
"Get",
"operating",
"system",
"summary"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L129-L138 |
36,099 | saltstack/salt | salt/modules/inspectlib/query.py | Query._configuration | def _configuration(self, *args, **kwargs):
'''
Return configuration files.
'''
data = dict()
self.db.open()
for pkg in self.db.get(Package):
configs = list()
for pkg_cfg in self.db.get(PackageCfgFile, eq={'pkgid': pkg.id}):
configs... | python | def _configuration(self, *args, **kwargs):
'''
Return configuration files.
'''
data = dict()
self.db.open()
for pkg in self.db.get(Package):
configs = list()
for pkg_cfg in self.db.get(PackageCfgFile, eq={'pkgid': pkg.id}):
configs... | [
"def",
"_configuration",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"dict",
"(",
")",
"self",
".",
"db",
".",
"open",
"(",
")",
"for",
"pkg",
"in",
"self",
".",
"db",
".",
"get",
"(",
"Package",
")",
":",
"... | Return configuration files. | [
"Return",
"configuration",
"files",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L195-L211 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.