repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/modules/azurearm_network.py | route_delete | def route_delete(name, route_table, resource_group, **kwargs):
'''
.. versionadded:: 2019.2.0
Delete a route from a route table.
:param name: The route to delete.
:param route_table: The route table containing the route.
:param resource_group: The resource group name assigned to the
... | python | def route_delete(name, route_table, resource_group, **kwargs):
'''
.. versionadded:: 2019.2.0
Delete a route from a route table.
:param name: The route to delete.
:param route_table: The route table containing the route.
:param resource_group: The resource group name assigned to the
... | [
"def",
"route_delete",
"(",
"name",
",",
"route_table",
",",
"resource_group",
",",
"*",
"*",
"kwargs",
")",
":",
"result",
"=",
"False",
"netconn",
"=",
"__utils__",
"[",
"'azurearm.get_client'",
"]",
"(",
"'network'",
",",
"*",
"*",
"kwargs",
")",
"try",... | .. versionadded:: 2019.2.0
Delete a route from a route table.
:param name: The route to delete.
:param route_table: The route table containing the route.
:param resource_group: The resource group name assigned to the
route table.
CLI Example:
.. code-block:: bash
salt-call... | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L2392-L2425 | train |
saltstack/salt | salt/modules/azurearm_network.py | route_get | def route_get(name, route_table, resource_group, **kwargs):
'''
.. versionadded:: 2019.2.0
Get details about a specific route.
:param name: The route to query.
:param route_table: The route table containing the route.
:param resource_group: The resource group name assigned to the
rou... | python | def route_get(name, route_table, resource_group, **kwargs):
'''
.. versionadded:: 2019.2.0
Get details about a specific route.
:param name: The route to query.
:param route_table: The route table containing the route.
:param resource_group: The resource group name assigned to the
rou... | [
"def",
"route_get",
"(",
"name",
",",
"route_table",
",",
"resource_group",
",",
"*",
"*",
"kwargs",
")",
":",
"result",
"=",
"{",
"}",
"netconn",
"=",
"__utils__",
"[",
"'azurearm.get_client'",
"]",
"(",
"'network'",
",",
"*",
"*",
"kwargs",
")",
"try",... | .. versionadded:: 2019.2.0
Get details about a specific route.
:param name: The route to query.
:param route_table: The route table containing the route.
:param resource_group: The resource group name assigned to the
route table.
CLI Example:
.. code-block:: bash
salt-call... | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L2428-L2462 | train |
saltstack/salt | salt/modules/azurearm_network.py | route_create_or_update | def route_create_or_update(name, address_prefix, next_hop_type, route_table, resource_group,
next_hop_ip_address=None, **kwargs):
'''
.. versionadded:: 2019.2.0
Create or update a route within a specified route table.
:param name: The name of the route to create.
:param... | python | def route_create_or_update(name, address_prefix, next_hop_type, route_table, resource_group,
next_hop_ip_address=None, **kwargs):
'''
.. versionadded:: 2019.2.0
Create or update a route within a specified route table.
:param name: The name of the route to create.
:param... | [
"def",
"route_create_or_update",
"(",
"name",
",",
"address_prefix",
",",
"next_hop_type",
",",
"route_table",
",",
"resource_group",
",",
"next_hop_ip_address",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"netconn",
"=",
"__utils__",
"[",
"'azurearm.get_clien... | .. versionadded:: 2019.2.0
Create or update a route within a specified route table.
:param name: The name of the route to create.
:param address_prefix: The destination CIDR to which the route applies.
:param next_hop_type: The type of Azure hop the packet should be sent to. Possible values are:
... | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L2465-L2525 | train |
saltstack/salt | salt/modules/azurearm_network.py | routes_list | def routes_list(route_table, resource_group, **kwargs):
'''
.. versionadded:: 2019.2.0
List all routes within a route table.
:param route_table: The route table to query.
:param resource_group: The resource group name assigned to the
route table.
CLI Example:
.. code-block:: bas... | python | def routes_list(route_table, resource_group, **kwargs):
'''
.. versionadded:: 2019.2.0
List all routes within a route table.
:param route_table: The route table to query.
:param resource_group: The resource group name assigned to the
route table.
CLI Example:
.. code-block:: bas... | [
"def",
"routes_list",
"(",
"route_table",
",",
"resource_group",
",",
"*",
"*",
"kwargs",
")",
":",
"result",
"=",
"{",
"}",
"netconn",
"=",
"__utils__",
"[",
"'azurearm.get_client'",
"]",
"(",
"'network'",
",",
"*",
"*",
"kwargs",
")",
"try",
":",
"rout... | .. versionadded:: 2019.2.0
List all routes within a route table.
:param route_table: The route table to query.
:param resource_group: The resource group name assigned to the
route table.
CLI Example:
.. code-block:: bash
salt-call azurearm_network.routes_list test-rt-table test... | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L2528-L2562 | train |
saltstack/salt | salt/modules/azurearm_network.py | route_table_delete | def route_table_delete(name, resource_group, **kwargs):
'''
.. versionadded:: 2019.2.0
Delete a route table.
:param name: The name of the route table to delete.
:param resource_group: The resource group name assigned to the
route table.
CLI Example:
.. code-block:: bash
... | python | def route_table_delete(name, resource_group, **kwargs):
'''
.. versionadded:: 2019.2.0
Delete a route table.
:param name: The name of the route table to delete.
:param resource_group: The resource group name assigned to the
route table.
CLI Example:
.. code-block:: bash
... | [
"def",
"route_table_delete",
"(",
"name",
",",
"resource_group",
",",
"*",
"*",
"kwargs",
")",
":",
"result",
"=",
"False",
"netconn",
"=",
"__utils__",
"[",
"'azurearm.get_client'",
"]",
"(",
"'network'",
",",
"*",
"*",
"kwargs",
")",
"try",
":",
"table",... | .. versionadded:: 2019.2.0
Delete a route table.
:param name: The name of the route table to delete.
:param resource_group: The resource group name assigned to the
route table.
CLI Example:
.. code-block:: bash
salt-call azurearm_network.route_table_delete test-rt-table testgro... | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L2565-L2595 | train |
saltstack/salt | salt/modules/azurearm_network.py | route_table_get | def route_table_get(name, resource_group, **kwargs):
'''
.. versionadded:: 2019.2.0
Get details about a specific route table.
:param name: The name of the route table to query.
:param resource_group: The resource group name assigned to the
route table.
CLI Example:
.. code-block... | python | def route_table_get(name, resource_group, **kwargs):
'''
.. versionadded:: 2019.2.0
Get details about a specific route table.
:param name: The name of the route table to query.
:param resource_group: The resource group name assigned to the
route table.
CLI Example:
.. code-block... | [
"def",
"route_table_get",
"(",
"name",
",",
"resource_group",
",",
"*",
"*",
"kwargs",
")",
":",
"expand",
"=",
"kwargs",
".",
"get",
"(",
"'expand'",
")",
"netconn",
"=",
"__utils__",
"[",
"'azurearm.get_client'",
"]",
"(",
"'network'",
",",
"*",
"*",
"... | .. versionadded:: 2019.2.0
Get details about a specific route table.
:param name: The name of the route table to query.
:param resource_group: The resource group name assigned to the
route table.
CLI Example:
.. code-block:: bash
salt-call azurearm_network.route_table_get test-... | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L2598-L2631 | train |
saltstack/salt | salt/modules/azurearm_network.py | route_table_create_or_update | def route_table_create_or_update(name, resource_group, **kwargs):
'''
.. versionadded:: 2019.2.0
Create or update a route table within a specified resource group.
:param name: The name of the route table to create.
:param resource_group: The resource group name assigned to the
route table... | python | def route_table_create_or_update(name, resource_group, **kwargs):
'''
.. versionadded:: 2019.2.0
Create or update a route table within a specified resource group.
:param name: The name of the route table to create.
:param resource_group: The resource group name assigned to the
route table... | [
"def",
"route_table_create_or_update",
"(",
"name",
",",
"resource_group",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'location'",
"not",
"in",
"kwargs",
":",
"rg_props",
"=",
"__salt__",
"[",
"'azurearm_resource.resource_group_get'",
"]",
"(",
"resource_group",
",... | .. versionadded:: 2019.2.0
Create or update a route table within a specified resource group.
:param name: The name of the route table to create.
:param resource_group: The resource group name assigned to the
route table.
CLI Example:
.. code-block:: bash
salt-call azurearm_netw... | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L2634-L2687 | train |
saltstack/salt | salt/modules/azurearm_network.py | route_tables_list | def route_tables_list(resource_group, **kwargs):
'''
.. versionadded:: 2019.2.0
List all route tables within a resource group.
:param resource_group: The resource group name to list route
tables within.
CLI Example:
.. code-block:: bash
salt-call azurearm_network.route_table... | python | def route_tables_list(resource_group, **kwargs):
'''
.. versionadded:: 2019.2.0
List all route tables within a resource group.
:param resource_group: The resource group name to list route
tables within.
CLI Example:
.. code-block:: bash
salt-call azurearm_network.route_table... | [
"def",
"route_tables_list",
"(",
"resource_group",
",",
"*",
"*",
"kwargs",
")",
":",
"result",
"=",
"{",
"}",
"netconn",
"=",
"__utils__",
"[",
"'azurearm.get_client'",
"]",
"(",
"'network'",
",",
"*",
"*",
"kwargs",
")",
"try",
":",
"tables",
"=",
"__u... | .. versionadded:: 2019.2.0
List all route tables within a resource group.
:param resource_group: The resource group name to list route
tables within.
CLI Example:
.. code-block:: bash
salt-call azurearm_network.route_tables_list testgroup | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L2690-L2721 | train |
saltstack/salt | salt/modules/azurearm_network.py | route_tables_list_all | def route_tables_list_all(**kwargs):
'''
.. versionadded:: 2019.2.0
List all route tables within a subscription.
CLI Example:
.. code-block:: bash
salt-call azurearm_network.route_tables_list_all
'''
result = {}
netconn = __utils__['azurearm.get_client']('network', **kwargs)... | python | def route_tables_list_all(**kwargs):
'''
.. versionadded:: 2019.2.0
List all route tables within a subscription.
CLI Example:
.. code-block:: bash
salt-call azurearm_network.route_tables_list_all
'''
result = {}
netconn = __utils__['azurearm.get_client']('network', **kwargs)... | [
"def",
"route_tables_list_all",
"(",
"*",
"*",
"kwargs",
")",
":",
"result",
"=",
"{",
"}",
"netconn",
"=",
"__utils__",
"[",
"'azurearm.get_client'",
"]",
"(",
"'network'",
",",
"*",
"*",
"kwargs",
")",
"try",
":",
"tables",
"=",
"__utils__",
"[",
"'azu... | .. versionadded:: 2019.2.0
List all route tables within a subscription.
CLI Example:
.. code-block:: bash
salt-call azurearm_network.route_tables_list_all | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L2724-L2748 | train |
saltstack/salt | salt/modules/capirca_acl.py | _import_platform_generator | def _import_platform_generator(platform):
'''
Given a specific platform (under the Capirca conventions),
return the generator class.
The generator class is identified looking under the <platform> module
for a class inheriting the `ACLGenerator` class.
'''
log.debug('Using platform: %s', plat... | python | def _import_platform_generator(platform):
'''
Given a specific platform (under the Capirca conventions),
return the generator class.
The generator class is identified looking under the <platform> module
for a class inheriting the `ACLGenerator` class.
'''
log.debug('Using platform: %s', plat... | [
"def",
"_import_platform_generator",
"(",
"platform",
")",
":",
"log",
".",
"debug",
"(",
"'Using platform: %s'",
",",
"platform",
")",
"for",
"mod_name",
",",
"mod_obj",
"in",
"inspect",
".",
"getmembers",
"(",
"capirca",
".",
"aclgen",
")",
":",
"if",
"mod... | Given a specific platform (under the Capirca conventions),
return the generator class.
The generator class is identified looking under the <platform> module
for a class inheriting the `ACLGenerator` class. | [
"Given",
"a",
"specific",
"platform",
"(",
"under",
"the",
"Capirca",
"conventions",
")",
"return",
"the",
"generator",
"class",
".",
"The",
"generator",
"class",
"is",
"identified",
"looking",
"under",
"the",
"<platform",
">",
"module",
"for",
"a",
"class",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/capirca_acl.py#L197-L211 | train |
saltstack/salt | salt/modules/capirca_acl.py | _get_services_mapping | def _get_services_mapping():
'''
Build a map of services based on the IANA assignment list:
http://www.iana.org/assignments/port-numbers
It will load the /etc/services file and will build the mapping on the fly,
similar to the Capirca's SERVICES file:
https://github.com/google/capirca/blob/mast... | python | def _get_services_mapping():
'''
Build a map of services based on the IANA assignment list:
http://www.iana.org/assignments/port-numbers
It will load the /etc/services file and will build the mapping on the fly,
similar to the Capirca's SERVICES file:
https://github.com/google/capirca/blob/mast... | [
"def",
"_get_services_mapping",
"(",
")",
":",
"if",
"_SERVICES",
":",
"return",
"_SERVICES",
"services_txt",
"=",
"''",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"'/etc/services'",
",",
"'r'",
")",
"as",
"srv_f",
":",
"s... | Build a map of services based on the IANA assignment list:
http://www.iana.org/assignments/port-numbers
It will load the /etc/services file and will build the mapping on the fly,
similar to the Capirca's SERVICES file:
https://github.com/google/capirca/blob/master/def/SERVICES.svc
As this module i... | [
"Build",
"a",
"map",
"of",
"services",
"based",
"on",
"the",
"IANA",
"assignment",
"list",
":",
"http",
":",
"//",
"www",
".",
"iana",
".",
"org",
"/",
"assignments",
"/",
"port",
"-",
"numbers"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/capirca_acl.py#L214-L258 | train |
saltstack/salt | salt/modules/capirca_acl.py | _translate_port | def _translate_port(port):
'''
Look into services and return the port value using the
service name as lookup value.
'''
services = _get_services_mapping()
if port in services and services[port]['port']:
return services[port]['port'][0]
return port | python | def _translate_port(port):
'''
Look into services and return the port value using the
service name as lookup value.
'''
services = _get_services_mapping()
if port in services and services[port]['port']:
return services[port]['port'][0]
return port | [
"def",
"_translate_port",
"(",
"port",
")",
":",
"services",
"=",
"_get_services_mapping",
"(",
")",
"if",
"port",
"in",
"services",
"and",
"services",
"[",
"port",
"]",
"[",
"'port'",
"]",
":",
"return",
"services",
"[",
"port",
"]",
"[",
"'port'",
"]",... | Look into services and return the port value using the
service name as lookup value. | [
"Look",
"into",
"services",
"and",
"return",
"the",
"port",
"value",
"using",
"the",
"service",
"name",
"as",
"lookup",
"value",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/capirca_acl.py#L261-L269 | train |
saltstack/salt | salt/modules/capirca_acl.py | _make_it_list | def _make_it_list(dict_, field_name, value):
'''
Return the object list.
'''
prev_value = []
# firsly we'll collect the prev value
if field_name in dict_:
prev_value = dict_[field_name]
if value is None:
return prev_value
elif isinstance(value, (tuple, list)):
# o... | python | def _make_it_list(dict_, field_name, value):
'''
Return the object list.
'''
prev_value = []
# firsly we'll collect the prev value
if field_name in dict_:
prev_value = dict_[field_name]
if value is None:
return prev_value
elif isinstance(value, (tuple, list)):
# o... | [
"def",
"_make_it_list",
"(",
"dict_",
",",
"field_name",
",",
"value",
")",
":",
"prev_value",
"=",
"[",
"]",
"# firsly we'll collect the prev value",
"if",
"field_name",
"in",
"dict_",
":",
"prev_value",
"=",
"dict_",
"[",
"field_name",
"]",
"if",
"value",
"i... | Return the object list. | [
"Return",
"the",
"object",
"list",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/capirca_acl.py#L272-L320 | train |
saltstack/salt | salt/modules/capirca_acl.py | _clean_term_opts | def _clean_term_opts(term_opts):
'''
Cleanup the term opts:
- strip Null and empty valuee, defaulting their value to their base definition from _TERM_FIELDS
- convert to `nacaddr.IP` fields from `_IP_FILEDS`
- create lists for those fields requiring it
'''
clean_opts = {}
_services = _g... | python | def _clean_term_opts(term_opts):
'''
Cleanup the term opts:
- strip Null and empty valuee, defaulting their value to their base definition from _TERM_FIELDS
- convert to `nacaddr.IP` fields from `_IP_FILEDS`
- create lists for those fields requiring it
'''
clean_opts = {}
_services = _g... | [
"def",
"_clean_term_opts",
"(",
"term_opts",
")",
":",
"clean_opts",
"=",
"{",
"}",
"_services",
"=",
"_get_services_mapping",
"(",
")",
"for",
"field",
",",
"value",
"in",
"six",
".",
"iteritems",
"(",
"term_opts",
")",
":",
"# firstly we'll process special fie... | Cleanup the term opts:
- strip Null and empty valuee, defaulting their value to their base definition from _TERM_FIELDS
- convert to `nacaddr.IP` fields from `_IP_FILEDS`
- create lists for those fields requiring it | [
"Cleanup",
"the",
"term",
"opts",
":"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/capirca_acl.py#L323-L390 | train |
saltstack/salt | salt/modules/capirca_acl.py | _lookup_element | def _lookup_element(lst, key):
'''
Find an dictionary in a list of dictionaries, given its main key.
'''
if not lst:
return {}
for ele in lst:
if not ele or not isinstance(ele, dict):
continue
if ele.keys()[0] == key:
return ele.values()[0]
return ... | python | def _lookup_element(lst, key):
'''
Find an dictionary in a list of dictionaries, given its main key.
'''
if not lst:
return {}
for ele in lst:
if not ele or not isinstance(ele, dict):
continue
if ele.keys()[0] == key:
return ele.values()[0]
return ... | [
"def",
"_lookup_element",
"(",
"lst",
",",
"key",
")",
":",
"if",
"not",
"lst",
":",
"return",
"{",
"}",
"for",
"ele",
"in",
"lst",
":",
"if",
"not",
"ele",
"or",
"not",
"isinstance",
"(",
"ele",
",",
"dict",
")",
":",
"continue",
"if",
"ele",
".... | Find an dictionary in a list of dictionaries, given its main key. | [
"Find",
"an",
"dictionary",
"in",
"a",
"list",
"of",
"dictionaries",
"given",
"its",
"main",
"key",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/capirca_acl.py#L393-L404 | train |
saltstack/salt | salt/modules/capirca_acl.py | _get_pillar_cfg | def _get_pillar_cfg(pillar_key,
pillarenv=None,
saltenv=None):
'''
Retrieve the pillar data from the right environment.
'''
pillar_cfg = __salt__['pillar.get'](pillar_key,
pillarenv=pillarenv,
... | python | def _get_pillar_cfg(pillar_key,
pillarenv=None,
saltenv=None):
'''
Retrieve the pillar data from the right environment.
'''
pillar_cfg = __salt__['pillar.get'](pillar_key,
pillarenv=pillarenv,
... | [
"def",
"_get_pillar_cfg",
"(",
"pillar_key",
",",
"pillarenv",
"=",
"None",
",",
"saltenv",
"=",
"None",
")",
":",
"pillar_cfg",
"=",
"__salt__",
"[",
"'pillar.get'",
"]",
"(",
"pillar_key",
",",
"pillarenv",
"=",
"pillarenv",
",",
"saltenv",
"=",
"saltenv",... | Retrieve the pillar data from the right environment. | [
"Retrieve",
"the",
"pillar",
"data",
"from",
"the",
"right",
"environment",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/capirca_acl.py#L407-L416 | train |
saltstack/salt | salt/modules/capirca_acl.py | _cleanup | def _cleanup(lst):
'''
Return a list of non-empty dictionaries.
'''
clean = []
for ele in lst:
if ele and isinstance(ele, dict):
clean.append(ele)
return clean | python | def _cleanup(lst):
'''
Return a list of non-empty dictionaries.
'''
clean = []
for ele in lst:
if ele and isinstance(ele, dict):
clean.append(ele)
return clean | [
"def",
"_cleanup",
"(",
"lst",
")",
":",
"clean",
"=",
"[",
"]",
"for",
"ele",
"in",
"lst",
":",
"if",
"ele",
"and",
"isinstance",
"(",
"ele",
",",
"dict",
")",
":",
"clean",
".",
"append",
"(",
"ele",
")",
"return",
"clean"
] | Return a list of non-empty dictionaries. | [
"Return",
"a",
"list",
"of",
"non",
"-",
"empty",
"dictionaries",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/capirca_acl.py#L419-L427 | train |
saltstack/salt | salt/modules/capirca_acl.py | _merge_list_of_dict | def _merge_list_of_dict(first, second, prepend=True):
'''
Merge lists of dictionaries.
Each element of the list is a dictionary having one single key.
That key is then used as unique lookup.
The first element list has higher priority than the second.
When there's an overlap between the two lists... | python | def _merge_list_of_dict(first, second, prepend=True):
'''
Merge lists of dictionaries.
Each element of the list is a dictionary having one single key.
That key is then used as unique lookup.
The first element list has higher priority than the second.
When there's an overlap between the two lists... | [
"def",
"_merge_list_of_dict",
"(",
"first",
",",
"second",
",",
"prepend",
"=",
"True",
")",
":",
"first",
"=",
"_cleanup",
"(",
"first",
")",
"second",
"=",
"_cleanup",
"(",
"second",
")",
"if",
"not",
"first",
"and",
"not",
"second",
":",
"return",
"... | Merge lists of dictionaries.
Each element of the list is a dictionary having one single key.
That key is then used as unique lookup.
The first element list has higher priority than the second.
When there's an overlap between the two lists,
it won't change the position, but the content. | [
"Merge",
"lists",
"of",
"dictionaries",
".",
"Each",
"element",
"of",
"the",
"list",
"is",
"a",
"dictionary",
"having",
"one",
"single",
"key",
".",
"That",
"key",
"is",
"then",
"used",
"as",
"unique",
"lookup",
".",
"The",
"first",
"element",
"list",
"h... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/capirca_acl.py#L430-L470 | train |
saltstack/salt | salt/modules/capirca_acl.py | _get_term_object | def _get_term_object(filter_name,
term_name,
pillar_key='acl',
pillarenv=None,
saltenv=None,
merge_pillar=True,
**term_fields):
'''
Return an instance of the ``_Term`` class given the te... | python | def _get_term_object(filter_name,
term_name,
pillar_key='acl',
pillarenv=None,
saltenv=None,
merge_pillar=True,
**term_fields):
'''
Return an instance of the ``_Term`` class given the te... | [
"def",
"_get_term_object",
"(",
"filter_name",
",",
"term_name",
",",
"pillar_key",
"=",
"'acl'",
",",
"pillarenv",
"=",
"None",
",",
"saltenv",
"=",
"None",
",",
"merge_pillar",
"=",
"True",
",",
"*",
"*",
"term_fields",
")",
":",
"log",
".",
"debug",
"... | Return an instance of the ``_Term`` class given the term options. | [
"Return",
"an",
"instance",
"of",
"the",
"_Term",
"class",
"given",
"the",
"term",
"options",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/capirca_acl.py#L473-L511 | train |
saltstack/salt | salt/modules/capirca_acl.py | _get_policy_object | def _get_policy_object(platform,
filters=None,
pillar_key='acl',
pillarenv=None,
saltenv=None,
merge_pillar=True):
'''
Return an instance of the ``_Policy`` class given the filters config.
'''
... | python | def _get_policy_object(platform,
filters=None,
pillar_key='acl',
pillarenv=None,
saltenv=None,
merge_pillar=True):
'''
Return an instance of the ``_Policy`` class given the filters config.
'''
... | [
"def",
"_get_policy_object",
"(",
"platform",
",",
"filters",
"=",
"None",
",",
"pillar_key",
"=",
"'acl'",
",",
"pillarenv",
"=",
"None",
",",
"saltenv",
"=",
"None",
",",
"merge_pillar",
"=",
"True",
")",
":",
"policy",
"=",
"_Policy",
"(",
")",
"polic... | Return an instance of the ``_Policy`` class given the filters config. | [
"Return",
"an",
"instance",
"of",
"the",
"_Policy",
"class",
"given",
"the",
"filters",
"config",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/capirca_acl.py#L514-L567 | train |
saltstack/salt | salt/modules/capirca_acl.py | _revision_tag | def _revision_tag(text,
revision_id=None,
revision_no=None,
revision_date=True,
revision_date_format='%Y/%m/%d'):
'''
Refactor revision tag comments.
Capirca generates the filter text having the following tag keys:
- $Id:$
- $R... | python | def _revision_tag(text,
revision_id=None,
revision_no=None,
revision_date=True,
revision_date_format='%Y/%m/%d'):
'''
Refactor revision tag comments.
Capirca generates the filter text having the following tag keys:
- $Id:$
- $R... | [
"def",
"_revision_tag",
"(",
"text",
",",
"revision_id",
"=",
"None",
",",
"revision_no",
"=",
"None",
",",
"revision_date",
"=",
"True",
",",
"revision_date_format",
"=",
"'%Y/%m/%d'",
")",
":",
"timestamp",
"=",
"datetime",
".",
"datetime",
".",
"now",
"("... | Refactor revision tag comments.
Capirca generates the filter text having the following tag keys:
- $Id:$
- $Revision:$
- $Date:$
This function goes through all the config lines and replaces
those tags with the content requested by the user.
If a certain value is not provided, the correspon... | [
"Refactor",
"revision",
"tag",
"comments",
".",
"Capirca",
"generates",
"the",
"filter",
"text",
"having",
"the",
"following",
"tag",
"keys",
":"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/capirca_acl.py#L570-L603 | train |
saltstack/salt | salt/modules/capirca_acl.py | get_term_config | def get_term_config(platform,
filter_name,
term_name,
filter_options=None,
pillar_key='acl',
pillarenv=None,
saltenv=None,
merge_pillar=True,
revision_id=None,
... | python | def get_term_config(platform,
filter_name,
term_name,
filter_options=None,
pillar_key='acl',
pillarenv=None,
saltenv=None,
merge_pillar=True,
revision_id=None,
... | [
"def",
"get_term_config",
"(",
"platform",
",",
"filter_name",
",",
"term_name",
",",
"filter_options",
"=",
"None",
",",
"pillar_key",
"=",
"'acl'",
",",
"pillarenv",
"=",
"None",
",",
"saltenv",
"=",
"None",
",",
"merge_pillar",
"=",
"True",
",",
"revision... | Return the configuration of a single policy term.
platform
The name of the Capirca platform.
filter_name
The name of the policy filter.
term_name
The name of the term.
filter_options
Additional filter options. These options are platform-specific.
E.g.: ``inet6... | [
"Return",
"the",
"configuration",
"of",
"a",
"single",
"policy",
"term",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/capirca_acl.py#L610-L885 | train |
saltstack/salt | salt/modules/capirca_acl.py | get_filter_config | def get_filter_config(platform,
filter_name,
filter_options=None,
terms=None,
prepend=True,
pillar_key='acl',
pillarenv=None,
saltenv=None,
merg... | python | def get_filter_config(platform,
filter_name,
filter_options=None,
terms=None,
prepend=True,
pillar_key='acl',
pillarenv=None,
saltenv=None,
merg... | [
"def",
"get_filter_config",
"(",
"platform",
",",
"filter_name",
",",
"filter_options",
"=",
"None",
",",
"terms",
"=",
"None",
",",
"prepend",
"=",
"True",
",",
"pillar_key",
"=",
"'acl'",
",",
"pillarenv",
"=",
"None",
",",
"saltenv",
"=",
"None",
",",
... | Return the configuration of a policy filter.
platform
The name of the Capirca platform.
filter_name
The name of the policy filter.
filter_options
Additional filter options. These options are platform-specific.
See the complete list of options_.
.. _options: https:... | [
"Return",
"the",
"configuration",
"of",
"a",
"policy",
"filter",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/capirca_acl.py#L888-L1031 | train |
saltstack/salt | salt/modules/capirca_acl.py | get_policy_config | def get_policy_config(platform,
filters=None,
prepend=True,
pillar_key='acl',
pillarenv=None,
saltenv=None,
merge_pillar=True,
only_lower_merge=False,
... | python | def get_policy_config(platform,
filters=None,
prepend=True,
pillar_key='acl',
pillarenv=None,
saltenv=None,
merge_pillar=True,
only_lower_merge=False,
... | [
"def",
"get_policy_config",
"(",
"platform",
",",
"filters",
"=",
"None",
",",
"prepend",
"=",
"True",
",",
"pillar_key",
"=",
"'acl'",
",",
"pillarenv",
"=",
"None",
",",
"saltenv",
"=",
"None",
",",
"merge_pillar",
"=",
"True",
",",
"only_lower_merge",
"... | Return the configuration of the whole policy.
platform
The name of the Capirca platform.
filters
List of filters for this policy.
If not specified or empty, will try to load the configuration from the pillar,
unless ``merge_pillar`` is set as ``False``.
prepend: ``True``
... | [
"Return",
"the",
"configuration",
"of",
"the",
"whole",
"policy",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/capirca_acl.py#L1034-L1202 | train |
saltstack/salt | salt/modules/capirca_acl.py | get_filter_pillar | def get_filter_pillar(filter_name,
pillar_key='acl',
pillarenv=None,
saltenv=None):
'''
Helper that can be used inside a state SLS,
in order to get the filter configuration given its name.
filter_name
The name of the filter.
... | python | def get_filter_pillar(filter_name,
pillar_key='acl',
pillarenv=None,
saltenv=None):
'''
Helper that can be used inside a state SLS,
in order to get the filter configuration given its name.
filter_name
The name of the filter.
... | [
"def",
"get_filter_pillar",
"(",
"filter_name",
",",
"pillar_key",
"=",
"'acl'",
",",
"pillarenv",
"=",
"None",
",",
"saltenv",
"=",
"None",
")",
":",
"pillar_cfg",
"=",
"_get_pillar_cfg",
"(",
"pillar_key",
",",
"pillarenv",
"=",
"pillarenv",
",",
"saltenv",
... | Helper that can be used inside a state SLS,
in order to get the filter configuration given its name.
filter_name
The name of the filter.
pillar_key
The root key of the whole policy config.
pillarenv
Query the master to generate fresh pillar data on the fly,
specificall... | [
"Helper",
"that",
"can",
"be",
"used",
"inside",
"a",
"state",
"SLS",
"in",
"order",
"to",
"get",
"the",
"filter",
"configuration",
"given",
"its",
"name",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/capirca_acl.py#L1205-L1230 | train |
saltstack/salt | salt/modules/capirca_acl.py | get_term_pillar | def get_term_pillar(filter_name,
term_name,
pillar_key='acl',
pillarenv=None,
saltenv=None):
'''
Helper that can be used inside a state SLS,
in order to get the term configuration given its name,
under a certain filter uniqu... | python | def get_term_pillar(filter_name,
term_name,
pillar_key='acl',
pillarenv=None,
saltenv=None):
'''
Helper that can be used inside a state SLS,
in order to get the term configuration given its name,
under a certain filter uniqu... | [
"def",
"get_term_pillar",
"(",
"filter_name",
",",
"term_name",
",",
"pillar_key",
"=",
"'acl'",
",",
"pillarenv",
"=",
"None",
",",
"saltenv",
"=",
"None",
")",
":",
"filter_pillar_cfg",
"=",
"get_filter_pillar",
"(",
"filter_name",
",",
"pillar_key",
"=",
"p... | Helper that can be used inside a state SLS,
in order to get the term configuration given its name,
under a certain filter uniquely identified by its name.
filter_name
The name of the filter.
term_name
The name of the term.
pillar_key: ``acl``
The root key of the whole poli... | [
"Helper",
"that",
"can",
"be",
"used",
"inside",
"a",
"state",
"SLS",
"in",
"order",
"to",
"get",
"the",
"term",
"configuration",
"given",
"its",
"name",
"under",
"a",
"certain",
"filter",
"uniquely",
"identified",
"by",
"its",
"name",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/capirca_acl.py#L1233-L1266 | train |
saltstack/salt | salt/cli/call.py | SaltCall.run | def run(self):
'''
Execute the salt call!
'''
self.parse_args()
if self.options.file_root:
# check if the argument is pointing to a file on disk
file_root = os.path.abspath(self.options.file_root)
self.config['file_roots'] = {'base': _expand_g... | python | def run(self):
'''
Execute the salt call!
'''
self.parse_args()
if self.options.file_root:
# check if the argument is pointing to a file on disk
file_root = os.path.abspath(self.options.file_root)
self.config['file_roots'] = {'base': _expand_g... | [
"def",
"run",
"(",
"self",
")",
":",
"self",
".",
"parse_args",
"(",
")",
"if",
"self",
".",
"options",
".",
"file_root",
":",
"# check if the argument is pointing to a file on disk",
"file_root",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"self",
".",
"op... | Execute the salt call! | [
"Execute",
"the",
"salt",
"call!"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/call.py#L17-L57 | train |
saltstack/salt | salt/states/highstate_doc.py | note | def note(name, source=None, contents=None, **kwargs):
'''
Add content to a document generated using `highstate_doc.render`.
This state does not preform any tasks on the host. It only is used in highstate_doc lowstate proccessers
to include extra documents.
.. code-block:: yaml
{{sls}} exa... | python | def note(name, source=None, contents=None, **kwargs):
'''
Add content to a document generated using `highstate_doc.render`.
This state does not preform any tasks on the host. It only is used in highstate_doc lowstate proccessers
to include extra documents.
.. code-block:: yaml
{{sls}} exa... | [
"def",
"note",
"(",
"name",
",",
"source",
"=",
"None",
",",
"contents",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"comment",
"=",
"''",
"if",
"source",
":",
"comment",
"+=",
"'include file: {0}\\n'",
".",
"format",
"(",
"source",
")",
"if",
"c... | Add content to a document generated using `highstate_doc.render`.
This state does not preform any tasks on the host. It only is used in highstate_doc lowstate proccessers
to include extra documents.
.. code-block:: yaml
{{sls}} example note:
highstate_doc.note:
- name:... | [
"Add",
"content",
"to",
"a",
"document",
"generated",
"using",
"highstate_doc",
".",
"render",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/highstate_doc.py#L12-L45 | train |
saltstack/salt | salt/modules/win_wua.py | available | def available(software=True,
drivers=True,
summary=False,
skip_installed=True,
skip_hidden=True,
skip_mandatory=False,
skip_reboot=False,
categories=None,
severities=None,):
'''
.. versionadded:: 2017... | python | def available(software=True,
drivers=True,
summary=False,
skip_installed=True,
skip_hidden=True,
skip_mandatory=False,
skip_reboot=False,
categories=None,
severities=None,):
'''
.. versionadded:: 2017... | [
"def",
"available",
"(",
"software",
"=",
"True",
",",
"drivers",
"=",
"True",
",",
"summary",
"=",
"False",
",",
"skip_installed",
"=",
"True",
",",
"skip_hidden",
"=",
"True",
",",
"skip_mandatory",
"=",
"False",
",",
"skip_reboot",
"=",
"False",
",",
... | .. versionadded:: 2017.7.0
List updates that match the passed criteria. This allows for more filter
options than :func:`list`. Good for finding a specific GUID or KB.
Args:
software (bool):
Include software updates in the results (default is True)
drivers (bool):
... | [
"..",
"versionadded",
"::",
"2017",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_wua.py#L99-L236 | train |
saltstack/salt | salt/modules/win_wua.py | get | def get(name, download=False, install=False):
'''
.. versionadded:: 2017.7.0
Returns details for the named update
Args:
name (str):
The name of the update you're searching for. This can be the GUID, a
KB number, or any part of the name of the update. GUIDs and KBs are
... | python | def get(name, download=False, install=False):
'''
.. versionadded:: 2017.7.0
Returns details for the named update
Args:
name (str):
The name of the update you're searching for. This can be the GUID, a
KB number, or any part of the name of the update. GUIDs and KBs are
... | [
"def",
"get",
"(",
"name",
",",
"download",
"=",
"False",
",",
"install",
"=",
"False",
")",
":",
"# Create a Windows Update Agent instance",
"wua",
"=",
"salt",
".",
"utils",
".",
"win_update",
".",
"WindowsUpdateAgent",
"(",
")",
"# Search for Update",
"update... | .. versionadded:: 2017.7.0
Returns details for the named update
Args:
name (str):
The name of the update you're searching for. This can be the GUID, a
KB number, or any part of the name of the update. GUIDs and KBs are
preferred. Run ``list`` to get the GUID for th... | [
"..",
"versionadded",
"::",
"2017",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_wua.py#L239-L328 | train |
saltstack/salt | salt/modules/win_wua.py | list | def list(software=True,
drivers=False,
summary=False,
skip_installed=True,
categories=None,
severities=None,
download=False,
install=False):
'''
.. versionadded:: 2017.7.0
Returns a detailed list of available updates or a summary. If download o... | python | def list(software=True,
drivers=False,
summary=False,
skip_installed=True,
categories=None,
severities=None,
download=False,
install=False):
'''
.. versionadded:: 2017.7.0
Returns a detailed list of available updates or a summary. If download o... | [
"def",
"list",
"(",
"software",
"=",
"True",
",",
"drivers",
"=",
"False",
",",
"summary",
"=",
"False",
",",
"skip_installed",
"=",
"True",
",",
"categories",
"=",
"None",
",",
"severities",
"=",
"None",
",",
"download",
"=",
"False",
",",
"install",
... | .. versionadded:: 2017.7.0
Returns a detailed list of available updates or a summary. If download or
install is True the same list will be downloaded and/or installed.
Args:
software (bool):
Include software updates in the results (default is True)
drivers (bool):
... | [
"..",
"versionadded",
"::",
"2017",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_wua.py#L331-L479 | train |
saltstack/salt | salt/modules/win_wua.py | download | def download(names):
'''
.. versionadded:: 2017.7.0
Downloads updates that match the list of passed identifiers. It's easier to
use this function by using list_updates and setting install=True.
Args:
names (str, list):
A single update or a list of updates to download. This can... | python | def download(names):
'''
.. versionadded:: 2017.7.0
Downloads updates that match the list of passed identifiers. It's easier to
use this function by using list_updates and setting install=True.
Args:
names (str, list):
A single update or a list of updates to download. This can... | [
"def",
"download",
"(",
"names",
")",
":",
"# Create a Windows Update Agent instance",
"wua",
"=",
"salt",
".",
"utils",
".",
"win_update",
".",
"WindowsUpdateAgent",
"(",
")",
"# Search for Update",
"updates",
"=",
"wua",
".",
"search",
"(",
"names",
")",
"if",... | .. versionadded:: 2017.7.0
Downloads updates that match the list of passed identifiers. It's easier to
use this function by using list_updates and setting install=True.
Args:
names (str, list):
A single update or a list of updates to download. This can be any
combination o... | [
"..",
"versionadded",
"::",
"2017",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_wua.py#L482-L531 | train |
saltstack/salt | salt/modules/win_wua.py | uninstall | def uninstall(names):
'''
.. versionadded:: 2017.7.0
Uninstall updates.
Args:
names (str, list):
A single update or a list of updates to uninstall. This can be any
combination of GUIDs, KB numbers, or names. GUIDs or KBs are
preferred.
Returns:
... | python | def uninstall(names):
'''
.. versionadded:: 2017.7.0
Uninstall updates.
Args:
names (str, list):
A single update or a list of updates to uninstall. This can be any
combination of GUIDs, KB numbers, or names. GUIDs or KBs are
preferred.
Returns:
... | [
"def",
"uninstall",
"(",
"names",
")",
":",
"# Create a Windows Update Agent instance",
"wua",
"=",
"salt",
".",
"utils",
".",
"win_update",
".",
"WindowsUpdateAgent",
"(",
")",
"# Search for Updates",
"updates",
"=",
"wua",
".",
"search",
"(",
"names",
")",
"if... | .. versionadded:: 2017.7.0
Uninstall updates.
Args:
names (str, list):
A single update or a list of updates to uninstall. This can be any
combination of GUIDs, KB numbers, or names. GUIDs or KBs are
preferred.
Returns:
dict: A dictionary containing th... | [
"..",
"versionadded",
"::",
"2017",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_wua.py#L586-L622 | train |
saltstack/salt | salt/modules/win_wua.py | set_wu_settings | def set_wu_settings(level=None,
recommended=None,
featured=None,
elevated=None,
msupdate=None,
day=None,
time=None):
'''
Change Windows Update settings. If no parameters are passed, the curren... | python | def set_wu_settings(level=None,
recommended=None,
featured=None,
elevated=None,
msupdate=None,
day=None,
time=None):
'''
Change Windows Update settings. If no parameters are passed, the curren... | [
"def",
"set_wu_settings",
"(",
"level",
"=",
"None",
",",
"recommended",
"=",
"None",
",",
"featured",
"=",
"None",
",",
"elevated",
"=",
"None",
",",
"msupdate",
"=",
"None",
",",
"day",
"=",
"None",
",",
"time",
"=",
"None",
")",
":",
"# The Automati... | Change Windows Update settings. If no parameters are passed, the current
value will be returned.
Supported:
- Windows Vista / Server 2008
- Windows 7 / Server 2008R2
- Windows 8 / Server 2012
- Windows 8.1 / Server 2012R2
.. note:
Microsoft began using the Unified U... | [
"Change",
"Windows",
"Update",
"settings",
".",
"If",
"no",
"parameters",
"are",
"passed",
"the",
"current",
"value",
"will",
"be",
"returned",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_wua.py#L625-L863 | train |
saltstack/salt | salt/modules/win_wua.py | get_wu_settings | def get_wu_settings():
'''
Get current Windows Update settings.
Returns:
dict: A dictionary of Windows Update settings:
Featured Updates:
Boolean value that indicates whether to display notifications for
featured updates.
Group Policy Required (Read-only):
... | python | def get_wu_settings():
'''
Get current Windows Update settings.
Returns:
dict: A dictionary of Windows Update settings:
Featured Updates:
Boolean value that indicates whether to display notifications for
featured updates.
Group Policy Required (Read-only):
... | [
"def",
"get_wu_settings",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"day",
"=",
"[",
"'Every Day'",
",",
"'Sunday'",
",",
"'Monday'",
",",
"'Tuesday'",
",",
"'Wednesday'",
",",
"'Thursday'",
",",
"'Friday'",
",",
"'Saturday'",
"]",
"# Initialize the PyCom system",
... | Get current Windows Update settings.
Returns:
dict: A dictionary of Windows Update settings:
Featured Updates:
Boolean value that indicates whether to display notifications for
featured updates.
Group Policy Required (Read-only):
Boolean value that indi... | [
"Get",
"current",
"Windows",
"Update",
"settings",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_wua.py#L866-L953 | train |
saltstack/salt | salt/modules/win_wua.py | _get_msupdate_status | def _get_msupdate_status():
'''
Check to see if Microsoft Update is Enabled
Return Boolean
'''
# To get the status of Microsoft Update we actually have to check the
# Microsoft Update Service Manager
# Initialize the PyCom system
with salt.utils.winapi.Com():
# Create a ServiceMa... | python | def _get_msupdate_status():
'''
Check to see if Microsoft Update is Enabled
Return Boolean
'''
# To get the status of Microsoft Update we actually have to check the
# Microsoft Update Service Manager
# Initialize the PyCom system
with salt.utils.winapi.Com():
# Create a ServiceMa... | [
"def",
"_get_msupdate_status",
"(",
")",
":",
"# To get the status of Microsoft Update we actually have to check the",
"# Microsoft Update Service Manager",
"# Initialize the PyCom system",
"with",
"salt",
".",
"utils",
".",
"winapi",
".",
"Com",
"(",
")",
":",
"# Create a Serv... | Check to see if Microsoft Update is Enabled
Return Boolean | [
"Check",
"to",
"see",
"if",
"Microsoft",
"Update",
"is",
"Enabled",
"Return",
"Boolean"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_wua.py#L956-L977 | train |
saltstack/salt | salt/modules/boto_s3.py | get_object_metadata | def get_object_metadata(
name,
extra_args=None,
region=None,
key=None,
keyid=None,
profile=None,
):
'''
Get metadata about an S3 object.
Returns None if the object does not exist.
You can pass AWS SSE-C related args and/or RequestPayer in extra_args.
CLI Example:
.. co... | python | def get_object_metadata(
name,
extra_args=None,
region=None,
key=None,
keyid=None,
profile=None,
):
'''
Get metadata about an S3 object.
Returns None if the object does not exist.
You can pass AWS SSE-C related args and/or RequestPayer in extra_args.
CLI Example:
.. co... | [
"def",
"get_object_metadata",
"(",
"name",
",",
"extra_args",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
",",
")",
":",
"bucket",
",",
"_",
",",
"s3_key",
"=",
"name",
"... | Get metadata about an S3 object.
Returns None if the object does not exist.
You can pass AWS SSE-C related args and/or RequestPayer in extra_args.
CLI Example:
.. code-block:: bash
salt myminion boto_s3.get_object_metadata \\
my_bucket/path/to/object \\
... | [
"Get",
"metadata",
"about",
"an",
"S3",
"object",
".",
"Returns",
"None",
"if",
"the",
"object",
"does",
"not",
"exist",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3.py#L90-L132 | train |
saltstack/salt | salt/modules/boto_s3.py | upload_file | def upload_file(
source,
name,
extra_args=None,
region=None,
key=None,
keyid=None,
profile=None,
):
'''
Upload a local file as an S3 object.
CLI Example:
.. code-block:: bash
salt myminion boto_s3.upload_file \\
/path/to/local/file \\
... | python | def upload_file(
source,
name,
extra_args=None,
region=None,
key=None,
keyid=None,
profile=None,
):
'''
Upload a local file as an S3 object.
CLI Example:
.. code-block:: bash
salt myminion boto_s3.upload_file \\
/path/to/local/file \\
... | [
"def",
"upload_file",
"(",
"source",
",",
"name",
",",
"extra_args",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
",",
")",
":",
"bucket",
",",
"_",
",",
"s3_key",
"=",
... | Upload a local file as an S3 object.
CLI Example:
.. code-block:: bash
salt myminion boto_s3.upload_file \\
/path/to/local/file \\
my_bucket/path/to/object \\
region=us-east-1 \\
key=key \\
... | [
"Upload",
"a",
"local",
"file",
"as",
"an",
"S3",
"object",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3.py#L135-L169 | train |
saltstack/salt | salt/utils/profile.py | profile_func | def profile_func(filename=None):
'''
Decorator for adding profiling to a nested function in Salt
'''
def proffunc(fun):
def profiled_func(*args, **kwargs):
logging.info('Profiling function %s', fun.__name__)
try:
profiler = cProfile.Profile()
... | python | def profile_func(filename=None):
'''
Decorator for adding profiling to a nested function in Salt
'''
def proffunc(fun):
def profiled_func(*args, **kwargs):
logging.info('Profiling function %s', fun.__name__)
try:
profiler = cProfile.Profile()
... | [
"def",
"profile_func",
"(",
"filename",
"=",
"None",
")",
":",
"def",
"proffunc",
"(",
"fun",
")",
":",
"def",
"profiled_func",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"logging",
".",
"info",
"(",
"'Profiling function %s'",
",",
"fun",
"."... | Decorator for adding profiling to a nested function in Salt | [
"Decorator",
"for",
"adding",
"profiling",
"to",
"a",
"nested",
"function",
"in",
"Salt"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/profile.py#L30-L47 | train |
saltstack/salt | salt/modules/djangomod.py | _get_django_admin | def _get_django_admin(bin_env):
'''
Return the django admin
'''
if not bin_env:
if salt.utils.path.which('django-admin.py'):
return 'django-admin.py'
elif salt.utils.path.which('django-admin'):
return 'django-admin'
else:
raise salt.exceptions.... | python | def _get_django_admin(bin_env):
'''
Return the django admin
'''
if not bin_env:
if salt.utils.path.which('django-admin.py'):
return 'django-admin.py'
elif salt.utils.path.which('django-admin'):
return 'django-admin'
else:
raise salt.exceptions.... | [
"def",
"_get_django_admin",
"(",
"bin_env",
")",
":",
"if",
"not",
"bin_env",
":",
"if",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"'django-admin.py'",
")",
":",
"return",
"'django-admin.py'",
"elif",
"salt",
".",
"utils",
".",
"path",
".",
"... | Return the django admin | [
"Return",
"the",
"django",
"admin"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/djangomod.py#L26-L42 | train |
saltstack/salt | salt/modules/djangomod.py | command | def command(settings_module,
command,
bin_env=None,
pythonpath=None,
env=None,
runas=None,
*args, **kwargs):
'''
Run arbitrary django management command
CLI Example:
.. code-block:: bash
salt '*' django.command <settings_... | python | def command(settings_module,
command,
bin_env=None,
pythonpath=None,
env=None,
runas=None,
*args, **kwargs):
'''
Run arbitrary django management command
CLI Example:
.. code-block:: bash
salt '*' django.command <settings_... | [
"def",
"command",
"(",
"settings_module",
",",
"command",
",",
"bin_env",
"=",
"None",
",",
"pythonpath",
"=",
"None",
",",
"env",
"=",
"None",
",",
"runas",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"dja",
"=",
"_get_django_a... | Run arbitrary django management command
CLI Example:
.. code-block:: bash
salt '*' django.command <settings_module> <command> | [
"Run",
"arbitrary",
"django",
"management",
"command"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/djangomod.py#L45-L73 | train |
saltstack/salt | salt/modules/djangomod.py | syncdb | def syncdb(settings_module,
bin_env=None,
migrate=False,
database=None,
pythonpath=None,
env=None,
noinput=True,
runas=None):
'''
Run syncdb
Execute the Django-Admin syncdb command, if South is available on the
minion the ``mi... | python | def syncdb(settings_module,
bin_env=None,
migrate=False,
database=None,
pythonpath=None,
env=None,
noinput=True,
runas=None):
'''
Run syncdb
Execute the Django-Admin syncdb command, if South is available on the
minion the ``mi... | [
"def",
"syncdb",
"(",
"settings_module",
",",
"bin_env",
"=",
"None",
",",
"migrate",
"=",
"False",
",",
"database",
"=",
"None",
",",
"pythonpath",
"=",
"None",
",",
"env",
"=",
"None",
",",
"noinput",
"=",
"True",
",",
"runas",
"=",
"None",
")",
":... | Run syncdb
Execute the Django-Admin syncdb command, if South is available on the
minion the ``migrate`` option can be passed as ``True`` calling the
migrations to run after the syncdb completes
NOTE: The syncdb command was deprecated in Django 1.7 and removed in Django 1.9.
For Django versions 1.9... | [
"Run",
"syncdb"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/djangomod.py#L76-L115 | train |
saltstack/salt | salt/modules/djangomod.py | migrate | def migrate(settings_module,
app_label=None,
migration_name=None,
bin_env=None,
database=None,
pythonpath=None,
env=None,
noinput=True,
runas=None):
'''
Run migrate
Execute the Django-Admin migrate command (requires Dja... | python | def migrate(settings_module,
app_label=None,
migration_name=None,
bin_env=None,
database=None,
pythonpath=None,
env=None,
noinput=True,
runas=None):
'''
Run migrate
Execute the Django-Admin migrate command (requires Dja... | [
"def",
"migrate",
"(",
"settings_module",
",",
"app_label",
"=",
"None",
",",
"migration_name",
"=",
"None",
",",
"bin_env",
"=",
"None",
",",
"database",
"=",
"None",
",",
"pythonpath",
"=",
"None",
",",
"env",
"=",
"None",
",",
"noinput",
"=",
"True",
... | Run migrate
Execute the Django-Admin migrate command (requires Django 1.7 or higher).
.. versionadded:: Neon
settings_module
Specifies the settings module to use.
The settings module should be in Python package syntax, e.g. mysite.settings.
If this isn’t provided, django-admin wil... | [
"Run",
"migrate"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/djangomod.py#L118-L211 | train |
saltstack/salt | salt/modules/djangomod.py | createsuperuser | def createsuperuser(settings_module,
username,
email,
bin_env=None,
database=None,
pythonpath=None,
env=None,
runas=None):
'''
Create a super user for the database.
Thi... | python | def createsuperuser(settings_module,
username,
email,
bin_env=None,
database=None,
pythonpath=None,
env=None,
runas=None):
'''
Create a super user for the database.
Thi... | [
"def",
"createsuperuser",
"(",
"settings_module",
",",
"username",
",",
"email",
",",
"bin_env",
"=",
"None",
",",
"database",
"=",
"None",
",",
"pythonpath",
"=",
"None",
",",
"env",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"args",
"=",
"[",
... | Create a super user for the database.
This function defaults to use the ``--noinput`` flag which prevents the
creation of a password for the superuser.
CLI Example:
.. code-block:: bash
salt '*' django.createsuperuser <settings_module> user user@example.com | [
"Create",
"a",
"super",
"user",
"for",
"the",
"database",
".",
"This",
"function",
"defaults",
"to",
"use",
"the",
"--",
"noinput",
"flag",
"which",
"prevents",
"the",
"creation",
"of",
"a",
"password",
"for",
"the",
"superuser",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/djangomod.py#L214-L246 | train |
saltstack/salt | salt/modules/djangomod.py | loaddata | def loaddata(settings_module,
fixtures,
bin_env=None,
database=None,
pythonpath=None,
env=None):
'''
Load fixture data
Fixtures:
comma separated list of fixtures to load
CLI Example:
.. code-block:: bash
salt '*' dj... | python | def loaddata(settings_module,
fixtures,
bin_env=None,
database=None,
pythonpath=None,
env=None):
'''
Load fixture data
Fixtures:
comma separated list of fixtures to load
CLI Example:
.. code-block:: bash
salt '*' dj... | [
"def",
"loaddata",
"(",
"settings_module",
",",
"fixtures",
",",
"bin_env",
"=",
"None",
",",
"database",
"=",
"None",
",",
"pythonpath",
"=",
"None",
",",
"env",
"=",
"None",
")",
":",
"args",
"=",
"[",
"]",
"kwargs",
"=",
"{",
"}",
"if",
"database"... | Load fixture data
Fixtures:
comma separated list of fixtures to load
CLI Example:
.. code-block:: bash
salt '*' django.loaddata <settings_module> <comma delimited list of fixtures> | [
"Load",
"fixture",
"data"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/djangomod.py#L249-L280 | train |
saltstack/salt | salt/modules/djangomod.py | collectstatic | def collectstatic(settings_module,
bin_env=None,
no_post_process=False,
ignore=None,
dry_run=False,
clear=False,
link=False,
no_default_ignore=False,
pythonpath=None,
... | python | def collectstatic(settings_module,
bin_env=None,
no_post_process=False,
ignore=None,
dry_run=False,
clear=False,
link=False,
no_default_ignore=False,
pythonpath=None,
... | [
"def",
"collectstatic",
"(",
"settings_module",
",",
"bin_env",
"=",
"None",
",",
"no_post_process",
"=",
"False",
",",
"ignore",
"=",
"None",
",",
"dry_run",
"=",
"False",
",",
"clear",
"=",
"False",
",",
"link",
"=",
"False",
",",
"no_default_ignore",
"=... | Collect static files from each of your applications into a single location
that can easily be served in production.
CLI Example:
.. code-block:: bash
salt '*' django.collectstatic <settings_module> | [
"Collect",
"static",
"files",
"from",
"each",
"of",
"your",
"applications",
"into",
"a",
"single",
"location",
"that",
"can",
"easily",
"be",
"served",
"in",
"production",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/djangomod.py#L283-L325 | train |
saltstack/salt | salt/states/postgres_default_privileges.py | present | def present(name,
object_name,
object_type,
defprivileges=None,
grant_option=None,
prepend='public',
maintenance_db=None,
user=None,
db_password=None,
db_host=None,
db_port=None,
db_user=N... | python | def present(name,
object_name,
object_type,
defprivileges=None,
grant_option=None,
prepend='public',
maintenance_db=None,
user=None,
db_password=None,
db_host=None,
db_port=None,
db_user=N... | [
"def",
"present",
"(",
"name",
",",
"object_name",
",",
"object_type",
",",
"defprivileges",
"=",
"None",
",",
"grant_option",
"=",
"None",
",",
"prepend",
"=",
"'public'",
",",
"maintenance_db",
"=",
"None",
",",
"user",
"=",
"None",
",",
"db_password",
"... | Grant the requested privilege(s) on the specified object to a role
name
Name of the role to which privileges should be granted
object_name
Name of the object on which the grant is to be performed.
'ALL' may be used for objects of type 'table' or 'sequence'.
object_type
The ob... | [
"Grant",
"the",
"requested",
"privilege",
"(",
"s",
")",
"on",
"the",
"specified",
"object",
"to",
"a",
"role"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/postgres_default_privileges.py#L77-L196 | train |
saltstack/salt | salt/modules/nfs3.py | list_exports | def list_exports(exports='/etc/exports'):
'''
List configured exports
CLI Example:
.. code-block:: bash
salt '*' nfs.list_exports
'''
ret = {}
with salt.utils.files.fopen(exports, 'r') as efl:
for line in salt.utils.stringutils.to_unicode(efl.read()).splitlines():
... | python | def list_exports(exports='/etc/exports'):
'''
List configured exports
CLI Example:
.. code-block:: bash
salt '*' nfs.list_exports
'''
ret = {}
with salt.utils.files.fopen(exports, 'r') as efl:
for line in salt.utils.stringutils.to_unicode(efl.read()).splitlines():
... | [
"def",
"list_exports",
"(",
"exports",
"=",
"'/etc/exports'",
")",
":",
"ret",
"=",
"{",
"}",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"exports",
",",
"'r'",
")",
"as",
"efl",
":",
"for",
"line",
"in",
"salt",
".",
"utils",
".... | List configured exports
CLI Example:
.. code-block:: bash
salt '*' nfs.list_exports | [
"List",
"configured",
"exports"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nfs3.py#L28-L66 | train |
saltstack/salt | salt/modules/nfs3.py | del_export | def del_export(exports='/etc/exports', path=None):
'''
Remove an export
CLI Example:
.. code-block:: bash
salt '*' nfs.del_export /media/storage
'''
edict = list_exports(exports)
del edict[path]
_write_exports(exports, edict)
return edict | python | def del_export(exports='/etc/exports', path=None):
'''
Remove an export
CLI Example:
.. code-block:: bash
salt '*' nfs.del_export /media/storage
'''
edict = list_exports(exports)
del edict[path]
_write_exports(exports, edict)
return edict | [
"def",
"del_export",
"(",
"exports",
"=",
"'/etc/exports'",
",",
"path",
"=",
"None",
")",
":",
"edict",
"=",
"list_exports",
"(",
"exports",
")",
"del",
"edict",
"[",
"path",
"]",
"_write_exports",
"(",
"exports",
",",
"edict",
")",
"return",
"edict"
] | Remove an export
CLI Example:
.. code-block:: bash
salt '*' nfs.del_export /media/storage | [
"Remove",
"an",
"export"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nfs3.py#L69-L82 | train |
saltstack/salt | salt/modules/nfs3.py | add_export | def add_export(exports='/etc/exports', path=None, hosts=None, options=None):
'''
Add an export
CLI Example:
.. code-block:: bash
salt '*' nfs3.add_export path='/srv/test' hosts='127.0.0.1' options=['rw']
'''
if options is None:
options = []
if not isinstance(hosts, six.str... | python | def add_export(exports='/etc/exports', path=None, hosts=None, options=None):
'''
Add an export
CLI Example:
.. code-block:: bash
salt '*' nfs3.add_export path='/srv/test' hosts='127.0.0.1' options=['rw']
'''
if options is None:
options = []
if not isinstance(hosts, six.str... | [
"def",
"add_export",
"(",
"exports",
"=",
"'/etc/exports'",
",",
"path",
"=",
"None",
",",
"hosts",
"=",
"None",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"[",
"]",
"if",
"not",
"isinstance",
"(",
"hos... | Add an export
CLI Example:
.. code-block:: bash
salt '*' nfs3.add_export path='/srv/test' hosts='127.0.0.1' options=['rw'] | [
"Add",
"an",
"export"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nfs3.py#L85-L107 | train |
saltstack/salt | salt/modules/nfs3.py | _write_exports | def _write_exports(exports, edict):
'''
Write an exports file to disk
If multiple shares were initially configured per line, like:
/media/storage /media/data *(ro,sync,no_subtree_check)
...then they will be saved to disk with only one share per line:
/media/storage *(ro,sync,no_subtr... | python | def _write_exports(exports, edict):
'''
Write an exports file to disk
If multiple shares were initially configured per line, like:
/media/storage /media/data *(ro,sync,no_subtree_check)
...then they will be saved to disk with only one share per line:
/media/storage *(ro,sync,no_subtr... | [
"def",
"_write_exports",
"(",
"exports",
",",
"edict",
")",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"exports",
",",
"'w'",
")",
"as",
"efh",
":",
"for",
"export",
"in",
"edict",
":",
"line",
"=",
"salt",
".",
"utils",
".... | Write an exports file to disk
If multiple shares were initially configured per line, like:
/media/storage /media/data *(ro,sync,no_subtree_check)
...then they will be saved to disk with only one share per line:
/media/storage *(ro,sync,no_subtree_check)
/media/data *(ro,sync,no_subtr... | [
"Write",
"an",
"exports",
"file",
"to",
"disk"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nfs3.py#L110-L130 | train |
saltstack/salt | salt/modules/nfs3.py | reload_exports | def reload_exports():
'''
Trigger a reload of the exports file to apply changes
CLI Example:
.. code-block:: bash
salt '*' nfs3.reload_exports
'''
ret = {}
command = 'exportfs -r'
output = __salt__['cmd.run_all'](command)
ret['stdout'] = output['stdout']
ret['stderr'... | python | def reload_exports():
'''
Trigger a reload of the exports file to apply changes
CLI Example:
.. code-block:: bash
salt '*' nfs3.reload_exports
'''
ret = {}
command = 'exportfs -r'
output = __salt__['cmd.run_all'](command)
ret['stdout'] = output['stdout']
ret['stderr'... | [
"def",
"reload_exports",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"command",
"=",
"'exportfs -r'",
"output",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"command",
")",
"ret",
"[",
"'stdout'",
"]",
"=",
"output",
"[",
"'stdout'",
"]",
"ret",
"[",
"'st... | Trigger a reload of the exports file to apply changes
CLI Example:
.. code-block:: bash
salt '*' nfs3.reload_exports | [
"Trigger",
"a",
"reload",
"of",
"the",
"exports",
"file",
"to",
"apply",
"changes"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nfs3.py#L133-L154 | train |
saltstack/salt | salt/states/docker_image.py | present | def present(name,
tag=None,
build=None,
load=None,
force=False,
insecure_registry=False,
client_timeout=salt.utils.docker.CLIENT_TIMEOUT,
dockerfile=None,
sls=None,
base='opensuse/python',
saltenv='ba... | python | def present(name,
tag=None,
build=None,
load=None,
force=False,
insecure_registry=False,
client_timeout=salt.utils.docker.CLIENT_TIMEOUT,
dockerfile=None,
sls=None,
base='opensuse/python',
saltenv='ba... | [
"def",
"present",
"(",
"name",
",",
"tag",
"=",
"None",
",",
"build",
"=",
"None",
",",
"load",
"=",
"None",
",",
"force",
"=",
"False",
",",
"insecure_registry",
"=",
"False",
",",
"client_timeout",
"=",
"salt",
".",
"utils",
".",
"docker",
".",
"CL... | .. versionchanged:: 2018.3.0
The ``tag`` argument has been added. It is now required unless pulling
from a registry.
Ensure that an image is present. The image can either be pulled from a
Docker registry, built from a Dockerfile, loaded from a saved image, or
built by running SLS files agai... | [
"..",
"versionchanged",
"::",
"2018",
".",
"3",
".",
"0",
"The",
"tag",
"argument",
"has",
"been",
"added",
".",
"It",
"is",
"now",
"required",
"unless",
"pulling",
"from",
"a",
"registry",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/docker_image.py#L65-L375 | train |
saltstack/salt | salt/states/docker_image.py | absent | def absent(name=None, images=None, force=False):
'''
Ensure that an image is absent from the Minion. Image names can be
specified either using ``repo:tag`` notation, or just the repo name (in
which case a tag of ``latest`` is assumed).
images
Run this state on more than one image at a time.... | python | def absent(name=None, images=None, force=False):
'''
Ensure that an image is absent from the Minion. Image names can be
specified either using ``repo:tag`` notation, or just the repo name (in
which case a tag of ``latest`` is assumed).
images
Run this state on more than one image at a time.... | [
"def",
"absent",
"(",
"name",
"=",
"None",
",",
"images",
"=",
"None",
",",
"force",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",... | Ensure that an image is absent from the Minion. Image names can be
specified either using ``repo:tag`` notation, or just the repo name (in
which case a tag of ``latest`` is assumed).
images
Run this state on more than one image at a time. The following two
examples accomplish the same thing... | [
"Ensure",
"that",
"an",
"image",
"is",
"absent",
"from",
"the",
"Minion",
".",
"Image",
"names",
"can",
"be",
"specified",
"either",
"using",
"repo",
":",
"tag",
"notation",
"or",
"just",
"the",
"repo",
"name",
"(",
"in",
"which",
"case",
"a",
"tag",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/docker_image.py#L378-L502 | train |
saltstack/salt | salt/states/docker_image.py | mod_watch | def mod_watch(name, sfun=None, **kwargs):
'''
The docker_image watcher, called to invoke the watch command.
.. note::
This state exists to support special handling of the ``watch``
:ref:`requisite <requisites>`. It should not be called directly.
Parameters for this function should... | python | def mod_watch(name, sfun=None, **kwargs):
'''
The docker_image watcher, called to invoke the watch command.
.. note::
This state exists to support special handling of the ``watch``
:ref:`requisite <requisites>`. It should not be called directly.
Parameters for this function should... | [
"def",
"mod_watch",
"(",
"name",
",",
"sfun",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"sfun",
"==",
"'present'",
":",
"# Force image to be updated",
"kwargs",
"[",
"'force'",
"]",
"=",
"True",
"return",
"present",
"(",
"name",
",",
"*",
"... | The docker_image watcher, called to invoke the watch command.
.. note::
This state exists to support special handling of the ``watch``
:ref:`requisite <requisites>`. It should not be called directly.
Parameters for this function should be set by the state being triggered. | [
"The",
"docker_image",
"watcher",
"called",
"to",
"invoke",
"the",
"watch",
"command",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/docker_image.py#L505-L524 | train |
saltstack/salt | salt/renderers/genshi.py | render | def render(genshi_data, saltenv='base', sls='', method='xml', **kws):
'''
Render a Genshi template. A method should be passed in as part of the
kwargs. If no method is passed in, xml is assumed. Valid methods are:
.. code-block:
- xml
- xhtml
- html
- text
- new... | python | def render(genshi_data, saltenv='base', sls='', method='xml', **kws):
'''
Render a Genshi template. A method should be passed in as part of the
kwargs. If no method is passed in, xml is assumed. Valid methods are:
.. code-block:
- xml
- xhtml
- html
- text
- new... | [
"def",
"render",
"(",
"genshi_data",
",",
"saltenv",
"=",
"'base'",
",",
"sls",
"=",
"''",
",",
"method",
"=",
"'xml'",
",",
"*",
"*",
"kws",
")",
":",
"if",
"not",
"HAS_LIBS",
":",
"return",
"{",
"}",
"if",
"not",
"isinstance",
"(",
"genshi_data",
... | Render a Genshi template. A method should be passed in as part of the
kwargs. If no method is passed in, xml is assumed. Valid methods are:
.. code-block:
- xml
- xhtml
- html
- text
- newtext
- oldtext
Note that the ``text`` method will call ``NewTextTempl... | [
"Render",
"a",
"Genshi",
"template",
".",
"A",
"method",
"should",
"be",
"passed",
"in",
"as",
"part",
"of",
"the",
"kwargs",
".",
"If",
"no",
"method",
"is",
"passed",
"in",
"xml",
"is",
"assumed",
".",
"Valid",
"methods",
"are",
":"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/renderers/genshi.py#L21-L58 | train |
saltstack/salt | salt/output/nested.py | output | def output(ret, **kwargs):
'''
Display ret data
'''
# Prefer kwargs before opts
retcode = kwargs.get('_retcode', 0)
base_indent = kwargs.get('nested_indent', 0) \
or __opts__.get('nested_indent', 0)
nest = NestDisplay(retcode=retcode)
lines = nest.display(ret, base_indent, '', []... | python | def output(ret, **kwargs):
'''
Display ret data
'''
# Prefer kwargs before opts
retcode = kwargs.get('_retcode', 0)
base_indent = kwargs.get('nested_indent', 0) \
or __opts__.get('nested_indent', 0)
nest = NestDisplay(retcode=retcode)
lines = nest.display(ret, base_indent, '', []... | [
"def",
"output",
"(",
"ret",
",",
"*",
"*",
"kwargs",
")",
":",
"# Prefer kwargs before opts",
"retcode",
"=",
"kwargs",
".",
"get",
"(",
"'_retcode'",
",",
"0",
")",
"base_indent",
"=",
"kwargs",
".",
"get",
"(",
"'nested_indent'",
",",
"0",
")",
"or",
... | Display ret data | [
"Display",
"ret",
"data"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/nested.py#L208-L224 | train |
saltstack/salt | salt/output/nested.py | NestDisplay.display | def display(self, ret, indent, prefix, out):
'''
Recursively iterate down through data structures to determine output
'''
if isinstance(ret, bytes):
try:
ret = salt.utils.stringutils.to_unicode(ret)
except UnicodeDecodeError:
# ret ... | python | def display(self, ret, indent, prefix, out):
'''
Recursively iterate down through data structures to determine output
'''
if isinstance(ret, bytes):
try:
ret = salt.utils.stringutils.to_unicode(ret)
except UnicodeDecodeError:
# ret ... | [
"def",
"display",
"(",
"self",
",",
"ret",
",",
"indent",
",",
"prefix",
",",
"out",
")",
":",
"if",
"isinstance",
"(",
"ret",
",",
"bytes",
")",
":",
"try",
":",
"ret",
"=",
"salt",
".",
"utils",
".",
"stringutils",
".",
"to_unicode",
"(",
"ret",
... | Recursively iterate down through data structures to determine output | [
"Recursively",
"iterate",
"down",
"through",
"data",
"structures",
"to",
"determine",
"output"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/nested.py#L97-L205 | train |
saltstack/salt | salt/utils/mount.py | _read_file | def _read_file(path):
'''
Reads and returns the contents of a text file
'''
try:
with salt.utils.files.fopen(path, 'rb') as contents:
return salt.utils.yaml.safe_load(contents)
except (OSError, IOError):
return {} | python | def _read_file(path):
'''
Reads and returns the contents of a text file
'''
try:
with salt.utils.files.fopen(path, 'rb') as contents:
return salt.utils.yaml.safe_load(contents)
except (OSError, IOError):
return {} | [
"def",
"_read_file",
"(",
"path",
")",
":",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"path",
",",
"'rb'",
")",
"as",
"contents",
":",
"return",
"salt",
".",
"utils",
".",
"yaml",
".",
"safe_load",
"(",
"contents",
... | Reads and returns the contents of a text file | [
"Reads",
"and",
"returns",
"the",
"contents",
"of",
"a",
"text",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/mount.py#L20-L28 | train |
saltstack/salt | salt/utils/mount.py | write_cache | def write_cache(cache, opts):
'''
Write the mount cache file.
'''
cache_file = get_cache(opts)
try:
_cache = salt.utils.stringutils.to_bytes(
salt.utils.yaml.safe_dump(cache)
)
with salt.utils.files.fopen(cache_file, 'wb+') as fp_:
fp_.write(_cache)
... | python | def write_cache(cache, opts):
'''
Write the mount cache file.
'''
cache_file = get_cache(opts)
try:
_cache = salt.utils.stringutils.to_bytes(
salt.utils.yaml.safe_dump(cache)
)
with salt.utils.files.fopen(cache_file, 'wb+') as fp_:
fp_.write(_cache)
... | [
"def",
"write_cache",
"(",
"cache",
",",
"opts",
")",
":",
"cache_file",
"=",
"get_cache",
"(",
"opts",
")",
"try",
":",
"_cache",
"=",
"salt",
".",
"utils",
".",
"stringutils",
".",
"to_bytes",
"(",
"salt",
".",
"utils",
".",
"yaml",
".",
"safe_dump",... | Write the mount cache file. | [
"Write",
"the",
"mount",
"cache",
"file",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/mount.py#L46-L62 | train |
saltstack/salt | salt/modules/iosconfig.py | _get_diff_text | def _get_diff_text(old, new):
'''
Returns the diff of two text blobs.
'''
diff = difflib.unified_diff(old.splitlines(1),
new.splitlines(1))
return ''.join([x.replace('\r', '') for x in diff]) | python | def _get_diff_text(old, new):
'''
Returns the diff of two text blobs.
'''
diff = difflib.unified_diff(old.splitlines(1),
new.splitlines(1))
return ''.join([x.replace('\r', '') for x in diff]) | [
"def",
"_get_diff_text",
"(",
"old",
",",
"new",
")",
":",
"diff",
"=",
"difflib",
".",
"unified_diff",
"(",
"old",
".",
"splitlines",
"(",
"1",
")",
",",
"new",
".",
"splitlines",
"(",
"1",
")",
")",
"return",
"''",
".",
"join",
"(",
"[",
"x",
"... | Returns the diff of two text blobs. | [
"Returns",
"the",
"diff",
"of",
"two",
"text",
"blobs",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iosconfig.py#L116-L122 | train |
saltstack/salt | salt/modules/iosconfig.py | _print_config_text | def _print_config_text(tree, indentation=0):
'''
Return the config as text from a config tree.
'''
config = ''
for key, value in six.iteritems(tree):
config += '{indent}{line}\n'.format(indent=' '*indentation, line=key)
if value:
config += _print_config_text(value, indent... | python | def _print_config_text(tree, indentation=0):
'''
Return the config as text from a config tree.
'''
config = ''
for key, value in six.iteritems(tree):
config += '{indent}{line}\n'.format(indent=' '*indentation, line=key)
if value:
config += _print_config_text(value, indent... | [
"def",
"_print_config_text",
"(",
"tree",
",",
"indentation",
"=",
"0",
")",
":",
"config",
"=",
"''",
"for",
"key",
",",
"value",
"in",
"six",
".",
"iteritems",
"(",
"tree",
")",
":",
"config",
"+=",
"'{indent}{line}\\n'",
".",
"format",
"(",
"indent",
... | Return the config as text from a config tree. | [
"Return",
"the",
"config",
"as",
"text",
"from",
"a",
"config",
"tree",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iosconfig.py#L125-L134 | train |
saltstack/salt | salt/modules/iosconfig.py | tree | def tree(config=None,
path=None,
with_tags=False,
saltenv='base'):
'''
Transform Cisco IOS style configuration to structured Python dictionary.
Depending on the value of the ``with_tags`` argument, this function may
provide different views, valuable in different situations.
... | python | def tree(config=None,
path=None,
with_tags=False,
saltenv='base'):
'''
Transform Cisco IOS style configuration to structured Python dictionary.
Depending on the value of the ``with_tags`` argument, this function may
provide different views, valuable in different situations.
... | [
"def",
"tree",
"(",
"config",
"=",
"None",
",",
"path",
"=",
"None",
",",
"with_tags",
"=",
"False",
",",
"saltenv",
"=",
"'base'",
")",
":",
"if",
"path",
":",
"config",
"=",
"__salt__",
"[",
"'cp.get_file_str'",
"]",
"(",
"path",
",",
"saltenv",
"=... | Transform Cisco IOS style configuration to structured Python dictionary.
Depending on the value of the ``with_tags`` argument, this function may
provide different views, valuable in different situations.
config
The configuration sent as text. This argument is ignored when ``path``
is config... | [
"Transform",
"Cisco",
"IOS",
"style",
"configuration",
"to",
"structured",
"Python",
"dictionary",
".",
"Depending",
"on",
"the",
"value",
"of",
"the",
"with_tags",
"argument",
"this",
"function",
"may",
"provide",
"different",
"views",
"valuable",
"in",
"differen... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iosconfig.py#L141-L179 | train |
saltstack/salt | salt/modules/iosconfig.py | clean | def clean(config=None, path=None, saltenv='base'):
'''
Return a clean version of the config, without any special signs (such as
``!`` as an individual line) or empty lines, but just lines with significant
value in the configuration of the network device.
config
The configuration sent as tex... | python | def clean(config=None, path=None, saltenv='base'):
'''
Return a clean version of the config, without any special signs (such as
``!`` as an individual line) or empty lines, but just lines with significant
value in the configuration of the network device.
config
The configuration sent as tex... | [
"def",
"clean",
"(",
"config",
"=",
"None",
",",
"path",
"=",
"None",
",",
"saltenv",
"=",
"'base'",
")",
":",
"config_tree",
"=",
"tree",
"(",
"config",
"=",
"config",
",",
"path",
"=",
"path",
",",
"saltenv",
"=",
"saltenv",
")",
"return",
"_print_... | Return a clean version of the config, without any special signs (such as
``!`` as an individual line) or empty lines, but just lines with significant
value in the configuration of the network device.
config
The configuration sent as text. This argument is ignored when ``path``
is configured... | [
"Return",
"a",
"clean",
"version",
"of",
"the",
"config",
"without",
"any",
"special",
"signs",
"(",
"such",
"as",
"!",
"as",
"an",
"individual",
"line",
")",
"or",
"empty",
"lines",
"but",
"just",
"lines",
"with",
"significant",
"value",
"in",
"the",
"c... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iosconfig.py#L182-L210 | train |
saltstack/salt | salt/modules/iosconfig.py | merge_tree | def merge_tree(initial_config=None,
initial_path=None,
merge_config=None,
merge_path=None,
saltenv='base'):
'''
Return the merge tree of the ``initial_config`` with the ``merge_config``,
as a Python dictionary.
initial_config
The initi... | python | def merge_tree(initial_config=None,
initial_path=None,
merge_config=None,
merge_path=None,
saltenv='base'):
'''
Return the merge tree of the ``initial_config`` with the ``merge_config``,
as a Python dictionary.
initial_config
The initi... | [
"def",
"merge_tree",
"(",
"initial_config",
"=",
"None",
",",
"initial_path",
"=",
"None",
",",
"merge_config",
"=",
"None",
",",
"merge_path",
"=",
"None",
",",
"saltenv",
"=",
"'base'",
")",
":",
"merge_tree",
"=",
"tree",
"(",
"config",
"=",
"merge_conf... | Return the merge tree of the ``initial_config`` with the ``merge_config``,
as a Python dictionary.
initial_config
The initial configuration sent as text. This argument is ignored when
``initial_path`` is set.
initial_path
Absolute or remote path from where to load the initial confi... | [
"Return",
"the",
"merge",
"tree",
"of",
"the",
"initial_config",
"with",
"the",
"merge_config",
"as",
"a",
"Python",
"dictionary",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iosconfig.py#L213-L258 | train |
saltstack/salt | salt/modules/iosconfig.py | merge_text | def merge_text(initial_config=None,
initial_path=None,
merge_config=None,
merge_path=None,
saltenv='base'):
'''
Return the merge result of the ``initial_config`` with the ``merge_config``,
as plain text.
initial_config
The initial conf... | python | def merge_text(initial_config=None,
initial_path=None,
merge_config=None,
merge_path=None,
saltenv='base'):
'''
Return the merge result of the ``initial_config`` with the ``merge_config``,
as plain text.
initial_config
The initial conf... | [
"def",
"merge_text",
"(",
"initial_config",
"=",
"None",
",",
"initial_path",
"=",
"None",
",",
"merge_config",
"=",
"None",
",",
"merge_path",
"=",
"None",
",",
"saltenv",
"=",
"'base'",
")",
":",
"candidate_tree",
"=",
"merge_tree",
"(",
"initial_config",
... | Return the merge result of the ``initial_config`` with the ``merge_config``,
as plain text.
initial_config
The initial configuration sent as text. This argument is ignored when
``initial_path`` is set.
initial_path
Absolute or remote path from where to load the initial configuratio... | [
"Return",
"the",
"merge",
"result",
"of",
"the",
"initial_config",
"with",
"the",
"merge_config",
"as",
"plain",
"text",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iosconfig.py#L261-L305 | train |
saltstack/salt | salt/modules/iosconfig.py | merge_diff | def merge_diff(initial_config=None,
initial_path=None,
merge_config=None,
merge_path=None,
saltenv='base'):
'''
Return the merge diff, as text, after merging the merge config into the
initial config.
initial_config
The initial configur... | python | def merge_diff(initial_config=None,
initial_path=None,
merge_config=None,
merge_path=None,
saltenv='base'):
'''
Return the merge diff, as text, after merging the merge config into the
initial config.
initial_config
The initial configur... | [
"def",
"merge_diff",
"(",
"initial_config",
"=",
"None",
",",
"initial_path",
"=",
"None",
",",
"merge_config",
"=",
"None",
",",
"merge_path",
"=",
"None",
",",
"saltenv",
"=",
"'base'",
")",
":",
"if",
"initial_path",
":",
"initial_config",
"=",
"__salt__"... | Return the merge diff, as text, after merging the merge config into the
initial config.
initial_config
The initial configuration sent as text. This argument is ignored when
``initial_path`` is set.
initial_path
Absolute or remote path from where to load the initial configuration
... | [
"Return",
"the",
"merge",
"diff",
"as",
"text",
"after",
"merging",
"the",
"merge",
"config",
"into",
"the",
"initial",
"config",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iosconfig.py#L308-L355 | train |
saltstack/salt | salt/modules/iosconfig.py | diff_tree | def diff_tree(candidate_config=None,
candidate_path=None,
running_config=None,
running_path=None,
saltenv='base'):
'''
Return the diff, as Python dictionary, between the candidate and the running
configuration.
candidate_config
The candida... | python | def diff_tree(candidate_config=None,
candidate_path=None,
running_config=None,
running_path=None,
saltenv='base'):
'''
Return the diff, as Python dictionary, between the candidate and the running
configuration.
candidate_config
The candida... | [
"def",
"diff_tree",
"(",
"candidate_config",
"=",
"None",
",",
"candidate_path",
"=",
"None",
",",
"running_config",
"=",
"None",
",",
"running_path",
"=",
"None",
",",
"saltenv",
"=",
"'base'",
")",
":",
"candidate_tree",
"=",
"tree",
"(",
"config",
"=",
... | Return the diff, as Python dictionary, between the candidate and the running
configuration.
candidate_config
The candidate configuration sent as text. This argument is ignored when
``candidate_path`` is set.
candidate_path
Absolute or remote path from where to load the candidate co... | [
"Return",
"the",
"diff",
"as",
"Python",
"dictionary",
"between",
"the",
"candidate",
"and",
"the",
"running",
"configuration",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iosconfig.py#L358-L404 | train |
saltstack/salt | salt/modules/iosconfig.py | diff_text | def diff_text(candidate_config=None,
candidate_path=None,
running_config=None,
running_path=None,
saltenv='base'):
'''
Return the diff, as text, between the candidate and the running config.
candidate_config
The candidate configuration sent as... | python | def diff_text(candidate_config=None,
candidate_path=None,
running_config=None,
running_path=None,
saltenv='base'):
'''
Return the diff, as text, between the candidate and the running config.
candidate_config
The candidate configuration sent as... | [
"def",
"diff_text",
"(",
"candidate_config",
"=",
"None",
",",
"candidate_path",
"=",
"None",
",",
"running_config",
"=",
"None",
",",
"running_path",
"=",
"None",
",",
"saltenv",
"=",
"'base'",
")",
":",
"candidate_text",
"=",
"clean",
"(",
"config",
"=",
... | Return the diff, as text, between the candidate and the running config.
candidate_config
The candidate configuration sent as text. This argument is ignored when
``candidate_path`` is set.
candidate_path
Absolute or remote path from where to load the candidate configuration
text... | [
"Return",
"the",
"diff",
"as",
"text",
"between",
"the",
"candidate",
"and",
"the",
"running",
"config",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iosconfig.py#L407-L452 | train |
saltstack/salt | salt/modules/pcs.py | item_show | def item_show(item, item_id=None, item_type=None, show='show', extra_args=None, cibfile=None):
'''
Show an item via pcs command
(mainly for use with the pcs state module)
item
config, property, resource, constraint etc.
item_id
id of the item
item_type
item type
show... | python | def item_show(item, item_id=None, item_type=None, show='show', extra_args=None, cibfile=None):
'''
Show an item via pcs command
(mainly for use with the pcs state module)
item
config, property, resource, constraint etc.
item_id
id of the item
item_type
item type
show... | [
"def",
"item_show",
"(",
"item",
",",
"item_id",
"=",
"None",
",",
"item_type",
"=",
"None",
",",
"show",
"=",
"'show'",
",",
"extra_args",
"=",
"None",
",",
"cibfile",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"'pcs'",
"]",
"if",
"isinstance",
"(",
... | Show an item via pcs command
(mainly for use with the pcs state module)
item
config, property, resource, constraint etc.
item_id
id of the item
item_type
item type
show
show command (probably None, default: show)
extra_args
additional options for the pcs ... | [
"Show",
"an",
"item",
"via",
"pcs",
"command",
"(",
"mainly",
"for",
"use",
"with",
"the",
"pcs",
"state",
"module",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pcs.py#L29-L77 | train |
saltstack/salt | salt/modules/pcs.py | item_create | def item_create(item, item_id, item_type, create='create', extra_args=None, cibfile=None):
'''
Create an item via pcs command
(mainly for use with the pcs state module)
item
config, property, resource, constraint etc.
item_id
id of the item
item_type
item type
create... | python | def item_create(item, item_id, item_type, create='create', extra_args=None, cibfile=None):
'''
Create an item via pcs command
(mainly for use with the pcs state module)
item
config, property, resource, constraint etc.
item_id
id of the item
item_type
item type
create... | [
"def",
"item_create",
"(",
"item",
",",
"item_id",
",",
"item_type",
",",
"create",
"=",
"'create'",
",",
"extra_args",
"=",
"None",
",",
"cibfile",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"'pcs'",
"]",
"if",
"isinstance",
"(",
"cibfile",
",",
"six",
... | Create an item via pcs command
(mainly for use with the pcs state module)
item
config, property, resource, constraint etc.
item_id
id of the item
item_type
item type
create
create command (create or set f.e., default: create)
extra_args
additional options... | [
"Create",
"an",
"item",
"via",
"pcs",
"command",
"(",
"mainly",
"for",
"use",
"with",
"the",
"pcs",
"state",
"module",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pcs.py#L80-L130 | train |
saltstack/salt | salt/modules/pcs.py | auth | def auth(nodes, pcsuser='hacluster', pcspasswd='hacluster', extra_args=None):
'''
Authorize nodes to the cluster
nodes
a list of nodes which should be authorized to the cluster
pcsuser
user for communitcation with PCS (default: hacluster)
pcspasswd
password for pcsuser (defa... | python | def auth(nodes, pcsuser='hacluster', pcspasswd='hacluster', extra_args=None):
'''
Authorize nodes to the cluster
nodes
a list of nodes which should be authorized to the cluster
pcsuser
user for communitcation with PCS (default: hacluster)
pcspasswd
password for pcsuser (defa... | [
"def",
"auth",
"(",
"nodes",
",",
"pcsuser",
"=",
"'hacluster'",
",",
"pcspasswd",
"=",
"'hacluster'",
",",
"extra_args",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"'pcs'",
",",
"'cluster'",
",",
"'auth'",
"]",
"if",
"pcsuser",
":",
"cmd",
"+=",
"[",
"... | Authorize nodes to the cluster
nodes
a list of nodes which should be authorized to the cluster
pcsuser
user for communitcation with PCS (default: hacluster)
pcspasswd
password for pcsuser (default: hacluster)
extra_args
list of extra option for the \'pcs cluster auth\' c... | [
"Authorize",
"nodes",
"to",
"the",
"cluster"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pcs.py#L133-L164 | train |
saltstack/salt | salt/modules/pcs.py | is_auth | def is_auth(nodes):
'''
Check if nodes are already authorized
nodes
a list of nodes to be checked for authorization to the cluster
CLI Example:
.. code-block:: bash
salt '*' pcs.is_auth nodes='[node1.example.org node2.example.org]'
'''
cmd = ['pcs', 'cluster', 'auth']
... | python | def is_auth(nodes):
'''
Check if nodes are already authorized
nodes
a list of nodes to be checked for authorization to the cluster
CLI Example:
.. code-block:: bash
salt '*' pcs.is_auth nodes='[node1.example.org node2.example.org]'
'''
cmd = ['pcs', 'cluster', 'auth']
... | [
"def",
"is_auth",
"(",
"nodes",
")",
":",
"cmd",
"=",
"[",
"'pcs'",
",",
"'cluster'",
",",
"'auth'",
"]",
"cmd",
"+=",
"nodes",
"return",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
",",
"stdin",
"=",
"'\\n\\n'",
",",
"output_loglevel",
"=",
"'t... | Check if nodes are already authorized
nodes
a list of nodes to be checked for authorization to the cluster
CLI Example:
.. code-block:: bash
salt '*' pcs.is_auth nodes='[node1.example.org node2.example.org]' | [
"Check",
"if",
"nodes",
"are",
"already",
"authorized"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pcs.py#L167-L183 | train |
saltstack/salt | salt/modules/pcs.py | cluster_setup | def cluster_setup(nodes, pcsclustername='pcscluster', extra_args=None):
'''
Setup pacemaker cluster via pcs command
nodes
a list of nodes which should be set up
pcsclustername
Name of the Pacemaker cluster (default: pcscluster)
extra_args
list of extra option for the \'pcs c... | python | def cluster_setup(nodes, pcsclustername='pcscluster', extra_args=None):
'''
Setup pacemaker cluster via pcs command
nodes
a list of nodes which should be set up
pcsclustername
Name of the Pacemaker cluster (default: pcscluster)
extra_args
list of extra option for the \'pcs c... | [
"def",
"cluster_setup",
"(",
"nodes",
",",
"pcsclustername",
"=",
"'pcscluster'",
",",
"extra_args",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"'pcs'",
",",
"'cluster'",
",",
"'setup'",
"]",
"cmd",
"+=",
"[",
"'--name'",
",",
"pcsclustername",
"]",
"cmd",
... | Setup pacemaker cluster via pcs command
nodes
a list of nodes which should be set up
pcsclustername
Name of the Pacemaker cluster (default: pcscluster)
extra_args
list of extra option for the \'pcs cluster setup\' command
CLI Example:
.. code-block:: bash
salt '*'... | [
"Setup",
"pacemaker",
"cluster",
"via",
"pcs",
"command"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pcs.py#L186-L211 | train |
saltstack/salt | salt/modules/pcs.py | cluster_node_add | def cluster_node_add(node, extra_args=None):
'''
Add a node to the pacemaker cluster via pcs command
node
node that should be added
extra_args
list of extra option for the \'pcs cluster node add\' command
CLI Example:
.. code-block:: bash
salt '*' pcs.cluster_node_add... | python | def cluster_node_add(node, extra_args=None):
'''
Add a node to the pacemaker cluster via pcs command
node
node that should be added
extra_args
list of extra option for the \'pcs cluster node add\' command
CLI Example:
.. code-block:: bash
salt '*' pcs.cluster_node_add... | [
"def",
"cluster_node_add",
"(",
"node",
",",
"extra_args",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"'pcs'",
",",
"'cluster'",
",",
"'node'",
",",
"'add'",
"]",
"cmd",
"+=",
"[",
"node",
"]",
"if",
"isinstance",
"(",
"extra_args",
",",
"(",
"list",
",... | Add a node to the pacemaker cluster via pcs command
node
node that should be added
extra_args
list of extra option for the \'pcs cluster node add\' command
CLI Example:
.. code-block:: bash
salt '*' pcs.cluster_node_add node=node2.example.org | [
"Add",
"a",
"node",
"to",
"the",
"pacemaker",
"cluster",
"via",
"pcs",
"command"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pcs.py#L214-L235 | train |
saltstack/salt | salt/modules/pcs.py | cib_create | def cib_create(cibfile, scope='configuration', extra_args=None):
'''
Create a CIB-file from the current CIB of the cluster
cibfile
name/path of the file containing the CIB
scope
specific section of the CIB (default: configuration)
extra_args
additional options for creating t... | python | def cib_create(cibfile, scope='configuration', extra_args=None):
'''
Create a CIB-file from the current CIB of the cluster
cibfile
name/path of the file containing the CIB
scope
specific section of the CIB (default: configuration)
extra_args
additional options for creating t... | [
"def",
"cib_create",
"(",
"cibfile",
",",
"scope",
"=",
"'configuration'",
",",
"extra_args",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"'pcs'",
",",
"'cluster'",
",",
"'cib'",
",",
"cibfile",
"]",
"if",
"isinstance",
"(",
"scope",
",",
"six",
".",
"stri... | Create a CIB-file from the current CIB of the cluster
cibfile
name/path of the file containing the CIB
scope
specific section of the CIB (default: configuration)
extra_args
additional options for creating the CIB-file
CLI Example:
.. code-block:: bash
salt '*' pcs... | [
"Create",
"a",
"CIB",
"-",
"file",
"from",
"the",
"current",
"CIB",
"of",
"the",
"cluster"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pcs.py#L238-L261 | train |
saltstack/salt | salt/modules/pcs.py | prop_show | def prop_show(prop, extra_args=None, cibfile=None):
'''
Show the value of a cluster property
prop
name of the property
extra_args
additional options for the pcs property command
cibfile
use cibfile instead of the live CIB
CLI Example:
.. code-block:: bash
... | python | def prop_show(prop, extra_args=None, cibfile=None):
'''
Show the value of a cluster property
prop
name of the property
extra_args
additional options for the pcs property command
cibfile
use cibfile instead of the live CIB
CLI Example:
.. code-block:: bash
... | [
"def",
"prop_show",
"(",
"prop",
",",
"extra_args",
"=",
"None",
",",
"cibfile",
"=",
"None",
")",
":",
"return",
"item_show",
"(",
"item",
"=",
"'property'",
",",
"item_id",
"=",
"prop",
",",
"extra_args",
"=",
"extra_args",
",",
"cibfile",
"=",
"cibfil... | Show the value of a cluster property
prop
name of the property
extra_args
additional options for the pcs property command
cibfile
use cibfile instead of the live CIB
CLI Example:
.. code-block:: bash
salt '*' pcs.prop_show cibfile='/tmp/2_node_cluster.cib' prop='n... | [
"Show",
"the",
"value",
"of",
"a",
"cluster",
"property"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pcs.py#L306-L323 | train |
saltstack/salt | salt/modules/pcs.py | prop_set | def prop_set(prop, value, extra_args=None, cibfile=None):
'''
Set the value of a cluster property
prop
name of the property
value
value of the property prop
extra_args
additional options for the pcs property command
cibfile
use cibfile instead of the live CIB
... | python | def prop_set(prop, value, extra_args=None, cibfile=None):
'''
Set the value of a cluster property
prop
name of the property
value
value of the property prop
extra_args
additional options for the pcs property command
cibfile
use cibfile instead of the live CIB
... | [
"def",
"prop_set",
"(",
"prop",
",",
"value",
",",
"extra_args",
"=",
"None",
",",
"cibfile",
"=",
"None",
")",
":",
"return",
"item_create",
"(",
"item",
"=",
"'property'",
",",
"item_id",
"=",
"'{0}={1}'",
".",
"format",
"(",
"prop",
",",
"value",
")... | Set the value of a cluster property
prop
name of the property
value
value of the property prop
extra_args
additional options for the pcs property command
cibfile
use cibfile instead of the live CIB
CLI Example:
.. code-block:: bash
salt '*' pcs.prop_se... | [
"Set",
"the",
"value",
"of",
"a",
"cluster",
"property"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pcs.py#L326-L350 | train |
saltstack/salt | salt/modules/pcs.py | stonith_show | def stonith_show(stonith_id, extra_args=None, cibfile=None):
'''
Show the value of a cluster stonith
stonith_id
name for the stonith resource
extra_args
additional options for the pcs stonith command
cibfile
use cibfile instead of the live CIB
CLI Example:
.. code-... | python | def stonith_show(stonith_id, extra_args=None, cibfile=None):
'''
Show the value of a cluster stonith
stonith_id
name for the stonith resource
extra_args
additional options for the pcs stonith command
cibfile
use cibfile instead of the live CIB
CLI Example:
.. code-... | [
"def",
"stonith_show",
"(",
"stonith_id",
",",
"extra_args",
"=",
"None",
",",
"cibfile",
"=",
"None",
")",
":",
"return",
"item_show",
"(",
"item",
"=",
"'stonith'",
",",
"item_id",
"=",
"stonith_id",
",",
"extra_args",
"=",
"extra_args",
",",
"cibfile",
... | Show the value of a cluster stonith
stonith_id
name for the stonith resource
extra_args
additional options for the pcs stonith command
cibfile
use cibfile instead of the live CIB
CLI Example:
.. code-block:: bash
salt '*' pcs.stonith_show stonith_id='eps_fence' ci... | [
"Show",
"the",
"value",
"of",
"a",
"cluster",
"stonith"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pcs.py#L353-L370 | train |
saltstack/salt | salt/modules/pcs.py | stonith_create | def stonith_create(stonith_id, stonith_device_type, stonith_device_options=None, cibfile=None):
'''
Create a stonith resource via pcs command
stonith_id
name for the stonith resource
stonith_device_type
name of the stonith agent fence_eps, fence_xvm f.e.
stonith_device_options
... | python | def stonith_create(stonith_id, stonith_device_type, stonith_device_options=None, cibfile=None):
'''
Create a stonith resource via pcs command
stonith_id
name for the stonith resource
stonith_device_type
name of the stonith agent fence_eps, fence_xvm f.e.
stonith_device_options
... | [
"def",
"stonith_create",
"(",
"stonith_id",
",",
"stonith_device_type",
",",
"stonith_device_options",
"=",
"None",
",",
"cibfile",
"=",
"None",
")",
":",
"return",
"item_create",
"(",
"item",
"=",
"'stonith'",
",",
"item_id",
"=",
"stonith_id",
",",
"item_type"... | Create a stonith resource via pcs command
stonith_id
name for the stonith resource
stonith_device_type
name of the stonith agent fence_eps, fence_xvm f.e.
stonith_device_options
additional options for creating the stonith resource
cibfile
use cibfile instead of the live ... | [
"Create",
"a",
"stonith",
"resource",
"via",
"pcs",
"command"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pcs.py#L373-L397 | train |
saltstack/salt | salt/modules/pcs.py | resource_show | def resource_show(resource_id, extra_args=None, cibfile=None):
'''
Show a resource via pcs command
resource_id
name of the resource
extra_args
additional options for the pcs command
cibfile
use cibfile instead of the live CIB
CLI Example:
.. code-block:: bash
... | python | def resource_show(resource_id, extra_args=None, cibfile=None):
'''
Show a resource via pcs command
resource_id
name of the resource
extra_args
additional options for the pcs command
cibfile
use cibfile instead of the live CIB
CLI Example:
.. code-block:: bash
... | [
"def",
"resource_show",
"(",
"resource_id",
",",
"extra_args",
"=",
"None",
",",
"cibfile",
"=",
"None",
")",
":",
"return",
"item_show",
"(",
"item",
"=",
"'resource'",
",",
"item_id",
"=",
"resource_id",
",",
"extra_args",
"=",
"extra_args",
",",
"cibfile"... | Show a resource via pcs command
resource_id
name of the resource
extra_args
additional options for the pcs command
cibfile
use cibfile instead of the live CIB
CLI Example:
.. code-block:: bash
salt '*' pcs.resource_show resource_id='galera' cibfile='/tmp/cib_for_g... | [
"Show",
"a",
"resource",
"via",
"pcs",
"command"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pcs.py#L400-L417 | train |
saltstack/salt | salt/modules/pcs.py | resource_create | def resource_create(resource_id, resource_type, resource_options=None, cibfile=None):
'''
Create a resource via pcs command
resource_id
name for the resource
resource_type
resource type (f.e. ocf:heartbeat:IPaddr2 or VirtualIP)
resource_options
additional options for creatin... | python | def resource_create(resource_id, resource_type, resource_options=None, cibfile=None):
'''
Create a resource via pcs command
resource_id
name for the resource
resource_type
resource type (f.e. ocf:heartbeat:IPaddr2 or VirtualIP)
resource_options
additional options for creatin... | [
"def",
"resource_create",
"(",
"resource_id",
",",
"resource_type",
",",
"resource_options",
"=",
"None",
",",
"cibfile",
"=",
"None",
")",
":",
"return",
"item_create",
"(",
"item",
"=",
"'resource'",
",",
"item_id",
"=",
"resource_id",
",",
"item_type",
"=",... | Create a resource via pcs command
resource_id
name for the resource
resource_type
resource type (f.e. ocf:heartbeat:IPaddr2 or VirtualIP)
resource_options
additional options for creating the resource
cibfile
use cibfile instead of the live CIB for manipulation
CLI E... | [
"Create",
"a",
"resource",
"via",
"pcs",
"command"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pcs.py#L420-L443 | train |
saltstack/salt | salt/cli/support/console.py | wrap | def wrap(txt, width=80, ident=0):
'''
Wrap text to the required dimensions and clean it up, prepare for display.
:param txt:
:param width:
:return:
'''
ident = ' ' * ident
txt = (txt or '').replace(os.linesep, ' ').strip()
wrapper = textwrap.TextWrapper()
wrapper.fix_sentence_e... | python | def wrap(txt, width=80, ident=0):
'''
Wrap text to the required dimensions and clean it up, prepare for display.
:param txt:
:param width:
:return:
'''
ident = ' ' * ident
txt = (txt or '').replace(os.linesep, ' ').strip()
wrapper = textwrap.TextWrapper()
wrapper.fix_sentence_e... | [
"def",
"wrap",
"(",
"txt",
",",
"width",
"=",
"80",
",",
"ident",
"=",
"0",
")",
":",
"ident",
"=",
"' '",
"*",
"ident",
"txt",
"=",
"(",
"txt",
"or",
"''",
")",
".",
"replace",
"(",
"os",
".",
"linesep",
",",
"' '",
")",
".",
"strip",
"(",
... | Wrap text to the required dimensions and clean it up, prepare for display.
:param txt:
:param width:
:return: | [
"Wrap",
"text",
"to",
"the",
"required",
"dimensions",
"and",
"clean",
"it",
"up",
"prepare",
"for",
"display",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/console.py#L150-L165 | train |
saltstack/salt | salt/cli/support/console.py | IndentOutput.put | def put(self, message, indent=0):
'''
Print message with an indent.
:param message:
:param indent:
:return:
'''
color = self._colors_conf.get(indent + indent % 2, self._colors_conf.get(0, self._default_color))
for chunk in [' ' * indent, self._colors[col... | python | def put(self, message, indent=0):
'''
Print message with an indent.
:param message:
:param indent:
:return:
'''
color = self._colors_conf.get(indent + indent % 2, self._colors_conf.get(0, self._default_color))
for chunk in [' ' * indent, self._colors[col... | [
"def",
"put",
"(",
"self",
",",
"message",
",",
"indent",
"=",
"0",
")",
":",
"color",
"=",
"self",
".",
"_colors_conf",
".",
"get",
"(",
"indent",
"+",
"indent",
"%",
"2",
",",
"self",
".",
"_colors_conf",
".",
"get",
"(",
"0",
",",
"self",
".",... | Print message with an indent.
:param message:
:param indent:
:return: | [
"Print",
"message",
"with",
"an",
"indent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/console.py#L30-L43 | train |
saltstack/salt | salt/cli/support/console.py | MessagesOutput.msg | def msg(self, message, title=None, title_color=None, color='BLUE', ident=0):
'''
Hint message.
:param message:
:param title:
:param title_color:
:param color:
:param ident:
:return:
'''
if title and not title_color:
title_color... | python | def msg(self, message, title=None, title_color=None, color='BLUE', ident=0):
'''
Hint message.
:param message:
:param title:
:param title_color:
:param color:
:param ident:
:return:
'''
if title and not title_color:
title_color... | [
"def",
"msg",
"(",
"self",
",",
"message",
",",
"title",
"=",
"None",
",",
"title_color",
"=",
"None",
",",
"color",
"=",
"'BLUE'",
",",
"ident",
"=",
"0",
")",
":",
"if",
"title",
"and",
"not",
"title_color",
":",
"title_color",
"=",
"color",
"if",
... | Hint message.
:param message:
:param title:
:param title_color:
:param color:
:param ident:
:return: | [
"Hint",
"message",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/console.py#L50-L66 | train |
saltstack/salt | salt/cli/support/console.py | MessagesOutput.highlight | def highlight(self, message, *values, **colors):
'''
Highlighter works the way that message parameter is a template,
the "values" is a list of arguments going one after another as values there.
And so the "colors" should designate either highlight color or alternate for each.
Ex... | python | def highlight(self, message, *values, **colors):
'''
Highlighter works the way that message parameter is a template,
the "values" is a list of arguments going one after another as values there.
And so the "colors" should designate either highlight color or alternate for each.
Ex... | [
"def",
"highlight",
"(",
"self",
",",
"message",
",",
"*",
"values",
",",
"*",
"*",
"colors",
")",
":",
"m_color",
"=",
"colors",
".",
"get",
"(",
"'_main'",
",",
"self",
".",
"_default_color",
")",
"h_color",
"=",
"colors",
".",
"get",
"(",
"'_highl... | Highlighter works the way that message parameter is a template,
the "values" is a list of arguments going one after another as values there.
And so the "colors" should designate either highlight color or alternate for each.
Example:
highlight('Hello {}, there! It is {}.', 'user', 'd... | [
"Highlighter",
"works",
"the",
"way",
"that",
"message",
"parameter",
"is",
"a",
"template",
"the",
"values",
"is",
"a",
"list",
"of",
"arguments",
"going",
"one",
"after",
"another",
"as",
"values",
"there",
".",
"And",
"so",
"the",
"colors",
"should",
"d... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/console.py#L110-L147 | train |
saltstack/salt | salt/modules/nspawn.py | _ensure_exists | def _ensure_exists(wrapped):
'''
Decorator to ensure that the named container exists.
'''
@functools.wraps(wrapped)
def check_exists(name, *args, **kwargs):
if not exists(name):
raise CommandExecutionError(
'Container \'{0}\' does not exist'.format(name)
... | python | def _ensure_exists(wrapped):
'''
Decorator to ensure that the named container exists.
'''
@functools.wraps(wrapped)
def check_exists(name, *args, **kwargs):
if not exists(name):
raise CommandExecutionError(
'Container \'{0}\' does not exist'.format(name)
... | [
"def",
"_ensure_exists",
"(",
"wrapped",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"wrapped",
")",
"def",
"check_exists",
"(",
"name",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"exists",
"(",
"name",
")",
":",
"raise",
... | Decorator to ensure that the named container exists. | [
"Decorator",
"to",
"ensure",
"that",
"the",
"named",
"container",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L79-L90 | train |
saltstack/salt | salt/modules/nspawn.py | _root | def _root(name='', all_roots=False):
'''
Return the container root directory. Starting with systemd 219, new
images go into /var/lib/machines.
'''
if _sd_version() >= 219:
if all_roots:
return [os.path.join(x, name)
for x in ('/var/lib/machines', '/var/lib/con... | python | def _root(name='', all_roots=False):
'''
Return the container root directory. Starting with systemd 219, new
images go into /var/lib/machines.
'''
if _sd_version() >= 219:
if all_roots:
return [os.path.join(x, name)
for x in ('/var/lib/machines', '/var/lib/con... | [
"def",
"_root",
"(",
"name",
"=",
"''",
",",
"all_roots",
"=",
"False",
")",
":",
"if",
"_sd_version",
"(",
")",
">=",
"219",
":",
"if",
"all_roots",
":",
"return",
"[",
"os",
".",
"path",
".",
"join",
"(",
"x",
",",
"name",
")",
"for",
"x",
"i... | Return the container root directory. Starting with systemd 219, new
images go into /var/lib/machines. | [
"Return",
"the",
"container",
"root",
"directory",
".",
"Starting",
"with",
"systemd",
"219",
"new",
"images",
"go",
"into",
"/",
"var",
"/",
"lib",
"/",
"machines",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L93-L109 | train |
saltstack/salt | salt/modules/nspawn.py | _make_container_root | def _make_container_root(name):
'''
Make the container root directory
'''
path = _root(name)
if os.path.exists(path):
__context__['retcode'] = salt.defaults.exitcodes.SALT_BUILD_FAIL
raise CommandExecutionError(
'Container {0} already exists'.format(name)
)
el... | python | def _make_container_root(name):
'''
Make the container root directory
'''
path = _root(name)
if os.path.exists(path):
__context__['retcode'] = salt.defaults.exitcodes.SALT_BUILD_FAIL
raise CommandExecutionError(
'Container {0} already exists'.format(name)
)
el... | [
"def",
"_make_container_root",
"(",
"name",
")",
":",
"path",
"=",
"_root",
"(",
"name",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"__context__",
"[",
"'retcode'",
"]",
"=",
"salt",
".",
"defaults",
".",
"exitcodes",
".",
"S... | Make the container root directory | [
"Make",
"the",
"container",
"root",
"directory"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L112-L130 | train |
saltstack/salt | salt/modules/nspawn.py | _bootstrap_arch | def _bootstrap_arch(name, **kwargs):
'''
Bootstrap an Arch Linux container
'''
if not salt.utils.path.which('pacstrap'):
raise CommandExecutionError(
'pacstrap not found, is the arch-install-scripts package '
'installed?'
)
dst = _make_container_root(name)
... | python | def _bootstrap_arch(name, **kwargs):
'''
Bootstrap an Arch Linux container
'''
if not salt.utils.path.which('pacstrap'):
raise CommandExecutionError(
'pacstrap not found, is the arch-install-scripts package '
'installed?'
)
dst = _make_container_root(name)
... | [
"def",
"_bootstrap_arch",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"'pacstrap'",
")",
":",
"raise",
"CommandExecutionError",
"(",
"'pacstrap not found, is the arch-install-scripts package '"... | Bootstrap an Arch Linux container | [
"Bootstrap",
"an",
"Arch",
"Linux",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L147-L161 | train |
saltstack/salt | salt/modules/nspawn.py | _bootstrap_debian | def _bootstrap_debian(name, **kwargs):
'''
Bootstrap a Debian Linux container
'''
version = kwargs.get('version', False)
if not version:
if __grains__['os'].lower() == 'debian':
version = __grains__['osrelease']
else:
version = 'stable'
release_blacklist ... | python | def _bootstrap_debian(name, **kwargs):
'''
Bootstrap a Debian Linux container
'''
version = kwargs.get('version', False)
if not version:
if __grains__['os'].lower() == 'debian':
version = __grains__['osrelease']
else:
version = 'stable'
release_blacklist ... | [
"def",
"_bootstrap_debian",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"version",
"=",
"kwargs",
".",
"get",
"(",
"'version'",
",",
"False",
")",
"if",
"not",
"version",
":",
"if",
"__grains__",
"[",
"'os'",
"]",
".",
"lower",
"(",
")",
"==",
... | Bootstrap a Debian Linux container | [
"Bootstrap",
"a",
"Debian",
"Linux",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L164-L187 | train |
saltstack/salt | salt/modules/nspawn.py | _bootstrap_fedora | def _bootstrap_fedora(name, **kwargs):
'''
Bootstrap a Fedora container
'''
dst = _make_container_root(name)
if not kwargs.get('version', False):
if __grains__['os'].lower() == 'fedora':
version = __grains__['osrelease']
else:
version = '21'
else:
... | python | def _bootstrap_fedora(name, **kwargs):
'''
Bootstrap a Fedora container
'''
dst = _make_container_root(name)
if not kwargs.get('version', False):
if __grains__['os'].lower() == 'fedora':
version = __grains__['osrelease']
else:
version = '21'
else:
... | [
"def",
"_bootstrap_fedora",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"dst",
"=",
"_make_container_root",
"(",
"name",
")",
"if",
"not",
"kwargs",
".",
"get",
"(",
"'version'",
",",
"False",
")",
":",
"if",
"__grains__",
"[",
"'os'",
"]",
".",
... | Bootstrap a Fedora container | [
"Bootstrap",
"a",
"Fedora",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L190-L208 | train |
saltstack/salt | salt/modules/nspawn.py | _ensure_systemd | def _ensure_systemd(version):
'''
Raises an exception if the systemd version is not greater than the
passed version.
'''
try:
version = int(version)
except ValueError:
raise CommandExecutionError('Invalid version \'{0}\''.format(version))
try:
installed = _sd_version... | python | def _ensure_systemd(version):
'''
Raises an exception if the systemd version is not greater than the
passed version.
'''
try:
version = int(version)
except ValueError:
raise CommandExecutionError('Invalid version \'{0}\''.format(version))
try:
installed = _sd_version... | [
"def",
"_ensure_systemd",
"(",
"version",
")",
":",
"try",
":",
"version",
"=",
"int",
"(",
"version",
")",
"except",
"ValueError",
":",
"raise",
"CommandExecutionError",
"(",
"'Invalid version \\'{0}\\''",
".",
"format",
"(",
"version",
")",
")",
"try",
":",
... | Raises an exception if the systemd version is not greater than the
passed version. | [
"Raises",
"an",
"exception",
"if",
"the",
"systemd",
"version",
"is",
"not",
"greater",
"than",
"the",
"passed",
"version",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L248-L268 | train |
saltstack/salt | salt/modules/nspawn.py | _machinectl | def _machinectl(cmd,
output_loglevel='debug',
ignore_retcode=False,
use_vt=False):
'''
Helper function to run machinectl
'''
prefix = 'machinectl --no-legend --no-pager'
return __salt__['cmd.run_all']('{0} {1}'.format(prefix, cmd),
... | python | def _machinectl(cmd,
output_loglevel='debug',
ignore_retcode=False,
use_vt=False):
'''
Helper function to run machinectl
'''
prefix = 'machinectl --no-legend --no-pager'
return __salt__['cmd.run_all']('{0} {1}'.format(prefix, cmd),
... | [
"def",
"_machinectl",
"(",
"cmd",
",",
"output_loglevel",
"=",
"'debug'",
",",
"ignore_retcode",
"=",
"False",
",",
"use_vt",
"=",
"False",
")",
":",
"prefix",
"=",
"'machinectl --no-legend --no-pager'",
"return",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"'{0... | Helper function to run machinectl | [
"Helper",
"function",
"to",
"run",
"machinectl"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L271-L282 | train |
saltstack/salt | salt/modules/nspawn.py | _run | def _run(name,
cmd,
output=None,
no_start=False,
stdin=None,
python_shell=True,
preserve_state=False,
output_loglevel='debug',
ignore_retcode=False,
use_vt=False,
keep_env=None):
'''
Common logic for nspawn.run functions
... | python | def _run(name,
cmd,
output=None,
no_start=False,
stdin=None,
python_shell=True,
preserve_state=False,
output_loglevel='debug',
ignore_retcode=False,
use_vt=False,
keep_env=None):
'''
Common logic for nspawn.run functions
... | [
"def",
"_run",
"(",
"name",
",",
"cmd",
",",
"output",
"=",
"None",
",",
"no_start",
"=",
"False",
",",
"stdin",
"=",
"None",
",",
"python_shell",
"=",
"True",
",",
"preserve_state",
"=",
"False",
",",
"output_loglevel",
"=",
"'debug'",
",",
"ignore_retc... | Common logic for nspawn.run functions | [
"Common",
"logic",
"for",
"nspawn",
".",
"run",
"functions"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L286-L329 | train |
saltstack/salt | salt/modules/nspawn.py | pid | def pid(name):
'''
Returns the PID of a container
name
Container name
CLI Example:
.. code-block:: bash
salt myminion nspawn.pid arch1
'''
try:
return int(info(name).get('PID'))
except (TypeError, ValueError) as exc:
raise CommandExecutionError(
... | python | def pid(name):
'''
Returns the PID of a container
name
Container name
CLI Example:
.. code-block:: bash
salt myminion nspawn.pid arch1
'''
try:
return int(info(name).get('PID'))
except (TypeError, ValueError) as exc:
raise CommandExecutionError(
... | [
"def",
"pid",
"(",
"name",
")",
":",
"try",
":",
"return",
"int",
"(",
"info",
"(",
"name",
")",
".",
"get",
"(",
"'PID'",
")",
")",
"except",
"(",
"TypeError",
",",
"ValueError",
")",
"as",
"exc",
":",
"raise",
"CommandExecutionError",
"(",
"'Unable... | Returns the PID of a container
name
Container name
CLI Example:
.. code-block:: bash
salt myminion nspawn.pid arch1 | [
"Returns",
"the",
"PID",
"of",
"a",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L333-L351 | train |
saltstack/salt | salt/modules/nspawn.py | bootstrap_container | def bootstrap_container(name, dist=None, version=None):
'''
Bootstrap a container from package servers, if dist is None the os the
minion is running as will be created, otherwise the needed bootstrapping
tools will need to be available on the host.
CLI Example:
.. code-block:: bash
sa... | python | def bootstrap_container(name, dist=None, version=None):
'''
Bootstrap a container from package servers, if dist is None the os the
minion is running as will be created, otherwise the needed bootstrapping
tools will need to be available on the host.
CLI Example:
.. code-block:: bash
sa... | [
"def",
"bootstrap_container",
"(",
"name",
",",
"dist",
"=",
"None",
",",
"version",
"=",
"None",
")",
":",
"if",
"not",
"dist",
":",
"dist",
"=",
"__grains__",
"[",
"'os'",
"]",
".",
"lower",
"(",
")",
"log",
".",
"debug",
"(",
"'nspawn.bootstrap: no ... | Bootstrap a container from package servers, if dist is None the os the
minion is running as will be created, otherwise the needed bootstrapping
tools will need to be available on the host.
CLI Example:
.. code-block:: bash
salt myminion nspawn.bootstrap_container <name> | [
"Bootstrap",
"a",
"container",
"from",
"package",
"servers",
"if",
"dist",
"is",
"None",
"the",
"os",
"the",
"minion",
"is",
"running",
"as",
"will",
"be",
"created",
"otherwise",
"the",
"needed",
"bootstrapping",
"tools",
"will",
"need",
"to",
"be",
"availa... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L673-L691 | train |
saltstack/salt | salt/modules/nspawn.py | bootstrap_salt | def bootstrap_salt(name,
config=None,
approve_key=True,
install=True,
pub_key=None,
priv_key=None,
bootstrap_url=None,
force_install=False,
unconditional_install=False,... | python | def bootstrap_salt(name,
config=None,
approve_key=True,
install=True,
pub_key=None,
priv_key=None,
bootstrap_url=None,
force_install=False,
unconditional_install=False,... | [
"def",
"bootstrap_salt",
"(",
"name",
",",
"config",
"=",
"None",
",",
"approve_key",
"=",
"True",
",",
"install",
"=",
"True",
",",
"pub_key",
"=",
"None",
",",
"priv_key",
"=",
"None",
",",
"bootstrap_url",
"=",
"None",
",",
"force_install",
"=",
"Fals... | Bootstrap a container from package servers, if dist is None the os the
minion is running as will be created, otherwise the needed bootstrapping
tools will need to be available on the host.
CLI Example::
salt '*' nspawn.bootstrap_salt arch1 | [
"Bootstrap",
"a",
"container",
"from",
"package",
"servers",
"if",
"dist",
"is",
"None",
"the",
"os",
"the",
"minion",
"is",
"running",
"as",
"will",
"be",
"created",
"otherwise",
"the",
"needed",
"bootstrapping",
"tools",
"will",
"need",
"to",
"be",
"availa... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L712-L831 | train |
saltstack/salt | salt/modules/nspawn.py | list_all | def list_all():
'''
Lists all nspawn containers
CLI Example:
.. code-block:: bash
salt myminion nspawn.list_all
'''
ret = []
if _sd_version() >= 219:
for line in _machinectl('list-images')['stdout'].splitlines():
try:
ret.append(line.split()[0])... | python | def list_all():
'''
Lists all nspawn containers
CLI Example:
.. code-block:: bash
salt myminion nspawn.list_all
'''
ret = []
if _sd_version() >= 219:
for line in _machinectl('list-images')['stdout'].splitlines():
try:
ret.append(line.split()[0])... | [
"def",
"list_all",
"(",
")",
":",
"ret",
"=",
"[",
"]",
"if",
"_sd_version",
"(",
")",
">=",
"219",
":",
"for",
"line",
"in",
"_machinectl",
"(",
"'list-images'",
")",
"[",
"'stdout'",
"]",
".",
"splitlines",
"(",
")",
":",
"try",
":",
"ret",
".",
... | Lists all nspawn containers
CLI Example:
.. code-block:: bash
salt myminion nspawn.list_all | [
"Lists",
"all",
"nspawn",
"containers"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L834-L859 | train |
saltstack/salt | salt/modules/nspawn.py | list_running | def list_running():
'''
Lists running nspawn containers
.. note::
``nspawn.list`` also works to list running containers
CLI Example:
.. code-block:: bash
salt myminion nspawn.list_running
salt myminion nspawn.list
'''
ret = []
for line in _machinectl('list')[... | python | def list_running():
'''
Lists running nspawn containers
.. note::
``nspawn.list`` also works to list running containers
CLI Example:
.. code-block:: bash
salt myminion nspawn.list_running
salt myminion nspawn.list
'''
ret = []
for line in _machinectl('list')[... | [
"def",
"list_running",
"(",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"line",
"in",
"_machinectl",
"(",
"'list'",
")",
"[",
"'stdout'",
"]",
".",
"splitlines",
"(",
")",
":",
"try",
":",
"ret",
".",
"append",
"(",
"line",
".",
"split",
"(",
")",
"["... | Lists running nspawn containers
.. note::
``nspawn.list`` also works to list running containers
CLI Example:
.. code-block:: bash
salt myminion nspawn.list_running
salt myminion nspawn.list | [
"Lists",
"running",
"nspawn",
"containers"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L862-L883 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.