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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
34,800 | saltstack/salt | salt/utils/jinja.py | ensure_sequence_filter | def ensure_sequence_filter(data):
'''
Ensure sequenced data.
**sequence**
ensure that parsed data is a sequence
.. code-block:: jinja
{% set my_string = "foo" %}
{% set my_list = ["bar", ] %}
{% set my_dict = {"baz": "qux"} %}
{{ my_string|sequence|first }}
... | python | def ensure_sequence_filter(data):
'''
Ensure sequenced data.
**sequence**
ensure that parsed data is a sequence
.. code-block:: jinja
{% set my_string = "foo" %}
{% set my_list = ["bar", ] %}
{% set my_dict = {"baz": "qux"} %}
{{ my_string|sequence|first }}
... | [
"def",
"ensure_sequence_filter",
"(",
"data",
")",
":",
"if",
"not",
"isinstance",
"(",
"data",
",",
"(",
"list",
",",
"tuple",
",",
"set",
",",
"dict",
")",
")",
":",
"return",
"[",
"data",
"]",
"return",
"data"
] | Ensure sequenced data.
**sequence**
ensure that parsed data is a sequence
.. code-block:: jinja
{% set my_string = "foo" %}
{% set my_list = ["bar", ] %}
{% set my_dict = {"baz": "qux"} %}
{{ my_string|sequence|first }}
{{ my_list|sequence|first }}
{{... | [
"Ensure",
"sequenced",
"data",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L252-L281 |
34,801 | saltstack/salt | salt/utils/jinja.py | to_bool | def to_bool(val):
'''
Returns the logical value.
.. code-block:: jinja
{{ 'yes' | to_bool }}
will be rendered as:
.. code-block:: text
True
'''
if val is None:
return False
if isinstance(val, bool):
return val
if isinstance(val, (six.text_type, si... | python | def to_bool(val):
'''
Returns the logical value.
.. code-block:: jinja
{{ 'yes' | to_bool }}
will be rendered as:
.. code-block:: text
True
'''
if val is None:
return False
if isinstance(val, bool):
return val
if isinstance(val, (six.text_type, si... | [
"def",
"to_bool",
"(",
"val",
")",
":",
"if",
"val",
"is",
"None",
":",
"return",
"False",
"if",
"isinstance",
"(",
"val",
",",
"bool",
")",
":",
"return",
"val",
"if",
"isinstance",
"(",
"val",
",",
"(",
"six",
".",
"text_type",
",",
"six",
".",
... | Returns the logical value.
.. code-block:: jinja
{{ 'yes' | to_bool }}
will be rendered as:
.. code-block:: text
True | [
"Returns",
"the",
"logical",
"value",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L285-L309 |
34,802 | saltstack/salt | salt/utils/jinja.py | regex_replace | def regex_replace(txt, rgx, val, ignorecase=False, multiline=False):
r'''
Searches for a pattern and replaces with a sequence of characters.
.. code-block:: jinja
{% set my_text = 'lets replace spaces' %}
{{ my_text | regex_replace('\s+', '__') }}
will be rendered as:
.. code-blo... | python | def regex_replace(txt, rgx, val, ignorecase=False, multiline=False):
r'''
Searches for a pattern and replaces with a sequence of characters.
.. code-block:: jinja
{% set my_text = 'lets replace spaces' %}
{{ my_text | regex_replace('\s+', '__') }}
will be rendered as:
.. code-blo... | [
"def",
"regex_replace",
"(",
"txt",
",",
"rgx",
",",
"val",
",",
"ignorecase",
"=",
"False",
",",
"multiline",
"=",
"False",
")",
":",
"flag",
"=",
"0",
"if",
"ignorecase",
":",
"flag",
"|=",
"re",
".",
"I",
"if",
"multiline",
":",
"flag",
"|=",
"r... | r'''
Searches for a pattern and replaces with a sequence of characters.
.. code-block:: jinja
{% set my_text = 'lets replace spaces' %}
{{ my_text | regex_replace('\s+', '__') }}
will be rendered as:
.. code-block:: text
lets__replace__spaces | [
"r",
"Searches",
"for",
"a",
"pattern",
"and",
"replaces",
"with",
"a",
"sequence",
"of",
"characters",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L411-L432 |
34,803 | saltstack/salt | salt/utils/jinja.py | uuid_ | def uuid_(val):
'''
Returns a UUID corresponding to the value passed as argument.
.. code-block:: jinja
{{ 'example' | uuid }}
will be rendered as:
.. code-block:: text
f4efeff8-c219-578a-bad7-3dc280612ec8
'''
return six.text_type(
uuid.uuid5(
GLOBAL_... | python | def uuid_(val):
'''
Returns a UUID corresponding to the value passed as argument.
.. code-block:: jinja
{{ 'example' | uuid }}
will be rendered as:
.. code-block:: text
f4efeff8-c219-578a-bad7-3dc280612ec8
'''
return six.text_type(
uuid.uuid5(
GLOBAL_... | [
"def",
"uuid_",
"(",
"val",
")",
":",
"return",
"six",
".",
"text_type",
"(",
"uuid",
".",
"uuid5",
"(",
"GLOBAL_UUID",
",",
"salt",
".",
"utils",
".",
"stringutils",
".",
"to_str",
"(",
"val",
")",
")",
")"
] | Returns a UUID corresponding to the value passed as argument.
.. code-block:: jinja
{{ 'example' | uuid }}
will be rendered as:
.. code-block:: text
f4efeff8-c219-578a-bad7-3dc280612ec8 | [
"Returns",
"a",
"UUID",
"corresponding",
"to",
"the",
"value",
"passed",
"as",
"argument",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L436-L455 |
34,804 | saltstack/salt | salt/utils/jinja.py | unique | def unique(values):
'''
Removes duplicates from a list.
.. code-block:: jinja
{% set my_list = ['a', 'b', 'c', 'a', 'b'] -%}
{{ my_list | unique }}
will be rendered as:
.. code-block:: text
['a', 'b', 'c']
'''
ret = None
if isinstance(values, collections.Hash... | python | def unique(values):
'''
Removes duplicates from a list.
.. code-block:: jinja
{% set my_list = ['a', 'b', 'c', 'a', 'b'] -%}
{{ my_list | unique }}
will be rendered as:
.. code-block:: text
['a', 'b', 'c']
'''
ret = None
if isinstance(values, collections.Hash... | [
"def",
"unique",
"(",
"values",
")",
":",
"ret",
"=",
"None",
"if",
"isinstance",
"(",
"values",
",",
"collections",
".",
"Hashable",
")",
":",
"ret",
"=",
"set",
"(",
"values",
")",
"else",
":",
"ret",
"=",
"[",
"]",
"for",
"value",
"in",
"values"... | Removes duplicates from a list.
.. code-block:: jinja
{% set my_list = ['a', 'b', 'c', 'a', 'b'] -%}
{{ my_list | unique }}
will be rendered as:
.. code-block:: text
['a', 'b', 'c'] | [
"Removes",
"duplicates",
"from",
"a",
"list",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L462-L485 |
34,805 | saltstack/salt | salt/utils/jinja.py | lst_avg | def lst_avg(lst):
'''
Returns the average value of a list.
.. code-block:: jinja
{% my_list = [1,2,3,4] -%}
{{ set my_list | avg }}
will be rendered as:
.. code-block:: yaml
2.5
'''
salt.utils.versions.warn_until(
'Neon',
'This results of this fun... | python | def lst_avg(lst):
'''
Returns the average value of a list.
.. code-block:: jinja
{% my_list = [1,2,3,4] -%}
{{ set my_list | avg }}
will be rendered as:
.. code-block:: yaml
2.5
'''
salt.utils.versions.warn_until(
'Neon',
'This results of this fun... | [
"def",
"lst_avg",
"(",
"lst",
")",
":",
"salt",
".",
"utils",
".",
"versions",
".",
"warn_until",
"(",
"'Neon'",
",",
"'This results of this function are currently being rounded.'",
"'Beginning in the Salt Neon release, results will no longer be '",
"'rounded and this warning wil... | Returns the average value of a list.
.. code-block:: jinja
{% my_list = [1,2,3,4] -%}
{{ set my_list | avg }}
will be rendered as:
.. code-block:: yaml
2.5 | [
"Returns",
"the",
"average",
"value",
"of",
"a",
"list",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L527-L552 |
34,806 | saltstack/salt | salt/utils/jinja.py | union | def union(lst1, lst2):
'''
Returns the union of two lists.
.. code-block:: jinja
{% my_list = [1,2,3,4] -%}
{{ set my_list | union([2, 4, 6]) }}
will be rendered as:
.. code-block:: text
[1, 2, 3, 4, 6]
'''
if isinstance(lst1, collections.Hashable) and isinstance... | python | def union(lst1, lst2):
'''
Returns the union of two lists.
.. code-block:: jinja
{% my_list = [1,2,3,4] -%}
{{ set my_list | union([2, 4, 6]) }}
will be rendered as:
.. code-block:: text
[1, 2, 3, 4, 6]
'''
if isinstance(lst1, collections.Hashable) and isinstance... | [
"def",
"union",
"(",
"lst1",
",",
"lst2",
")",
":",
"if",
"isinstance",
"(",
"lst1",
",",
"collections",
".",
"Hashable",
")",
"and",
"isinstance",
"(",
"lst2",
",",
"collections",
".",
"Hashable",
")",
":",
"return",
"set",
"(",
"lst1",
")",
"|",
"s... | Returns the union of two lists.
.. code-block:: jinja
{% my_list = [1,2,3,4] -%}
{{ set my_list | union([2, 4, 6]) }}
will be rendered as:
.. code-block:: text
[1, 2, 3, 4, 6] | [
"Returns",
"the",
"union",
"of",
"two",
"lists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L556-L573 |
34,807 | saltstack/salt | salt/utils/jinja.py | intersect | def intersect(lst1, lst2):
'''
Returns the intersection of two lists.
.. code-block:: jinja
{% my_list = [1,2,3,4] -%}
{{ set my_list | intersect([2, 4, 6]) }}
will be rendered as:
.. code-block:: text
[2, 4]
'''
if isinstance(lst1, collections.Hashable) and isin... | python | def intersect(lst1, lst2):
'''
Returns the intersection of two lists.
.. code-block:: jinja
{% my_list = [1,2,3,4] -%}
{{ set my_list | intersect([2, 4, 6]) }}
will be rendered as:
.. code-block:: text
[2, 4]
'''
if isinstance(lst1, collections.Hashable) and isin... | [
"def",
"intersect",
"(",
"lst1",
",",
"lst2",
")",
":",
"if",
"isinstance",
"(",
"lst1",
",",
"collections",
".",
"Hashable",
")",
"and",
"isinstance",
"(",
"lst2",
",",
"collections",
".",
"Hashable",
")",
":",
"return",
"set",
"(",
"lst1",
")",
"&",
... | Returns the intersection of two lists.
.. code-block:: jinja
{% my_list = [1,2,3,4] -%}
{{ set my_list | intersect([2, 4, 6]) }}
will be rendered as:
.. code-block:: text
[2, 4] | [
"Returns",
"the",
"intersection",
"of",
"two",
"lists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L577-L594 |
34,808 | saltstack/salt | salt/utils/jinja.py | SaltCacheLoader.file_client | def file_client(self):
'''
Return a file client. Instantiates on first call.
'''
if not self._file_client:
self._file_client = salt.fileclient.get_file_client(
self.opts, self.pillar_rend)
return self._file_client | python | def file_client(self):
'''
Return a file client. Instantiates on first call.
'''
if not self._file_client:
self._file_client = salt.fileclient.get_file_client(
self.opts, self.pillar_rend)
return self._file_client | [
"def",
"file_client",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_file_client",
":",
"self",
".",
"_file_client",
"=",
"salt",
".",
"fileclient",
".",
"get_file_client",
"(",
"self",
".",
"opts",
",",
"self",
".",
"pillar_rend",
")",
"return",
"se... | Return a file client. Instantiates on first call. | [
"Return",
"a",
"file",
"client",
".",
"Instantiates",
"on",
"first",
"call",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L76-L83 |
34,809 | saltstack/salt | salt/utils/jinja.py | SaltCacheLoader.cache_file | def cache_file(self, template):
'''
Cache a file from the salt master
'''
saltpath = salt.utils.url.create(template)
self.file_client().get_file(saltpath, '', True, self.saltenv) | python | def cache_file(self, template):
'''
Cache a file from the salt master
'''
saltpath = salt.utils.url.create(template)
self.file_client().get_file(saltpath, '', True, self.saltenv) | [
"def",
"cache_file",
"(",
"self",
",",
"template",
")",
":",
"saltpath",
"=",
"salt",
".",
"utils",
".",
"url",
".",
"create",
"(",
"template",
")",
"self",
".",
"file_client",
"(",
")",
".",
"get_file",
"(",
"saltpath",
",",
"''",
",",
"True",
",",
... | Cache a file from the salt master | [
"Cache",
"a",
"file",
"from",
"the",
"salt",
"master"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L85-L90 |
34,810 | saltstack/salt | salt/utils/jinja.py | SaltCacheLoader.check_cache | def check_cache(self, template):
'''
Cache a file only once
'''
if template not in self.cached:
self.cache_file(template)
self.cached.append(template) | python | def check_cache(self, template):
'''
Cache a file only once
'''
if template not in self.cached:
self.cache_file(template)
self.cached.append(template) | [
"def",
"check_cache",
"(",
"self",
",",
"template",
")",
":",
"if",
"template",
"not",
"in",
"self",
".",
"cached",
":",
"self",
".",
"cache_file",
"(",
"template",
")",
"self",
".",
"cached",
".",
"append",
"(",
"template",
")"
] | Cache a file only once | [
"Cache",
"a",
"file",
"only",
"once"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L92-L98 |
34,811 | saltstack/salt | salt/utils/jinja.py | SaltCacheLoader.get_source | def get_source(self, environment, template):
'''
Salt-specific loader to find imported jinja files.
Jinja imports will be interpreted as originating from the top
of each of the directories in the searchpath when the template
name does not begin with './' or '../'. When a templa... | python | def get_source(self, environment, template):
'''
Salt-specific loader to find imported jinja files.
Jinja imports will be interpreted as originating from the top
of each of the directories in the searchpath when the template
name does not begin with './' or '../'. When a templa... | [
"def",
"get_source",
"(",
"self",
",",
"environment",
",",
"template",
")",
":",
"# FIXME: somewhere do seprataor replacement: '\\\\' => '/'",
"_template",
"=",
"template",
"if",
"template",
".",
"split",
"(",
"'/'",
",",
"1",
")",
"[",
"0",
"]",
"in",
"(",
"'... | Salt-specific loader to find imported jinja files.
Jinja imports will be interpreted as originating from the top
of each of the directories in the searchpath when the template
name does not begin with './' or '../'. When a template name
begins with './' or '../' then the import will be... | [
"Salt",
"-",
"specific",
"loader",
"to",
"find",
"imported",
"jinja",
"files",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L100-L171 |
34,812 | saltstack/salt | salt/utils/jinja.py | SerializerExtension.finalizer | def finalizer(self, data):
'''
Ensure that printed mappings are YAML friendly.
'''
def explore(data):
if isinstance(data, (dict, OrderedDict)):
return PrintableDict(
[(key, explore(value)) for key, value in six.iteritems(data)]
... | python | def finalizer(self, data):
'''
Ensure that printed mappings are YAML friendly.
'''
def explore(data):
if isinstance(data, (dict, OrderedDict)):
return PrintableDict(
[(key, explore(value)) for key, value in six.iteritems(data)]
... | [
"def",
"finalizer",
"(",
"self",
",",
"data",
")",
":",
"def",
"explore",
"(",
"data",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"(",
"dict",
",",
"OrderedDict",
")",
")",
":",
"return",
"PrintableDict",
"(",
"[",
"(",
"key",
",",
"explore",
... | Ensure that printed mappings are YAML friendly. | [
"Ensure",
"that",
"printed",
"mappings",
"are",
"YAML",
"friendly",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L840-L852 |
34,813 | saltstack/salt | salt/states/elasticsearch.py | alias_absent | def alias_absent(name, index):
'''
Ensure that the index alias is absent.
name
Name of the index alias to remove
index
Name of the index for the alias
'''
ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''}
try:
alias = __salt__['elasticsearch.alias_... | python | def alias_absent(name, index):
'''
Ensure that the index alias is absent.
name
Name of the index alias to remove
index
Name of the index for the alias
'''
ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''}
try:
alias = __salt__['elasticsearch.alias_... | [
"def",
"alias_absent",
"(",
"name",
",",
"index",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"try",
":",
"alias",
"=",
"__salt__",
"[",
"'elasti... | Ensure that the index alias is absent.
name
Name of the index alias to remove
index
Name of the index for the alias | [
"Ensure",
"that",
"the",
"index",
"alias",
"is",
"absent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/elasticsearch.py#L104-L136 |
34,814 | saltstack/salt | salt/states/elasticsearch.py | alias_present | def alias_present(name, index, definition=None):
'''
Ensure that the named index alias is present.
name
Name of the alias
index
Name of the index
definition
Optional dict for filters as per https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html
... | python | def alias_present(name, index, definition=None):
'''
Ensure that the named index alias is present.
name
Name of the alias
index
Name of the index
definition
Optional dict for filters as per https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html
... | [
"def",
"alias_present",
"(",
"name",
",",
"index",
",",
"definition",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"try",
":",
"alias... | Ensure that the named index alias is present.
name
Name of the alias
index
Name of the index
definition
Optional dict for filters as per https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html
**Example:**
.. code-block:: yaml
mytestal... | [
"Ensure",
"that",
"the",
"named",
"index",
"alias",
"is",
"present",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/elasticsearch.py#L139-L199 |
34,815 | saltstack/salt | salt/states/elasticsearch.py | index_template_absent | def index_template_absent(name):
'''
Ensure that the named index template is absent.
name
Name of the index to remove
'''
ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''}
try:
index_template = __salt__['elasticsearch.index_template_get'](name=name)
if... | python | def index_template_absent(name):
'''
Ensure that the named index template is absent.
name
Name of the index to remove
'''
ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''}
try:
index_template = __salt__['elasticsearch.index_template_get'](name=name)
if... | [
"def",
"index_template_absent",
"(",
"name",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"try",
":",
"index_template",
"=",
"__salt__",
"[",
"'elasti... | Ensure that the named index template is absent.
name
Name of the index to remove | [
"Ensure",
"that",
"the",
"named",
"index",
"template",
"is",
"absent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/elasticsearch.py#L202-L232 |
34,816 | saltstack/salt | salt/states/elasticsearch.py | index_template_present | def index_template_present(name, definition, check_definition=False):
'''
Ensure that the named index template is present.
name
Name of the index to add
definition
Required dict for creation parameters as per https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templa... | python | def index_template_present(name, definition, check_definition=False):
'''
Ensure that the named index template is present.
name
Name of the index to add
definition
Required dict for creation parameters as per https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templa... | [
"def",
"index_template_present",
"(",
"name",
",",
"definition",
",",
"check_definition",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"... | Ensure that the named index template is present.
name
Name of the index to add
definition
Required dict for creation parameters as per https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html
check_definition
If the template already exists and the defin... | [
"Ensure",
"that",
"the",
"named",
"index",
"template",
"is",
"present",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/elasticsearch.py#L235-L309 |
34,817 | saltstack/salt | salt/states/elasticsearch.py | pipeline_absent | def pipeline_absent(name):
'''
Ensure that the named pipeline is absent
name
Name of the pipeline to remove
'''
ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''}
try:
pipeline = __salt__['elasticsearch.pipeline_get'](id=name)
if pipeline and name in pi... | python | def pipeline_absent(name):
'''
Ensure that the named pipeline is absent
name
Name of the pipeline to remove
'''
ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''}
try:
pipeline = __salt__['elasticsearch.pipeline_get'](id=name)
if pipeline and name in pi... | [
"def",
"pipeline_absent",
"(",
"name",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"try",
":",
"pipeline",
"=",
"__salt__",
"[",
"'elasticsearch.pipe... | Ensure that the named pipeline is absent
name
Name of the pipeline to remove | [
"Ensure",
"that",
"the",
"named",
"pipeline",
"is",
"absent"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/elasticsearch.py#L312-L342 |
34,818 | saltstack/salt | salt/states/elasticsearch.py | pipeline_present | def pipeline_present(name, definition):
'''
Ensure that the named pipeline is present.
name
Name of the index to add
definition
Required dict for creation parameters as per https://www.elastic.co/guide/en/elasticsearch/reference/master/pipeline.html
**Example:**
.. code-block:... | python | def pipeline_present(name, definition):
'''
Ensure that the named pipeline is present.
name
Name of the index to add
definition
Required dict for creation parameters as per https://www.elastic.co/guide/en/elasticsearch/reference/master/pipeline.html
**Example:**
.. code-block:... | [
"def",
"pipeline_present",
"(",
"name",
",",
"definition",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"try",
":",
"pipeline",
"=",
"__salt__",
"["... | Ensure that the named pipeline is present.
name
Name of the index to add
definition
Required dict for creation parameters as per https://www.elastic.co/guide/en/elasticsearch/reference/master/pipeline.html
**Example:**
.. code-block:: yaml
test_pipeline:
elasticsear... | [
"Ensure",
"that",
"the",
"named",
"pipeline",
"is",
"present",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/elasticsearch.py#L345-L401 |
34,819 | saltstack/salt | salt/states/elasticsearch.py | search_template_absent | def search_template_absent(name):
'''
Ensure that the search template is absent
name
Name of the search template to remove
'''
ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''}
try:
template = __salt__['elasticsearch.search_template_get'](id=name)
if t... | python | def search_template_absent(name):
'''
Ensure that the search template is absent
name
Name of the search template to remove
'''
ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''}
try:
template = __salt__['elasticsearch.search_template_get'](id=name)
if t... | [
"def",
"search_template_absent",
"(",
"name",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"try",
":",
"template",
"=",
"__salt__",
"[",
"'elasticsear... | Ensure that the search template is absent
name
Name of the search template to remove | [
"Ensure",
"that",
"the",
"search",
"template",
"is",
"absent"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/elasticsearch.py#L404-L434 |
34,820 | saltstack/salt | salt/states/elasticsearch.py | search_template_present | def search_template_present(name, definition):
'''
Ensure that the named search template is present.
name
Name of the search template to add
definition
Required dict for creation parameters as per http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html
*... | python | def search_template_present(name, definition):
'''
Ensure that the named search template is present.
name
Name of the search template to add
definition
Required dict for creation parameters as per http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html
*... | [
"def",
"search_template_present",
"(",
"name",
",",
"definition",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"try",
":",
"template",
"=",
"__salt__"... | Ensure that the named search template is present.
name
Name of the search template to add
definition
Required dict for creation parameters as per http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html
**Example:**
.. code-block:: yaml
test_pipelin... | [
"Ensure",
"that",
"the",
"named",
"search",
"template",
"is",
"present",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/elasticsearch.py#L437-L492 |
34,821 | saltstack/salt | salt/modules/pkgng.py | _pkg | def _pkg(jail=None, chroot=None, root=None):
'''
Returns the prefix for a pkg command, using -j if a jail is specified, or
-c if chroot is specified.
'''
ret = ['pkg']
if jail:
ret.extend(['-j', jail])
elif chroot:
ret.extend(['-c', chroot])
elif root:
ret.extend(... | python | def _pkg(jail=None, chroot=None, root=None):
'''
Returns the prefix for a pkg command, using -j if a jail is specified, or
-c if chroot is specified.
'''
ret = ['pkg']
if jail:
ret.extend(['-j', jail])
elif chroot:
ret.extend(['-c', chroot])
elif root:
ret.extend(... | [
"def",
"_pkg",
"(",
"jail",
"=",
"None",
",",
"chroot",
"=",
"None",
",",
"root",
"=",
"None",
")",
":",
"ret",
"=",
"[",
"'pkg'",
"]",
"if",
"jail",
":",
"ret",
".",
"extend",
"(",
"[",
"'-j'",
",",
"jail",
"]",
")",
"elif",
"chroot",
":",
"... | Returns the prefix for a pkg command, using -j if a jail is specified, or
-c if chroot is specified. | [
"Returns",
"the",
"prefix",
"for",
"a",
"pkg",
"command",
"using",
"-",
"j",
"if",
"a",
"jail",
"is",
"specified",
"or",
"-",
"c",
"if",
"chroot",
"is",
"specified",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L89-L101 |
34,822 | saltstack/salt | salt/modules/pkgng.py | _get_pkgng_version | def _get_pkgng_version(jail=None, chroot=None, root=None):
'''
return the version of 'pkg'
'''
cmd = _pkg(jail, chroot, root) + ['--version']
return __salt__['cmd.run'](cmd).strip() | python | def _get_pkgng_version(jail=None, chroot=None, root=None):
'''
return the version of 'pkg'
'''
cmd = _pkg(jail, chroot, root) + ['--version']
return __salt__['cmd.run'](cmd).strip() | [
"def",
"_get_pkgng_version",
"(",
"jail",
"=",
"None",
",",
"chroot",
"=",
"None",
",",
"root",
"=",
"None",
")",
":",
"cmd",
"=",
"_pkg",
"(",
"jail",
",",
"chroot",
",",
"root",
")",
"+",
"[",
"'--version'",
"]",
"return",
"__salt__",
"[",
"'cmd.ru... | return the version of 'pkg' | [
"return",
"the",
"version",
"of",
"pkg"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L104-L109 |
34,823 | saltstack/salt | salt/modules/pkgng.py | _get_version | def _get_version(name, results):
'''
``pkg search`` will return all packages for which the pattern is a match.
Narrow this down and return the package version, or None if no exact match.
'''
for line in salt.utils.itertools.split(results, '\n'):
if not line:
continue
try:... | python | def _get_version(name, results):
'''
``pkg search`` will return all packages for which the pattern is a match.
Narrow this down and return the package version, or None if no exact match.
'''
for line in salt.utils.itertools.split(results, '\n'):
if not line:
continue
try:... | [
"def",
"_get_version",
"(",
"name",
",",
"results",
")",
":",
"for",
"line",
"in",
"salt",
".",
"utils",
".",
"itertools",
".",
"split",
"(",
"results",
",",
"'\\n'",
")",
":",
"if",
"not",
"line",
":",
"continue",
"try",
":",
"pkgname",
",",
"pkgver... | ``pkg search`` will return all packages for which the pattern is a match.
Narrow this down and return the package version, or None if no exact match. | [
"pkg",
"search",
"will",
"return",
"all",
"packages",
"for",
"which",
"the",
"pattern",
"is",
"a",
"match",
".",
"Narrow",
"this",
"down",
"and",
"return",
"the",
"package",
"version",
"or",
"None",
"if",
"no",
"exact",
"match",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L112-L126 |
34,824 | saltstack/salt | salt/modules/pkgng.py | parse_config | def parse_config(file_name='/usr/local/etc/pkg.conf'):
'''
Return dict of uncommented global variables.
CLI Example:
.. code-block:: bash
salt '*' pkg.parse_config
``NOTE:`` not working properly right now
'''
ret = {}
if not os.path.isfile(file_name):
return 'Unable t... | python | def parse_config(file_name='/usr/local/etc/pkg.conf'):
'''
Return dict of uncommented global variables.
CLI Example:
.. code-block:: bash
salt '*' pkg.parse_config
``NOTE:`` not working properly right now
'''
ret = {}
if not os.path.isfile(file_name):
return 'Unable t... | [
"def",
"parse_config",
"(",
"file_name",
"=",
"'/usr/local/etc/pkg.conf'",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"file_name",
")",
":",
"return",
"'Unable to find {0} on file system'",
".",
"format",
"(",
"file_nam... | Return dict of uncommented global variables.
CLI Example:
.. code-block:: bash
salt '*' pkg.parse_config
``NOTE:`` not working properly right now | [
"Return",
"dict",
"of",
"uncommented",
"global",
"variables",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L144-L169 |
34,825 | saltstack/salt | salt/modules/pkgng.py | refresh_db | def refresh_db(jail=None, chroot=None, root=None, force=False, **kwargs):
'''
Refresh PACKAGESITE contents
.. note::
This function can accessed using ``pkg.update`` in addition to
``pkg.refresh_db``, to more closely match the CLI usage of ``pkg(8)``.
CLI Example:
.. code-block:: ... | python | def refresh_db(jail=None, chroot=None, root=None, force=False, **kwargs):
'''
Refresh PACKAGESITE contents
.. note::
This function can accessed using ``pkg.update`` in addition to
``pkg.refresh_db``, to more closely match the CLI usage of ``pkg(8)``.
CLI Example:
.. code-block:: ... | [
"def",
"refresh_db",
"(",
"jail",
"=",
"None",
",",
"chroot",
"=",
"None",
",",
"root",
"=",
"None",
",",
"force",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# Remove rtag file to keep multiple refreshes from happening in pkg states",
"salt",
".",
"utils"... | Refresh PACKAGESITE contents
.. note::
This function can accessed using ``pkg.update`` in addition to
``pkg.refresh_db``, to more closely match the CLI usage of ``pkg(8)``.
CLI Example:
.. code-block:: bash
salt '*' pkg.refresh_db
jail
Refresh the pkg database withi... | [
"Refresh",
"PACKAGESITE",
"contents"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L227-L269 |
34,826 | saltstack/salt | salt/modules/pkgng.py | stats | def stats(local=False, remote=False, jail=None, chroot=None, root=None):
'''
Return pkgng stats.
CLI Example:
.. code-block:: bash
salt '*' pkg.stats
local
Display stats only for the local package database.
CLI Example:
.. code-block:: bash
salt '*'... | python | def stats(local=False, remote=False, jail=None, chroot=None, root=None):
'''
Return pkgng stats.
CLI Example:
.. code-block:: bash
salt '*' pkg.stats
local
Display stats only for the local package database.
CLI Example:
.. code-block:: bash
salt '*'... | [
"def",
"stats",
"(",
"local",
"=",
"False",
",",
"remote",
"=",
"False",
",",
"jail",
"=",
"None",
",",
"chroot",
"=",
"None",
",",
"root",
"=",
"None",
")",
":",
"opts",
"=",
"''",
"if",
"local",
":",
"opts",
"+=",
"'l'",
"if",
"remote",
":",
... | Return pkgng stats.
CLI Example:
.. code-block:: bash
salt '*' pkg.stats
local
Display stats only for the local package database.
CLI Example:
.. code-block:: bash
salt '*' pkg.stats local=True
remote
Display stats only for the remote package d... | [
"Return",
"pkgng",
"stats",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L462-L529 |
34,827 | saltstack/salt | salt/modules/pkgng.py | backup | def backup(file_name, jail=None, chroot=None, root=None):
'''
Export installed packages into yaml+mtree file
CLI Example:
.. code-block:: bash
salt '*' pkg.backup /tmp/pkg
jail
Backup packages from the specified jail. Note that this will run the
command within the jail, a... | python | def backup(file_name, jail=None, chroot=None, root=None):
'''
Export installed packages into yaml+mtree file
CLI Example:
.. code-block:: bash
salt '*' pkg.backup /tmp/pkg
jail
Backup packages from the specified jail. Note that this will run the
command within the jail, a... | [
"def",
"backup",
"(",
"file_name",
",",
"jail",
"=",
"None",
",",
"chroot",
"=",
"None",
",",
"root",
"=",
"None",
")",
":",
"ret",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"_pkg",
"(",
"jail",
",",
"chroot",
",",
"root",
")",
"+",
"[",
"'bac... | Export installed packages into yaml+mtree file
CLI Example:
.. code-block:: bash
salt '*' pkg.backup /tmp/pkg
jail
Backup packages from the specified jail. Note that this will run the
command within the jail, and so the path to the backup file will be
relative to the root... | [
"Export",
"installed",
"packages",
"into",
"yaml",
"+",
"mtree",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L532-L576 |
34,828 | saltstack/salt | salt/modules/pkgng.py | restore | def restore(file_name, jail=None, chroot=None, root=None):
'''
Reads archive created by pkg backup -d and recreates the database.
CLI Example:
.. code-block:: bash
salt '*' pkg.restore /tmp/pkg
jail
Restore database to the specified jail. Note that this will run the
comma... | python | def restore(file_name, jail=None, chroot=None, root=None):
'''
Reads archive created by pkg backup -d and recreates the database.
CLI Example:
.. code-block:: bash
salt '*' pkg.restore /tmp/pkg
jail
Restore database to the specified jail. Note that this will run the
comma... | [
"def",
"restore",
"(",
"file_name",
",",
"jail",
"=",
"None",
",",
"chroot",
"=",
"None",
",",
"root",
"=",
"None",
")",
":",
"return",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"_pkg",
"(",
"jail",
",",
"chroot",
",",
"root",
")",
"+",
"[",
"'backup... | Reads archive created by pkg backup -d and recreates the database.
CLI Example:
.. code-block:: bash
salt '*' pkg.restore /tmp/pkg
jail
Restore database to the specified jail. Note that this will run the
command within the jail, and so the path to the file from which the pkg
... | [
"Reads",
"archive",
"created",
"by",
"pkg",
"backup",
"-",
"d",
"and",
"recreates",
"the",
"database",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L579-L622 |
34,829 | saltstack/salt | salt/modules/pkgng.py | audit | def audit(jail=None, chroot=None, root=None):
'''
Audits installed packages against known vulnerabilities
CLI Example:
.. code-block:: bash
salt '*' pkg.audit
jail
Audit packages within the specified jail
CLI Example:
.. code-block:: bash
salt '*' p... | python | def audit(jail=None, chroot=None, root=None):
'''
Audits installed packages against known vulnerabilities
CLI Example:
.. code-block:: bash
salt '*' pkg.audit
jail
Audit packages within the specified jail
CLI Example:
.. code-block:: bash
salt '*' p... | [
"def",
"audit",
"(",
"jail",
"=",
"None",
",",
"chroot",
"=",
"None",
",",
"root",
"=",
"None",
")",
":",
"return",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"_pkg",
"(",
"jail",
",",
"chroot",
",",
"root",
")",
"+",
"[",
"'audit'",
",",
"'-F'",
"]... | Audits installed packages against known vulnerabilities
CLI Example:
.. code-block:: bash
salt '*' pkg.audit
jail
Audit packages within the specified jail
CLI Example:
.. code-block:: bash
salt '*' pkg.audit jail=<jail name or id>
chroot
Audit ... | [
"Audits",
"installed",
"packages",
"against",
"known",
"vulnerabilities"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L625-L662 |
34,830 | saltstack/salt | salt/modules/pkgng.py | remove | def remove(name=None,
pkgs=None,
jail=None,
chroot=None,
root=None,
all_installed=False,
force=False,
glob=False,
dryrun=False,
recurse=False,
regex=False,
pcre=False,
**kwargs):
'''
... | python | def remove(name=None,
pkgs=None,
jail=None,
chroot=None,
root=None,
all_installed=False,
force=False,
glob=False,
dryrun=False,
recurse=False,
regex=False,
pcre=False,
**kwargs):
'''
... | [
"def",
"remove",
"(",
"name",
"=",
"None",
",",
"pkgs",
"=",
"None",
",",
"jail",
"=",
"None",
",",
"chroot",
"=",
"None",
",",
"root",
"=",
"None",
",",
"all_installed",
"=",
"False",
",",
"force",
"=",
"False",
",",
"glob",
"=",
"False",
",",
"... | Remove a package from the database and system
.. note::
This function can accessed using ``pkg.delete`` in addition to
``pkg.remove``, to more closely match the CLI usage of ``pkg(8)``.
name
The package to remove
CLI Example:
.. code-block:: bash
salt '*... | [
"Remove",
"a",
"package",
"from",
"the",
"database",
"and",
"system"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L912-L1086 |
34,831 | saltstack/salt | salt/modules/pkgng.py | clean | def clean(jail=None,
chroot=None,
root=None,
clean_all=False,
dryrun=False):
'''
Cleans the local cache of fetched remote packages
CLI Example:
.. code-block:: bash
salt '*' pkg.clean
jail
Cleans the package cache in the specified jail
... | python | def clean(jail=None,
chroot=None,
root=None,
clean_all=False,
dryrun=False):
'''
Cleans the local cache of fetched remote packages
CLI Example:
.. code-block:: bash
salt '*' pkg.clean
jail
Cleans the package cache in the specified jail
... | [
"def",
"clean",
"(",
"jail",
"=",
"None",
",",
"chroot",
"=",
"None",
",",
"root",
"=",
"None",
",",
"clean_all",
"=",
"False",
",",
"dryrun",
"=",
"False",
")",
":",
"opts",
"=",
"''",
"if",
"clean_all",
":",
"opts",
"+=",
"'a'",
"if",
"dryrun",
... | Cleans the local cache of fetched remote packages
CLI Example:
.. code-block:: bash
salt '*' pkg.clean
jail
Cleans the package cache in the specified jail
CLI Example:
.. code-block:: bash
salt '*' pkg.clean jail=<jail name or id>
chroot
Cleans... | [
"Cleans",
"the",
"local",
"cache",
"of",
"fetched",
"remote",
"packages"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L1215-L1288 |
34,832 | saltstack/salt | salt/modules/pkgng.py | check | def check(jail=None,
chroot=None,
root=None,
depends=False,
recompute=False,
checksum=False):
'''
Sanity checks installed packages
jail
Perform the sanity check in the specified jail
CLI Example:
.. code-block:: bash
s... | python | def check(jail=None,
chroot=None,
root=None,
depends=False,
recompute=False,
checksum=False):
'''
Sanity checks installed packages
jail
Perform the sanity check in the specified jail
CLI Example:
.. code-block:: bash
s... | [
"def",
"check",
"(",
"jail",
"=",
"None",
",",
"chroot",
"=",
"None",
",",
"root",
"=",
"None",
",",
"depends",
"=",
"False",
",",
"recompute",
"=",
"False",
",",
"checksum",
"=",
"False",
")",
":",
"if",
"not",
"any",
"(",
"(",
"depends",
",",
"... | Sanity checks installed packages
jail
Perform the sanity check in the specified jail
CLI Example:
.. code-block:: bash
salt '*' pkg.check jail=<jail name or id>
chroot
Perform the sanity check in the specified chroot (ignored if ``jail``
is specified)
... | [
"Sanity",
"checks",
"installed",
"packages"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L1326-L1407 |
34,833 | saltstack/salt | salt/modules/pkgng.py | which | def which(path, jail=None, chroot=None, root=None, origin=False, quiet=False):
'''
Displays which package installed a specific file
CLI Example:
.. code-block:: bash
salt '*' pkg.which <file name>
jail
Perform the check in the specified jail
CLI Example:
.. code... | python | def which(path, jail=None, chroot=None, root=None, origin=False, quiet=False):
'''
Displays which package installed a specific file
CLI Example:
.. code-block:: bash
salt '*' pkg.which <file name>
jail
Perform the check in the specified jail
CLI Example:
.. code... | [
"def",
"which",
"(",
"path",
",",
"jail",
"=",
"None",
",",
"chroot",
"=",
"None",
",",
"root",
"=",
"None",
",",
"origin",
"=",
"False",
",",
"quiet",
"=",
"False",
")",
":",
"opts",
"=",
"''",
"if",
"quiet",
":",
"opts",
"+=",
"'q'",
"if",
"o... | Displays which package installed a specific file
CLI Example:
.. code-block:: bash
salt '*' pkg.which <file name>
jail
Perform the check in the specified jail
CLI Example:
.. code-block:: bash
salt '*' pkg.which <file name> jail=<jail name or id>
chroo... | [
"Displays",
"which",
"package",
"installed",
"a",
"specific",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L1410-L1477 |
34,834 | saltstack/salt | salt/modules/pkgng.py | search | def search(name,
jail=None,
chroot=None,
root=None,
exact=False,
glob=False,
regex=False,
pcre=False,
comment=False,
desc=False,
full=False,
depends=False,
size=False,
quiet=Fal... | python | def search(name,
jail=None,
chroot=None,
root=None,
exact=False,
glob=False,
regex=False,
pcre=False,
comment=False,
desc=False,
full=False,
depends=False,
size=False,
quiet=Fal... | [
"def",
"search",
"(",
"name",
",",
"jail",
"=",
"None",
",",
"chroot",
"=",
"None",
",",
"root",
"=",
"None",
",",
"exact",
"=",
"False",
",",
"glob",
"=",
"False",
",",
"regex",
"=",
"False",
",",
"pcre",
"=",
"False",
",",
"comment",
"=",
"Fals... | Searches in remote package repositories
CLI Example:
.. code-block:: bash
salt '*' pkg.search pattern
jail
Perform the search using the ``pkg.conf(5)`` from the specified jail
CLI Example:
.. code-block:: bash
salt '*' pkg.search pattern jail=<jail name or ... | [
"Searches",
"in",
"remote",
"package",
"repositories"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L1480-L1673 |
34,835 | saltstack/salt | salt/modules/pkgng.py | fetch | def fetch(name,
jail=None,
chroot=None,
root=None,
fetch_all=False,
quiet=False,
fromrepo=None,
glob=True,
regex=False,
pcre=False,
local=False,
depends=False):
'''
Fetches remote packages
CLI Exam... | python | def fetch(name,
jail=None,
chroot=None,
root=None,
fetch_all=False,
quiet=False,
fromrepo=None,
glob=True,
regex=False,
pcre=False,
local=False,
depends=False):
'''
Fetches remote packages
CLI Exam... | [
"def",
"fetch",
"(",
"name",
",",
"jail",
"=",
"None",
",",
"chroot",
"=",
"None",
",",
"root",
"=",
"None",
",",
"fetch_all",
"=",
"False",
",",
"quiet",
"=",
"False",
",",
"fromrepo",
"=",
"None",
",",
"glob",
"=",
"True",
",",
"regex",
"=",
"F... | Fetches remote packages
CLI Example:
.. code-block:: bash
salt '*' pkg.fetch <package name>
jail
Fetch package in the specified jail
CLI Example:
.. code-block:: bash
salt '*' pkg.fetch <package name> jail=<jail name or id>
chroot
Fetch package... | [
"Fetches",
"remote",
"packages"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L1676-L1821 |
34,836 | saltstack/salt | salt/modules/pkgng.py | updating | def updating(name,
jail=None,
chroot=None,
root=None,
filedate=None,
filename=None):
''''
Displays UPDATING entries of software packages
CLI Example:
.. code-block:: bash
salt '*' pkg.updating foo
jail
Perform the a... | python | def updating(name,
jail=None,
chroot=None,
root=None,
filedate=None,
filename=None):
''''
Displays UPDATING entries of software packages
CLI Example:
.. code-block:: bash
salt '*' pkg.updating foo
jail
Perform the a... | [
"def",
"updating",
"(",
"name",
",",
"jail",
"=",
"None",
",",
"chroot",
"=",
"None",
",",
"root",
"=",
"None",
",",
"filedate",
"=",
"None",
",",
"filename",
"=",
"None",
")",
":",
"opts",
"=",
"''",
"if",
"filedate",
":",
"opts",
"+=",
"'d {0}'",... | Displays UPDATING entries of software packages
CLI Example:
.. code-block:: bash
salt '*' pkg.updating foo
jail
Perform the action in the specified jail
CLI Example:
.. code-block:: bash
salt '*' pkg.updating foo jail=<jail name or id>
chroot
P... | [
"Displays",
"UPDATING",
"entries",
"of",
"software",
"packages"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L1824-L1896 |
34,837 | saltstack/salt | salt/modules/pkgng.py | hold | def hold(name=None, pkgs=None, **kwargs): # pylint: disable=W0613
'''
Version-lock packages
.. note::
This function is provided primarily for compatibilty with some
parts of :py:mod:`states.pkg <salt.states.pkg>`.
Consider using Consider using :py:func:`pkg.lock <salt.modules.pkgng... | python | def hold(name=None, pkgs=None, **kwargs): # pylint: disable=W0613
'''
Version-lock packages
.. note::
This function is provided primarily for compatibilty with some
parts of :py:mod:`states.pkg <salt.states.pkg>`.
Consider using Consider using :py:func:`pkg.lock <salt.modules.pkgng... | [
"def",
"hold",
"(",
"name",
"=",
"None",
",",
"pkgs",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=W0613",
"targets",
"=",
"[",
"]",
"if",
"pkgs",
":",
"targets",
".",
"extend",
"(",
"pkgs",
")",
"else",
":",
"targets",
".",
"... | Version-lock packages
.. note::
This function is provided primarily for compatibilty with some
parts of :py:mod:`states.pkg <salt.states.pkg>`.
Consider using Consider using :py:func:`pkg.lock <salt.modules.pkgng.lock>` instead. instead.
name
The name of the package to be held.... | [
"Version",
"-",
"lock",
"packages"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L1899-L1961 |
34,838 | saltstack/salt | salt/modules/pkgng.py | list_locked | def list_locked(**kwargs):
'''
Query the package database those packages which are
locked against reinstallation, modification or deletion.
Returns returns a list of package names with version strings
CLI Example:
.. code-block:: bash
salt '*' pkg.list_locked
jail
List l... | python | def list_locked(**kwargs):
'''
Query the package database those packages which are
locked against reinstallation, modification or deletion.
Returns returns a list of package names with version strings
CLI Example:
.. code-block:: bash
salt '*' pkg.list_locked
jail
List l... | [
"def",
"list_locked",
"(",
"*",
"*",
"kwargs",
")",
":",
"return",
"[",
"'{0}-{1}'",
".",
"format",
"(",
"pkgname",
",",
"version",
"(",
"pkgname",
",",
"*",
"*",
"kwargs",
")",
")",
"for",
"pkgname",
"in",
"_lockcmd",
"(",
"'lock'",
",",
"name",
"="... | Query the package database those packages which are
locked against reinstallation, modification or deletion.
Returns returns a list of package names with version strings
CLI Example:
.. code-block:: bash
salt '*' pkg.list_locked
jail
List locked packages within the specified jai... | [
"Query",
"the",
"package",
"database",
"those",
"packages",
"which",
"are",
"locked",
"against",
"reinstallation",
"modification",
"or",
"deletion",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L2029-L2073 |
34,839 | saltstack/salt | salt/modules/pkgng.py | _lockcmd | def _lockcmd(subcmd, pkgname=None, **kwargs):
'''
Helper function for lock and unlock commands, because their syntax is identical.
Run the lock/unlock command, and return a list of locked packages
'''
jail = kwargs.pop('jail', None)
chroot = kwargs.pop('chroot', None)
root = kwargs.pop('ro... | python | def _lockcmd(subcmd, pkgname=None, **kwargs):
'''
Helper function for lock and unlock commands, because their syntax is identical.
Run the lock/unlock command, and return a list of locked packages
'''
jail = kwargs.pop('jail', None)
chroot = kwargs.pop('chroot', None)
root = kwargs.pop('ro... | [
"def",
"_lockcmd",
"(",
"subcmd",
",",
"pkgname",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"jail",
"=",
"kwargs",
".",
"pop",
"(",
"'jail'",
",",
"None",
")",
"chroot",
"=",
"kwargs",
".",
"pop",
"(",
"'chroot'",
",",
"None",
")",
"root",
... | Helper function for lock and unlock commands, because their syntax is identical.
Run the lock/unlock command, and return a list of locked packages | [
"Helper",
"function",
"for",
"lock",
"and",
"unlock",
"commands",
"because",
"their",
"syntax",
"is",
"identical",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L2221-L2261 |
34,840 | saltstack/salt | salt/modules/pkgng.py | list_upgrades | def list_upgrades(refresh=True, **kwargs):
'''
List those packages for which an upgrade is available
The ``fromrepo`` argument is also supported, as used in pkg states.
CLI Example:
.. code-block:: bash
salt '*' pkg.list_upgrades
jail
List upgrades within the specified jail
... | python | def list_upgrades(refresh=True, **kwargs):
'''
List those packages for which an upgrade is available
The ``fromrepo`` argument is also supported, as used in pkg states.
CLI Example:
.. code-block:: bash
salt '*' pkg.list_upgrades
jail
List upgrades within the specified jail
... | [
"def",
"list_upgrades",
"(",
"refresh",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"jail",
"=",
"kwargs",
".",
"pop",
"(",
"'jail'",
",",
"None",
")",
"chroot",
"=",
"kwargs",
".",
"pop",
"(",
"'chroot'",
",",
"None",
")",
"root",
"=",
"kwargs... | List those packages for which an upgrade is available
The ``fromrepo`` argument is also supported, as used in pkg states.
CLI Example:
.. code-block:: bash
salt '*' pkg.list_upgrades
jail
List upgrades within the specified jail
CLI Example:
.. code-block:: bash
... | [
"List",
"those",
"packages",
"for",
"which",
"an",
"upgrade",
"is",
"available"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L2264-L2322 |
34,841 | saltstack/salt | salt/modules/dpkg_lowpkg.py | unpurge | def unpurge(*packages):
'''
Change package selection for each package specified to 'install'
CLI Example:
.. code-block:: bash
salt '*' lowpkg.unpurge curl
'''
if not packages:
return {}
old = __salt__['pkg.list_pkgs'](purge_desired=True)
ret = {}
__salt__['cmd.run... | python | def unpurge(*packages):
'''
Change package selection for each package specified to 'install'
CLI Example:
.. code-block:: bash
salt '*' lowpkg.unpurge curl
'''
if not packages:
return {}
old = __salt__['pkg.list_pkgs'](purge_desired=True)
ret = {}
__salt__['cmd.run... | [
"def",
"unpurge",
"(",
"*",
"packages",
")",
":",
"if",
"not",
"packages",
":",
"return",
"{",
"}",
"old",
"=",
"__salt__",
"[",
"'pkg.list_pkgs'",
"]",
"(",
"purge_desired",
"=",
"True",
")",
"ret",
"=",
"{",
"}",
"__salt__",
"[",
"'cmd.run'",
"]",
... | Change package selection for each package specified to 'install'
CLI Example:
.. code-block:: bash
salt '*' lowpkg.unpurge curl | [
"Change",
"package",
"selection",
"for",
"each",
"package",
"specified",
"to",
"install"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dpkg_lowpkg.py#L113-L135 |
34,842 | saltstack/salt | salt/modules/dpkg_lowpkg.py | _get_pkg_build_time | def _get_pkg_build_time(name):
'''
Get package build time, if possible.
:param name:
:return:
'''
iso_time = iso_time_t = None
changelog_dir = os.path.join('/usr/share/doc', name)
if os.path.exists(changelog_dir):
for fname in os.listdir(changelog_dir):
try:
... | python | def _get_pkg_build_time(name):
'''
Get package build time, if possible.
:param name:
:return:
'''
iso_time = iso_time_t = None
changelog_dir = os.path.join('/usr/share/doc', name)
if os.path.exists(changelog_dir):
for fname in os.listdir(changelog_dir):
try:
... | [
"def",
"_get_pkg_build_time",
"(",
"name",
")",
":",
"iso_time",
"=",
"iso_time_t",
"=",
"None",
"changelog_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"'/usr/share/doc'",
",",
"name",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"changelog_dir",
... | Get package build time, if possible.
:param name:
:return: | [
"Get",
"package",
"build",
"time",
"if",
"possible",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dpkg_lowpkg.py#L255-L284 |
34,843 | saltstack/salt | salt/modules/dpkg_lowpkg.py | _get_pkg_info | def _get_pkg_info(*packages, **kwargs):
'''
Return list of package information. If 'packages' parameter is empty,
then data about all installed packages will be returned.
:param packages: Specified packages.
:param failhard: Throw an exception if no packages found.
:return:
'''
kwargs =... | python | def _get_pkg_info(*packages, **kwargs):
'''
Return list of package information. If 'packages' parameter is empty,
then data about all installed packages will be returned.
:param packages: Specified packages.
:param failhard: Throw an exception if no packages found.
:return:
'''
kwargs =... | [
"def",
"_get_pkg_info",
"(",
"*",
"packages",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"failhard",
"=",
"kwargs",
".",
"pop",
"(",
"'failhard'",
",",
"True... | Return list of package information. If 'packages' parameter is empty,
then data about all installed packages will be returned.
:param packages: Specified packages.
:param failhard: Throw an exception if no packages found.
:return: | [
"Return",
"list",
"of",
"package",
"information",
".",
"If",
"packages",
"parameter",
"is",
"empty",
"then",
"data",
"about",
"all",
"installed",
"packages",
"will",
"be",
"returned",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dpkg_lowpkg.py#L287-L354 |
34,844 | saltstack/salt | salt/modules/dpkg_lowpkg.py | _get_pkg_ds_avail | def _get_pkg_ds_avail():
'''
Get the package information of the available packages, maintained by dselect.
Note, this will be not very useful, if dselect isn't installed.
:return:
'''
avail = "/var/lib/dpkg/available"
if not salt.utils.path.which('dselect') or not os.path.exists(avail):
... | python | def _get_pkg_ds_avail():
'''
Get the package information of the available packages, maintained by dselect.
Note, this will be not very useful, if dselect isn't installed.
:return:
'''
avail = "/var/lib/dpkg/available"
if not salt.utils.path.which('dselect') or not os.path.exists(avail):
... | [
"def",
"_get_pkg_ds_avail",
"(",
")",
":",
"avail",
"=",
"\"/var/lib/dpkg/available\"",
"if",
"not",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"'dselect'",
")",
"or",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"avail",
")",
":",
"return",
... | Get the package information of the available packages, maintained by dselect.
Note, this will be not very useful, if dselect isn't installed.
:return: | [
"Get",
"the",
"package",
"information",
"of",
"the",
"available",
"packages",
"maintained",
"by",
"dselect",
".",
"Note",
"this",
"will",
"be",
"not",
"very",
"useful",
"if",
"dselect",
"isn",
"t",
"installed",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dpkg_lowpkg.py#L404-L432 |
34,845 | saltstack/salt | salt/modules/dpkg_lowpkg.py | info | def info(*packages, **kwargs):
'''
Returns a detailed summary of package information for provided package names.
If no packages are specified, all packages will be returned.
.. versionadded:: 2015.8.1
packages
The names of the packages for which to return information.
failhard
... | python | def info(*packages, **kwargs):
'''
Returns a detailed summary of package information for provided package names.
If no packages are specified, all packages will be returned.
.. versionadded:: 2015.8.1
packages
The names of the packages for which to return information.
failhard
... | [
"def",
"info",
"(",
"*",
"packages",
",",
"*",
"*",
"kwargs",
")",
":",
"# Get the missing information from the /var/lib/dpkg/available, if it is there.",
"# However, this file is operated by dselect which has to be installed.",
"dselect_pkg_avail",
"=",
"_get_pkg_ds_avail",
"(",
"... | Returns a detailed summary of package information for provided package names.
If no packages are specified, all packages will be returned.
.. versionadded:: 2015.8.1
packages
The names of the packages for which to return information.
failhard
Whether to throw an exception if none of t... | [
"Returns",
"a",
"detailed",
"summary",
"of",
"package",
"information",
"for",
"provided",
"package",
"names",
".",
"If",
"no",
"packages",
"are",
"specified",
"all",
"packages",
"will",
"be",
"returned",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dpkg_lowpkg.py#L435-L507 |
34,846 | saltstack/salt | salt/utils/context.py | func_globals_inject | def func_globals_inject(func, **overrides):
'''
Override specific variables within a function's global context.
'''
# recognize methods
if hasattr(func, 'im_func'):
func = func.__func__
# Get a reference to the function globals dictionary
func_globals = func.__globals__
# Save t... | python | def func_globals_inject(func, **overrides):
'''
Override specific variables within a function's global context.
'''
# recognize methods
if hasattr(func, 'im_func'):
func = func.__func__
# Get a reference to the function globals dictionary
func_globals = func.__globals__
# Save t... | [
"def",
"func_globals_inject",
"(",
"func",
",",
"*",
"*",
"overrides",
")",
":",
"# recognize methods",
"if",
"hasattr",
"(",
"func",
",",
"'im_func'",
")",
":",
"func",
"=",
"func",
".",
"__func__",
"# Get a reference to the function globals dictionary",
"func_glob... | Override specific variables within a function's global context. | [
"Override",
"specific",
"variables",
"within",
"a",
"function",
"s",
"global",
"context",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/context.py#L28-L61 |
34,847 | saltstack/salt | salt/utils/context.py | ContextDict.clone | def clone(self, **kwargs):
'''
Clone this context, and return the ChildContextDict
'''
child = ChildContextDict(parent=self, threadsafe=self._threadsafe, overrides=kwargs)
return child | python | def clone(self, **kwargs):
'''
Clone this context, and return the ChildContextDict
'''
child = ChildContextDict(parent=self, threadsafe=self._threadsafe, overrides=kwargs)
return child | [
"def",
"clone",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"child",
"=",
"ChildContextDict",
"(",
"parent",
"=",
"self",
",",
"threadsafe",
"=",
"self",
".",
"_threadsafe",
",",
"overrides",
"=",
"kwargs",
")",
"return",
"child"
] | Clone this context, and return the ChildContextDict | [
"Clone",
"this",
"context",
"and",
"return",
"the",
"ChildContextDict"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/context.py#L95-L100 |
34,848 | saltstack/salt | salt/cli/cp.py | SaltCPCli.run | def run(self):
'''
Execute salt-cp
'''
self.parse_args()
# Setup file logging!
self.setup_logfile_logger()
salt.utils.verify.verify_log(self.config)
cp_ = SaltCP(self.config)
cp_.run() | python | def run(self):
'''
Execute salt-cp
'''
self.parse_args()
# Setup file logging!
self.setup_logfile_logger()
salt.utils.verify.verify_log(self.config)
cp_ = SaltCP(self.config)
cp_.run() | [
"def",
"run",
"(",
"self",
")",
":",
"self",
".",
"parse_args",
"(",
")",
"# Setup file logging!",
"self",
".",
"setup_logfile_logger",
"(",
")",
"salt",
".",
"utils",
".",
"verify",
".",
"verify_log",
"(",
"self",
".",
"config",
")",
"cp_",
"=",
"SaltCP... | Execute salt-cp | [
"Execute",
"salt",
"-",
"cp"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/cp.py#L41-L52 |
34,849 | saltstack/salt | salt/cli/cp.py | SaltCP._recurse | def _recurse(self, path):
'''
Get a list of all specified files
'''
files = {}
empty_dirs = []
try:
sub_paths = os.listdir(path)
except OSError as exc:
if exc.errno == errno.ENOENT:
# Path does not exist
sys.... | python | def _recurse(self, path):
'''
Get a list of all specified files
'''
files = {}
empty_dirs = []
try:
sub_paths = os.listdir(path)
except OSError as exc:
if exc.errno == errno.ENOENT:
# Path does not exist
sys.... | [
"def",
"_recurse",
"(",
"self",
",",
"path",
")",
":",
"files",
"=",
"{",
"}",
"empty_dirs",
"=",
"[",
"]",
"try",
":",
"sub_paths",
"=",
"os",
".",
"listdir",
"(",
"path",
")",
"except",
"OSError",
"as",
"exc",
":",
"if",
"exc",
".",
"errno",
"=... | Get a list of all specified files | [
"Get",
"a",
"list",
"of",
"all",
"specified",
"files"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/cp.py#L71-L95 |
34,850 | saltstack/salt | salt/cli/cp.py | SaltCP._file_dict | def _file_dict(self, fn_):
'''
Take a path and return the contents of the file as a string
'''
if not os.path.isfile(fn_):
err = 'The referenced file, {0} is not available.'.format(fn_)
sys.stderr.write(err + '\n')
sys.exit(42)
with salt.utils.... | python | def _file_dict(self, fn_):
'''
Take a path and return the contents of the file as a string
'''
if not os.path.isfile(fn_):
err = 'The referenced file, {0} is not available.'.format(fn_)
sys.stderr.write(err + '\n')
sys.exit(42)
with salt.utils.... | [
"def",
"_file_dict",
"(",
"self",
",",
"fn_",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"fn_",
")",
":",
"err",
"=",
"'The referenced file, {0} is not available.'",
".",
"format",
"(",
"fn_",
")",
"sys",
".",
"stderr",
".",
"write",
... | Take a path and return the contents of the file as a string | [
"Take",
"a",
"path",
"and",
"return",
"the",
"contents",
"of",
"the",
"file",
"as",
"a",
"string"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/cp.py#L106-L116 |
34,851 | saltstack/salt | salt/cli/cp.py | SaltCP.run | def run(self):
'''
Make the salt client call
'''
if self.opts['chunked']:
ret = self.run_chunked()
else:
ret = self.run_oldstyle()
salt.output.display_output(
ret,
self.opts.get('output', 'nested'),
... | python | def run(self):
'''
Make the salt client call
'''
if self.opts['chunked']:
ret = self.run_chunked()
else:
ret = self.run_oldstyle()
salt.output.display_output(
ret,
self.opts.get('output', 'nested'),
... | [
"def",
"run",
"(",
"self",
")",
":",
"if",
"self",
".",
"opts",
"[",
"'chunked'",
"]",
":",
"ret",
"=",
"self",
".",
"run_chunked",
"(",
")",
"else",
":",
"ret",
"=",
"self",
".",
"run_oldstyle",
"(",
")",
"salt",
".",
"output",
".",
"display_outpu... | Make the salt client call | [
"Make",
"the",
"salt",
"client",
"call"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/cp.py#L135-L147 |
34,852 | saltstack/salt | salt/cli/cp.py | SaltCP.run_oldstyle | def run_oldstyle(self):
'''
Make the salt client call in old-style all-in-one call method
'''
arg = [self._load_files(), self.opts['dest']]
local = salt.client.get_local_client(self.opts['conf_file'])
args = [self.opts['tgt'],
'cp.recv',
ar... | python | def run_oldstyle(self):
'''
Make the salt client call in old-style all-in-one call method
'''
arg = [self._load_files(), self.opts['dest']]
local = salt.client.get_local_client(self.opts['conf_file'])
args = [self.opts['tgt'],
'cp.recv',
ar... | [
"def",
"run_oldstyle",
"(",
"self",
")",
":",
"arg",
"=",
"[",
"self",
".",
"_load_files",
"(",
")",
",",
"self",
".",
"opts",
"[",
"'dest'",
"]",
"]",
"local",
"=",
"salt",
".",
"client",
".",
"get_local_client",
"(",
"self",
".",
"opts",
"[",
"'c... | Make the salt client call in old-style all-in-one call method | [
"Make",
"the",
"salt",
"client",
"call",
"in",
"old",
"-",
"style",
"all",
"-",
"in",
"-",
"one",
"call",
"method"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/cp.py#L149-L165 |
34,853 | saltstack/salt | salt/modules/mdadm_raid.py | list_ | def list_():
'''
List the RAID devices.
CLI Example:
.. code-block:: bash
salt '*' raid.list
'''
ret = {}
for line in (__salt__['cmd.run_stdout']
(['mdadm', '--detail', '--scan'],
python_shell=False).splitlines()):
if ' ' not in lin... | python | def list_():
'''
List the RAID devices.
CLI Example:
.. code-block:: bash
salt '*' raid.list
'''
ret = {}
for line in (__salt__['cmd.run_stdout']
(['mdadm', '--detail', '--scan'],
python_shell=False).splitlines()):
if ' ' not in lin... | [
"def",
"list_",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"for",
"line",
"in",
"(",
"__salt__",
"[",
"'cmd.run_stdout'",
"]",
"(",
"[",
"'mdadm'",
",",
"'--detail'",
",",
"'--scan'",
"]",
",",
"python_shell",
"=",
"False",
")",
".",
"splitlines",
"(",
")"... | List the RAID devices.
CLI Example:
.. code-block:: bash
salt '*' raid.list | [
"List",
"the",
"RAID",
"devices",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mdadm_raid.py#L43-L66 |
34,854 | saltstack/salt | salt/modules/mdadm_raid.py | detail | def detail(device='/dev/md0'):
'''
Show detail for a specified RAID device
CLI Example:
.. code-block:: bash
salt '*' raid.detail '/dev/md0'
'''
ret = {}
ret['members'] = {}
# Lets make sure the device exists before running mdadm
if not os.path.exists(device):
msg... | python | def detail(device='/dev/md0'):
'''
Show detail for a specified RAID device
CLI Example:
.. code-block:: bash
salt '*' raid.detail '/dev/md0'
'''
ret = {}
ret['members'] = {}
# Lets make sure the device exists before running mdadm
if not os.path.exists(device):
msg... | [
"def",
"detail",
"(",
"device",
"=",
"'/dev/md0'",
")",
":",
"ret",
"=",
"{",
"}",
"ret",
"[",
"'members'",
"]",
"=",
"{",
"}",
"# Lets make sure the device exists before running mdadm",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"device",
")",
":... | Show detail for a specified RAID device
CLI Example:
.. code-block:: bash
salt '*' raid.detail '/dev/md0' | [
"Show",
"detail",
"for",
"a",
"specified",
"RAID",
"device"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mdadm_raid.py#L69-L111 |
34,855 | saltstack/salt | salt/modules/mdadm_raid.py | destroy | def destroy(device):
'''
Destroy a RAID device.
WARNING This will zero the superblock of all members of the RAID array..
CLI Example:
.. code-block:: bash
salt '*' raid.destroy /dev/md0
'''
try:
details = detail(device)
except CommandExecutionError:
return Fal... | python | def destroy(device):
'''
Destroy a RAID device.
WARNING This will zero the superblock of all members of the RAID array..
CLI Example:
.. code-block:: bash
salt '*' raid.destroy /dev/md0
'''
try:
details = detail(device)
except CommandExecutionError:
return Fal... | [
"def",
"destroy",
"(",
"device",
")",
":",
"try",
":",
"details",
"=",
"detail",
"(",
"device",
")",
"except",
"CommandExecutionError",
":",
"return",
"False",
"stop_cmd",
"=",
"[",
"'mdadm'",
",",
"'--stop'",
",",
"device",
"]",
"zero_cmd",
"=",
"[",
"'... | Destroy a RAID device.
WARNING This will zero the superblock of all members of the RAID array..
CLI Example:
.. code-block:: bash
salt '*' raid.destroy /dev/md0 | [
"Destroy",
"a",
"RAID",
"device",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mdadm_raid.py#L114-L153 |
34,856 | saltstack/salt | salt/modules/mdadm_raid.py | create | def create(name,
level,
devices,
metadata='default',
test_mode=False,
**kwargs):
'''
Create a RAID device.
.. versionchanged:: 2014.7.0
.. warning::
Use with CAUTION, as this function can be very destructive if not used
properly!
... | python | def create(name,
level,
devices,
metadata='default',
test_mode=False,
**kwargs):
'''
Create a RAID device.
.. versionchanged:: 2014.7.0
.. warning::
Use with CAUTION, as this function can be very destructive if not used
properly!
... | [
"def",
"create",
"(",
"name",
",",
"level",
",",
"devices",
",",
"metadata",
"=",
"'default'",
",",
"test_mode",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"opts",
"=",
"[",
"]",
"raid_devices",
"=",
"len",
"(",
"devices",
")",
"for",
"key",
... | Create a RAID device.
.. versionchanged:: 2014.7.0
.. warning::
Use with CAUTION, as this function can be very destructive if not used
properly!
CLI Examples:
.. code-block:: bash
salt '*' raid.create /dev/md0 level=1 chunk=256 devices="['/dev/xvdd', '/dev/xvde']" test_mode=... | [
"Create",
"a",
"RAID",
"device",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mdadm_raid.py#L174-L259 |
34,857 | saltstack/salt | salt/modules/mdadm_raid.py | save_config | def save_config():
'''
Save RAID configuration to config file.
Same as:
mdadm --detail --scan >> /etc/mdadm/mdadm.conf
Fixes this issue with Ubuntu
REF: http://askubuntu.com/questions/209702/why-is-my-raid-dev-md1-showing-up-as-dev-md126-is-mdadm-conf-being-ignored
CLI Example:
.. co... | python | def save_config():
'''
Save RAID configuration to config file.
Same as:
mdadm --detail --scan >> /etc/mdadm/mdadm.conf
Fixes this issue with Ubuntu
REF: http://askubuntu.com/questions/209702/why-is-my-raid-dev-md1-showing-up-as-dev-md126-is-mdadm-conf-being-ignored
CLI Example:
.. co... | [
"def",
"save_config",
"(",
")",
":",
"scan",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'mdadm --detail --scan'",
",",
"python_shell",
"=",
"False",
")",
".",
"splitlines",
"(",
")",
"# Issue with mdadm and ubuntu",
"# REF: http://askubuntu.com/questions/209702/why-i... | Save RAID configuration to config file.
Same as:
mdadm --detail --scan >> /etc/mdadm/mdadm.conf
Fixes this issue with Ubuntu
REF: http://askubuntu.com/questions/209702/why-is-my-raid-dev-md1-showing-up-as-dev-md126-is-mdadm-conf-being-ignored
CLI Example:
.. code-block:: bash
salt '... | [
"Save",
"RAID",
"configuration",
"to",
"config",
"file",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mdadm_raid.py#L262-L306 |
34,858 | saltstack/salt | salt/modules/mdadm_raid.py | assemble | def assemble(name,
devices,
test_mode=False,
**kwargs):
'''
Assemble a RAID device.
CLI Examples:
.. code-block:: bash
salt '*' raid.assemble /dev/md0 ['/dev/xvdd', '/dev/xvde']
.. note::
Adding ``test_mode=True`` as an argument will print ... | python | def assemble(name,
devices,
test_mode=False,
**kwargs):
'''
Assemble a RAID device.
CLI Examples:
.. code-block:: bash
salt '*' raid.assemble /dev/md0 ['/dev/xvdd', '/dev/xvde']
.. note::
Adding ``test_mode=True`` as an argument will print ... | [
"def",
"assemble",
"(",
"name",
",",
"devices",
",",
"test_mode",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"opts",
"=",
"[",
"]",
"for",
"key",
"in",
"kwargs",
":",
"if",
"not",
"key",
".",
"startswith",
"(",
"'__'",
")",
":",
"opts",
"."... | Assemble a RAID device.
CLI Examples:
.. code-block:: bash
salt '*' raid.assemble /dev/md0 ['/dev/xvdd', '/dev/xvde']
.. note::
Adding ``test_mode=True`` as an argument will print out the mdadm
command that would have been run.
name
The name of the array to assemble... | [
"Assemble",
"a",
"RAID",
"device",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mdadm_raid.py#L309-L360 |
34,859 | saltstack/salt | salt/modules/mdadm_raid.py | examine | def examine(device, quiet=False):
'''
Show detail for a specified RAID component device
device
Device to examine, that is part of the RAID
quiet
If the device is not part of the RAID, do not show any error
CLI Example:
.. code-block:: bash
salt '*' raid.examine '/dev... | python | def examine(device, quiet=False):
'''
Show detail for a specified RAID component device
device
Device to examine, that is part of the RAID
quiet
If the device is not part of the RAID, do not show any error
CLI Example:
.. code-block:: bash
salt '*' raid.examine '/dev... | [
"def",
"examine",
"(",
"device",
",",
"quiet",
"=",
"False",
")",
":",
"res",
"=",
"__salt__",
"[",
"'cmd.run_stdout'",
"]",
"(",
"'mdadm -Y -E {0}'",
".",
"format",
"(",
"device",
")",
",",
"python_shell",
"=",
"False",
",",
"ignore_retcode",
"=",
"quiet"... | Show detail for a specified RAID component device
device
Device to examine, that is part of the RAID
quiet
If the device is not part of the RAID, do not show any error
CLI Example:
.. code-block:: bash
salt '*' raid.examine '/dev/sda1' | [
"Show",
"detail",
"for",
"a",
"specified",
"RAID",
"component",
"device"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mdadm_raid.py#L363-L387 |
34,860 | saltstack/salt | salt/modules/mdadm_raid.py | add | def add(name, device):
'''
Add new device to RAID array.
CLI Example:
.. code-block:: bash
salt '*' raid.add /dev/md0 /dev/sda1
'''
cmd = 'mdadm --manage {0} --add {1}'.format(name, device)
if __salt__['cmd.retcode'](cmd) == 0:
return True
return False | python | def add(name, device):
'''
Add new device to RAID array.
CLI Example:
.. code-block:: bash
salt '*' raid.add /dev/md0 /dev/sda1
'''
cmd = 'mdadm --manage {0} --add {1}'.format(name, device)
if __salt__['cmd.retcode'](cmd) == 0:
return True
return False | [
"def",
"add",
"(",
"name",
",",
"device",
")",
":",
"cmd",
"=",
"'mdadm --manage {0} --add {1}'",
".",
"format",
"(",
"name",
",",
"device",
")",
"if",
"__salt__",
"[",
"'cmd.retcode'",
"]",
"(",
"cmd",
")",
"==",
"0",
":",
"return",
"True",
"return",
... | Add new device to RAID array.
CLI Example:
.. code-block:: bash
salt '*' raid.add /dev/md0 /dev/sda1 | [
"Add",
"new",
"device",
"to",
"RAID",
"array",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mdadm_raid.py#L390-L405 |
34,861 | saltstack/salt | salt/modules/boto_elasticsearch_domain.py | exists | def exists(DomainName,
region=None, key=None, keyid=None, profile=None):
'''
Given a domain name, check to see if the given domain exists.
Returns True if the given domain exists and returns False if the given
function does not exist.
CLI Example:
.. code-block:: bash
salt... | python | def exists(DomainName,
region=None, key=None, keyid=None, profile=None):
'''
Given a domain name, check to see if the given domain exists.
Returns True if the given domain exists and returns False if the given
function does not exist.
CLI Example:
.. code-block:: bash
salt... | [
"def",
"exists",
"(",
"DomainName",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"key",
",",
"keyid",... | Given a domain name, check to see if the given domain exists.
Returns True if the given domain exists and returns False if the given
function does not exist.
CLI Example:
.. code-block:: bash
salt myminion boto_elasticsearch_domain.exists mydomain | [
"Given",
"a",
"domain",
"name",
"check",
"to",
"see",
"if",
"the",
"given",
"domain",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticsearch_domain.py#L127-L150 |
34,862 | saltstack/salt | salt/modules/boto_elasticsearch_domain.py | status | def status(DomainName,
region=None, key=None, keyid=None, profile=None):
'''
Given a domain name describe its status.
Returns a dictionary of interesting properties.
CLI Example:
.. code-block:: bash
salt myminion boto_elasticsearch_domain.status mydomain
'''
conn ... | python | def status(DomainName,
region=None, key=None, keyid=None, profile=None):
'''
Given a domain name describe its status.
Returns a dictionary of interesting properties.
CLI Example:
.. code-block:: bash
salt myminion boto_elasticsearch_domain.status mydomain
'''
conn ... | [
"def",
"status",
"(",
"DomainName",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"key",
",",
"keyid",... | Given a domain name describe its status.
Returns a dictionary of interesting properties.
CLI Example:
.. code-block:: bash
salt myminion boto_elasticsearch_domain.status mydomain | [
"Given",
"a",
"domain",
"name",
"describe",
"its",
"status",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticsearch_domain.py#L153-L181 |
34,863 | saltstack/salt | salt/modules/boto_elasticsearch_domain.py | describe | def describe(DomainName,
region=None, key=None, keyid=None, profile=None):
'''
Given a domain name describe its properties.
Returns a dictionary of interesting properties.
CLI Example:
.. code-block:: bash
salt myminion boto_elasticsearch_domain.describe mydomain
'''
... | python | def describe(DomainName,
region=None, key=None, keyid=None, profile=None):
'''
Given a domain name describe its properties.
Returns a dictionary of interesting properties.
CLI Example:
.. code-block:: bash
salt myminion boto_elasticsearch_domain.describe mydomain
'''
... | [
"def",
"describe",
"(",
"DomainName",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"key",
",",
"keyid... | Given a domain name describe its properties.
Returns a dictionary of interesting properties.
CLI Example:
.. code-block:: bash
salt myminion boto_elasticsearch_domain.describe mydomain | [
"Given",
"a",
"domain",
"name",
"describe",
"its",
"properties",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticsearch_domain.py#L184-L210 |
34,864 | saltstack/salt | salt/modules/boto_elasticsearch_domain.py | create | def create(DomainName, ElasticsearchClusterConfig=None, EBSOptions=None,
AccessPolicies=None, SnapshotOptions=None, AdvancedOptions=None,
region=None, key=None, keyid=None, profile=None,
ElasticsearchVersion=None):
'''
Given a valid config, create a domain.
Returns {created... | python | def create(DomainName, ElasticsearchClusterConfig=None, EBSOptions=None,
AccessPolicies=None, SnapshotOptions=None, AdvancedOptions=None,
region=None, key=None, keyid=None, profile=None,
ElasticsearchVersion=None):
'''
Given a valid config, create a domain.
Returns {created... | [
"def",
"create",
"(",
"DomainName",
",",
"ElasticsearchClusterConfig",
"=",
"None",
",",
"EBSOptions",
"=",
"None",
",",
"AccessPolicies",
"=",
"None",
",",
"SnapshotOptions",
"=",
"None",
",",
"AdvancedOptions",
"=",
"None",
",",
"region",
"=",
"None",
",",
... | Given a valid config, create a domain.
Returns {created: true} if the domain was created and returns
{created: False} if the domain was not created.
CLI Example:
.. code-block:: bash
salt myminion boto_elasticsearch_domain.create mydomain \\
{'InstanceType': 't2.micro.elasticse... | [
"Given",
"a",
"valid",
"config",
"create",
"a",
"domain",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticsearch_domain.py#L213-L264 |
34,865 | saltstack/salt | salt/modules/boto_elasticsearch_domain.py | delete | def delete(DomainName, region=None, key=None, keyid=None, profile=None):
'''
Given a domain name, delete it.
Returns {deleted: true} if the domain was deleted and returns
{deleted: false} if the domain was not deleted.
CLI Example:
.. code-block:: bash
salt myminion boto_elasticsearc... | python | def delete(DomainName, region=None, key=None, keyid=None, profile=None):
'''
Given a domain name, delete it.
Returns {deleted: true} if the domain was deleted and returns
{deleted: false} if the domain was not deleted.
CLI Example:
.. code-block:: bash
salt myminion boto_elasticsearc... | [
"def",
"delete",
"(",
"DomainName",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"key",
... | Given a domain name, delete it.
Returns {deleted: true} if the domain was deleted and returns
{deleted: false} if the domain was not deleted.
CLI Example:
.. code-block:: bash
salt myminion boto_elasticsearch_domain.delete mydomain | [
"Given",
"a",
"domain",
"name",
"delete",
"it",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticsearch_domain.py#L267-L287 |
34,866 | saltstack/salt | salt/modules/boto_elasticsearch_domain.py | add_tags | def add_tags(DomainName=None, ARN=None,
region=None, key=None, keyid=None, profile=None, **kwargs):
'''
Add tags to a domain
Returns {tagged: true} if the domain was tagged and returns
{tagged: False} if the domain was not tagged.
CLI Example:
.. code-block:: bash
salt mym... | python | def add_tags(DomainName=None, ARN=None,
region=None, key=None, keyid=None, profile=None, **kwargs):
'''
Add tags to a domain
Returns {tagged: true} if the domain was tagged and returns
{tagged: False} if the domain was not tagged.
CLI Example:
.. code-block:: bash
salt mym... | [
"def",
"add_tags",
"(",
"DomainName",
"=",
"None",
",",
"ARN",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"conn",
"=",
... | Add tags to a domain
Returns {tagged: true} if the domain was tagged and returns
{tagged: False} if the domain was not tagged.
CLI Example:
.. code-block:: bash
salt myminion boto_elasticsearch_domain.add_tags mydomain tag_a=tag_value tag_b=tag_value | [
"Add",
"tags",
"to",
"a",
"domain"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticsearch_domain.py#L340-L380 |
34,867 | saltstack/salt | salt/modules/boto_elasticsearch_domain.py | remove_tags | def remove_tags(TagKeys, DomainName=None, ARN=None,
region=None, key=None, keyid=None, profile=None):
'''
Remove tags from a trail
Returns {tagged: true} if the trail was tagged and returns
{tagged: False} if the trail was not tagged.
CLI Example:
.. code-block:: bash
salt... | python | def remove_tags(TagKeys, DomainName=None, ARN=None,
region=None, key=None, keyid=None, profile=None):
'''
Remove tags from a trail
Returns {tagged: true} if the trail was tagged and returns
{tagged: False} if the trail was not tagged.
CLI Example:
.. code-block:: bash
salt... | [
"def",
"remove_tags",
"(",
"TagKeys",
",",
"DomainName",
"=",
"None",
",",
"ARN",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_con... | Remove tags from a trail
Returns {tagged: true} if the trail was tagged and returns
{tagged: False} if the trail was not tagged.
CLI Example:
.. code-block:: bash
salt myminion boto_cloudtrail.remove_tags my_trail tag_a=tag_value tag_b=tag_value | [
"Remove",
"tags",
"from",
"a",
"trail"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticsearch_domain.py#L383-L419 |
34,868 | saltstack/salt | salt/states/neutron_secgroup.py | present | def present(name, auth=None, **kwargs):
'''
Ensure a security group exists.
You can supply either project_name or project_id.
Creating a default security group will not show up as a change;
it gets created through the lookup process.
name
Name of the security group
description
... | python | def present(name, auth=None, **kwargs):
'''
Ensure a security group exists.
You can supply either project_name or project_id.
Creating a default security group will not show up as a change;
it gets created through the lookup process.
name
Name of the security group
description
... | [
"def",
"present",
"(",
"name",
",",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"kwargs",
"=",
... | Ensure a security group exists.
You can supply either project_name or project_id.
Creating a default security group will not show up as a change;
it gets created through the lookup process.
name
Name of the security group
description
Description of the security group
project... | [
"Ensure",
"a",
"security",
"group",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/neutron_secgroup.py#L50-L120 |
34,869 | saltstack/salt | salt/states/neutron_secgroup.py | absent | def absent(name, auth=None, **kwargs):
'''
Ensure a security group does not exist
name
Name of the security group
'''
ret = {'name': name,
'changes': {},
'result': True,
'comment': ''}
kwargs = __utils__['args.clean_kwargs'](**kwargs)
__salt__['ne... | python | def absent(name, auth=None, **kwargs):
'''
Ensure a security group does not exist
name
Name of the security group
'''
ret = {'name': name,
'changes': {},
'result': True,
'comment': ''}
kwargs = __utils__['args.clean_kwargs'](**kwargs)
__salt__['ne... | [
"def",
"absent",
"(",
"name",
",",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"kwargs",
"=",
"... | Ensure a security group does not exist
name
Name of the security group | [
"Ensure",
"a",
"security",
"group",
"does",
"not",
"exist"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/neutron_secgroup.py#L123-L159 |
34,870 | saltstack/salt | salt/modules/logrotate.py | _parse_conf | def _parse_conf(conf_file=_DEFAULT_CONF):
'''
Parse a logrotate configuration file.
Includes will also be parsed, and their configuration will be stored in the
return dict, as if they were part of the main config file. A dict of which
configs came from which includes will be stored in the 'include ... | python | def _parse_conf(conf_file=_DEFAULT_CONF):
'''
Parse a logrotate configuration file.
Includes will also be parsed, and their configuration will be stored in the
return dict, as if they were part of the main config file. A dict of which
configs came from which includes will be stored in the 'include ... | [
"def",
"_parse_conf",
"(",
"conf_file",
"=",
"_DEFAULT_CONF",
")",
":",
"ret",
"=",
"{",
"}",
"mode",
"=",
"'single'",
"multi_names",
"=",
"[",
"]",
"multi",
"=",
"{",
"}",
"prev_comps",
"=",
"None",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"... | Parse a logrotate configuration file.
Includes will also be parsed, and their configuration will be stored in the
return dict, as if they were part of the main config file. A dict of which
configs came from which includes will be stored in the 'include files' dict
inside the return dict, for later refe... | [
"Parse",
"a",
"logrotate",
"configuration",
"file",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/logrotate.py#L57-L123 |
34,871 | saltstack/salt | salt/modules/logrotate.py | get | def get(key, value=None, conf_file=_DEFAULT_CONF):
'''
Get the value for a specific configuration line.
:param str key: The command or stanza block to configure.
:param str value: The command value or command of the block specified by the key parameter.
:param str conf_file: The logrotate configura... | python | def get(key, value=None, conf_file=_DEFAULT_CONF):
'''
Get the value for a specific configuration line.
:param str key: The command or stanza block to configure.
:param str value: The command value or command of the block specified by the key parameter.
:param str conf_file: The logrotate configura... | [
"def",
"get",
"(",
"key",
",",
"value",
"=",
"None",
",",
"conf_file",
"=",
"_DEFAULT_CONF",
")",
":",
"current_conf",
"=",
"_parse_conf",
"(",
"conf_file",
")",
"stanza",
"=",
"current_conf",
".",
"get",
"(",
"key",
",",
"False",
")",
"if",
"value",
"... | Get the value for a specific configuration line.
:param str key: The command or stanza block to configure.
:param str value: The command value or command of the block specified by the key parameter.
:param str conf_file: The logrotate configuration file.
:return: The value for a specific configuration... | [
"Get",
"the",
"value",
"for",
"a",
"specific",
"configuration",
"line",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/logrotate.py#L144-L170 |
34,872 | saltstack/salt | salt/modules/logrotate.py | _dict_to_stanza | def _dict_to_stanza(key, stanza):
'''
Convert a dict to a multi-line stanza
'''
ret = ''
for skey in stanza:
if stanza[skey] is True:
stanza[skey] = ''
ret += ' {0} {1}\n'.format(skey, stanza[skey])
return '{0} {{\n{1}}}'.format(key, ret) | python | def _dict_to_stanza(key, stanza):
'''
Convert a dict to a multi-line stanza
'''
ret = ''
for skey in stanza:
if stanza[skey] is True:
stanza[skey] = ''
ret += ' {0} {1}\n'.format(skey, stanza[skey])
return '{0} {{\n{1}}}'.format(key, ret) | [
"def",
"_dict_to_stanza",
"(",
"key",
",",
"stanza",
")",
":",
"ret",
"=",
"''",
"for",
"skey",
"in",
"stanza",
":",
"if",
"stanza",
"[",
"skey",
"]",
"is",
"True",
":",
"stanza",
"[",
"skey",
"]",
"=",
"''",
"ret",
"+=",
"' {0} {1}\\n'",
".",
"... | Convert a dict to a multi-line stanza | [
"Convert",
"a",
"dict",
"to",
"a",
"multi",
"-",
"line",
"stanza"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/logrotate.py#L276-L285 |
34,873 | saltstack/salt | salt/states/zk_concurrency.py | unlock | def unlock(name,
zk_hosts=None, # in case you need to unlock without having run lock (failed execution for example)
identifier=None,
max_concurrency=1,
ephemeral_lease=False,
profile=None,
scheme=None,
username=None,
password=None,... | python | def unlock(name,
zk_hosts=None, # in case you need to unlock without having run lock (failed execution for example)
identifier=None,
max_concurrency=1,
ephemeral_lease=False,
profile=None,
scheme=None,
username=None,
password=None,... | [
"def",
"unlock",
"(",
"name",
",",
"zk_hosts",
"=",
"None",
",",
"# in case you need to unlock without having run lock (failed execution for example)",
"identifier",
"=",
"None",
",",
"max_concurrency",
"=",
"1",
",",
"ephemeral_lease",
"=",
"False",
",",
"profile",
"="... | Remove lease from semaphore. | [
"Remove",
"lease",
"from",
"semaphore",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zk_concurrency.py#L115-L155 |
34,874 | saltstack/salt | salt/states/zk_concurrency.py | min_party | def min_party(name,
zk_hosts,
min_nodes,
blocking=False,
profile=None,
scheme=None,
username=None,
password=None,
default_acl=None):
'''
Ensure that there are `min_nodes` in the party at `name`, optio... | python | def min_party(name,
zk_hosts,
min_nodes,
blocking=False,
profile=None,
scheme=None,
username=None,
password=None,
default_acl=None):
'''
Ensure that there are `min_nodes` in the party at `name`, optio... | [
"def",
"min_party",
"(",
"name",
",",
"zk_hosts",
",",
"min_nodes",
",",
"blocking",
"=",
"False",
",",
"profile",
"=",
"None",
",",
"scheme",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"default_acl",
"=",
"None",
")"... | Ensure that there are `min_nodes` in the party at `name`, optionally blocking if not available. | [
"Ensure",
"that",
"there",
"are",
"min_nodes",
"in",
"the",
"party",
"at",
"name",
"optionally",
"blocking",
"if",
"not",
"available",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zk_concurrency.py#L158-L198 |
34,875 | saltstack/salt | salt/modules/nxos_api.py | _cli_command | def _cli_command(commands,
method='cli',
**kwargs):
'''
Execute a list of CLI commands.
'''
if not isinstance(commands, (list, tuple)):
commands = [commands]
rpc_responses = rpc(commands,
method=method,
**kwarg... | python | def _cli_command(commands,
method='cli',
**kwargs):
'''
Execute a list of CLI commands.
'''
if not isinstance(commands, (list, tuple)):
commands = [commands]
rpc_responses = rpc(commands,
method=method,
**kwarg... | [
"def",
"_cli_command",
"(",
"commands",
",",
"method",
"=",
"'cli'",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"commands",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"commands",
"=",
"[",
"commands",
"]",
"rpc_responses",
... | Execute a list of CLI commands. | [
"Execute",
"a",
"list",
"of",
"CLI",
"commands",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos_api.py#L171-L194 |
34,876 | saltstack/salt | salt/utils/aggregation.py | levelise | def levelise(level):
'''
Describe which levels are allowed to do deep merging.
level can be:
True
all levels are True
False
all levels are False
an int
only the first levels are True, the others are False
a sequence
it describes which levels are True, it ... | python | def levelise(level):
'''
Describe which levels are allowed to do deep merging.
level can be:
True
all levels are True
False
all levels are False
an int
only the first levels are True, the others are False
a sequence
it describes which levels are True, it ... | [
"def",
"levelise",
"(",
"level",
")",
":",
"if",
"not",
"level",
":",
"# False, 0, [] ...",
"return",
"False",
",",
"False",
"if",
"level",
"is",
"True",
":",
"return",
"True",
",",
"True",
"if",
"isinstance",
"(",
"level",
",",
"int",
")",
":",
"retur... | Describe which levels are allowed to do deep merging.
level can be:
True
all levels are True
False
all levels are False
an int
only the first levels are True, the others are False
a sequence
it describes which levels are True, it can be:
* a list of bool... | [
"Describe",
"which",
"levels",
"are",
"allowed",
"to",
"do",
"deep",
"merging",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/aggregation.py#L151-L185 |
34,877 | saltstack/salt | salt/utils/aggregation.py | mark | def mark(obj, map_class=Map, sequence_class=Sequence):
'''
Convert obj into an Aggregate instance
'''
if isinstance(obj, Aggregate):
return obj
if isinstance(obj, dict):
return map_class(obj)
if isinstance(obj, (list, tuple, set)):
return sequence_class(obj)
else:
... | python | def mark(obj, map_class=Map, sequence_class=Sequence):
'''
Convert obj into an Aggregate instance
'''
if isinstance(obj, Aggregate):
return obj
if isinstance(obj, dict):
return map_class(obj)
if isinstance(obj, (list, tuple, set)):
return sequence_class(obj)
else:
... | [
"def",
"mark",
"(",
"obj",
",",
"map_class",
"=",
"Map",
",",
"sequence_class",
"=",
"Sequence",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"Aggregate",
")",
":",
"return",
"obj",
"if",
"isinstance",
"(",
"obj",
",",
"dict",
")",
":",
"return",
"... | Convert obj into an Aggregate instance | [
"Convert",
"obj",
"into",
"an",
"Aggregate",
"instance"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/aggregation.py#L188-L199 |
34,878 | saltstack/salt | salt/utils/migrations.py | migrate_paths | def migrate_paths(opts):
'''
Migrate old minion and master pki file paths to new ones.
'''
oldpki_dir = os.path.join(syspaths.CONFIG_DIR, 'pki')
if not os.path.exists(oldpki_dir):
# There's not even a pki directory, don't bother migrating
return
newpki_dir = opts['pki_dir']
... | python | def migrate_paths(opts):
'''
Migrate old minion and master pki file paths to new ones.
'''
oldpki_dir = os.path.join(syspaths.CONFIG_DIR, 'pki')
if not os.path.exists(oldpki_dir):
# There's not even a pki directory, don't bother migrating
return
newpki_dir = opts['pki_dir']
... | [
"def",
"migrate_paths",
"(",
"opts",
")",
":",
"oldpki_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"syspaths",
".",
"CONFIG_DIR",
",",
"'pki'",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"oldpki_dir",
")",
":",
"# There's not even a pki... | Migrate old minion and master pki file paths to new ones. | [
"Migrate",
"old",
"minion",
"and",
"master",
"pki",
"file",
"paths",
"to",
"new",
"ones",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/migrations.py#L15-L54 |
34,879 | saltstack/salt | salt/utils/zfs.py | _check_retcode | def _check_retcode(cmd):
'''
Simple internal wrapper for cmdmod.retcode
'''
return salt.modules.cmdmod.retcode(cmd, output_loglevel='quiet', ignore_retcode=True) == 0 | python | def _check_retcode(cmd):
'''
Simple internal wrapper for cmdmod.retcode
'''
return salt.modules.cmdmod.retcode(cmd, output_loglevel='quiet', ignore_retcode=True) == 0 | [
"def",
"_check_retcode",
"(",
"cmd",
")",
":",
"return",
"salt",
".",
"modules",
".",
"cmdmod",
".",
"retcode",
"(",
"cmd",
",",
"output_loglevel",
"=",
"'quiet'",
",",
"ignore_retcode",
"=",
"True",
")",
"==",
"0"
] | Simple internal wrapper for cmdmod.retcode | [
"Simple",
"internal",
"wrapper",
"for",
"cmdmod",
".",
"retcode"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/zfs.py#L40-L44 |
34,880 | saltstack/salt | salt/utils/zfs.py | _exec | def _exec(**kwargs):
'''
Simple internal wrapper for cmdmod.run
'''
if 'ignore_retcode' not in kwargs:
kwargs['ignore_retcode'] = True
if 'output_loglevel' not in kwargs:
kwargs['output_loglevel'] = 'quiet'
return salt.modules.cmdmod.run_all(**kwargs) | python | def _exec(**kwargs):
'''
Simple internal wrapper for cmdmod.run
'''
if 'ignore_retcode' not in kwargs:
kwargs['ignore_retcode'] = True
if 'output_loglevel' not in kwargs:
kwargs['output_loglevel'] = 'quiet'
return salt.modules.cmdmod.run_all(**kwargs) | [
"def",
"_exec",
"(",
"*",
"*",
"kwargs",
")",
":",
"if",
"'ignore_retcode'",
"not",
"in",
"kwargs",
":",
"kwargs",
"[",
"'ignore_retcode'",
"]",
"=",
"True",
"if",
"'output_loglevel'",
"not",
"in",
"kwargs",
":",
"kwargs",
"[",
"'output_loglevel'",
"]",
"=... | Simple internal wrapper for cmdmod.run | [
"Simple",
"internal",
"wrapper",
"for",
"cmdmod",
".",
"run"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/zfs.py#L47-L55 |
34,881 | saltstack/salt | salt/utils/zfs.py | _merge_last | def _merge_last(values, merge_after, merge_with=' '):
'''
Merge values all values after X into the last value
'''
if len(values) > merge_after:
values = values[0:(merge_after-1)] + [merge_with.join(values[(merge_after-1):])]
return values | python | def _merge_last(values, merge_after, merge_with=' '):
'''
Merge values all values after X into the last value
'''
if len(values) > merge_after:
values = values[0:(merge_after-1)] + [merge_with.join(values[(merge_after-1):])]
return values | [
"def",
"_merge_last",
"(",
"values",
",",
"merge_after",
",",
"merge_with",
"=",
"' '",
")",
":",
"if",
"len",
"(",
"values",
")",
">",
"merge_after",
":",
"values",
"=",
"values",
"[",
"0",
":",
"(",
"merge_after",
"-",
"1",
")",
"]",
"+",
"[",
"m... | Merge values all values after X into the last value | [
"Merge",
"values",
"all",
"values",
"after",
"X",
"into",
"the",
"last",
"value"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/zfs.py#L58-L65 |
34,882 | saltstack/salt | salt/utils/zfs.py | _property_detect_type | def _property_detect_type(name, values):
'''
Detect the datatype of a property
'''
value_type = 'str'
if values.startswith('on | off'):
value_type = 'bool'
elif values.startswith('yes | no'):
value_type = 'bool_alt'
elif values in ['<size>', '<size> | none']:
value_ty... | python | def _property_detect_type(name, values):
'''
Detect the datatype of a property
'''
value_type = 'str'
if values.startswith('on | off'):
value_type = 'bool'
elif values.startswith('yes | no'):
value_type = 'bool_alt'
elif values in ['<size>', '<size> | none']:
value_ty... | [
"def",
"_property_detect_type",
"(",
"name",
",",
"values",
")",
":",
"value_type",
"=",
"'str'",
"if",
"values",
".",
"startswith",
"(",
"'on | off'",
")",
":",
"value_type",
"=",
"'bool'",
"elif",
"values",
".",
"startswith",
"(",
"'yes | no'",
")",
":",
... | Detect the datatype of a property | [
"Detect",
"the",
"datatype",
"of",
"a",
"property"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/zfs.py#L77-L94 |
34,883 | saltstack/salt | salt/utils/zfs.py | _property_create_dict | def _property_create_dict(header, data):
'''
Create a property dict
'''
prop = dict(zip(header, _merge_last(data, len(header))))
prop['name'] = _property_normalize_name(prop['property'])
prop['type'] = _property_detect_type(prop['name'], prop['values'])
prop['edit'] = from_bool(prop['edit'])... | python | def _property_create_dict(header, data):
'''
Create a property dict
'''
prop = dict(zip(header, _merge_last(data, len(header))))
prop['name'] = _property_normalize_name(prop['property'])
prop['type'] = _property_detect_type(prop['name'], prop['values'])
prop['edit'] = from_bool(prop['edit'])... | [
"def",
"_property_create_dict",
"(",
"header",
",",
"data",
")",
":",
"prop",
"=",
"dict",
"(",
"zip",
"(",
"header",
",",
"_merge_last",
"(",
"data",
",",
"len",
"(",
"header",
")",
")",
")",
")",
"prop",
"[",
"'name'",
"]",
"=",
"_property_normalize_... | Create a property dict | [
"Create",
"a",
"property",
"dict"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/zfs.py#L97-L108 |
34,884 | saltstack/salt | salt/utils/zfs.py | _auto | def _auto(direction, name, value, source='auto', convert_to_human=True):
'''
Internal magic for from_auto and to_auto
'''
# NOTE: check direction
if direction not in ['to', 'from']:
return value
# NOTE: collect property data
props = property_data_zpool()
if source == 'zfs':
... | python | def _auto(direction, name, value, source='auto', convert_to_human=True):
'''
Internal magic for from_auto and to_auto
'''
# NOTE: check direction
if direction not in ['to', 'from']:
return value
# NOTE: collect property data
props = property_data_zpool()
if source == 'zfs':
... | [
"def",
"_auto",
"(",
"direction",
",",
"name",
",",
"value",
",",
"source",
"=",
"'auto'",
",",
"convert_to_human",
"=",
"True",
")",
":",
"# NOTE: check direction",
"if",
"direction",
"not",
"in",
"[",
"'to'",
",",
"'from'",
"]",
":",
"return",
"value",
... | Internal magic for from_auto and to_auto | [
"Internal",
"magic",
"for",
"from_auto",
"and",
"to_auto"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/zfs.py#L153-L175 |
34,885 | saltstack/salt | salt/utils/zfs.py | _command | def _command(source, command, flags=None, opts=None,
property_name=None, property_value=None,
filesystem_properties=None, pool_properties=None,
target=None):
'''
Build and properly escape a zfs command
.. note::
Input is not considered safe and will be passed... | python | def _command(source, command, flags=None, opts=None,
property_name=None, property_value=None,
filesystem_properties=None, pool_properties=None,
target=None):
'''
Build and properly escape a zfs command
.. note::
Input is not considered safe and will be passed... | [
"def",
"_command",
"(",
"source",
",",
"command",
",",
"flags",
"=",
"None",
",",
"opts",
"=",
"None",
",",
"property_name",
"=",
"None",
",",
"property_value",
"=",
"None",
",",
"filesystem_properties",
"=",
"None",
",",
"pool_properties",
"=",
"None",
",... | Build and properly escape a zfs command
.. note::
Input is not considered safe and will be passed through
to_auto(from_auto('input_here')), you do not need to do so
your self first. | [
"Build",
"and",
"properly",
"escape",
"a",
"zfs",
"command"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/zfs.py#L196-L279 |
34,886 | saltstack/salt | salt/utils/zfs.py | is_supported | def is_supported():
'''
Check the system for ZFS support
'''
# Check for supported platforms
# NOTE: ZFS on Windows is in development
# NOTE: ZFS on NetBSD is in development
on_supported_platform = False
if salt.utils.platform.is_sunos():
on_supported_platform = True
elif sal... | python | def is_supported():
'''
Check the system for ZFS support
'''
# Check for supported platforms
# NOTE: ZFS on Windows is in development
# NOTE: ZFS on NetBSD is in development
on_supported_platform = False
if salt.utils.platform.is_sunos():
on_supported_platform = True
elif sal... | [
"def",
"is_supported",
"(",
")",
":",
"# Check for supported platforms",
"# NOTE: ZFS on Windows is in development",
"# NOTE: ZFS on NetBSD is in development",
"on_supported_platform",
"=",
"False",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_sunos",
"(",
")",
":"... | Check the system for ZFS support | [
"Check",
"the",
"system",
"for",
"ZFS",
"support"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/zfs.py#L282-L304 |
34,887 | saltstack/salt | salt/utils/zfs.py | has_feature_flags | def has_feature_flags():
'''
Check if zpool-features is available
'''
# get man location
man = salt.utils.path.which('man')
return _check_retcode('{man} zpool-features'.format(
man=man
)) if man else False | python | def has_feature_flags():
'''
Check if zpool-features is available
'''
# get man location
man = salt.utils.path.which('man')
return _check_retcode('{man} zpool-features'.format(
man=man
)) if man else False | [
"def",
"has_feature_flags",
"(",
")",
":",
"# get man location",
"man",
"=",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"'man'",
")",
"return",
"_check_retcode",
"(",
"'{man} zpool-features'",
".",
"format",
"(",
"man",
"=",
"man",
")",
")",
"if... | Check if zpool-features is available | [
"Check",
"if",
"zpool",
"-",
"features",
"is",
"available"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/zfs.py#L308-L316 |
34,888 | saltstack/salt | salt/utils/zfs.py | property_data_zpool | def property_data_zpool():
'''
Return a dict of zpool properties
.. note::
Each property will have an entry with the following info:
- edit : boolean - is this property editable after pool creation
- type : str - either bool, bool_alt, size, numeric, or string
-... | python | def property_data_zpool():
'''
Return a dict of zpool properties
.. note::
Each property will have an entry with the following info:
- edit : boolean - is this property editable after pool creation
- type : str - either bool, bool_alt, size, numeric, or string
-... | [
"def",
"property_data_zpool",
"(",
")",
":",
"# NOTE: man page also mentions a few short forms",
"property_data",
"=",
"_property_parse_cmd",
"(",
"_zpool_cmd",
"(",
")",
",",
"{",
"'allocated'",
":",
"'alloc'",
",",
"'autoexpand'",
":",
"'expand'",
",",
"'autoreplace'"... | Return a dict of zpool properties
.. note::
Each property will have an entry with the following info:
- edit : boolean - is this property editable after pool creation
- type : str - either bool, bool_alt, size, numeric, or string
- values : str - list of possible values... | [
"Return",
"a",
"dict",
"of",
"zpool",
"properties"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/zfs.py#L320-L372 |
34,889 | saltstack/salt | salt/utils/zfs.py | from_bool | def from_bool(value):
'''
Convert zfs bool to python bool
'''
if value in ['on', 'yes']:
value = True
elif value in ['off', 'no']:
value = False
elif value == 'none':
value = None
return value | python | def from_bool(value):
'''
Convert zfs bool to python bool
'''
if value in ['on', 'yes']:
value = True
elif value in ['off', 'no']:
value = False
elif value == 'none':
value = None
return value | [
"def",
"from_bool",
"(",
"value",
")",
":",
"if",
"value",
"in",
"[",
"'on'",
",",
"'yes'",
"]",
":",
"value",
"=",
"True",
"elif",
"value",
"in",
"[",
"'off'",
",",
"'no'",
"]",
":",
"value",
"=",
"False",
"elif",
"value",
"==",
"'none'",
":",
"... | Convert zfs bool to python bool | [
"Convert",
"zfs",
"bool",
"to",
"python",
"bool"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/zfs.py#L430-L441 |
34,890 | saltstack/salt | salt/utils/zfs.py | to_auto | def to_auto(name, value, source='auto', convert_to_human=True):
'''
Convert python value to zfs value
'''
return _auto('to', name, value, source, convert_to_human) | python | def to_auto(name, value, source='auto', convert_to_human=True):
'''
Convert python value to zfs value
'''
return _auto('to', name, value, source, convert_to_human) | [
"def",
"to_auto",
"(",
"name",
",",
"value",
",",
"source",
"=",
"'auto'",
",",
"convert_to_human",
"=",
"True",
")",
":",
"return",
"_auto",
"(",
"'to'",
",",
"name",
",",
"value",
",",
"source",
",",
"convert_to_human",
")"
] | Convert python value to zfs value | [
"Convert",
"python",
"value",
"to",
"zfs",
"value"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/zfs.py#L568-L572 |
34,891 | saltstack/salt | salt/utils/zfs.py | from_auto_dict | def from_auto_dict(values, source='auto'):
'''
Pass an entire dictionary to from_auto
.. note::
The key will be passed as the name
'''
for name, value in values.items():
values[name] = from_auto(name, value, source)
return values | python | def from_auto_dict(values, source='auto'):
'''
Pass an entire dictionary to from_auto
.. note::
The key will be passed as the name
'''
for name, value in values.items():
values[name] = from_auto(name, value, source)
return values | [
"def",
"from_auto_dict",
"(",
"values",
",",
"source",
"=",
"'auto'",
")",
":",
"for",
"name",
",",
"value",
"in",
"values",
".",
"items",
"(",
")",
":",
"values",
"[",
"name",
"]",
"=",
"from_auto",
"(",
"name",
",",
"value",
",",
"source",
")",
"... | Pass an entire dictionary to from_auto
.. note::
The key will be passed as the name | [
"Pass",
"an",
"entire",
"dictionary",
"to",
"from_auto"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/zfs.py#L575-L586 |
34,892 | saltstack/salt | salt/utils/zfs.py | to_auto_dict | def to_auto_dict(values, source='auto', convert_to_human=True):
'''
Pass an entire dictionary to to_auto
.. note::
The key will be passed as the name
'''
for name, value in values.items():
values[name] = to_auto(name, value, source, convert_to_human)
return values | python | def to_auto_dict(values, source='auto', convert_to_human=True):
'''
Pass an entire dictionary to to_auto
.. note::
The key will be passed as the name
'''
for name, value in values.items():
values[name] = to_auto(name, value, source, convert_to_human)
return values | [
"def",
"to_auto_dict",
"(",
"values",
",",
"source",
"=",
"'auto'",
",",
"convert_to_human",
"=",
"True",
")",
":",
"for",
"name",
",",
"value",
"in",
"values",
".",
"items",
"(",
")",
":",
"values",
"[",
"name",
"]",
"=",
"to_auto",
"(",
"name",
","... | Pass an entire dictionary to to_auto
.. note::
The key will be passed as the name | [
"Pass",
"an",
"entire",
"dictionary",
"to",
"to_auto"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/zfs.py#L589-L599 |
34,893 | saltstack/salt | salt/utils/zfs.py | zpool_command | def zpool_command(command, flags=None, opts=None, property_name=None, property_value=None,
filesystem_properties=None, pool_properties=None, target=None):
'''
Build and properly escape a zpool command
.. note::
Input is not considered safe and will be passed through
to_au... | python | def zpool_command(command, flags=None, opts=None, property_name=None, property_value=None,
filesystem_properties=None, pool_properties=None, target=None):
'''
Build and properly escape a zpool command
.. note::
Input is not considered safe and will be passed through
to_au... | [
"def",
"zpool_command",
"(",
"command",
",",
"flags",
"=",
"None",
",",
"opts",
"=",
"None",
",",
"property_name",
"=",
"None",
",",
"property_value",
"=",
"None",
",",
"filesystem_properties",
"=",
"None",
",",
"pool_properties",
"=",
"None",
",",
"target",... | Build and properly escape a zpool command
.. note::
Input is not considered safe and will be passed through
to_auto(from_auto('input_here')), you do not need to do so
your self first. | [
"Build",
"and",
"properly",
"escape",
"a",
"zpool",
"command"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/zfs.py#L648-L670 |
34,894 | saltstack/salt | salt/beacons/logs.py | beacon | def beacon(config):
'''
Read the log file and return match whole string
.. code-block:: yaml
beacons:
log:
- file: <path>
- tags:
<tag>:
regex: <pattern>
.. note::
regex matching is based on the `re`_ modul... | python | def beacon(config):
'''
Read the log file and return match whole string
.. code-block:: yaml
beacons:
log:
- file: <path>
- tags:
<tag>:
regex: <pattern>
.. note::
regex matching is based on the `re`_ modul... | [
"def",
"beacon",
"(",
"config",
")",
":",
"_config",
"=",
"{",
"}",
"list",
"(",
"map",
"(",
"_config",
".",
"update",
",",
"config",
")",
")",
"ret",
"=",
"[",
"]",
"if",
"'file'",
"not",
"in",
"_config",
":",
"event",
"=",
"SKEL",
".",
"copy",
... | Read the log file and return match whole string
.. code-block:: yaml
beacons:
log:
- file: <path>
- tags:
<tag>:
regex: <pattern>
.. note::
regex matching is based on the `re`_ module
.. _re: https://docs.pyth... | [
"Read",
"the",
"log",
"file",
"and",
"return",
"match",
"whole",
"string"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/logs.py#L70-L157 |
34,895 | saltstack/salt | salt/pillar/pepa.py | validate | def validate(output, resource):
'''
Validate Pepa templates
'''
try:
import cerberus # pylint: disable=import-error
except ImportError:
log.critical('You need module cerberus in order to use validation')
return
roots = __opts__['pepa_roots']
valdir = os.path.join(r... | python | def validate(output, resource):
'''
Validate Pepa templates
'''
try:
import cerberus # pylint: disable=import-error
except ImportError:
log.critical('You need module cerberus in order to use validation')
return
roots = __opts__['pepa_roots']
valdir = os.path.join(r... | [
"def",
"validate",
"(",
"output",
",",
"resource",
")",
":",
"try",
":",
"import",
"cerberus",
"# pylint: disable=import-error",
"except",
"ImportError",
":",
"log",
".",
"critical",
"(",
"'You need module cerberus in order to use validation'",
")",
"return",
"roots",
... | Validate Pepa templates | [
"Validate",
"Pepa",
"templates"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/pepa.py#L509-L542 |
34,896 | saltstack/salt | salt/grains/disks.py | disks | def disks():
'''
Return list of disk devices
'''
if salt.utils.platform.is_freebsd():
return _freebsd_geom()
elif salt.utils.platform.is_linux():
return _linux_disks()
elif salt.utils.platform.is_windows():
return _windows_disks()
else:
log.trace('Disk grain d... | python | def disks():
'''
Return list of disk devices
'''
if salt.utils.platform.is_freebsd():
return _freebsd_geom()
elif salt.utils.platform.is_linux():
return _linux_disks()
elif salt.utils.platform.is_windows():
return _windows_disks()
else:
log.trace('Disk grain d... | [
"def",
"disks",
"(",
")",
":",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_freebsd",
"(",
")",
":",
"return",
"_freebsd_geom",
"(",
")",
"elif",
"salt",
".",
"utils",
".",
"platform",
".",
"is_linux",
"(",
")",
":",
"return",
"_linux_disks",
... | Return list of disk devices | [
"Return",
"list",
"of",
"disk",
"devices"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/disks.py#L29-L40 |
34,897 | saltstack/salt | salt/grains/disks.py | _linux_disks | def _linux_disks():
'''
Return list of disk devices and work out if they are SSD or HDD.
'''
ret = {'disks': [], 'SSDs': []}
for entry in glob.glob('/sys/block/*/queue/rotational'):
try:
with salt.utils.files.fopen(entry) as entry_fp:
device = entry.split('/')[3]... | python | def _linux_disks():
'''
Return list of disk devices and work out if they are SSD or HDD.
'''
ret = {'disks': [], 'SSDs': []}
for entry in glob.glob('/sys/block/*/queue/rotational'):
try:
with salt.utils.files.fopen(entry) as entry_fp:
device = entry.split('/')[3]... | [
"def",
"_linux_disks",
"(",
")",
":",
"ret",
"=",
"{",
"'disks'",
":",
"[",
"]",
",",
"'SSDs'",
":",
"[",
"]",
"}",
"for",
"entry",
"in",
"glob",
".",
"glob",
"(",
"'/sys/block/*/queue/rotational'",
")",
":",
"try",
":",
"with",
"salt",
".",
"utils",... | Return list of disk devices and work out if they are SSD or HDD. | [
"Return",
"list",
"of",
"disk",
"devices",
"and",
"work",
"out",
"if",
"they",
"are",
"SSD",
"or",
"HDD",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/disks.py#L128-L152 |
34,898 | saltstack/salt | salt/states/vbox_guest.py | additions_installed | def additions_installed(name, reboot=False, upgrade_os=False):
'''
Ensure that the VirtualBox Guest Additions are installed. Uses the CD,
connected by VirtualBox.
name
The name has no functional value and is only used as a tracking
reference.
reboot : False
Restart OS to com... | python | def additions_installed(name, reboot=False, upgrade_os=False):
'''
Ensure that the VirtualBox Guest Additions are installed. Uses the CD,
connected by VirtualBox.
name
The name has no functional value and is only used as a tracking
reference.
reboot : False
Restart OS to com... | [
"def",
"additions_installed",
"(",
"name",
",",
"reboot",
"=",
"False",
",",
"upgrade_os",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}... | Ensure that the VirtualBox Guest Additions are installed. Uses the CD,
connected by VirtualBox.
name
The name has no functional value and is only used as a tracking
reference.
reboot : False
Restart OS to complete installation.
upgrade_os : False
Upgrade OS (to ensure th... | [
"Ensure",
"that",
"the",
"VirtualBox",
"Guest",
"Additions",
"are",
"installed",
".",
"Uses",
"the",
"CD",
"connected",
"by",
"VirtualBox",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/vbox_guest.py#L13-L52 |
34,899 | saltstack/salt | salt/states/vbox_guest.py | additions_removed | def additions_removed(name, force=False):
'''
Ensure that the VirtualBox Guest Additions are removed. Uses the CD,
connected by VirtualBox.
To connect VirtualBox Guest Additions via VirtualBox graphical interface
press 'Host+D' ('Host' is usually 'Right Ctrl').
name
The name has no fun... | python | def additions_removed(name, force=False):
'''
Ensure that the VirtualBox Guest Additions are removed. Uses the CD,
connected by VirtualBox.
To connect VirtualBox Guest Additions via VirtualBox graphical interface
press 'Host+D' ('Host' is usually 'Right Ctrl').
name
The name has no fun... | [
"def",
"additions_removed",
"(",
"name",
",",
"force",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
"current_state",
"=",
"__salt__",
... | Ensure that the VirtualBox Guest Additions are removed. Uses the CD,
connected by VirtualBox.
To connect VirtualBox Guest Additions via VirtualBox graphical interface
press 'Host+D' ('Host' is usually 'Right Ctrl').
name
The name has no functional value and is only used as a tracking
r... | [
"Ensure",
"that",
"the",
"VirtualBox",
"Guest",
"Additions",
"are",
"removed",
".",
"Uses",
"the",
"CD",
"connected",
"by",
"VirtualBox",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/vbox_guest.py#L55-L93 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.