partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | hostinterface_update | .. versionadded:: 2016.3.0
Update host interface
.. note::
This function accepts all standard hostinterface: keyword argument
names differ depending on your zabbix version, see here__.
.. __: https://www.zabbix.com/documentation/2.4/manual/api/reference/hostinterface/object#host_inter... | salt/modules/zabbix.py | def hostinterface_update(interfaceid, **kwargs):
'''
.. versionadded:: 2016.3.0
Update host interface
.. note::
This function accepts all standard hostinterface: keyword argument
names differ depending on your zabbix version, see here__.
.. __: https://www.zabbix.com/documenta... | def hostinterface_update(interfaceid, **kwargs):
'''
.. versionadded:: 2016.3.0
Update host interface
.. note::
This function accepts all standard hostinterface: keyword argument
names differ depending on your zabbix version, see here__.
.. __: https://www.zabbix.com/documenta... | [
"..",
"versionadded",
"::",
"2016",
".",
"3",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zabbix.py#L1852-L1891 | [
"def",
"hostinterface_update",
"(",
"interfaceid",
",",
"*",
"*",
"kwargs",
")",
":",
"conn_args",
"=",
"_login",
"(",
"*",
"*",
"kwargs",
")",
"ret",
"=",
"{",
"}",
"try",
":",
"if",
"conn_args",
":",
"method",
"=",
"'hostinterface.update'",
"params",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | usermacro_get | Retrieve user macros according to the given parameters.
Args:
macro: name of the usermacro
hostids: Return macros for the given hostids
templateids: Return macros for the given templateids
hostmacroids: Return macros with the given hostmacroids
globalmac... | salt/modules/zabbix.py | def usermacro_get(macro=None, hostids=None, templateids=None, hostmacroids=None,
globalmacroids=None, globalmacro=False, **kwargs):
'''
Retrieve user macros according to the given parameters.
Args:
macro: name of the usermacro
hostids: Return macros for the... | def usermacro_get(macro=None, hostids=None, templateids=None, hostmacroids=None,
globalmacroids=None, globalmacro=False, **kwargs):
'''
Retrieve user macros according to the given parameters.
Args:
macro: name of the usermacro
hostids: Return macros for the... | [
"Retrieve",
"user",
"macros",
"according",
"to",
"the",
"given",
"parameters",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zabbix.py#L1894-L1951 | [
"def",
"usermacro_get",
"(",
"macro",
"=",
"None",
",",
"hostids",
"=",
"None",
",",
"templateids",
"=",
"None",
",",
"hostmacroids",
"=",
"None",
",",
"globalmacroids",
"=",
"None",
",",
"globalmacro",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | usermacro_create | Create new host usermacro.
:param macro: name of the host usermacro
:param value: value of the host usermacro
:param hostid: hostid or templateid
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_password: Optional - zabbi... | salt/modules/zabbix.py | def usermacro_create(macro, value, hostid, **kwargs):
'''
Create new host usermacro.
:param macro: name of the host usermacro
:param value: value of the host usermacro
:param hostid: hostid or templateid
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see mod... | def usermacro_create(macro, value, hostid, **kwargs):
'''
Create new host usermacro.
:param macro: name of the host usermacro
:param value: value of the host usermacro
:param hostid: hostid or templateid
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see mod... | [
"Create",
"new",
"host",
"usermacro",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zabbix.py#L1954-L1994 | [
"def",
"usermacro_create",
"(",
"macro",
",",
"value",
",",
"hostid",
",",
"*",
"*",
"kwargs",
")",
":",
"conn_args",
"=",
"_login",
"(",
"*",
"*",
"kwargs",
")",
"ret",
"=",
"{",
"}",
"try",
":",
"if",
"conn_args",
":",
"params",
"=",
"{",
"}",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | usermacro_delete | Delete host usermacros.
:param macroids: macroids of the host usermacros
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_password: Optional - zabbix password (can also be set in opts or pillar, see module's docstring)
:para... | salt/modules/zabbix.py | def usermacro_delete(macroids, **kwargs):
'''
Delete host usermacros.
:param macroids: macroids of the host usermacros
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_password: Optional - zabbix password (can also be se... | def usermacro_delete(macroids, **kwargs):
'''
Delete host usermacros.
:param macroids: macroids of the host usermacros
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_password: Optional - zabbix password (can also be se... | [
"Delete",
"host",
"usermacros",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zabbix.py#L2038-L2070 | [
"def",
"usermacro_delete",
"(",
"macroids",
",",
"*",
"*",
"kwargs",
")",
":",
"conn_args",
"=",
"_login",
"(",
"*",
"*",
"kwargs",
")",
"ret",
"=",
"{",
"}",
"try",
":",
"if",
"conn_args",
":",
"method",
"=",
"'usermacro.delete'",
"if",
"isinstance",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | usermacro_update | Update existing host usermacro.
:param hostmacroid: id of the host usermacro
:param value: new value of the host usermacro
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_password: Optional - zabbix password (can also be set... | salt/modules/zabbix.py | def usermacro_update(hostmacroid, value, **kwargs):
'''
Update existing host usermacro.
:param hostmacroid: id of the host usermacro
:param value: new value of the host usermacro
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _... | def usermacro_update(hostmacroid, value, **kwargs):
'''
Update existing host usermacro.
:param hostmacroid: id of the host usermacro
:param value: new value of the host usermacro
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _... | [
"Update",
"existing",
"host",
"usermacro",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zabbix.py#L2108-L2140 | [
"def",
"usermacro_update",
"(",
"hostmacroid",
",",
"value",
",",
"*",
"*",
"kwargs",
")",
":",
"conn_args",
"=",
"_login",
"(",
"*",
"*",
"kwargs",
")",
"ret",
"=",
"{",
"}",
"try",
":",
"if",
"conn_args",
":",
"params",
"=",
"{",
"}",
"method",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | usermacro_updateglobal | Update existing global usermacro.
:param globalmacroid: id of the host usermacro
:param value: new value of the host usermacro
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_password: Optional - zabbix password (can also be... | salt/modules/zabbix.py | def usermacro_updateglobal(globalmacroid, value, **kwargs):
'''
Update existing global usermacro.
:param globalmacroid: id of the host usermacro
:param value: new value of the host usermacro
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
... | def usermacro_updateglobal(globalmacroid, value, **kwargs):
'''
Update existing global usermacro.
:param globalmacroid: id of the host usermacro
:param value: new value of the host usermacro
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
... | [
"Update",
"existing",
"global",
"usermacro",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zabbix.py#L2143-L2175 | [
"def",
"usermacro_updateglobal",
"(",
"globalmacroid",
",",
"value",
",",
"*",
"*",
"kwargs",
")",
":",
"conn_args",
"=",
"_login",
"(",
"*",
"*",
"kwargs",
")",
"ret",
"=",
"{",
"}",
"try",
":",
"if",
"conn_args",
":",
"params",
"=",
"{",
"}",
"meth... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | mediatype_get | Retrieve mediatypes according to the given parameters.
Args:
name: Name or description of the mediatype
mediatypeids: ids of the mediatypes
optional kwargs:
_connection_user: zabbix user (can also be set in opts or pillar, see module's docstring)
_co... | salt/modules/zabbix.py | def mediatype_get(name=None, mediatypeids=None, **kwargs):
'''
Retrieve mediatypes according to the given parameters.
Args:
name: Name or description of the mediatype
mediatypeids: ids of the mediatypes
optional kwargs:
_connection_user: zabbix user (can als... | def mediatype_get(name=None, mediatypeids=None, **kwargs):
'''
Retrieve mediatypes according to the given parameters.
Args:
name: Name or description of the mediatype
mediatypeids: ids of the mediatypes
optional kwargs:
_connection_user: zabbix user (can als... | [
"Retrieve",
"mediatypes",
"according",
"to",
"the",
"given",
"parameters",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zabbix.py#L2178-L2220 | [
"def",
"mediatype_get",
"(",
"name",
"=",
"None",
",",
"mediatypeids",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn_args",
"=",
"_login",
"(",
"*",
"*",
"kwargs",
")",
"ret",
"=",
"{",
"}",
"try",
":",
"if",
"conn_args",
":",
"method",
"="... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | mediatype_create | Create new mediatype
.. note::
This function accepts all standard mediatype properties: keyword
argument names differ depending on your zabbix version, see here__.
.. __: https://www.zabbix.com/documentation/3.0/manual/api/reference/mediatype/object
:param mediatype: media type - 0: e... | salt/modules/zabbix.py | def mediatype_create(name, mediatype, **kwargs):
'''
Create new mediatype
.. note::
This function accepts all standard mediatype properties: keyword
argument names differ depending on your zabbix version, see here__.
.. __: https://www.zabbix.com/documentation/3.0/manual/api/refere... | def mediatype_create(name, mediatype, **kwargs):
'''
Create new mediatype
.. note::
This function accepts all standard mediatype properties: keyword
argument names differ depending on your zabbix version, see here__.
.. __: https://www.zabbix.com/documentation/3.0/manual/api/refere... | [
"Create",
"new",
"mediatype"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zabbix.py#L2223-L2268 | [
"def",
"mediatype_create",
"(",
"name",
",",
"mediatype",
",",
"*",
"*",
"kwargs",
")",
":",
"conn_args",
"=",
"_login",
"(",
"*",
"*",
"kwargs",
")",
"ret",
"=",
"{",
"}",
"try",
":",
"if",
"conn_args",
":",
"method",
"=",
"'mediatype.create'",
"param... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | mediatype_delete | Delete mediatype
:param interfaceids: IDs of the mediatypes to delete
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_password: Optional - zabbix password (can also be set in opts or pillar, see module's docstring)
:param _... | salt/modules/zabbix.py | def mediatype_delete(mediatypeids, **kwargs):
'''
Delete mediatype
:param interfaceids: IDs of the mediatypes to delete
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_password: Optional - zabbix password (can also be s... | def mediatype_delete(mediatypeids, **kwargs):
'''
Delete mediatype
:param interfaceids: IDs of the mediatypes to delete
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_password: Optional - zabbix password (can also be s... | [
"Delete",
"mediatype"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zabbix.py#L2271-L2302 | [
"def",
"mediatype_delete",
"(",
"mediatypeids",
",",
"*",
"*",
"kwargs",
")",
":",
"conn_args",
"=",
"_login",
"(",
"*",
"*",
"kwargs",
")",
"ret",
"=",
"{",
"}",
"try",
":",
"if",
"conn_args",
":",
"method",
"=",
"'mediatype.delete'",
"if",
"isinstance"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | mediatype_update | Update existing mediatype
.. note::
This function accepts all standard mediatype properties: keyword
argument names differ depending on your zabbix version, see here__.
.. __: https://www.zabbix.com/documentation/3.0/manual/api/reference/mediatype/object
:param mediatypeid: ID of the ... | salt/modules/zabbix.py | def mediatype_update(mediatypeid, name=False, mediatype=False, **kwargs):
'''
Update existing mediatype
.. note::
This function accepts all standard mediatype properties: keyword
argument names differ depending on your zabbix version, see here__.
.. __: https://www.zabbix.com/docum... | def mediatype_update(mediatypeid, name=False, mediatype=False, **kwargs):
'''
Update existing mediatype
.. note::
This function accepts all standard mediatype properties: keyword
argument names differ depending on your zabbix version, see here__.
.. __: https://www.zabbix.com/docum... | [
"Update",
"existing",
"mediatype"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zabbix.py#L2305-L2343 | [
"def",
"mediatype_update",
"(",
"mediatypeid",
",",
"name",
"=",
"False",
",",
"mediatype",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"conn_args",
"=",
"_login",
"(",
"*",
"*",
"kwargs",
")",
"ret",
"=",
"{",
"}",
"try",
":",
"if",
"conn_args"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | template_get | Retrieve templates according to the given parameters.
Args:
host: technical name of the template
name: visible name of the template
hostids: ids of the templates
optional kwargs:
_connection_user: zabbix user (can also be set in opts or pillar, see module's docstrin... | salt/modules/zabbix.py | def template_get(name=None, host=None, templateids=None, **kwargs):
'''
Retrieve templates according to the given parameters.
Args:
host: technical name of the template
name: visible name of the template
hostids: ids of the templates
optional kwargs:
_connec... | def template_get(name=None, host=None, templateids=None, **kwargs):
'''
Retrieve templates according to the given parameters.
Args:
host: technical name of the template
name: visible name of the template
hostids: ids of the templates
optional kwargs:
_connec... | [
"Retrieve",
"templates",
"according",
"to",
"the",
"given",
"parameters",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zabbix.py#L2346-L2391 | [
"def",
"template_get",
"(",
"name",
"=",
"None",
",",
"host",
"=",
"None",
",",
"templateids",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn_args",
"=",
"_login",
"(",
"*",
"*",
"kwargs",
")",
"ret",
"=",
"{",
"}",
"try",
":",
"if",
"conn... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | run_query | Send Zabbix API call
Args:
method: actual operation to perform via the API
params: parameters required for specific method
optional kwargs:
_connection_user: zabbix user (can also be set in opts or pillar, see module's docstring)
_connection_password: zabbix... | salt/modules/zabbix.py | def run_query(method, params, **kwargs):
'''
Send Zabbix API call
Args:
method: actual operation to perform via the API
params: parameters required for specific method
optional kwargs:
_connection_user: zabbix user (can also be set in opts or pillar, see module's do... | def run_query(method, params, **kwargs):
'''
Send Zabbix API call
Args:
method: actual operation to perform via the API
params: parameters required for specific method
optional kwargs:
_connection_user: zabbix user (can also be set in opts or pillar, see module's do... | [
"Send",
"Zabbix",
"API",
"call"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zabbix.py#L2394-L2433 | [
"def",
"run_query",
"(",
"method",
",",
"params",
",",
"*",
"*",
"kwargs",
")",
":",
"conn_args",
"=",
"_login",
"(",
"*",
"*",
"kwargs",
")",
"ret",
"=",
"{",
"}",
"try",
":",
"if",
"conn_args",
":",
"method",
"=",
"method",
"params",
"=",
"params... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | configuration_import | .. versionadded:: 2017.7
Imports Zabbix configuration specified in file to Zabbix server.
:param config_file: File with Zabbix config (local or remote)
:param rules: Optional - Rules that have to be different from default (defaults are the same as in Zabbix web UI.)
:param file_format: Config file for... | salt/modules/zabbix.py | def configuration_import(config_file, rules=None, file_format='xml', **kwargs):
'''
.. versionadded:: 2017.7
Imports Zabbix configuration specified in file to Zabbix server.
:param config_file: File with Zabbix config (local or remote)
:param rules: Optional - Rules that have to be different from ... | def configuration_import(config_file, rules=None, file_format='xml', **kwargs):
'''
.. versionadded:: 2017.7
Imports Zabbix configuration specified in file to Zabbix server.
:param config_file: File with Zabbix config (local or remote)
:param rules: Optional - Rules that have to be different from ... | [
"..",
"versionadded",
"::",
"2017",
".",
"7"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zabbix.py#L2436-L2505 | [
"def",
"configuration_import",
"(",
"config_file",
",",
"rules",
"=",
"None",
",",
"file_format",
"=",
"'xml'",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"rules",
"is",
"None",
":",
"rules",
"=",
"{",
"}",
"default_rules",
"=",
"{",
"'applications'",
":",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | triggerid_get | .. versionadded:: Fluorine
Retrieve trigger ID and description based in host ID and trigger description.
.. note::
https://www.zabbix.com/documentation/3.4/manual/api/reference/trigger/get
:param hostid: ID of the host whose trigger we want to find
:param trigger_desc: Description of trigger ... | salt/modules/zabbix.py | def triggerid_get(hostid=None, trigger_desc=None, priority=4, **kwargs):
'''
.. versionadded:: Fluorine
Retrieve trigger ID and description based in host ID and trigger description.
.. note::
https://www.zabbix.com/documentation/3.4/manual/api/reference/trigger/get
:param hostid: ID of th... | def triggerid_get(hostid=None, trigger_desc=None, priority=4, **kwargs):
'''
.. versionadded:: Fluorine
Retrieve trigger ID and description based in host ID and trigger description.
.. note::
https://www.zabbix.com/documentation/3.4/manual/api/reference/trigger/get
:param hostid: ID of th... | [
"..",
"versionadded",
"::",
"Fluorine"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zabbix.py#L2508-L2554 | [
"def",
"triggerid_get",
"(",
"hostid",
"=",
"None",
",",
"trigger_desc",
"=",
"None",
",",
"priority",
"=",
"4",
",",
"*",
"*",
"kwargs",
")",
":",
"conn_args",
"=",
"_login",
"(",
"*",
"*",
"kwargs",
")",
"ret",
"=",
"{",
"}",
"try",
":",
"if",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | service_add | .. versionadded:: Fluorine
Create service under service with id specified as parameter.
.. note::
https://www.zabbix.com/documentation/3.4/manual/api/reference/service/create
:param service_rootid: Service id under which service should be added
:param service_name: Name of new service
:pa... | salt/modules/zabbix.py | def service_add(service_rootid=None, service_name=None, triggerid=None, **kwargs):
'''
.. versionadded:: Fluorine
Create service under service with id specified as parameter.
.. note::
https://www.zabbix.com/documentation/3.4/manual/api/reference/service/create
:param service_rootid: Serv... | def service_add(service_rootid=None, service_name=None, triggerid=None, **kwargs):
'''
.. versionadded:: Fluorine
Create service under service with id specified as parameter.
.. note::
https://www.zabbix.com/documentation/3.4/manual/api/reference/service/create
:param service_rootid: Serv... | [
"..",
"versionadded",
"::",
"Fluorine"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zabbix.py#L2557-L2603 | [
"def",
"service_add",
"(",
"service_rootid",
"=",
"None",
",",
"service_name",
"=",
"None",
",",
"triggerid",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn_args",
"=",
"_login",
"(",
"*",
"*",
"kwargs",
")",
"ret",
"=",
"{",
"}",
"try",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | service_get | .. versionadded:: Fluorine
Get service according to name and parent service ID.
.. note::
https://www.zabbix.com/documentation/3.4/manual/api/reference/service/get
:param service_name: Name of the service
:param service_rootid: ID of service parent
:param _connection_user: Optional - zab... | salt/modules/zabbix.py | def service_get(service_name=None, service_rootid=None, **kwargs):
'''
.. versionadded:: Fluorine
Get service according to name and parent service ID.
.. note::
https://www.zabbix.com/documentation/3.4/manual/api/reference/service/get
:param service_name: Name of the service
:param se... | def service_get(service_name=None, service_rootid=None, **kwargs):
'''
.. versionadded:: Fluorine
Get service according to name and parent service ID.
.. note::
https://www.zabbix.com/documentation/3.4/manual/api/reference/service/get
:param service_name: Name of the service
:param se... | [
"..",
"versionadded",
"::",
"Fluorine"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zabbix.py#L2606-L2647 | [
"def",
"service_get",
"(",
"service_name",
"=",
"None",
",",
"service_rootid",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn_args",
"=",
"_login",
"(",
"*",
"*",
"kwargs",
")",
"ret",
"=",
"{",
"}",
"try",
":",
"if",
"conn_args",
":",
"method... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | service_delete | .. versionadded:: Fluorine
Delete service specified by id.
.. note::
https://www.zabbix.com/documentation/3.4/manual/api/reference/service/delete
:param service_id: ID of service which should be deleted
.. note::
Service can't be deleted if it has any children.
:param _connectio... | salt/modules/zabbix.py | def service_delete(service_id=None, **kwargs):
'''
.. versionadded:: Fluorine
Delete service specified by id.
.. note::
https://www.zabbix.com/documentation/3.4/manual/api/reference/service/delete
:param service_id: ID of service which should be deleted
.. note::
Service can'... | def service_delete(service_id=None, **kwargs):
'''
.. versionadded:: Fluorine
Delete service specified by id.
.. note::
https://www.zabbix.com/documentation/3.4/manual/api/reference/service/delete
:param service_id: ID of service which should be deleted
.. note::
Service can'... | [
"..",
"versionadded",
"::",
"Fluorine"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zabbix.py#L2650-L2689 | [
"def",
"service_delete",
"(",
"service_id",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn_args",
"=",
"_login",
"(",
"*",
"*",
"kwargs",
")",
"ret",
"=",
"{",
"}",
"try",
":",
"if",
"conn_args",
":",
"method",
"=",
"'service.delete'",
"if",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | present | Create the named container if it does not exist
name
The name of the container to be created
running : None
* If ``True``, ensure that the container is running
* If ``False``, ensure that the container is stopped
* If ``None``, do nothing with regards to the running state of th... | salt/states/lxd_container.py | def present(name,
running=None,
source=None,
profiles=None,
config=None,
devices=None,
architecture='x86_64',
ephemeral=False,
restart_on_change=False,
remote_addr=None,
cert=None,
key=Non... | def present(name,
running=None,
source=None,
profiles=None,
config=None,
devices=None,
architecture='x86_64',
ephemeral=False,
restart_on_change=False,
remote_addr=None,
cert=None,
key=Non... | [
"Create",
"the",
"named",
"container",
"if",
"it",
"does",
"not",
"exist"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/lxd_container.py#L57-L360 | [
"def",
"present",
"(",
"name",
",",
"running",
"=",
"None",
",",
"source",
"=",
"None",
",",
"profiles",
"=",
"None",
",",
"config",
"=",
"None",
",",
"devices",
"=",
"None",
",",
"architecture",
"=",
"'x86_64'",
",",
"ephemeral",
"=",
"False",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | absent | Ensure a LXD container is not present, destroying it if present
name :
The name of the container to destroy
stop :
stop before destroying
default: false
remote_addr :
An URL to a remote Server, you also have to give cert and key if you
provide remote_addr!
... | salt/states/lxd_container.py | def absent(name,
stop=False,
remote_addr=None,
cert=None,
key=None,
verify_cert=True):
'''
Ensure a LXD container is not present, destroying it if present
name :
The name of the container to destroy
stop :
stop before destroying
... | def absent(name,
stop=False,
remote_addr=None,
cert=None,
key=None,
verify_cert=True):
'''
Ensure a LXD container is not present, destroying it if present
name :
The name of the container to destroy
stop :
stop before destroying
... | [
"Ensure",
"a",
"LXD",
"container",
"is",
"not",
"present",
"destroying",
"it",
"if",
"present"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/lxd_container.py#L363-L440 | [
"def",
"absent",
"(",
"name",
",",
"stop",
"=",
"False",
",",
"remote_addr",
"=",
"None",
",",
"cert",
"=",
"None",
",",
"key",
"=",
"None",
",",
"verify_cert",
"=",
"True",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'stop'",
":",
"s... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | running | Ensure a LXD container is running and restart it if restart is True
name :
The name of the container to start/restart.
restart :
restart the container if it is already started.
remote_addr :
An URL to a remote Server, you also have to give cert and key if you
provide remot... | salt/states/lxd_container.py | def running(name,
restart=False,
remote_addr=None,
cert=None,
key=None,
verify_cert=True):
'''
Ensure a LXD container is running and restart it if restart is True
name :
The name of the container to start/restart.
restart :
re... | def running(name,
restart=False,
remote_addr=None,
cert=None,
key=None,
verify_cert=True):
'''
Ensure a LXD container is running and restart it if restart is True
name :
The name of the container to start/restart.
restart :
re... | [
"Ensure",
"a",
"LXD",
"container",
"is",
"running",
"and",
"restart",
"it",
"if",
"restart",
"is",
"True"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/lxd_container.py#L443-L536 | [
"def",
"running",
"(",
"name",
",",
"restart",
"=",
"False",
",",
"remote_addr",
"=",
"None",
",",
"cert",
"=",
"None",
",",
"key",
"=",
"None",
",",
"verify_cert",
"=",
"True",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'restart'",
":... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | stopped | Ensure a LXD container is stopped, kill it if kill is true else stop it
name :
The name of the container to stop
kill :
kill if true
remote_addr :
An URL to a remote Server, you also have to give cert and key if you
provide remote_addr!
Examples:
https... | salt/states/lxd_container.py | def stopped(name,
kill=False,
remote_addr=None,
cert=None,
key=None,
verify_cert=True):
'''
Ensure a LXD container is stopped, kill it if kill is true else stop it
name :
The name of the container to stop
kill :
kill if true
... | def stopped(name,
kill=False,
remote_addr=None,
cert=None,
key=None,
verify_cert=True):
'''
Ensure a LXD container is stopped, kill it if kill is true else stop it
name :
The name of the container to stop
kill :
kill if true
... | [
"Ensure",
"a",
"LXD",
"container",
"is",
"stopped",
"kill",
"it",
"if",
"kill",
"is",
"true",
"else",
"stop",
"it"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/lxd_container.py#L640-L713 | [
"def",
"stopped",
"(",
"name",
",",
"kill",
"=",
"False",
",",
"remote_addr",
"=",
"None",
",",
"cert",
"=",
"None",
",",
"key",
"=",
"None",
",",
"verify_cert",
"=",
"True",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'kill'",
":",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | migrated | Ensure a container is migrated to another host
If the container is running, it either must be shut down
first (use stop_and_start=True) or criu must be installed
on the source and destination machines.
For this operation both certs need to be authenticated,
use :mod:`lxd.authenticate <salt.states.... | salt/states/lxd_container.py | def migrated(name,
remote_addr,
cert,
key,
verify_cert,
src_remote_addr,
stop_and_start=False,
src_cert=None,
src_key=None,
src_verify_cert=None):
''' Ensure a container is migrated to another host
... | def migrated(name,
remote_addr,
cert,
key,
verify_cert,
src_remote_addr,
stop_and_start=False,
src_cert=None,
src_key=None,
src_verify_cert=None):
''' Ensure a container is migrated to another host
... | [
"Ensure",
"a",
"container",
"is",
"migrated",
"to",
"another",
"host"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/lxd_container.py#L716-L852 | [
"def",
"migrated",
"(",
"name",
",",
"remote_addr",
",",
"cert",
",",
"key",
",",
"verify_cert",
",",
"src_remote_addr",
",",
"stop_and_start",
"=",
"False",
",",
"src_cert",
"=",
"None",
",",
"src_key",
"=",
"None",
",",
"src_verify_cert",
"=",
"None",
")... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | uuid | Return the bcache UUID of a block device.
If no device is given, the Cache UUID is returned.
CLI example:
.. code-block:: bash
salt '*' bcache.uuid
salt '*' bcache.uuid /dev/sda
salt '*' bcache.uuid bcache0 | salt/modules/bcache.py | def uuid(dev=None):
'''
Return the bcache UUID of a block device.
If no device is given, the Cache UUID is returned.
CLI example:
.. code-block:: bash
salt '*' bcache.uuid
salt '*' bcache.uuid /dev/sda
salt '*' bcache.uuid bcache0
'''
try:
if dev is None:
... | def uuid(dev=None):
'''
Return the bcache UUID of a block device.
If no device is given, the Cache UUID is returned.
CLI example:
.. code-block:: bash
salt '*' bcache.uuid
salt '*' bcache.uuid /dev/sda
salt '*' bcache.uuid bcache0
'''
try:
if dev is None:
... | [
"Return",
"the",
"bcache",
"UUID",
"of",
"a",
"block",
"device",
".",
"If",
"no",
"device",
"is",
"given",
"the",
"Cache",
"UUID",
"is",
"returned",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L57-L79 | [
"def",
"uuid",
"(",
"dev",
"=",
"None",
")",
":",
"try",
":",
"if",
"dev",
"is",
"None",
":",
"# take the only directory in /sys/fs/bcache and return it's basename",
"return",
"list",
"(",
"salt",
".",
"utils",
".",
"path",
".",
"os_walk",
"(",
"'/sys/fs/bcache/... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | attach_ | Attach a backing devices to a cache set
If no dev is given, all backing devices will be attached.
CLI example:
.. code-block:: bash
salt '*' bcache.attach sdc
salt '*' bcache.attach /dev/bcache1
:return: bool or None if nuttin' happened | salt/modules/bcache.py | def attach_(dev=None):
'''
Attach a backing devices to a cache set
If no dev is given, all backing devices will be attached.
CLI example:
.. code-block:: bash
salt '*' bcache.attach sdc
salt '*' bcache.attach /dev/bcache1
:return: bool or None if nuttin' happened
'''
... | def attach_(dev=None):
'''
Attach a backing devices to a cache set
If no dev is given, all backing devices will be attached.
CLI example:
.. code-block:: bash
salt '*' bcache.attach sdc
salt '*' bcache.attach /dev/bcache1
:return: bool or None if nuttin' happened
'''
... | [
"Attach",
"a",
"backing",
"devices",
"to",
"a",
"cache",
"set",
"If",
"no",
"dev",
"is",
"given",
"all",
"backing",
"devices",
"will",
"be",
"attached",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L82-L125 | [
"def",
"attach_",
"(",
"dev",
"=",
"None",
")",
":",
"cache",
"=",
"uuid",
"(",
")",
"if",
"not",
"cache",
":",
"log",
".",
"error",
"(",
"'No cache to attach %s to'",
",",
"dev",
")",
"return",
"False",
"if",
"dev",
"is",
"None",
":",
"res",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | detach | Detach a backing device(s) from a cache set
If no dev is given, all backing devices will be attached.
Detaching a backing device will flush it's write cache.
This should leave the underlying device in a consistent state, but might take a while.
CLI example:
.. code-block:: bash
salt '*' ... | salt/modules/bcache.py | def detach(dev=None):
'''
Detach a backing device(s) from a cache set
If no dev is given, all backing devices will be attached.
Detaching a backing device will flush it's write cache.
This should leave the underlying device in a consistent state, but might take a while.
CLI example:
.. co... | def detach(dev=None):
'''
Detach a backing device(s) from a cache set
If no dev is given, all backing devices will be attached.
Detaching a backing device will flush it's write cache.
This should leave the underlying device in a consistent state, but might take a while.
CLI example:
.. co... | [
"Detach",
"a",
"backing",
"device",
"(",
"s",
")",
"from",
"a",
"cache",
"set",
"If",
"no",
"dev",
"is",
"given",
"all",
"backing",
"devices",
"will",
"be",
"attached",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L128-L155 | [
"def",
"detach",
"(",
"dev",
"=",
"None",
")",
":",
"if",
"dev",
"is",
"None",
":",
"res",
"=",
"{",
"}",
"for",
"dev",
",",
"data",
"in",
"status",
"(",
"alldevs",
"=",
"True",
")",
".",
"items",
"(",
")",
":",
"if",
"'cache'",
"in",
"data",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | stop | Stop a bcache device
If no device is given, all backing devices will be detached from the cache, which will subsequently be stopped.
.. warning::
'Stop' on an individual backing device means hard-stop;
no attempt at flushing will be done and the bcache device will seemingly 'disappear' from the... | salt/modules/bcache.py | def stop(dev=None):
'''
Stop a bcache device
If no device is given, all backing devices will be detached from the cache, which will subsequently be stopped.
.. warning::
'Stop' on an individual backing device means hard-stop;
no attempt at flushing will be done and the bcache device wil... | def stop(dev=None):
'''
Stop a bcache device
If no device is given, all backing devices will be detached from the cache, which will subsequently be stopped.
.. warning::
'Stop' on an individual backing device means hard-stop;
no attempt at flushing will be done and the bcache device wil... | [
"Stop",
"a",
"bcache",
"device",
"If",
"no",
"device",
"is",
"given",
"all",
"backing",
"devices",
"will",
"be",
"detached",
"from",
"the",
"cache",
"which",
"will",
"subsequently",
"be",
"stopped",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L176-L208 | [
"def",
"stop",
"(",
"dev",
"=",
"None",
")",
":",
"if",
"dev",
"is",
"not",
"None",
":",
"log",
".",
"warning",
"(",
"'Stopping %s, device will only reappear after reregistering!'",
",",
"dev",
")",
"if",
"not",
"_bcsys",
"(",
"dev",
",",
"'stop'",
",",
"'... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | back_make | Create a backing device for attachment to a set.
Because the block size must be the same, a cache set already needs to exist.
CLI example:
.. code-block:: bash
salt '*' bcache.back_make sdc cache_mode=writeback attach=True
:param cache_mode: writethrough, writeback, writearound or none.
... | salt/modules/bcache.py | def back_make(dev, cache_mode='writeback', force=False, attach=True, bucket_size=None):
'''
Create a backing device for attachment to a set.
Because the block size must be the same, a cache set already needs to exist.
CLI example:
.. code-block:: bash
salt '*' bcache.back_make sdc cache_m... | def back_make(dev, cache_mode='writeback', force=False, attach=True, bucket_size=None):
'''
Create a backing device for attachment to a set.
Because the block size must be the same, a cache set already needs to exist.
CLI example:
.. code-block:: bash
salt '*' bcache.back_make sdc cache_m... | [
"Create",
"a",
"backing",
"device",
"for",
"attachment",
"to",
"a",
"set",
".",
"Because",
"the",
"block",
"size",
"must",
"be",
"the",
"same",
"a",
"cache",
"set",
"already",
"needs",
"to",
"exist",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L211-L264 | [
"def",
"back_make",
"(",
"dev",
",",
"cache_mode",
"=",
"'writeback'",
",",
"force",
"=",
"False",
",",
"attach",
"=",
"True",
",",
"bucket_size",
"=",
"None",
")",
":",
"# pylint: disable=too-many-return-statements",
"cache",
"=",
"uuid",
"(",
")",
"if",
"n... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | cache_make | Create BCache cache on a block device.
If blkdiscard is available the entire device will be properly cleared in advance.
CLI example:
.. code-block:: bash
salt '*' bcache.cache_make sdb reserved=10% block_size=4096
:param reserved: if dev is a full device, create a partition table with this... | salt/modules/bcache.py | def cache_make(dev, reserved=None, force=False, block_size=None, bucket_size=None, attach=True):
'''
Create BCache cache on a block device.
If blkdiscard is available the entire device will be properly cleared in advance.
CLI example:
.. code-block:: bash
salt '*' bcache.cache_make sdb re... | def cache_make(dev, reserved=None, force=False, block_size=None, bucket_size=None, attach=True):
'''
Create BCache cache on a block device.
If blkdiscard is available the entire device will be properly cleared in advance.
CLI example:
.. code-block:: bash
salt '*' bcache.cache_make sdb re... | [
"Create",
"BCache",
"cache",
"on",
"a",
"block",
"device",
".",
"If",
"blkdiscard",
"is",
"available",
"the",
"entire",
"device",
"will",
"be",
"properly",
"cleared",
"in",
"advance",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L267-L357 | [
"def",
"cache_make",
"(",
"dev",
",",
"reserved",
"=",
"None",
",",
"force",
"=",
"False",
",",
"block_size",
"=",
"None",
",",
"bucket_size",
"=",
"None",
",",
"attach",
"=",
"True",
")",
":",
"# TODO: multiple devs == md jbod",
"# pylint: disable=too-many-retu... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | config_ | Show or update config of a bcache device.
If no device is given, operate on the cache set itself.
CLI example:
.. code-block:: bash
salt '*' bcache.config
salt '*' bcache.config bcache1
salt '*' bcache.config errors=panic journal_delay_ms=150
salt '*' bcache.config bcache... | salt/modules/bcache.py | def config_(dev=None, **kwargs):
'''
Show or update config of a bcache device.
If no device is given, operate on the cache set itself.
CLI example:
.. code-block:: bash
salt '*' bcache.config
salt '*' bcache.config bcache1
salt '*' bcache.config errors=panic journal_delay... | def config_(dev=None, **kwargs):
'''
Show or update config of a bcache device.
If no device is given, operate on the cache set itself.
CLI example:
.. code-block:: bash
salt '*' bcache.config
salt '*' bcache.config bcache1
salt '*' bcache.config errors=panic journal_delay... | [
"Show",
"or",
"update",
"config",
"of",
"a",
"bcache",
"device",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L360-L401 | [
"def",
"config_",
"(",
"dev",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"dev",
"is",
"None",
":",
"spath",
"=",
"_fspath",
"(",
")",
"else",
":",
"spath",
"=",
"_bcpath",
"(",
"dev",
")",
"# filter out 'hidden' kwargs added by our favourite orc... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | status | Show the full status of the BCache system and optionally all it's involved devices
CLI example:
.. code-block:: bash
salt '*' bcache.status
salt '*' bcache.status stats=True
salt '*' bcache.status internals=True alldevs=True
:param stats: include statistics
:param config: inc... | salt/modules/bcache.py | def status(stats=False, config=False, internals=False, superblock=False, alldevs=False):
'''
Show the full status of the BCache system and optionally all it's involved devices
CLI example:
.. code-block:: bash
salt '*' bcache.status
salt '*' bcache.status stats=True
salt '*' b... | def status(stats=False, config=False, internals=False, superblock=False, alldevs=False):
'''
Show the full status of the BCache system and optionally all it's involved devices
CLI example:
.. code-block:: bash
salt '*' bcache.status
salt '*' bcache.status stats=True
salt '*' b... | [
"Show",
"the",
"full",
"status",
"of",
"the",
"BCache",
"system",
"and",
"optionally",
"all",
"it",
"s",
"involved",
"devices"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L404-L448 | [
"def",
"status",
"(",
"stats",
"=",
"False",
",",
"config",
"=",
"False",
",",
"internals",
"=",
"False",
",",
"superblock",
"=",
"False",
",",
"alldevs",
"=",
"False",
")",
":",
"bdevs",
"=",
"[",
"]",
"for",
"_",
",",
"links",
",",
"_",
"in",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | device | Check the state of a single bcache device
CLI example:
.. code-block:: bash
salt '*' bcache.device bcache0
salt '*' bcache.device /dev/sdc stats=True
:param stats: include statistics
:param settings: include all settings
:param internals: include all internals
:param superblo... | salt/modules/bcache.py | def device(dev, stats=False, config=False, internals=False, superblock=False):
'''
Check the state of a single bcache device
CLI example:
.. code-block:: bash
salt '*' bcache.device bcache0
salt '*' bcache.device /dev/sdc stats=True
:param stats: include statistics
:param set... | def device(dev, stats=False, config=False, internals=False, superblock=False):
'''
Check the state of a single bcache device
CLI example:
.. code-block:: bash
salt '*' bcache.device bcache0
salt '*' bcache.device /dev/sdc stats=True
:param stats: include statistics
:param set... | [
"Check",
"the",
"state",
"of",
"a",
"single",
"bcache",
"device"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L451-L561 | [
"def",
"device",
"(",
"dev",
",",
"stats",
"=",
"False",
",",
"config",
"=",
"False",
",",
"internals",
"=",
"False",
",",
"superblock",
"=",
"False",
")",
":",
"result",
"=",
"{",
"}",
"if",
"not",
"_sysfs_attr",
"(",
"_bcpath",
"(",
"dev",
")",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | super_ | Read out BCache SuperBlock
CLI example:
.. code-block:: bash
salt '*' bcache.device bcache0
salt '*' bcache.device /dev/sdc | salt/modules/bcache.py | def super_(dev):
'''
Read out BCache SuperBlock
CLI example:
.. code-block:: bash
salt '*' bcache.device bcache0
salt '*' bcache.device /dev/sdc
'''
dev = _devpath(dev)
ret = {}
res = _run_all('bcache-super-show {0}'.format(dev), 'error', 'Error reading superblock on... | def super_(dev):
'''
Read out BCache SuperBlock
CLI example:
.. code-block:: bash
salt '*' bcache.device bcache0
salt '*' bcache.device /dev/sdc
'''
dev = _devpath(dev)
ret = {}
res = _run_all('bcache-super-show {0}'.format(dev), 'error', 'Error reading superblock on... | [
"Read",
"out",
"BCache",
"SuperBlock"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L564-L619 | [
"def",
"super_",
"(",
"dev",
")",
":",
"dev",
"=",
"_devpath",
"(",
"dev",
")",
"ret",
"=",
"{",
"}",
"res",
"=",
"_run_all",
"(",
"'bcache-super-show {0}'",
".",
"format",
"(",
"dev",
")",
",",
"'error'",
",",
"'Error reading superblock on {0}: %s'",
".",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _devbase | Basename of just about any dev | salt/modules/bcache.py | def _devbase(dev):
'''
Basename of just about any dev
'''
dev = os.path.realpath(os.path.expandvars(dev))
dev = os.path.basename(dev)
return dev | def _devbase(dev):
'''
Basename of just about any dev
'''
dev = os.path.realpath(os.path.expandvars(dev))
dev = os.path.basename(dev)
return dev | [
"Basename",
"of",
"just",
"about",
"any",
"dev"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L624-L630 | [
"def",
"_devbase",
"(",
"dev",
")",
":",
"dev",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"os",
".",
"path",
".",
"expandvars",
"(",
"dev",
")",
")",
"dev",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"dev",
")",
"return",
"dev"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _syspath | Full SysFS path of a device | salt/modules/bcache.py | def _syspath(dev):
'''
Full SysFS path of a device
'''
dev = _devbase(dev)
dev = re.sub(r'^([vhs][a-z]+)([0-9]+)', r'\1/\1\2', dev)
# name = re.sub(r'^([a-z]+)(?<!(bcache|md|dm))([0-9]+)', r'\1/\1\2', name)
return os.path.join('/sys/block/', dev) | def _syspath(dev):
'''
Full SysFS path of a device
'''
dev = _devbase(dev)
dev = re.sub(r'^([vhs][a-z]+)([0-9]+)', r'\1/\1\2', dev)
# name = re.sub(r'^([a-z]+)(?<!(bcache|md|dm))([0-9]+)', r'\1/\1\2', name)
return os.path.join('/sys/block/', dev) | [
"Full",
"SysFS",
"path",
"of",
"a",
"device"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L641-L649 | [
"def",
"_syspath",
"(",
"dev",
")",
":",
"dev",
"=",
"_devbase",
"(",
"dev",
")",
"dev",
"=",
"re",
".",
"sub",
"(",
"r'^([vhs][a-z]+)([0-9]+)'",
",",
"r'\\1/\\1\\2'",
",",
"dev",
")",
"# name = re.sub(r'^([a-z]+)(?<!(bcache|md|dm))([0-9]+)', r'\\1/\\1\\2', name)",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _bdev | Resolve a bcacheX or cache to a real dev
:return: basename of bcache dev | salt/modules/bcache.py | def _bdev(dev=None):
'''
Resolve a bcacheX or cache to a real dev
:return: basename of bcache dev
'''
if dev is None:
dev = _fssys('cache0')
else:
dev = _bcpath(dev)
if not dev:
return False
else:
return _devbase(os.path.dirname(dev)) | def _bdev(dev=None):
'''
Resolve a bcacheX or cache to a real dev
:return: basename of bcache dev
'''
if dev is None:
dev = _fssys('cache0')
else:
dev = _bcpath(dev)
if not dev:
return False
else:
return _devbase(os.path.dirname(dev)) | [
"Resolve",
"a",
"bcacheX",
"or",
"cache",
"to",
"a",
"real",
"dev",
":",
"return",
":",
"basename",
"of",
"bcache",
"dev"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L652-L665 | [
"def",
"_bdev",
"(",
"dev",
"=",
"None",
")",
":",
"if",
"dev",
"is",
"None",
":",
"dev",
"=",
"_fssys",
"(",
"'cache0'",
")",
"else",
":",
"dev",
"=",
"_bcpath",
"(",
"dev",
")",
"if",
"not",
"dev",
":",
"return",
"False",
"else",
":",
"return",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _fssys | Simple wrapper to interface with bcache SysFS | salt/modules/bcache.py | def _fssys(name, value=None, log_lvl=None, log_msg=None):
'''
Simple wrapper to interface with bcache SysFS
'''
fspath = _fspath()
if not fspath:
return False
else:
return _sysfs_attr([fspath, name], value, log_lvl, log_msg) | def _fssys(name, value=None, log_lvl=None, log_msg=None):
'''
Simple wrapper to interface with bcache SysFS
'''
fspath = _fspath()
if not fspath:
return False
else:
return _sysfs_attr([fspath, name], value, log_lvl, log_msg) | [
"Simple",
"wrapper",
"to",
"interface",
"with",
"bcache",
"SysFS"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L686-L694 | [
"def",
"_fssys",
"(",
"name",
",",
"value",
"=",
"None",
",",
"log_lvl",
"=",
"None",
",",
"log_msg",
"=",
"None",
")",
":",
"fspath",
"=",
"_fspath",
"(",
")",
"if",
"not",
"fspath",
":",
"return",
"False",
"else",
":",
"return",
"_sysfs_attr",
"(",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _bcsys | Simple wrapper to interface with backing devs SysFS | salt/modules/bcache.py | def _bcsys(dev, name, value=None, log_lvl=None, log_msg=None):
'''
Simple wrapper to interface with backing devs SysFS
'''
return _sysfs_attr([_bcpath(dev), name], value, log_lvl, log_msg) | def _bcsys(dev, name, value=None, log_lvl=None, log_msg=None):
'''
Simple wrapper to interface with backing devs SysFS
'''
return _sysfs_attr([_bcpath(dev), name], value, log_lvl, log_msg) | [
"Simple",
"wrapper",
"to",
"interface",
"with",
"backing",
"devs",
"SysFS"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L697-L701 | [
"def",
"_bcsys",
"(",
"dev",
",",
"name",
",",
"value",
"=",
"None",
",",
"log_lvl",
"=",
"None",
",",
"log_msg",
"=",
"None",
")",
":",
"return",
"_sysfs_attr",
"(",
"[",
"_bcpath",
"(",
"dev",
")",
",",
"name",
"]",
",",
"value",
",",
"log_lvl",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _sysfs_attr | Simple wrapper with logging around sysfs.attr | salt/modules/bcache.py | def _sysfs_attr(name, value=None, log_lvl=None, log_msg=None):
'''
Simple wrapper with logging around sysfs.attr
'''
if isinstance(name, six.string_types):
name = [name]
res = __salt__['sysfs.attr'](os.path.join(*name), value)
if not res and log_lvl is not None and log_msg is not None:
... | def _sysfs_attr(name, value=None, log_lvl=None, log_msg=None):
'''
Simple wrapper with logging around sysfs.attr
'''
if isinstance(name, six.string_types):
name = [name]
res = __salt__['sysfs.attr'](os.path.join(*name), value)
if not res and log_lvl is not None and log_msg is not None:
... | [
"Simple",
"wrapper",
"with",
"logging",
"around",
"sysfs",
".",
"attr"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L704-L713 | [
"def",
"_sysfs_attr",
"(",
"name",
",",
"value",
"=",
"None",
",",
"log_lvl",
"=",
"None",
",",
"log_msg",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"name",
",",
"six",
".",
"string_types",
")",
":",
"name",
"=",
"[",
"name",
"]",
"res",
"=",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _sysfs_parse | Helper function for parsing BCache's SysFS interface | salt/modules/bcache.py | def _sysfs_parse(path, base_attr=None, stats=False, config=False, internals=False, options=False):
'''
Helper function for parsing BCache's SysFS interface
'''
result = {}
# ---------------- Parse through the interfaces list ----------------
intfs = __salt__['sysfs.interfaces'](path)
# Act... | def _sysfs_parse(path, base_attr=None, stats=False, config=False, internals=False, options=False):
'''
Helper function for parsing BCache's SysFS interface
'''
result = {}
# ---------------- Parse through the interfaces list ----------------
intfs = __salt__['sysfs.interfaces'](path)
# Act... | [
"Helper",
"function",
"for",
"parsing",
"BCache",
"s",
"SysFS",
"interface"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L716-L826 | [
"def",
"_sysfs_parse",
"(",
"path",
",",
"base_attr",
"=",
"None",
",",
"stats",
"=",
"False",
",",
"config",
"=",
"False",
",",
"internals",
"=",
"False",
",",
"options",
"=",
"False",
")",
":",
"result",
"=",
"{",
"}",
"# ---------------- Parse through t... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _size_map | Map Bcache's size strings to real bytes | salt/modules/bcache.py | def _size_map(size):
'''
Map Bcache's size strings to real bytes
'''
try:
# I know, I know, EAFP.
# But everything else is reason for None
if not isinstance(size, int):
if re.search(r'[Kk]', size):
size = 1024 * float(re.sub(r'[Kk]', '', size))
... | def _size_map(size):
'''
Map Bcache's size strings to real bytes
'''
try:
# I know, I know, EAFP.
# But everything else is reason for None
if not isinstance(size, int):
if re.search(r'[Kk]', size):
size = 1024 * float(re.sub(r'[Kk]', '', size))
... | [
"Map",
"Bcache",
"s",
"size",
"strings",
"to",
"real",
"bytes"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L829-L844 | [
"def",
"_size_map",
"(",
"size",
")",
":",
"try",
":",
"# I know, I know, EAFP.",
"# But everything else is reason for None",
"if",
"not",
"isinstance",
"(",
"size",
",",
"int",
")",
":",
"if",
"re",
".",
"search",
"(",
"r'[Kk]'",
",",
"size",
")",
":",
"siz... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _sizes | Return neigh useless sizing info about a blockdev
:return: (total size in blocks, blocksize, maximum discard size in bytes) | salt/modules/bcache.py | def _sizes(dev):
'''
Return neigh useless sizing info about a blockdev
:return: (total size in blocks, blocksize, maximum discard size in bytes)
'''
dev = _devbase(dev)
# standarization yay
block_sizes = ('hw_sector_size', 'minimum_io_size', 'physical_block_size', 'logical_block_size')
... | def _sizes(dev):
'''
Return neigh useless sizing info about a blockdev
:return: (total size in blocks, blocksize, maximum discard size in bytes)
'''
dev = _devbase(dev)
# standarization yay
block_sizes = ('hw_sector_size', 'minimum_io_size', 'physical_block_size', 'logical_block_size')
... | [
"Return",
"neigh",
"useless",
"sizing",
"info",
"about",
"a",
"blockdev",
":",
"return",
":",
"(",
"total",
"size",
"in",
"blocks",
"blocksize",
"maximum",
"discard",
"size",
"in",
"bytes",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L847-L878 | [
"def",
"_sizes",
"(",
"dev",
")",
":",
"dev",
"=",
"_devbase",
"(",
"dev",
")",
"# standarization yay",
"block_sizes",
"=",
"(",
"'hw_sector_size'",
",",
"'minimum_io_size'",
",",
"'physical_block_size'",
",",
"'logical_block_size'",
")",
"discard_sizes",
"=",
"("... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _wipe | REALLY DESTRUCTIVE STUFF RIGHT AHEAD | salt/modules/bcache.py | def _wipe(dev):
'''
REALLY DESTRUCTIVE STUFF RIGHT AHEAD
'''
endres = 0
dev = _devbase(dev)
size, block, discard = _sizes(dev)
if discard is None:
log.error('Unable to read SysFS props for %s', dev)
return None
elif not discard:
log.warning('%s seems unable to d... | def _wipe(dev):
'''
REALLY DESTRUCTIVE STUFF RIGHT AHEAD
'''
endres = 0
dev = _devbase(dev)
size, block, discard = _sizes(dev)
if discard is None:
log.error('Unable to read SysFS props for %s', dev)
return None
elif not discard:
log.warning('%s seems unable to d... | [
"REALLY",
"DESTRUCTIVE",
"STUFF",
"RIGHT",
"AHEAD"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L881-L918 | [
"def",
"_wipe",
"(",
"dev",
")",
":",
"endres",
"=",
"0",
"dev",
"=",
"_devbase",
"(",
"dev",
")",
"size",
",",
"block",
",",
"discard",
"=",
"_sizes",
"(",
"dev",
")",
"if",
"discard",
"is",
"None",
":",
"log",
".",
"error",
"(",
"'Unable to read ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _wait | Wait for lfunc to be True
:return: True if lfunc succeeded within tries, False if it didn't | salt/modules/bcache.py | def _wait(lfunc, log_lvl=None, log_msg=None, tries=10):
'''
Wait for lfunc to be True
:return: True if lfunc succeeded within tries, False if it didn't
'''
i = 0
while i < tries:
time.sleep(1)
if lfunc():
return True
else:
i += 1
if log_lvl is... | def _wait(lfunc, log_lvl=None, log_msg=None, tries=10):
'''
Wait for lfunc to be True
:return: True if lfunc succeeded within tries, False if it didn't
'''
i = 0
while i < tries:
time.sleep(1)
if lfunc():
return True
else:
i += 1
if log_lvl is... | [
"Wait",
"for",
"lfunc",
"to",
"be",
"True",
":",
"return",
":",
"True",
"if",
"lfunc",
"succeeded",
"within",
"tries",
"False",
"if",
"it",
"didn",
"t"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L921-L936 | [
"def",
"_wait",
"(",
"lfunc",
",",
"log_lvl",
"=",
"None",
",",
"log_msg",
"=",
"None",
",",
"tries",
"=",
"10",
")",
":",
"i",
"=",
"0",
"while",
"i",
"<",
"tries",
":",
"time",
".",
"sleep",
"(",
"1",
")",
"if",
"lfunc",
"(",
")",
":",
"ret... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _run_all | Simple wrapper around cmd.run_all
log_msg can contain {0} for stderr
:return: True or stdout, False if retcode wasn't exitcode | salt/modules/bcache.py | def _run_all(cmd, log_lvl=None, log_msg=None, exitcode=0):
'''
Simple wrapper around cmd.run_all
log_msg can contain {0} for stderr
:return: True or stdout, False if retcode wasn't exitcode
'''
res = __salt__['cmd.run_all'](cmd)
if res['retcode'] == exitcode:
if res['stdout']:
... | def _run_all(cmd, log_lvl=None, log_msg=None, exitcode=0):
'''
Simple wrapper around cmd.run_all
log_msg can contain {0} for stderr
:return: True or stdout, False if retcode wasn't exitcode
'''
res = __salt__['cmd.run_all'](cmd)
if res['retcode'] == exitcode:
if res['stdout']:
... | [
"Simple",
"wrapper",
"around",
"cmd",
".",
"run_all",
"log_msg",
"can",
"contain",
"{",
"0",
"}",
"for",
"stderr",
":",
"return",
":",
"True",
"or",
"stdout",
"False",
"if",
"retcode",
"wasn",
"t",
"exitcode"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bcache.py#L939-L954 | [
"def",
"_run_all",
"(",
"cmd",
",",
"log_lvl",
"=",
"None",
",",
"log_msg",
"=",
"None",
",",
"exitcode",
"=",
"0",
")",
":",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
")",
"if",
"res",
"[",
"'retcode'",
"]",
"==",
"exitcode",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_release_number | Returns the release number of a given release code name in a
``<year>.<month>`` context.
If the release name has not been given an assigned release number, the
function returns a string. If the release cannot be found, it returns
``None``.
name
The release codename for which to find a rele... | salt/modules/salt_version.py | def get_release_number(name):
'''
Returns the release number of a given release code name in a
``<year>.<month>`` context.
If the release name has not been given an assigned release number, the
function returns a string. If the release cannot be found, it returns
``None``.
name
The... | def get_release_number(name):
'''
Returns the release number of a given release code name in a
``<year>.<month>`` context.
If the release name has not been given an assigned release number, the
function returns a string. If the release cannot be found, it returns
``None``.
name
The... | [
"Returns",
"the",
"release",
"number",
"of",
"a",
"given",
"release",
"code",
"name",
"in",
"a",
"<year",
">",
".",
"<month",
">",
"context",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/salt_version.py#L56-L85 | [
"def",
"get_release_number",
"(",
"name",
")",
":",
"name",
"=",
"name",
".",
"lower",
"(",
")",
"version_map",
"=",
"salt",
".",
"version",
".",
"SaltStackVersion",
".",
"LNAMES",
"version",
"=",
"version_map",
".",
"get",
"(",
"name",
")",
"if",
"versi... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _check_release_cmp | Helper function to compare release codename versions to the minion's current
Salt version.
If release codename isn't found, the function returns None. Otherwise, it
returns the results of the version comparison as documented by the
``versions_cmp`` function in ``salt.utils.versions.py``. | salt/modules/salt_version.py | def _check_release_cmp(name):
'''
Helper function to compare release codename versions to the minion's current
Salt version.
If release codename isn't found, the function returns None. Otherwise, it
returns the results of the version comparison as documented by the
``versions_cmp`` function in ... | def _check_release_cmp(name):
'''
Helper function to compare release codename versions to the minion's current
Salt version.
If release codename isn't found, the function returns None. Otherwise, it
returns the results of the version comparison as documented by the
``versions_cmp`` function in ... | [
"Helper",
"function",
"to",
"compare",
"release",
"codename",
"versions",
"to",
"the",
"minion",
"s",
"current",
"Salt",
"version",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/salt_version.py#L151-L170 | [
"def",
"_check_release_cmp",
"(",
"name",
")",
":",
"map_version",
"=",
"get_release_number",
"(",
"name",
")",
"if",
"map_version",
"is",
"None",
":",
"log",
".",
"info",
"(",
"'Release codename %s was not found.'",
",",
"name",
")",
"return",
"None",
"current_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | install | Install rbenv systemwide
CLI Example:
.. code-block:: bash
salt '*' rbenv.install | salt/modules/rbenv.py | def install(runas=None, path=None):
'''
Install rbenv systemwide
CLI Example:
.. code-block:: bash
salt '*' rbenv.install
'''
path = path or _rbenv_path(runas)
path = os.path.expanduser(path)
return _install_rbenv(path, runas) and _install_ruby_build(path, runas) | def install(runas=None, path=None):
'''
Install rbenv systemwide
CLI Example:
.. code-block:: bash
salt '*' rbenv.install
'''
path = path or _rbenv_path(runas)
path = os.path.expanduser(path)
return _install_rbenv(path, runas) and _install_ruby_build(path, runas) | [
"Install",
"rbenv",
"systemwide"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rbenv.py#L159-L171 | [
"def",
"install",
"(",
"runas",
"=",
"None",
",",
"path",
"=",
"None",
")",
":",
"path",
"=",
"path",
"or",
"_rbenv_path",
"(",
"runas",
")",
"path",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"path",
")",
"return",
"_install_rbenv",
"(",
"path"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | update | Updates the current versions of rbenv and ruby-build
runas
The user under which to run rbenv. If not specified, then rbenv will be
run as the user under which Salt is running.
CLI Example:
.. code-block:: bash
salt '*' rbenv.update | salt/modules/rbenv.py | def update(runas=None, path=None):
'''
Updates the current versions of rbenv and ruby-build
runas
The user under which to run rbenv. If not specified, then rbenv will be
run as the user under which Salt is running.
CLI Example:
.. code-block:: bash
salt '*' rbenv.update
... | def update(runas=None, path=None):
'''
Updates the current versions of rbenv and ruby-build
runas
The user under which to run rbenv. If not specified, then rbenv will be
run as the user under which Salt is running.
CLI Example:
.. code-block:: bash
salt '*' rbenv.update
... | [
"Updates",
"the",
"current",
"versions",
"of",
"rbenv",
"and",
"ruby",
"-",
"build"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rbenv.py#L174-L191 | [
"def",
"update",
"(",
"runas",
"=",
"None",
",",
"path",
"=",
"None",
")",
":",
"path",
"=",
"path",
"or",
"_rbenv_path",
"(",
"runas",
")",
"path",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"path",
")",
"return",
"_update_rbenv",
"(",
"path",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | install_ruby | Install a ruby implementation.
ruby
The version of Ruby to install, should match one of the
versions listed by :py:func:`rbenv.list <salt.modules.rbenv.list>`
runas
The user under which to run rbenv. If not specified, then rbenv will be
run as the user under which Salt is runni... | salt/modules/rbenv.py | def install_ruby(ruby, runas=None):
'''
Install a ruby implementation.
ruby
The version of Ruby to install, should match one of the
versions listed by :py:func:`rbenv.list <salt.modules.rbenv.list>`
runas
The user under which to run rbenv. If not specified, then rbenv will be
... | def install_ruby(ruby, runas=None):
'''
Install a ruby implementation.
ruby
The version of Ruby to install, should match one of the
versions listed by :py:func:`rbenv.list <salt.modules.rbenv.list>`
runas
The user under which to run rbenv. If not specified, then rbenv will be
... | [
"Install",
"a",
"ruby",
"implementation",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rbenv.py#L207-L257 | [
"def",
"install_ruby",
"(",
"ruby",
",",
"runas",
"=",
"None",
")",
":",
"ruby",
"=",
"re",
".",
"sub",
"(",
"r'^ruby-'",
",",
"''",
",",
"ruby",
")",
"env",
"=",
"None",
"env_list",
"=",
"[",
"]",
"if",
"__grains__",
"[",
"'os'",
"]",
"in",
"(",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | uninstall_ruby | Uninstall a ruby implementation.
ruby
The version of ruby to uninstall. Should match one of the versions
listed by :py:func:`rbenv.versions <salt.modules.rbenv.versions>`.
runas
The user under which to run rbenv. If not specified, then rbenv will be
run as the user under which ... | salt/modules/rbenv.py | def uninstall_ruby(ruby, runas=None):
'''
Uninstall a ruby implementation.
ruby
The version of ruby to uninstall. Should match one of the versions
listed by :py:func:`rbenv.versions <salt.modules.rbenv.versions>`.
runas
The user under which to run rbenv. If not specified, then ... | def uninstall_ruby(ruby, runas=None):
'''
Uninstall a ruby implementation.
ruby
The version of ruby to uninstall. Should match one of the versions
listed by :py:func:`rbenv.versions <salt.modules.rbenv.versions>`.
runas
The user under which to run rbenv. If not specified, then ... | [
"Uninstall",
"a",
"ruby",
"implementation",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rbenv.py#L260-L280 | [
"def",
"uninstall_ruby",
"(",
"ruby",
",",
"runas",
"=",
"None",
")",
":",
"ruby",
"=",
"re",
".",
"sub",
"(",
"r'^ruby-'",
",",
"''",
",",
"ruby",
")",
"_rbenv_exec",
"(",
"[",
"'uninstall'",
",",
"'--force'",
",",
"ruby",
"]",
",",
"runas",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | versions | List the installed versions of ruby
CLI Example:
.. code-block:: bash
salt '*' rbenv.versions | salt/modules/rbenv.py | def versions(runas=None):
'''
List the installed versions of ruby
CLI Example:
.. code-block:: bash
salt '*' rbenv.versions
'''
ret = _rbenv_exec(['versions', '--bare'], runas=runas)
return [] if ret is False else ret.splitlines() | def versions(runas=None):
'''
List the installed versions of ruby
CLI Example:
.. code-block:: bash
salt '*' rbenv.versions
'''
ret = _rbenv_exec(['versions', '--bare'], runas=runas)
return [] if ret is False else ret.splitlines() | [
"List",
"the",
"installed",
"versions",
"of",
"ruby"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rbenv.py#L283-L294 | [
"def",
"versions",
"(",
"runas",
"=",
"None",
")",
":",
"ret",
"=",
"_rbenv_exec",
"(",
"[",
"'versions'",
",",
"'--bare'",
"]",
",",
"runas",
"=",
"runas",
")",
"return",
"[",
"]",
"if",
"ret",
"is",
"False",
"else",
"ret",
".",
"splitlines",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | default | Returns or sets the currently defined default ruby
ruby
The version to set as the default. Should match one of the versions
listed by :py:func:`rbenv.versions <salt.modules.rbenv.versions>`.
Leave blank to return the current default.
CLI Example:
.. code-block:: bash
salt... | salt/modules/rbenv.py | def default(ruby=None, runas=None):
'''
Returns or sets the currently defined default ruby
ruby
The version to set as the default. Should match one of the versions
listed by :py:func:`rbenv.versions <salt.modules.rbenv.versions>`.
Leave blank to return the current default.
CLI ... | def default(ruby=None, runas=None):
'''
Returns or sets the currently defined default ruby
ruby
The version to set as the default. Should match one of the versions
listed by :py:func:`rbenv.versions <salt.modules.rbenv.versions>`.
Leave blank to return the current default.
CLI ... | [
"Returns",
"or",
"sets",
"the",
"currently",
"defined",
"default",
"ruby"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rbenv.py#L297-L318 | [
"def",
"default",
"(",
"ruby",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"if",
"ruby",
":",
"_rbenv_exec",
"(",
"[",
"'global'",
",",
"ruby",
"]",
",",
"runas",
"=",
"runas",
")",
"return",
"True",
"else",
":",
"ret",
"=",
"_rbenv_exec",
"(... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_ | List the installable versions of ruby
runas
The user under which to run rbenv. If not specified, then rbenv will be
run as the user under which Salt is running.
CLI Example:
.. code-block:: bash
salt '*' rbenv.list | salt/modules/rbenv.py | def list_(runas=None):
'''
List the installable versions of ruby
runas
The user under which to run rbenv. If not specified, then rbenv will be
run as the user under which Salt is running.
CLI Example:
.. code-block:: bash
salt '*' rbenv.list
'''
ret = []
outpu... | def list_(runas=None):
'''
List the installable versions of ruby
runas
The user under which to run rbenv. If not specified, then rbenv will be
run as the user under which Salt is running.
CLI Example:
.. code-block:: bash
salt '*' rbenv.list
'''
ret = []
outpu... | [
"List",
"the",
"installable",
"versions",
"of",
"ruby"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rbenv.py#L321-L342 | [
"def",
"list_",
"(",
"runas",
"=",
"None",
")",
":",
"ret",
"=",
"[",
"]",
"output",
"=",
"_rbenv_exec",
"(",
"[",
"'install'",
",",
"'--list'",
"]",
",",
"runas",
"=",
"runas",
")",
"if",
"output",
":",
"for",
"line",
"in",
"output",
".",
"splitli... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | do | Execute a ruby command with rbenv's shims from the user or the system
CLI Example:
.. code-block:: bash
salt '*' rbenv.do 'gem list bundler'
salt '*' rbenv.do 'gem list bundler' deploy | salt/modules/rbenv.py | def do(cmdline, runas=None, env=None):
'''
Execute a ruby command with rbenv's shims from the user or the system
CLI Example:
.. code-block:: bash
salt '*' rbenv.do 'gem list bundler'
salt '*' rbenv.do 'gem list bundler' deploy
'''
if not cmdline:
# This is a positiona... | def do(cmdline, runas=None, env=None):
'''
Execute a ruby command with rbenv's shims from the user or the system
CLI Example:
.. code-block:: bash
salt '*' rbenv.do 'gem list bundler'
salt '*' rbenv.do 'gem list bundler' deploy
'''
if not cmdline:
# This is a positiona... | [
"Execute",
"a",
"ruby",
"command",
"with",
"rbenv",
"s",
"shims",
"from",
"the",
"user",
"or",
"the",
"system"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rbenv.py#L363-L410 | [
"def",
"do",
"(",
"cmdline",
",",
"runas",
"=",
"None",
",",
"env",
"=",
"None",
")",
":",
"if",
"not",
"cmdline",
":",
"# This is a positional argument so this should never happen, but this",
"# will handle cases where someone explicitly passes a false value for",
"# cmdline... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | do_with_ruby | Execute a ruby command with rbenv's shims using a specific ruby version
CLI Example:
.. code-block:: bash
salt '*' rbenv.do_with_ruby 2.0.0-p0 'gem list bundler'
salt '*' rbenv.do_with_ruby 2.0.0-p0 'gem list bundler' runas=deploy | salt/modules/rbenv.py | def do_with_ruby(ruby, cmdline, runas=None):
'''
Execute a ruby command with rbenv's shims using a specific ruby version
CLI Example:
.. code-block:: bash
salt '*' rbenv.do_with_ruby 2.0.0-p0 'gem list bundler'
salt '*' rbenv.do_with_ruby 2.0.0-p0 'gem list bundler' runas=deploy
'... | def do_with_ruby(ruby, cmdline, runas=None):
'''
Execute a ruby command with rbenv's shims using a specific ruby version
CLI Example:
.. code-block:: bash
salt '*' rbenv.do_with_ruby 2.0.0-p0 'gem list bundler'
salt '*' rbenv.do_with_ruby 2.0.0-p0 'gem list bundler' runas=deploy
'... | [
"Execute",
"a",
"ruby",
"command",
"with",
"rbenv",
"s",
"shims",
"using",
"a",
"specific",
"ruby",
"version"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rbenv.py#L413-L442 | [
"def",
"do_with_ruby",
"(",
"ruby",
",",
"cmdline",
",",
"runas",
"=",
"None",
")",
":",
"if",
"not",
"cmdline",
":",
"# This is a positional argument so this should never happen, but this",
"# will handle cases where someone explicitly passes a false value for",
"# cmdline.",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | installed | Make sure that we have the given bundle ID or path to command
installed in the assistive access panel.
name
The bundle ID or path to command
enable
Should assistive access be enabled on this application? | salt/states/mac_assistive.py | def installed(name, enabled=True):
'''
Make sure that we have the given bundle ID or path to command
installed in the assistive access panel.
name
The bundle ID or path to command
enable
Should assistive access be enabled on this application?
'''
ret = {'name': name,
... | def installed(name, enabled=True):
'''
Make sure that we have the given bundle ID or path to command
installed in the assistive access panel.
name
The bundle ID or path to command
enable
Should assistive access be enabled on this application?
'''
ret = {'name': name,
... | [
"Make",
"sure",
"that",
"we",
"have",
"the",
"given",
"bundle",
"ID",
"or",
"path",
"to",
"command",
"installed",
"in",
"the",
"assistive",
"access",
"panel",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mac_assistive.py#L38-L70 | [
"def",
"installed",
"(",
"name",
",",
"enabled",
"=",
"True",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
"}",
"is_installed",
"=",
"__salt__",
"[",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _enable | Enable the service | salt/states/service.py | def _enable(name, started, result=True, skip_verify=False, **kwargs):
'''
Enable the service
'''
ret = {}
if not skip_verify:
# is service available?
try:
if not _available(name, ret):
return ret
except CommandExecutionError as exc:
re... | def _enable(name, started, result=True, skip_verify=False, **kwargs):
'''
Enable the service
'''
ret = {}
if not skip_verify:
# is service available?
try:
if not _available(name, ret):
return ret
except CommandExecutionError as exc:
re... | [
"Enable",
"the",
"service"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/service.py#L123-L223 | [
"def",
"_enable",
"(",
"name",
",",
"started",
",",
"result",
"=",
"True",
",",
"skip_verify",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"not",
"skip_verify",
":",
"# is service available?",
"try",
":",
"if",
"not",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _disable | Disable the service | salt/states/service.py | def _disable(name, started, result=True, skip_verify=False, **kwargs):
'''
Disable the service
'''
ret = {}
if not skip_verify:
# is service available?
try:
if not _available(name, ret):
ret['result'] = True
return ret
except Comma... | def _disable(name, started, result=True, skip_verify=False, **kwargs):
'''
Disable the service
'''
ret = {}
if not skip_verify:
# is service available?
try:
if not _available(name, ret):
ret['result'] = True
return ret
except Comma... | [
"Disable",
"the",
"service"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/service.py#L226-L320 | [
"def",
"_disable",
"(",
"name",
",",
"started",
",",
"result",
"=",
"True",
",",
"skip_verify",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"not",
"skip_verify",
":",
"# is service available?",
"try",
":",
"if",
"not",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _available | Check if the service is available | salt/states/service.py | def _available(name, ret):
'''
Check if the service is available
'''
avail = False
if 'service.available' in __salt__:
avail = __salt__['service.available'](name)
elif 'service.get_all' in __salt__:
avail = name in __salt__['service.get_all']()
if not avail:
ret['resu... | def _available(name, ret):
'''
Check if the service is available
'''
avail = False
if 'service.available' in __salt__:
avail = __salt__['service.available'](name)
elif 'service.get_all' in __salt__:
avail = name in __salt__['service.get_all']()
if not avail:
ret['resu... | [
"Check",
"if",
"the",
"service",
"is",
"available"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/service.py#L323-L335 | [
"def",
"_available",
"(",
"name",
",",
"ret",
")",
":",
"avail",
"=",
"False",
"if",
"'service.available'",
"in",
"__salt__",
":",
"avail",
"=",
"__salt__",
"[",
"'service.available'",
"]",
"(",
"name",
")",
"elif",
"'service.get_all'",
"in",
"__salt__",
":"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | running | Ensure that the service is running
name
The name of the init or rc script used to manage the service
enable
Set the service to be enabled at boot time, ``True`` sets the service
to be enabled, ``False`` sets the named service to be disabled. The
default is ``None``, which does ... | salt/states/service.py | def running(name,
enable=None,
sig=None,
init_delay=None,
no_block=False,
unmask=False,
unmask_runtime=False,
**kwargs):
'''
Ensure that the service is running
name
The name of the init or rc script used to manage t... | def running(name,
enable=None,
sig=None,
init_delay=None,
no_block=False,
unmask=False,
unmask_runtime=False,
**kwargs):
'''
Ensure that the service is running
name
The name of the init or rc script used to manage t... | [
"Ensure",
"that",
"the",
"service",
"is",
"running"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/service.py#L338-L514 | [
"def",
"running",
"(",
"name",
",",
"enable",
"=",
"None",
",",
"sig",
"=",
"None",
",",
"init_delay",
"=",
"None",
",",
"no_block",
"=",
"False",
",",
"unmask",
"=",
"False",
",",
"unmask_runtime",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | dead | Ensure that the named service is dead by stopping the service if it is running
name
The name of the init or rc script used to manage the service
enable
Set the service to be enabled at boot time, ``True`` sets the service
to be enabled, ``False`` sets the named service to be disabled. ... | salt/states/service.py | def dead(name,
enable=None,
sig=None,
init_delay=None,
**kwargs):
'''
Ensure that the named service is dead by stopping the service if it is running
name
The name of the init or rc script used to manage the service
enable
Set the service to be enable... | def dead(name,
enable=None,
sig=None,
init_delay=None,
**kwargs):
'''
Ensure that the named service is dead by stopping the service if it is running
name
The name of the init or rc script used to manage the service
enable
Set the service to be enable... | [
"Ensure",
"that",
"the",
"named",
"service",
"is",
"dead",
"by",
"stopping",
"the",
"service",
"if",
"it",
"is",
"running"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/service.py#L517-L651 | [
"def",
"dead",
"(",
"name",
",",
"enable",
"=",
"None",
",",
"sig",
"=",
"None",
",",
"init_delay",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | enabled | Ensure that the service is enabled on boot, only use this state if you
don't want to manage the running process, remember that if you want to
enable a running service to use the enable: True option for the running
or dead function.
name
The name of the init or rc script used to manage the servi... | salt/states/service.py | def enabled(name,
skip_verify=False,
**kwargs):
'''
Ensure that the service is enabled on boot, only use this state if you
don't want to manage the running process, remember that if you want to
enable a running service to use the enable: True option for the running
or dead fu... | def enabled(name,
skip_verify=False,
**kwargs):
'''
Ensure that the service is enabled on boot, only use this state if you
don't want to manage the running process, remember that if you want to
enable a running service to use the enable: True option for the running
or dead fu... | [
"Ensure",
"that",
"the",
"service",
"is",
"enabled",
"on",
"boot",
"only",
"use",
"this",
"state",
"if",
"you",
"don",
"t",
"want",
"to",
"manage",
"the",
"running",
"process",
"remember",
"that",
"if",
"you",
"want",
"to",
"enable",
"a",
"running",
"ser... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/service.py#L654-L677 | [
"def",
"enabled",
"(",
"name",
",",
"skip_verify",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"ret",
".... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | disabled | Ensure that the service is disabled on boot, only use this state if you
don't want to manage the running process, remember that if you want to
disable a service to use the enable: False option for the running or dead
function.
name
The name of the init or rc script used to manage the service
... | salt/states/service.py | def disabled(name,
skip_verify=False,
**kwargs):
'''
Ensure that the service is disabled on boot, only use this state if you
don't want to manage the running process, remember that if you want to
disable a service to use the enable: False option for the running or dead
funct... | def disabled(name,
skip_verify=False,
**kwargs):
'''
Ensure that the service is disabled on boot, only use this state if you
don't want to manage the running process, remember that if you want to
disable a service to use the enable: False option for the running or dead
funct... | [
"Ensure",
"that",
"the",
"service",
"is",
"disabled",
"on",
"boot",
"only",
"use",
"this",
"state",
"if",
"you",
"don",
"t",
"want",
"to",
"manage",
"the",
"running",
"process",
"remember",
"that",
"if",
"you",
"want",
"to",
"disable",
"a",
"service",
"t... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/service.py#L680-L703 | [
"def",
"disabled",
"(",
"name",
",",
"skip_verify",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"ret",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | masked | .. versionadded:: 2017.7.0
.. note::
This state is only available on minions which use systemd_.
Ensures that the named service is masked (i.e. prevented from being
started).
name
Name of the service to mask
runtime : False
By default, this state will manage an indefinite... | salt/states/service.py | def masked(name, runtime=False):
'''
.. versionadded:: 2017.7.0
.. note::
This state is only available on minions which use systemd_.
Ensures that the named service is masked (i.e. prevented from being
started).
name
Name of the service to mask
runtime : False
By ... | def masked(name, runtime=False):
'''
.. versionadded:: 2017.7.0
.. note::
This state is only available on minions which use systemd_.
Ensures that the named service is masked (i.e. prevented from being
started).
name
Name of the service to mask
runtime : False
By ... | [
"..",
"versionadded",
"::",
"2017",
".",
"7",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/service.py#L706-L788 | [
"def",
"masked",
"(",
"name",
",",
"runtime",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"if",
"'service.masked'",
"not",
"in",
"_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | mod_watch | The service watcher, called to invoke the watch command.
When called, it will restart or reload the named service.
.. note::
This state exists to support special handling of the ``watch``
:ref:`requisite <requisites>`. It should not be called directly.
Parameters for this function shou... | salt/states/service.py | def mod_watch(name,
sfun=None,
sig=None,
full_restart=False,
init_delay=None,
force=False,
**kwargs):
'''
The service watcher, called to invoke the watch command.
When called, it will restart or reload the named service.
... | def mod_watch(name,
sfun=None,
sig=None,
full_restart=False,
init_delay=None,
force=False,
**kwargs):
'''
The service watcher, called to invoke the watch command.
When called, it will restart or reload the named service.
... | [
"The",
"service",
"watcher",
"called",
"to",
"invoke",
"the",
"watch",
"command",
".",
"When",
"called",
"it",
"will",
"restart",
"or",
"reload",
"the",
"named",
"service",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/service.py#L858-L1002 | [
"def",
"mod_watch",
"(",
"name",
",",
"sfun",
"=",
"None",
",",
"sig",
"=",
"None",
",",
"full_restart",
"=",
"False",
",",
"init_delay",
"=",
"None",
",",
"force",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"reload_",
"=",
"kwargs",
".",
"po... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | recv | Used with salt-cp, pass the files dict, and the destination.
This function receives small fast copy files from the master via salt-cp.
It does not work via the CLI. | salt/modules/cp.py | def recv(files, dest):
'''
Used with salt-cp, pass the files dict, and the destination.
This function receives small fast copy files from the master via salt-cp.
It does not work via the CLI.
'''
ret = {}
for path, data in six.iteritems(files):
if os.path.basename(path) == os.path.b... | def recv(files, dest):
'''
Used with salt-cp, pass the files dict, and the destination.
This function receives small fast copy files from the master via salt-cp.
It does not work via the CLI.
'''
ret = {}
for path, data in six.iteritems(files):
if os.path.basename(path) == os.path.b... | [
"Used",
"with",
"salt",
"-",
"cp",
"pass",
"the",
"files",
"dict",
"and",
"the",
"destination",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cp.py#L63-L89 | [
"def",
"recv",
"(",
"files",
",",
"dest",
")",
":",
"ret",
"=",
"{",
"}",
"for",
"path",
",",
"data",
"in",
"six",
".",
"iteritems",
"(",
"files",
")",
":",
"if",
"os",
".",
"path",
".",
"basename",
"(",
"path",
")",
"==",
"os",
".",
"path",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | recv_chunked | This function receives files copied to the minion using ``salt-cp`` and is
not intended to be used directly on the CLI. | salt/modules/cp.py | def recv_chunked(dest, chunk, append=False, compressed=True, mode=None):
'''
This function receives files copied to the minion using ``salt-cp`` and is
not intended to be used directly on the CLI.
'''
if 'retcode' not in __context__:
__context__['retcode'] = 0
def _error(msg):
_... | def recv_chunked(dest, chunk, append=False, compressed=True, mode=None):
'''
This function receives files copied to the minion using ``salt-cp`` and is
not intended to be used directly on the CLI.
'''
if 'retcode' not in __context__:
__context__['retcode'] = 0
def _error(msg):
_... | [
"This",
"function",
"receives",
"files",
"copied",
"to",
"the",
"minion",
"using",
"salt",
"-",
"cp",
"and",
"is",
"not",
"intended",
"to",
"be",
"used",
"directly",
"on",
"the",
"CLI",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cp.py#L92-L154 | [
"def",
"recv_chunked",
"(",
"dest",
",",
"chunk",
",",
"append",
"=",
"False",
",",
"compressed",
"=",
"True",
",",
"mode",
"=",
"None",
")",
":",
"if",
"'retcode'",
"not",
"in",
"__context__",
":",
"__context__",
"[",
"'retcode'",
"]",
"=",
"0",
"def"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _mk_client | Create a file client and add it to the context.
Each file client needs to correspond to a unique copy
of the opts dictionary, therefore it's hashed by the
id of the __opts__ dict | salt/modules/cp.py | def _mk_client():
'''
Create a file client and add it to the context.
Each file client needs to correspond to a unique copy
of the opts dictionary, therefore it's hashed by the
id of the __opts__ dict
'''
if 'cp.fileclient_{0}'.format(id(__opts__)) not in __context__:
__context__['c... | def _mk_client():
'''
Create a file client and add it to the context.
Each file client needs to correspond to a unique copy
of the opts dictionary, therefore it's hashed by the
id of the __opts__ dict
'''
if 'cp.fileclient_{0}'.format(id(__opts__)) not in __context__:
__context__['c... | [
"Create",
"a",
"file",
"client",
"and",
"add",
"it",
"to",
"the",
"context",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cp.py#L157-L167 | [
"def",
"_mk_client",
"(",
")",
":",
"if",
"'cp.fileclient_{0}'",
".",
"format",
"(",
"id",
"(",
"__opts__",
")",
")",
"not",
"in",
"__context__",
":",
"__context__",
"[",
"'cp.fileclient_{0}'",
".",
"format",
"(",
"id",
"(",
"__opts__",
")",
")",
"]",
"=... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_file | .. versionchanged:: 2018.3.0
``dest`` can now be a directory
Used to get a single file from the salt master
CLI Example:
.. code-block:: bash
salt '*' cp.get_file salt://path/to/file /minion/dest
Template rendering can be enabled on both the source and destination file
names lik... | salt/modules/cp.py | def get_file(path,
dest,
saltenv='base',
makedirs=False,
template=None,
gzip=None,
**kwargs):
'''
.. versionchanged:: 2018.3.0
``dest`` can now be a directory
Used to get a single file from the salt master
CLI Exampl... | def get_file(path,
dest,
saltenv='base',
makedirs=False,
template=None,
gzip=None,
**kwargs):
'''
.. versionchanged:: 2018.3.0
``dest`` can now be a directory
Used to get a single file from the salt master
CLI Exampl... | [
"..",
"versionchanged",
"::",
"2018",
".",
"3",
".",
"0",
"dest",
"can",
"now",
"be",
"a",
"directory"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cp.py#L235-L301 | [
"def",
"get_file",
"(",
"path",
",",
"dest",
",",
"saltenv",
"=",
"'base'",
",",
"makedirs",
"=",
"False",
",",
"template",
"=",
"None",
",",
"gzip",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"(",
"path",
",",
"dest",
")",
"=",
"_render_filen... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_template | Render a file as a template before setting it down.
Warning, order is not the same as in fileclient.cp for
non breaking old API.
CLI Example:
.. code-block:: bash
salt '*' cp.get_template salt://path/to/template /minion/dest | salt/modules/cp.py | def get_template(path,
dest,
template='jinja',
saltenv='base',
makedirs=False,
**kwargs):
'''
Render a file as a template before setting it down.
Warning, order is not the same as in fileclient.cp for
non breaking old A... | def get_template(path,
dest,
template='jinja',
saltenv='base',
makedirs=False,
**kwargs):
'''
Render a file as a template before setting it down.
Warning, order is not the same as in fileclient.cp for
non breaking old A... | [
"Render",
"a",
"file",
"as",
"a",
"template",
"before",
"setting",
"it",
"down",
".",
"Warning",
"order",
"is",
"not",
"the",
"same",
"as",
"in",
"fileclient",
".",
"cp",
"for",
"non",
"breaking",
"old",
"API",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cp.py#L317-L348 | [
"def",
"get_template",
"(",
"path",
",",
"dest",
",",
"template",
"=",
"'jinja'",
",",
"saltenv",
"=",
"'base'",
",",
"makedirs",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'salt'",
"not",
"in",
"kwargs",
":",
"kwargs",
"[",
"'salt'",
"]... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_dir | Used to recursively copy a directory from the salt master
CLI Example:
.. code-block:: bash
salt '*' cp.get_dir salt://path/to/dir/ /minion/dest
get_dir supports the same template and gzip arguments as get_file. | salt/modules/cp.py | def get_dir(path, dest, saltenv='base', template=None, gzip=None, **kwargs):
'''
Used to recursively copy a directory from the salt master
CLI Example:
.. code-block:: bash
salt '*' cp.get_dir salt://path/to/dir/ /minion/dest
get_dir supports the same template and gzip arguments as get_f... | def get_dir(path, dest, saltenv='base', template=None, gzip=None, **kwargs):
'''
Used to recursively copy a directory from the salt master
CLI Example:
.. code-block:: bash
salt '*' cp.get_dir salt://path/to/dir/ /minion/dest
get_dir supports the same template and gzip arguments as get_f... | [
"Used",
"to",
"recursively",
"copy",
"a",
"directory",
"from",
"the",
"salt",
"master"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cp.py#L351-L365 | [
"def",
"get_dir",
"(",
"path",
",",
"dest",
",",
"saltenv",
"=",
"'base'",
",",
"template",
"=",
"None",
",",
"gzip",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"(",
"path",
",",
"dest",
")",
"=",
"_render_filenames",
"(",
"path",
",",
"dest",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_url | .. versionchanged:: 2018.3.0
``dest`` can now be a directory
Used to get a single file from a URL.
path
A URL to download a file from. Supported URL schemes are: ``salt://``,
``http://``, ``https://``, ``ftp://``, ``s3://``, ``swift://`` and
``file://`` (local filesystem). If n... | salt/modules/cp.py | def get_url(path, dest='', saltenv='base', makedirs=False, source_hash=None):
'''
.. versionchanged:: 2018.3.0
``dest`` can now be a directory
Used to get a single file from a URL.
path
A URL to download a file from. Supported URL schemes are: ``salt://``,
``http://``, ``https:... | def get_url(path, dest='', saltenv='base', makedirs=False, source_hash=None):
'''
.. versionchanged:: 2018.3.0
``dest`` can now be a directory
Used to get a single file from a URL.
path
A URL to download a file from. Supported URL schemes are: ``salt://``,
``http://``, ``https:... | [
"..",
"versionchanged",
"::",
"2018",
".",
"3",
".",
"0",
"dest",
"can",
"now",
"be",
"a",
"directory"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cp.py#L368-L426 | [
"def",
"get_url",
"(",
"path",
",",
"dest",
"=",
"''",
",",
"saltenv",
"=",
"'base'",
",",
"makedirs",
"=",
"False",
",",
"source_hash",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"dest",
",",
"six",
".",
"string_types",
")",
":",
"result",
"=",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_file_str | Download a file from a URL to the Minion cache directory and return the
contents of that file
Returns ``False`` if Salt was unable to cache a file from a URL.
CLI Example:
.. code-block:: bash
salt '*' cp.get_file_str salt://my/file | salt/modules/cp.py | def get_file_str(path, saltenv='base'):
'''
Download a file from a URL to the Minion cache directory and return the
contents of that file
Returns ``False`` if Salt was unable to cache a file from a URL.
CLI Example:
.. code-block:: bash
salt '*' cp.get_file_str salt://my/file
'''... | def get_file_str(path, saltenv='base'):
'''
Download a file from a URL to the Minion cache directory and return the
contents of that file
Returns ``False`` if Salt was unable to cache a file from a URL.
CLI Example:
.. code-block:: bash
salt '*' cp.get_file_str salt://my/file
'''... | [
"Download",
"a",
"file",
"from",
"a",
"URL",
"to",
"the",
"Minion",
"cache",
"directory",
"and",
"return",
"the",
"contents",
"of",
"that",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cp.py#L429-L449 | [
"def",
"get_file_str",
"(",
"path",
",",
"saltenv",
"=",
"'base'",
")",
":",
"fn_",
"=",
"cache_file",
"(",
"path",
",",
"saltenv",
")",
"if",
"isinstance",
"(",
"fn_",
",",
"six",
".",
"string_types",
")",
":",
"try",
":",
"with",
"salt",
".",
"util... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | cache_file | Used to cache a single file on the Minion
Returns the location of the new cached file on the Minion
source_hash
If ``name`` is an http(s) or ftp URL and the file exists in the
minion's file cache, this option can be passed to keep the minion from
re-downloading the file if the cached c... | salt/modules/cp.py | def cache_file(path, saltenv='base', source_hash=None):
'''
Used to cache a single file on the Minion
Returns the location of the new cached file on the Minion
source_hash
If ``name`` is an http(s) or ftp URL and the file exists in the
minion's file cache, this option can be passed to ... | def cache_file(path, saltenv='base', source_hash=None):
'''
Used to cache a single file on the Minion
Returns the location of the new cached file on the Minion
source_hash
If ``name`` is an http(s) or ftp URL and the file exists in the
minion's file cache, this option can be passed to ... | [
"Used",
"to",
"cache",
"a",
"single",
"file",
"on",
"the",
"Minion"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cp.py#L452-L525 | [
"def",
"cache_file",
"(",
"path",
",",
"saltenv",
"=",
"'base'",
",",
"source_hash",
"=",
"None",
")",
":",
"path",
"=",
"salt",
".",
"utils",
".",
"data",
".",
"decode",
"(",
"path",
")",
"saltenv",
"=",
"salt",
".",
"utils",
".",
"data",
".",
"de... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | cache_dir | Download and cache everything under a directory from the master
include_pat : None
Glob or regex to narrow down the files cached from the given path. If
matching with a regex, the regex must be prefixed with ``E@``,
otherwise the expression will be interpreted as a glob.
.. versio... | salt/modules/cp.py | def cache_dir(path, saltenv='base', include_empty=False, include_pat=None,
exclude_pat=None):
'''
Download and cache everything under a directory from the master
include_pat : None
Glob or regex to narrow down the files cached from the given path. If
matching with a regex, th... | def cache_dir(path, saltenv='base', include_empty=False, include_pat=None,
exclude_pat=None):
'''
Download and cache everything under a directory from the master
include_pat : None
Glob or regex to narrow down the files cached from the given path. If
matching with a regex, th... | [
"Download",
"and",
"cache",
"everything",
"under",
"a",
"directory",
"from",
"the",
"master"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cp.py#L590-L625 | [
"def",
"cache_dir",
"(",
"path",
",",
"saltenv",
"=",
"'base'",
",",
"include_empty",
"=",
"False",
",",
"include_pat",
"=",
"None",
",",
"exclude_pat",
"=",
"None",
")",
":",
"return",
"_client",
"(",
")",
".",
"cache_dir",
"(",
"path",
",",
"saltenv",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | cache_local_file | Cache a local file on the minion in the localfiles cache
CLI Example:
.. code-block:: bash
salt '*' cp.cache_local_file /etc/hosts | salt/modules/cp.py | def cache_local_file(path):
'''
Cache a local file on the minion in the localfiles cache
CLI Example:
.. code-block:: bash
salt '*' cp.cache_local_file /etc/hosts
'''
if not os.path.exists(path):
return ''
path_cached = is_cached(path)
# If the file has already been ... | def cache_local_file(path):
'''
Cache a local file on the minion in the localfiles cache
CLI Example:
.. code-block:: bash
salt '*' cp.cache_local_file /etc/hosts
'''
if not os.path.exists(path):
return ''
path_cached = is_cached(path)
# If the file has already been ... | [
"Cache",
"a",
"local",
"file",
"on",
"the",
"minion",
"in",
"the",
"localfiles",
"cache"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cp.py#L641-L665 | [
"def",
"cache_local_file",
"(",
"path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"return",
"''",
"path_cached",
"=",
"is_cached",
"(",
"path",
")",
"# If the file has already been cached, return the path",
"if",
"path_cache... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | hash_file | Return the hash of a file, to get the hash of a file on the
salt master file server prepend the path with salt://<file on server>
otherwise, prepend the file with / for a local file.
CLI Example:
.. code-block:: bash
salt '*' cp.hash_file salt://path/to/file | salt/modules/cp.py | def hash_file(path, saltenv='base'):
'''
Return the hash of a file, to get the hash of a file on the
salt master file server prepend the path with salt://<file on server>
otherwise, prepend the file with / for a local file.
CLI Example:
.. code-block:: bash
salt '*' cp.hash_file salt:... | def hash_file(path, saltenv='base'):
'''
Return the hash of a file, to get the hash of a file on the
salt master file server prepend the path with salt://<file on server>
otherwise, prepend the file with / for a local file.
CLI Example:
.. code-block:: bash
salt '*' cp.hash_file salt:... | [
"Return",
"the",
"hash",
"of",
"a",
"file",
"to",
"get",
"the",
"hash",
"of",
"a",
"file",
"on",
"the",
"salt",
"master",
"file",
"server",
"prepend",
"the",
"path",
"with",
"salt",
":",
"//",
"<file",
"on",
"server",
">",
"otherwise",
"prepend",
"the"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cp.py#L747-L763 | [
"def",
"hash_file",
"(",
"path",
",",
"saltenv",
"=",
"'base'",
")",
":",
"path",
",",
"senv",
"=",
"salt",
".",
"utils",
".",
"url",
".",
"split_env",
"(",
"path",
")",
"if",
"senv",
":",
"saltenv",
"=",
"senv",
"return",
"_client",
"(",
")",
".",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | stat_file | Return the permissions of a file, to get the permissions of a file on the
salt master file server prepend the path with salt://<file on server>
otherwise, prepend the file with / for a local file.
CLI Example:
.. code-block:: bash
salt '*' cp.stat_file salt://path/to/file | salt/modules/cp.py | def stat_file(path, saltenv='base', octal=True):
'''
Return the permissions of a file, to get the permissions of a file on the
salt master file server prepend the path with salt://<file on server>
otherwise, prepend the file with / for a local file.
CLI Example:
.. code-block:: bash
s... | def stat_file(path, saltenv='base', octal=True):
'''
Return the permissions of a file, to get the permissions of a file on the
salt master file server prepend the path with salt://<file on server>
otherwise, prepend the file with / for a local file.
CLI Example:
.. code-block:: bash
s... | [
"Return",
"the",
"permissions",
"of",
"a",
"file",
"to",
"get",
"the",
"permissions",
"of",
"a",
"file",
"on",
"the",
"salt",
"master",
"file",
"server",
"prepend",
"the",
"path",
"with",
"salt",
":",
"//",
"<file",
"on",
"server",
">",
"otherwise",
"pre... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cp.py#L766-L785 | [
"def",
"stat_file",
"(",
"path",
",",
"saltenv",
"=",
"'base'",
",",
"octal",
"=",
"True",
")",
":",
"path",
",",
"senv",
"=",
"salt",
".",
"utils",
".",
"url",
".",
"split_env",
"(",
"path",
")",
"if",
"senv",
":",
"saltenv",
"=",
"senv",
"stat",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | push | WARNING Files pushed to the master will have global read permissions..
Push a file from the minion up to the master, the file will be saved to
the salt master in the master's minion files cachedir
(defaults to ``/var/cache/salt/master/minions/minion-id/files``)
Since this feature allows a minion to pu... | salt/modules/cp.py | def push(path, keep_symlinks=False, upload_path=None, remove_source=False):
'''
WARNING Files pushed to the master will have global read permissions..
Push a file from the minion up to the master, the file will be saved to
the salt master in the master's minion files cachedir
(defaults to ``/var/ca... | def push(path, keep_symlinks=False, upload_path=None, remove_source=False):
'''
WARNING Files pushed to the master will have global read permissions..
Push a file from the minion up to the master, the file will be saved to
the salt master in the master's minion files cachedir
(defaults to ``/var/ca... | [
"WARNING",
"Files",
"pushed",
"to",
"the",
"master",
"will",
"have",
"global",
"read",
"permissions",
".."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cp.py#L788-L880 | [
"def",
"push",
"(",
"path",
",",
"keep_symlinks",
"=",
"False",
",",
"upload_path",
"=",
"None",
",",
"remove_source",
"=",
"False",
")",
":",
"log",
".",
"debug",
"(",
"'Trying to copy \\'%s\\' to master'",
",",
"path",
")",
"if",
"'../'",
"in",
"path",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | push_dir | Push a directory from the minion up to the master, the files will be saved
to the salt master in the master's minion files cachedir (defaults to
``/var/cache/salt/master/minions/minion-id/files``). It also has a glob
for matching specific files using globbing.
.. versionadded:: 2014.7.0
Since thi... | salt/modules/cp.py | def push_dir(path, glob=None, upload_path=None):
'''
Push a directory from the minion up to the master, the files will be saved
to the salt master in the master's minion files cachedir (defaults to
``/var/cache/salt/master/minions/minion-id/files``). It also has a glob
for matching specific files u... | def push_dir(path, glob=None, upload_path=None):
'''
Push a directory from the minion up to the master, the files will be saved
to the salt master in the master's minion files cachedir (defaults to
``/var/cache/salt/master/minions/minion-id/files``). It also has a glob
for matching specific files u... | [
"Push",
"a",
"directory",
"from",
"the",
"minion",
"up",
"to",
"the",
"master",
"the",
"files",
"will",
"be",
"saved",
"to",
"the",
"salt",
"master",
"in",
"the",
"master",
"s",
"minion",
"files",
"cachedir",
"(",
"defaults",
"to",
"/",
"var",
"/",
"ca... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cp.py#L883-L931 | [
"def",
"push_dir",
"(",
"path",
",",
"glob",
"=",
"None",
",",
"upload_path",
"=",
"None",
")",
":",
"if",
"'../'",
"in",
"path",
"or",
"not",
"os",
".",
"path",
".",
"isabs",
"(",
"path",
")",
":",
"return",
"False",
"tmpupload_path",
"=",
"upload_p... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | present | Ensure image exists and is up-to-date
name
Name of the image
enabled
Boolean to control if image is enabled
description
An arbitrary description of the image | salt/states/glance_image.py | def present(name, auth=None, **kwargs):
'''
Ensure image exists and is up-to-date
name
Name of the image
enabled
Boolean to control if image is enabled
description
An arbitrary description of the image
'''
ret = {'name': name,
'changes': {},
'... | def present(name, auth=None, **kwargs):
'''
Ensure image exists and is up-to-date
name
Name of the image
enabled
Boolean to control if image is enabled
description
An arbitrary description of the image
'''
ret = {'name': name,
'changes': {},
'... | [
"Ensure",
"image",
"exists",
"and",
"is",
"up",
"-",
"to",
"-",
"date"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/glance_image.py#L37-L75 | [
"def",
"present",
"(",
"name",
",",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"kwargs",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _merge_keys | The log_config is a mixture of the CLI options --log-driver and --log-opt
(which we support in Salt as log_driver and log_opt, respectively), but it
must be submitted to the host config in the format {'Type': log_driver,
'Config': log_opt}. So, we need to construct this argument to be passed to
the API ... | salt/utils/docker/translate/container.py | def _merge_keys(kwargs):
'''
The log_config is a mixture of the CLI options --log-driver and --log-opt
(which we support in Salt as log_driver and log_opt, respectively), but it
must be submitted to the host config in the format {'Type': log_driver,
'Config': log_opt}. So, we need to construct this ... | def _merge_keys(kwargs):
'''
The log_config is a mixture of the CLI options --log-driver and --log-opt
(which we support in Salt as log_driver and log_opt, respectively), but it
must be submitted to the host config in the format {'Type': log_driver,
'Config': log_opt}. So, we need to construct this ... | [
"The",
"log_config",
"is",
"a",
"mixture",
"of",
"the",
"CLI",
"options",
"--",
"log",
"-",
"driver",
"and",
"--",
"log",
"-",
"opt",
"(",
"which",
"we",
"support",
"in",
"Salt",
"as",
"log_driver",
"and",
"log_opt",
"respectively",
")",
"but",
"it",
"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/docker/translate/container.py#L44-L64 | [
"def",
"_merge_keys",
"(",
"kwargs",
")",
":",
"log_driver",
"=",
"kwargs",
".",
"pop",
"(",
"'log_driver'",
",",
"helpers",
".",
"NOTSET",
")",
"log_opt",
"=",
"kwargs",
".",
"pop",
"(",
"'log_opt'",
",",
"helpers",
".",
"NOTSET",
")",
"if",
"'log_confi... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _post_processing | Additional container-specific post-translation processing | salt/utils/docker/translate/container.py | def _post_processing(kwargs, skip_translate, invalid):
'''
Additional container-specific post-translation processing
'''
# Don't allow conflicting options to be set
if kwargs.get('port_bindings') is not None \
and kwargs.get('publish_all_ports'):
kwargs.pop('port_bindings')
... | def _post_processing(kwargs, skip_translate, invalid):
'''
Additional container-specific post-translation processing
'''
# Don't allow conflicting options to be set
if kwargs.get('port_bindings') is not None \
and kwargs.get('publish_all_ports'):
kwargs.pop('port_bindings')
... | [
"Additional",
"container",
"-",
"specific",
"post",
"-",
"translation",
"processing"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/docker/translate/container.py#L67-L137 | [
"def",
"_post_processing",
"(",
"kwargs",
",",
"skip_translate",
",",
"invalid",
")",
":",
"# Don't allow conflicting options to be set",
"if",
"kwargs",
".",
"get",
"(",
"'port_bindings'",
")",
"is",
"not",
"None",
"and",
"kwargs",
".",
"get",
"(",
"'publish_all_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | binds | On the CLI, these are passed as multiple instances of a given CLI option.
In Salt, we accept these as a comma-delimited list but the API expects a
Python list. | salt/utils/docker/translate/container.py | def binds(val, **kwargs): # pylint: disable=unused-argument
'''
On the CLI, these are passed as multiple instances of a given CLI option.
In Salt, we accept these as a comma-delimited list but the API expects a
Python list.
'''
if not isinstance(val, dict):
if not isinstance(val, list):... | def binds(val, **kwargs): # pylint: disable=unused-argument
'''
On the CLI, these are passed as multiple instances of a given CLI option.
In Salt, we accept these as a comma-delimited list but the API expects a
Python list.
'''
if not isinstance(val, dict):
if not isinstance(val, list):... | [
"On",
"the",
"CLI",
"these",
"are",
"passed",
"as",
"multiple",
"instances",
"of",
"a",
"given",
"CLI",
"option",
".",
"In",
"Salt",
"we",
"accept",
"these",
"as",
"a",
"comma",
"-",
"delimited",
"list",
"but",
"the",
"API",
"expects",
"a",
"Python",
"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/docker/translate/container.py#L145-L160 | [
"def",
"binds",
"(",
"val",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"if",
"not",
"isinstance",
"(",
"val",
",",
"dict",
")",
":",
"if",
"not",
"isinstance",
"(",
"val",
",",
"list",
")",
":",
"try",
":",
"val",
"=",
"h... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | blkio_weight_device | CLI input is a list of PATH:WEIGHT pairs, but the API expects a list of
dictionaries in the format [{'Path': path, 'Weight': weight}] | salt/utils/docker/translate/container.py | def blkio_weight_device(val, **kwargs): # pylint: disable=unused-argument
'''
CLI input is a list of PATH:WEIGHT pairs, but the API expects a list of
dictionaries in the format [{'Path': path, 'Weight': weight}]
'''
val = helpers.map_vals(val, 'Path', 'Weight')
for idx in range(len(val)):
... | def blkio_weight_device(val, **kwargs): # pylint: disable=unused-argument
'''
CLI input is a list of PATH:WEIGHT pairs, but the API expects a list of
dictionaries in the format [{'Path': path, 'Weight': weight}]
'''
val = helpers.map_vals(val, 'Path', 'Weight')
for idx in range(len(val)):
... | [
"CLI",
"input",
"is",
"a",
"list",
"of",
"PATH",
":",
"WEIGHT",
"pairs",
"but",
"the",
"API",
"expects",
"a",
"list",
"of",
"dictionaries",
"in",
"the",
"format",
"[",
"{",
"Path",
":",
"path",
"Weight",
":",
"weight",
"}",
"]"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/docker/translate/container.py#L167-L181 | [
"def",
"blkio_weight_device",
"(",
"val",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"val",
"=",
"helpers",
".",
"map_vals",
"(",
"val",
",",
"'Path'",
",",
"'Weight'",
")",
"for",
"idx",
"in",
"range",
"(",
"len",
"(",
"val",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | port_bindings | On the CLI, these are passed as multiple instances of a given CLI option.
In Salt, we accept these as a comma-delimited list but the API expects a
Python dictionary mapping ports to their bindings. The format the API
expects is complicated depending on whether or not the external port maps
to a differen... | salt/utils/docker/translate/container.py | def port_bindings(val, **kwargs):
'''
On the CLI, these are passed as multiple instances of a given CLI option.
In Salt, we accept these as a comma-delimited list but the API expects a
Python dictionary mapping ports to their bindings. The format the API
expects is complicated depending on whether o... | def port_bindings(val, **kwargs):
'''
On the CLI, these are passed as multiple instances of a given CLI option.
In Salt, we accept these as a comma-delimited list but the API expects a
Python dictionary mapping ports to their bindings. The format the API
expects is complicated depending on whether o... | [
"On",
"the",
"CLI",
"these",
"are",
"passed",
"as",
"multiple",
"instances",
"of",
"a",
"given",
"CLI",
"option",
".",
"In",
"Salt",
"we",
"accept",
"these",
"as",
"a",
"comma",
"-",
"delimited",
"list",
"but",
"the",
"API",
"expects",
"a",
"Python",
"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/docker/translate/container.py#L360-L514 | [
"def",
"port_bindings",
"(",
"val",
",",
"*",
"*",
"kwargs",
")",
":",
"validate_ip_addrs",
"=",
"kwargs",
".",
"get",
"(",
"'validate_ip_addrs'",
",",
"True",
")",
"if",
"not",
"isinstance",
"(",
"val",
",",
"dict",
")",
":",
"if",
"not",
"isinstance",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ports | Like cap_add, cap_drop, etc., this option can be specified multiple times,
and each time can be a port number or port range. Ultimately, the API
expects a list, but elements in the list are ints when the port is TCP, and
a tuple (port_num, 'udp') when the port is UDP. | salt/utils/docker/translate/container.py | def ports(val, **kwargs): # pylint: disable=unused-argument
'''
Like cap_add, cap_drop, etc., this option can be specified multiple times,
and each time can be a port number or port range. Ultimately, the API
expects a list, but elements in the list are ints when the port is TCP, and
a tuple (port_... | def ports(val, **kwargs): # pylint: disable=unused-argument
'''
Like cap_add, cap_drop, etc., this option can be specified multiple times,
and each time can be a port number or port range. Ultimately, the API
expects a list, but elements in the list are ints when the port is TCP, and
a tuple (port_... | [
"Like",
"cap_add",
"cap_drop",
"etc",
".",
"this",
"option",
"can",
"be",
"specified",
"multiple",
"times",
"and",
"each",
"time",
"can",
"be",
"a",
"port",
"number",
"or",
"port",
"range",
".",
"Ultimately",
"the",
"API",
"expects",
"a",
"list",
"but",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/docker/translate/container.py#L517-L554 | [
"def",
"ports",
"(",
"val",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"if",
"not",
"isinstance",
"(",
"val",
",",
"list",
")",
":",
"try",
":",
"val",
"=",
"helpers",
".",
"split",
"(",
"val",
")",
"except",
"AttributeError"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | restart_policy | CLI input is in the format NAME[:RETRY_COUNT] but the API expects {'Name':
name, 'MaximumRetryCount': retry_count}. We will use the 'fill' kwarg here
to make sure the mapped result uses '0' for the count if this optional
value was omitted. | salt/utils/docker/translate/container.py | def restart_policy(val, **kwargs): # pylint: disable=unused-argument
'''
CLI input is in the format NAME[:RETRY_COUNT] but the API expects {'Name':
name, 'MaximumRetryCount': retry_count}. We will use the 'fill' kwarg here
to make sure the mapped result uses '0' for the count if this optional
value... | def restart_policy(val, **kwargs): # pylint: disable=unused-argument
'''
CLI input is in the format NAME[:RETRY_COUNT] but the API expects {'Name':
name, 'MaximumRetryCount': retry_count}. We will use the 'fill' kwarg here
to make sure the mapped result uses '0' for the count if this optional
value... | [
"CLI",
"input",
"is",
"in",
"the",
"format",
"NAME",
"[",
":",
"RETRY_COUNT",
"]",
"but",
"the",
"API",
"expects",
"{",
"Name",
":",
"name",
"MaximumRetryCount",
":",
"retry_count",
"}",
".",
"We",
"will",
"use",
"the",
"fill",
"kwarg",
"here",
"to",
"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/docker/translate/container.py#L569-L597 | [
"def",
"restart_policy",
"(",
"val",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"val",
"=",
"helpers",
".",
"map_vals",
"(",
"val",
",",
"'Name'",
",",
"'MaximumRetryCount'",
",",
"fill",
"=",
"'0'",
")",
"# map_vals() converts the i... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | user | This can be either a string or a numeric uid | salt/utils/docker/translate/container.py | def user(val, **kwargs): # pylint: disable=unused-argument
'''
This can be either a string or a numeric uid
'''
if not isinstance(val, six.integer_types):
# Try to convert to integer. This will fail if the value is a
# username. This is OK, as we check below to make sure that the
... | def user(val, **kwargs): # pylint: disable=unused-argument
'''
This can be either a string or a numeric uid
'''
if not isinstance(val, six.integer_types):
# Try to convert to integer. This will fail if the value is a
# username. This is OK, as we check below to make sure that the
... | [
"This",
"can",
"be",
"either",
"a",
"string",
"or",
"a",
"numeric",
"uid"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/docker/translate/container.py#L665-L683 | [
"def",
"user",
"(",
"val",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"if",
"not",
"isinstance",
"(",
"val",
",",
"six",
".",
"integer_types",
")",
":",
"# Try to convert to integer. This will fail if the value is a",
"# username. This is OK... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | volumes | Should be a list of absolute paths | salt/utils/docker/translate/container.py | def volumes(val, **kwargs): # pylint: disable=unused-argument
'''
Should be a list of absolute paths
'''
val = helpers.translate_stringlist(val)
for item in val:
if not os.path.isabs(item):
raise SaltInvocationError(
'\'{0}\' is not an absolute path'.format(item)... | def volumes(val, **kwargs): # pylint: disable=unused-argument
'''
Should be a list of absolute paths
'''
val = helpers.translate_stringlist(val)
for item in val:
if not os.path.isabs(item):
raise SaltInvocationError(
'\'{0}\' is not an absolute path'.format(item)... | [
"Should",
"be",
"a",
"list",
"of",
"absolute",
"paths"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/docker/translate/container.py#L694-L704 | [
"def",
"volumes",
"(",
"val",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"val",
"=",
"helpers",
".",
"translate_stringlist",
"(",
"val",
")",
"for",
"item",
"in",
"val",
":",
"if",
"not",
"os",
".",
"path",
".",
"isabs",
"(",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | working_dir | Must be an absolute path | salt/utils/docker/translate/container.py | def working_dir(val, **kwargs): # pylint: disable=unused-argument
'''
Must be an absolute path
'''
try:
is_abs = os.path.isabs(val)
except AttributeError:
is_abs = False
if not is_abs:
raise SaltInvocationError('\'{0}\' is not an absolute path'.format(val))
return va... | def working_dir(val, **kwargs): # pylint: disable=unused-argument
'''
Must be an absolute path
'''
try:
is_abs = os.path.isabs(val)
except AttributeError:
is_abs = False
if not is_abs:
raise SaltInvocationError('\'{0}\' is not an absolute path'.format(val))
return va... | [
"Must",
"be",
"an",
"absolute",
"path"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/docker/translate/container.py#L711-L721 | [
"def",
"working_dir",
"(",
"val",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"try",
":",
"is_abs",
"=",
"os",
".",
"path",
".",
"isabs",
"(",
"val",
")",
"except",
"AttributeError",
":",
"is_abs",
"=",
"False",
"if",
"not",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _guess_apiserver | Try to guees the kubemaster url from environ,
then from `/etc/kubernetes/config` file | salt/modules/k8s.py | def _guess_apiserver(apiserver_url=None):
'''Try to guees the kubemaster url from environ,
then from `/etc/kubernetes/config` file
'''
default_config = "/etc/kubernetes/config"
if apiserver_url is not None:
return apiserver_url
if "KUBERNETES_MASTER" in os.environ:
apiserver_url ... | def _guess_apiserver(apiserver_url=None):
'''Try to guees the kubemaster url from environ,
then from `/etc/kubernetes/config` file
'''
default_config = "/etc/kubernetes/config"
if apiserver_url is not None:
return apiserver_url
if "KUBERNETES_MASTER" in os.environ:
apiserver_url ... | [
"Try",
"to",
"guees",
"the",
"kubemaster",
"url",
"from",
"environ",
"then",
"from",
"/",
"etc",
"/",
"kubernetes",
"/",
"config",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/k8s.py#L43-L67 | [
"def",
"_guess_apiserver",
"(",
"apiserver_url",
"=",
"None",
")",
":",
"default_config",
"=",
"\"/etc/kubernetes/config\"",
"if",
"apiserver_url",
"is",
"not",
"None",
":",
"return",
"apiserver_url",
"if",
"\"KUBERNETES_MASTER\"",
"in",
"os",
".",
"environ",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _kpost | create any object in kubernetes based on URL | salt/modules/k8s.py | def _kpost(url, data):
''' create any object in kubernetes based on URL '''
# Prepare headers
headers = {"Content-Type": "application/json"}
# Make request
log.trace("url is: %s, data is: %s", url, data)
ret = http.query(url,
method='POST',
header_dict=... | def _kpost(url, data):
''' create any object in kubernetes based on URL '''
# Prepare headers
headers = {"Content-Type": "application/json"}
# Make request
log.trace("url is: %s, data is: %s", url, data)
ret = http.query(url,
method='POST',
header_dict=... | [
"create",
"any",
"object",
"in",
"kubernetes",
"based",
"on",
"URL"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/k8s.py#L70-L85 | [
"def",
"_kpost",
"(",
"url",
",",
"data",
")",
":",
"# Prepare headers",
"headers",
"=",
"{",
"\"Content-Type\"",
":",
"\"application/json\"",
"}",
"# Make request",
"log",
".",
"trace",
"(",
"\"url is: %s, data is: %s\"",
",",
"url",
",",
"data",
")",
"ret",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _kput | put any object in kubernetes based on URL | salt/modules/k8s.py | def _kput(url, data):
''' put any object in kubernetes based on URL '''
# Prepare headers
headers = {"Content-Type": "application/json"}
# Make request
ret = http.query(url,
method='PUT',
header_dict=headers,
data=salt.utils.json.dumps(... | def _kput(url, data):
''' put any object in kubernetes based on URL '''
# Prepare headers
headers = {"Content-Type": "application/json"}
# Make request
ret = http.query(url,
method='PUT',
header_dict=headers,
data=salt.utils.json.dumps(... | [
"put",
"any",
"object",
"in",
"kubernetes",
"based",
"on",
"URL"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/k8s.py#L88-L102 | [
"def",
"_kput",
"(",
"url",
",",
"data",
")",
":",
"# Prepare headers",
"headers",
"=",
"{",
"\"Content-Type\"",
":",
"\"application/json\"",
"}",
"# Make request",
"ret",
"=",
"http",
".",
"query",
"(",
"url",
",",
"method",
"=",
"'PUT'",
",",
"header_dict"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _kpatch | patch any object in kubernetes based on URL | salt/modules/k8s.py | def _kpatch(url, data):
''' patch any object in kubernetes based on URL '''
# Prepare headers
headers = {"Content-Type": "application/json-patch+json"}
# Make request
ret = http.query(url, method='PATCH', header_dict=headers,
data=salt.utils.json.dumps(data))
# Check reques... | def _kpatch(url, data):
''' patch any object in kubernetes based on URL '''
# Prepare headers
headers = {"Content-Type": "application/json-patch+json"}
# Make request
ret = http.query(url, method='PATCH', header_dict=headers,
data=salt.utils.json.dumps(data))
# Check reques... | [
"patch",
"any",
"object",
"in",
"kubernetes",
"based",
"on",
"URL"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/k8s.py#L105-L118 | [
"def",
"_kpatch",
"(",
"url",
",",
"data",
")",
":",
"# Prepare headers",
"headers",
"=",
"{",
"\"Content-Type\"",
":",
"\"application/json-patch+json\"",
"}",
"# Make request",
"ret",
"=",
"http",
".",
"query",
"(",
"url",
",",
"method",
"=",
"'PATCH'",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _kname | Get name or names out of json result from API server | salt/modules/k8s.py | def _kname(obj):
'''Get name or names out of json result from API server'''
if isinstance(obj, dict):
return [obj.get("metadata", {}).get("name", "")]
elif isinstance(obj, (list, tuple)):
names = []
for i in obj:
names.append(i.get("metadata", {}).get("name", ""))
... | def _kname(obj):
'''Get name or names out of json result from API server'''
if isinstance(obj, dict):
return [obj.get("metadata", {}).get("name", "")]
elif isinstance(obj, (list, tuple)):
names = []
for i in obj:
names.append(i.get("metadata", {}).get("name", ""))
... | [
"Get",
"name",
"or",
"names",
"out",
"of",
"json",
"result",
"from",
"API",
"server"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/k8s.py#L121-L131 | [
"def",
"_kname",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"dict",
")",
":",
"return",
"[",
"obj",
".",
"get",
"(",
"\"metadata\"",
",",
"{",
"}",
")",
".",
"get",
"(",
"\"name\"",
",",
"\"\"",
")",
"]",
"elif",
"isinstance",
"("... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _is_dns_subdomain | Check that name is DNS subdomain: One or more lowercase rfc1035/rfc1123
labels separated by '.' with a maximum length of 253 characters | salt/modules/k8s.py | def _is_dns_subdomain(name):
''' Check that name is DNS subdomain: One or more lowercase rfc1035/rfc1123
labels separated by '.' with a maximum length of 253 characters '''
dns_subdomain = re.compile(r"""^[a-z0-9\.-]{1,253}$""")
if dns_subdomain.match(name):
log.debug("Name: %s is valid DNS sub... | def _is_dns_subdomain(name):
''' Check that name is DNS subdomain: One or more lowercase rfc1035/rfc1123
labels separated by '.' with a maximum length of 253 characters '''
dns_subdomain = re.compile(r"""^[a-z0-9\.-]{1,253}$""")
if dns_subdomain.match(name):
log.debug("Name: %s is valid DNS sub... | [
"Check",
"that",
"name",
"is",
"DNS",
"subdomain",
":",
"One",
"or",
"more",
"lowercase",
"rfc1035",
"/",
"rfc1123",
"labels",
"separated",
"by",
".",
"with",
"a",
"maximum",
"length",
"of",
"253",
"characters"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/k8s.py#L134-L144 | [
"def",
"_is_dns_subdomain",
"(",
"name",
")",
":",
"dns_subdomain",
"=",
"re",
".",
"compile",
"(",
"r\"\"\"^[a-z0-9\\.-]{1,253}$\"\"\"",
")",
"if",
"dns_subdomain",
".",
"match",
"(",
"name",
")",
":",
"log",
".",
"debug",
"(",
"\"Name: %s is valid DNS subdomain\... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _is_port_name | Check that name is IANA service: An alphanumeric (a-z, and 0-9) string,
with a maximum length of 15 characters, with the '-' character allowed
anywhere except the first or the last character or adjacent to another '-'
character, it must contain at least a (a-z) character | salt/modules/k8s.py | def _is_port_name(name):
''' Check that name is IANA service: An alphanumeric (a-z, and 0-9) string,
with a maximum length of 15 characters, with the '-' character allowed
anywhere except the first or the last character or adjacent to another '-'
character, it must contain at least a (a-z) character '''... | def _is_port_name(name):
''' Check that name is IANA service: An alphanumeric (a-z, and 0-9) string,
with a maximum length of 15 characters, with the '-' character allowed
anywhere except the first or the last character or adjacent to another '-'
character, it must contain at least a (a-z) character '''... | [
"Check",
"that",
"name",
"is",
"IANA",
"service",
":",
"An",
"alphanumeric",
"(",
"a",
"-",
"z",
"and",
"0",
"-",
"9",
")",
"string",
"with",
"a",
"maximum",
"length",
"of",
"15",
"characters",
"with",
"the",
"-",
"character",
"allowed",
"anywhere",
"e... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/k8s.py#L147-L157 | [
"def",
"_is_port_name",
"(",
"name",
")",
":",
"port_name",
"=",
"re",
".",
"compile",
"(",
"\"\"\"^[a-z0-9]{1,15}$\"\"\"",
")",
"if",
"port_name",
".",
"match",
"(",
"name",
")",
":",
"return",
"True",
"else",
":",
"return",
"False"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _is_dns_label | Check that name is DNS label: An alphanumeric (a-z, and 0-9) string,
with a maximum length of 63 characters, with the '-' character allowed
anywhere except the first or last character, suitable for use as a hostname
or segment in a domain name | salt/modules/k8s.py | def _is_dns_label(name):
''' Check that name is DNS label: An alphanumeric (a-z, and 0-9) string,
with a maximum length of 63 characters, with the '-' character allowed
anywhere except the first or last character, suitable for use as a hostname
or segment in a domain name '''
dns_label = re.compile... | def _is_dns_label(name):
''' Check that name is DNS label: An alphanumeric (a-z, and 0-9) string,
with a maximum length of 63 characters, with the '-' character allowed
anywhere except the first or last character, suitable for use as a hostname
or segment in a domain name '''
dns_label = re.compile... | [
"Check",
"that",
"name",
"is",
"DNS",
"label",
":",
"An",
"alphanumeric",
"(",
"a",
"-",
"z",
"and",
"0",
"-",
"9",
")",
"string",
"with",
"a",
"maximum",
"length",
"of",
"63",
"characters",
"with",
"the",
"-",
"character",
"allowed",
"anywhere",
"exce... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/k8s.py#L160-L170 | [
"def",
"_is_dns_label",
"(",
"name",
")",
":",
"dns_label",
"=",
"re",
".",
"compile",
"(",
"r\"\"\"^[a-z0-9][a-z0-9\\.-]{1,62}$\"\"\"",
")",
"if",
"dns_label",
".",
"match",
"(",
"name",
")",
":",
"return",
"True",
"else",
":",
"return",
"False"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_labels | Get all labels from a kube node. | salt/modules/k8s.py | def _get_labels(node, apiserver_url):
'''Get all labels from a kube node.'''
# Prepare URL
url = "{0}/api/v1/nodes/{1}".format(apiserver_url, node)
# Make request
ret = http.query(url)
# Check requests status
if 'body' in ret:
ret = salt.utils.json.loads(ret.get('body'))
elif ret... | def _get_labels(node, apiserver_url):
'''Get all labels from a kube node.'''
# Prepare URL
url = "{0}/api/v1/nodes/{1}".format(apiserver_url, node)
# Make request
ret = http.query(url)
# Check requests status
if 'body' in ret:
ret = salt.utils.json.loads(ret.get('body'))
elif ret... | [
"Get",
"all",
"labels",
"from",
"a",
"kube",
"node",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/k8s.py#L180-L194 | [
"def",
"_get_labels",
"(",
"node",
",",
"apiserver_url",
")",
":",
"# Prepare URL",
"url",
"=",
"\"{0}/api/v1/nodes/{1}\"",
".",
"format",
"(",
"apiserver_url",
",",
"node",
")",
"# Make request",
"ret",
"=",
"http",
".",
"query",
"(",
"url",
")",
"# Check req... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.