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 | event_list | List the recent events.
:param consul_url: The Consul server URL.
:param name: The name of the event to fire.
:return: List of ACLs
CLI Example:
.. code-block:: bash
salt '*' consul.event_list | salt/modules/consul.py | def event_list(consul_url=None, token=None, **kwargs):
'''
List the recent events.
:param consul_url: The Consul server URL.
:param name: The name of the event to fire.
:return: List of ACLs
CLI Example:
.. code-block:: bash
salt '*' consul.event_list
'''
ret = {}
qu... | def event_list(consul_url=None, token=None, **kwargs):
'''
List the recent events.
:param consul_url: The Consul server URL.
:param name: The name of the event to fire.
:return: List of ACLs
CLI Example:
.. code-block:: bash
salt '*' consul.event_list
'''
ret = {}
qu... | [
"List",
"the",
"recent",
"events",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/consul.py#L2424-L2459 | [
"def",
"event_list",
"(",
"consul_url",
"=",
"None",
",",
"token",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"}",
"query_params",
"=",
"{",
"}",
"if",
"not",
"consul_url",
":",
"consul_url",
"=",
"_get_config",
"(",
")",
"if",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | managed | Ensure a sysrc variable is set to a specific value.
name
The variable name to set
value
Value to set the variable to
file
(optional) The rc file to add the variable to.
jail
(option) the name or JID of the jail to set the value in.
Example:
.. code-block:: yaml... | salt/states/sysrc.py | def managed(name, value, **kwargs):
'''
Ensure a sysrc variable is set to a specific value.
name
The variable name to set
value
Value to set the variable to
file
(optional) The rc file to add the variable to.
jail
(option) the name or JID of the jail to set the v... | def managed(name, value, **kwargs):
'''
Ensure a sysrc variable is set to a specific value.
name
The variable name to set
value
Value to set the variable to
file
(optional) The rc file to add the variable to.
jail
(option) the name or JID of the jail to set the v... | [
"Ensure",
"a",
"sysrc",
"variable",
"is",
"set",
"to",
"a",
"specific",
"value",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/sysrc.py#L24-L81 | [
"def",
"managed",
"(",
"name",
",",
"value",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
"# Check the current state",
"cu... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get | .. versionadded:: 0.14
Attempt to retrieve the named value from pillar, if the named value is not
available return the passed default. The default return is an empty string.
If the merge parameter is set to ``True``, the default will be recursively
merged into the returned pillar data.
The value ... | salt/client/ssh/wrapper/pillar.py | def get(key, default='', merge=False, delimiter=DEFAULT_TARGET_DELIM):
'''
.. versionadded:: 0.14
Attempt to retrieve the named value from pillar, if the named value is not
available return the passed default. The default return is an empty string.
If the merge parameter is set to ``True``, the de... | def get(key, default='', merge=False, delimiter=DEFAULT_TARGET_DELIM):
'''
.. versionadded:: 0.14
Attempt to retrieve the named value from pillar, if the named value is not
available return the passed default. The default return is an empty string.
If the merge parameter is set to ``True``, the de... | [
"..",
"versionadded",
"::",
"0",
".",
"14"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/pillar.py#L17-L64 | [
"def",
"get",
"(",
"key",
",",
"default",
"=",
"''",
",",
"merge",
"=",
"False",
",",
"delimiter",
"=",
"DEFAULT_TARGET_DELIM",
")",
":",
"if",
"merge",
":",
"ret",
"=",
"salt",
".",
"utils",
".",
"data",
".",
"traverse_dict_and_list",
"(",
"__pillar__",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | item | .. versionadded:: 0.16.2
Return one or more pillar entries
CLI Examples:
.. code-block:: bash
salt '*' pillar.item foo
salt '*' pillar.item foo bar baz | salt/client/ssh/wrapper/pillar.py | def item(*args):
'''
.. versionadded:: 0.16.2
Return one or more pillar entries
CLI Examples:
.. code-block:: bash
salt '*' pillar.item foo
salt '*' pillar.item foo bar baz
'''
ret = {}
for arg in args:
try:
ret[arg] = __pillar__[arg]
excep... | def item(*args):
'''
.. versionadded:: 0.16.2
Return one or more pillar entries
CLI Examples:
.. code-block:: bash
salt '*' pillar.item foo
salt '*' pillar.item foo bar baz
'''
ret = {}
for arg in args:
try:
ret[arg] = __pillar__[arg]
excep... | [
"..",
"versionadded",
"::",
"0",
".",
"16",
".",
"2"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/pillar.py#L67-L86 | [
"def",
"item",
"(",
"*",
"args",
")",
":",
"ret",
"=",
"{",
"}",
"for",
"arg",
"in",
"args",
":",
"try",
":",
"ret",
"[",
"arg",
"]",
"=",
"__pillar__",
"[",
"arg",
"]",
"except",
"KeyError",
":",
"pass",
"return",
"ret"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | raw | Return the raw pillar data that is available in the module. This will
show the pillar as it is loaded as the __pillar__ dict.
CLI Example:
.. code-block:: bash
salt '*' pillar.raw
With the optional key argument, you can select a subtree of the
pillar raw data.::
salt '*' pillar.... | salt/client/ssh/wrapper/pillar.py | def raw(key=None):
'''
Return the raw pillar data that is available in the module. This will
show the pillar as it is loaded as the __pillar__ dict.
CLI Example:
.. code-block:: bash
salt '*' pillar.raw
With the optional key argument, you can select a subtree of the
pillar raw da... | def raw(key=None):
'''
Return the raw pillar data that is available in the module. This will
show the pillar as it is loaded as the __pillar__ dict.
CLI Example:
.. code-block:: bash
salt '*' pillar.raw
With the optional key argument, you can select a subtree of the
pillar raw da... | [
"Return",
"the",
"raw",
"pillar",
"data",
"that",
"is",
"available",
"in",
"the",
"module",
".",
"This",
"will",
"show",
"the",
"pillar",
"as",
"it",
"is",
"loaded",
"as",
"the",
"__pillar__",
"dict",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/pillar.py#L89-L110 | [
"def",
"raw",
"(",
"key",
"=",
"None",
")",
":",
"if",
"key",
":",
"ret",
"=",
"__pillar__",
".",
"get",
"(",
"key",
",",
"{",
"}",
")",
"else",
":",
"ret",
"=",
"__pillar__",
"return",
"ret"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | keys | .. versionadded:: 2015.8.0
Attempt to retrieve a list of keys from the named value from the pillar.
The value can also represent a value in a nested dict using a ":" delimiter
for the dict, similar to how pillar.get works.
delimiter
Specify an alternate delimiter to use when traversing a nest... | salt/client/ssh/wrapper/pillar.py | def keys(key, delimiter=DEFAULT_TARGET_DELIM):
'''
.. versionadded:: 2015.8.0
Attempt to retrieve a list of keys from the named value from the pillar.
The value can also represent a value in a nested dict using a ":" delimiter
for the dict, similar to how pillar.get works.
delimiter
S... | def keys(key, delimiter=DEFAULT_TARGET_DELIM):
'''
.. versionadded:: 2015.8.0
Attempt to retrieve a list of keys from the named value from the pillar.
The value can also represent a value in a nested dict using a ":" delimiter
for the dict, similar to how pillar.get works.
delimiter
S... | [
"..",
"versionadded",
"::",
"2015",
".",
"8",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/pillar.py#L113-L140 | [
"def",
"keys",
"(",
"key",
",",
"delimiter",
"=",
"DEFAULT_TARGET_DELIM",
")",
":",
"ret",
"=",
"salt",
".",
"utils",
".",
"data",
".",
"traverse_dict_and_list",
"(",
"__pillar__",
",",
"key",
",",
"KeyError",
",",
"delimiter",
")",
"if",
"ret",
"is",
"K... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | present | Ensure domain exists.
name
The name of the state definition
DomainName
Name of the domain.
ElasticsearchClusterConfig
Configuration options for an Elasticsearch domain. Specifies the
instance type and number of instances in the domain cluster.
InstanceType (string... | salt/states/boto_elasticsearch_domain.py | def present(name, DomainName,
ElasticsearchClusterConfig=None,
EBSOptions=None,
AccessPolicies=None,
SnapshotOptions=None,
AdvancedOptions=None,
Tags=None,
region=None, key=None, keyid=None, profile=None,
ElasticsearchVersio... | def present(name, DomainName,
ElasticsearchClusterConfig=None,
EBSOptions=None,
AccessPolicies=None,
SnapshotOptions=None,
AdvancedOptions=None,
Tags=None,
region=None, key=None, keyid=None, profile=None,
ElasticsearchVersio... | [
"Ensure",
"domain",
"exists",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_elasticsearch_domain.py#L106-L325 | [
"def",
"present",
"(",
"name",
",",
"DomainName",
",",
"ElasticsearchClusterConfig",
"=",
"None",
",",
"EBSOptions",
"=",
"None",
",",
"AccessPolicies",
"=",
"None",
",",
"SnapshotOptions",
"=",
"None",
",",
"AdvancedOptions",
"=",
"None",
",",
"Tags",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | DBHandleBase.open | Init the database, if required. | salt/modules/inspectlib/dbhandle.py | def open(self, new=False):
'''
Init the database, if required.
'''
self._db.new() if new else self._db.open() # pylint: disable=W0106
self._run_init_queries() | def open(self, new=False):
'''
Init the database, if required.
'''
self._db.new() if new else self._db.open() # pylint: disable=W0106
self._run_init_queries() | [
"Init",
"the",
"database",
"if",
"required",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/dbhandle.py#L39-L44 | [
"def",
"open",
"(",
"self",
",",
"new",
"=",
"False",
")",
":",
"self",
".",
"_db",
".",
"new",
"(",
")",
"if",
"new",
"else",
"self",
".",
"_db",
".",
"open",
"(",
")",
"# pylint: disable=W0106",
"self",
".",
"_run_init_queries",
"(",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | DBHandleBase._run_init_queries | Initialization queries | salt/modules/inspectlib/dbhandle.py | def _run_init_queries(self):
'''
Initialization queries
'''
for obj in (Package, PackageCfgFile, PayloadFile, IgnoredDir, AllowedDir):
self._db.create_table_from_object(obj()) | def _run_init_queries(self):
'''
Initialization queries
'''
for obj in (Package, PackageCfgFile, PayloadFile, IgnoredDir, AllowedDir):
self._db.create_table_from_object(obj()) | [
"Initialization",
"queries"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/dbhandle.py#L46-L51 | [
"def",
"_run_init_queries",
"(",
"self",
")",
":",
"for",
"obj",
"in",
"(",
"Package",
",",
"PackageCfgFile",
",",
"PayloadFile",
",",
"IgnoredDir",
",",
"AllowedDir",
")",
":",
"self",
".",
"_db",
".",
"create_table_from_object",
"(",
"obj",
"(",
")",
")"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | DBHandleBase.purge | Purge whole database. | salt/modules/inspectlib/dbhandle.py | def purge(self):
'''
Purge whole database.
'''
for table_name in self._db.list_tables():
self._db.flush(table_name)
self._run_init_queries() | def purge(self):
'''
Purge whole database.
'''
for table_name in self._db.list_tables():
self._db.flush(table_name)
self._run_init_queries() | [
"Purge",
"whole",
"database",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/dbhandle.py#L53-L60 | [
"def",
"purge",
"(",
"self",
")",
":",
"for",
"table_name",
"in",
"self",
".",
"_db",
".",
"list_tables",
"(",
")",
":",
"self",
".",
"_db",
".",
"flush",
"(",
"table_name",
")",
"self",
".",
"_run_init_queries",
"(",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_config_value | Helper function that returns a profile's configuration value based on
the supplied configuration name.
profile
The profile name that contains configuration information.
config_name
The configuration item's name to use to return configuration values. | salt/modules/github.py | def _get_config_value(profile, config_name):
'''
Helper function that returns a profile's configuration value based on
the supplied configuration name.
profile
The profile name that contains configuration information.
config_name
The configuration item's name to use to return confi... | def _get_config_value(profile, config_name):
'''
Helper function that returns a profile's configuration value based on
the supplied configuration name.
profile
The profile name that contains configuration information.
config_name
The configuration item's name to use to return confi... | [
"Helper",
"function",
"that",
"returns",
"a",
"profile",
"s",
"configuration",
"value",
"based",
"on",
"the",
"supplied",
"configuration",
"name",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L69-L97 | [
"def",
"_get_config_value",
"(",
"profile",
",",
"config_name",
")",
":",
"config",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"profile",
")",
"if",
"not",
"config",
":",
"raise",
"CommandExecutionError",
"(",
"'Authentication information could not be found fo... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_client | Return the GitHub client, cached into __context__ for performance | salt/modules/github.py | def _get_client(profile):
'''
Return the GitHub client, cached into __context__ for performance
'''
token = _get_config_value(profile, 'token')
key = 'github.{0}:{1}'.format(
token,
_get_config_value(profile, 'org_name')
)
if key not in __context__:
__context__[key] ... | def _get_client(profile):
'''
Return the GitHub client, cached into __context__ for performance
'''
token = _get_config_value(profile, 'token')
key = 'github.{0}:{1}'.format(
token,
_get_config_value(profile, 'org_name')
)
if key not in __context__:
__context__[key] ... | [
"Return",
"the",
"GitHub",
"client",
"cached",
"into",
"__context__",
"for",
"performance"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L100-L115 | [
"def",
"_get_client",
"(",
"profile",
")",
":",
"token",
"=",
"_get_config_value",
"(",
"profile",
",",
"'token'",
")",
"key",
"=",
"'github.{0}:{1}'",
".",
"format",
"(",
"token",
",",
"_get_config_value",
"(",
"profile",
",",
"'org_name'",
")",
")",
"if",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_users | List all users within the organization.
profile
The name of the profile configuration to use. Defaults to ``github``.
ignore_cache
Bypasses the use of cached users.
.. versionadded:: 2016.11.0
CLI Example:
.. code-block:: bash
salt myminion github.list_users
... | salt/modules/github.py | def list_users(profile="github", ignore_cache=False):
'''
List all users within the organization.
profile
The name of the profile configuration to use. Defaults to ``github``.
ignore_cache
Bypasses the use of cached users.
.. versionadded:: 2016.11.0
CLI Example:
.. ... | def list_users(profile="github", ignore_cache=False):
'''
List all users within the organization.
profile
The name of the profile configuration to use. Defaults to ``github``.
ignore_cache
Bypasses the use of cached users.
.. versionadded:: 2016.11.0
CLI Example:
.. ... | [
"List",
"all",
"users",
"within",
"the",
"organization",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L162-L189 | [
"def",
"list_users",
"(",
"profile",
"=",
"\"github\"",
",",
"ignore_cache",
"=",
"False",
")",
":",
"org_name",
"=",
"_get_config_value",
"(",
"profile",
",",
"'org_name'",
")",
"key",
"=",
"\"github.{0}:users\"",
".",
"format",
"(",
"org_name",
")",
"if",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_user | Get a GitHub user by name.
name
The user for which to obtain information.
profile
The name of the profile configuration to use. Defaults to ``github``.
user_details
Prints user information details. Defaults to ``False``. If the user is
already in the organization and user_... | salt/modules/github.py | def get_user(name, profile='github', user_details=False):
'''
Get a GitHub user by name.
name
The user for which to obtain information.
profile
The name of the profile configuration to use. Defaults to ``github``.
user_details
Prints user information details. Defaults to `... | def get_user(name, profile='github', user_details=False):
'''
Get a GitHub user by name.
name
The user for which to obtain information.
profile
The name of the profile configuration to use. Defaults to ``github``.
user_details
Prints user information details. Defaults to `... | [
"Get",
"a",
"GitHub",
"user",
"by",
"name",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L192-L256 | [
"def",
"get_user",
"(",
"name",
",",
"profile",
"=",
"'github'",
",",
"user_details",
"=",
"False",
")",
":",
"if",
"not",
"user_details",
"and",
"name",
"in",
"list_users",
"(",
"profile",
")",
":",
"# User is in the org, no need for additional Data",
"return",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | add_user | Add a GitHub user.
name
The user for which to obtain information.
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. code-block:: bash
salt myminion github.add_user github-handle | salt/modules/github.py | def add_user(name, profile='github'):
'''
Add a GitHub user.
name
The user for which to obtain information.
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. code-block:: bash
salt myminion github.add_user github-handle
... | def add_user(name, profile='github'):
'''
Add a GitHub user.
name
The user for which to obtain information.
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. code-block:: bash
salt myminion github.add_user github-handle
... | [
"Add",
"a",
"GitHub",
"user",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L259-L292 | [
"def",
"add_user",
"(",
"name",
",",
"profile",
"=",
"'github'",
")",
":",
"client",
"=",
"_get_client",
"(",
"profile",
")",
"organization",
"=",
"client",
".",
"get_organization",
"(",
"_get_config_value",
"(",
"profile",
",",
"'org_name'",
")",
")",
"try"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | remove_user | Remove a Github user by name.
name
The user for which to obtain information.
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. code-block:: bash
salt myminion github.remove_user github-handle | salt/modules/github.py | def remove_user(name, profile='github'):
'''
Remove a Github user by name.
name
The user for which to obtain information.
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. code-block:: bash
salt myminion github.remove_user ... | def remove_user(name, profile='github'):
'''
Remove a Github user by name.
name
The user for which to obtain information.
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. code-block:: bash
salt myminion github.remove_user ... | [
"Remove",
"a",
"Github",
"user",
"by",
"name",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L295-L326 | [
"def",
"remove_user",
"(",
"name",
",",
"profile",
"=",
"'github'",
")",
":",
"client",
"=",
"_get_client",
"(",
"profile",
")",
"organization",
"=",
"client",
".",
"get_organization",
"(",
"_get_config_value",
"(",
"profile",
",",
"'org_name'",
")",
")",
"t... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_issue | Return information about a single issue in a named repository.
.. versionadded:: 2016.11.0
issue_number
The number of the issue to retrieve.
repo_name
The name of the repository from which to get the issue. This argument is
required, either passed via the CLI, or defined in the co... | salt/modules/github.py | def get_issue(issue_number, repo_name=None, profile='github', output='min'):
'''
Return information about a single issue in a named repository.
.. versionadded:: 2016.11.0
issue_number
The number of the issue to retrieve.
repo_name
The name of the repository from which to get the ... | def get_issue(issue_number, repo_name=None, profile='github', output='min'):
'''
Return information about a single issue in a named repository.
.. versionadded:: 2016.11.0
issue_number
The number of the issue to retrieve.
repo_name
The name of the repository from which to get the ... | [
"Return",
"information",
"about",
"a",
"single",
"issue",
"in",
"a",
"named",
"repository",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L329-L374 | [
"def",
"get_issue",
"(",
"issue_number",
",",
"repo_name",
"=",
"None",
",",
"profile",
"=",
"'github'",
",",
"output",
"=",
"'min'",
")",
":",
"org_name",
"=",
"_get_config_value",
"(",
"profile",
",",
"'org_name'",
")",
"if",
"repo_name",
"is",
"None",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_issue_comments | Return information about the comments for a given issue in a named repository.
.. versionadded:: 2016.11.0
issue_number
The number of the issue for which to retrieve comments.
repo_name
The name of the repository to which the issue belongs. This argument is
required, either passed... | salt/modules/github.py | def get_issue_comments(issue_number,
repo_name=None,
profile='github',
since=None,
output='min'):
'''
Return information about the comments for a given issue in a named repository.
.. versionadded:: 2016.11.0
i... | def get_issue_comments(issue_number,
repo_name=None,
profile='github',
since=None,
output='min'):
'''
Return information about the comments for a given issue in a named repository.
.. versionadded:: 2016.11.0
i... | [
"Return",
"information",
"about",
"the",
"comments",
"for",
"a",
"given",
"issue",
"in",
"a",
"named",
"repository",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L377-L437 | [
"def",
"get_issue_comments",
"(",
"issue_number",
",",
"repo_name",
"=",
"None",
",",
"profile",
"=",
"'github'",
",",
"since",
"=",
"None",
",",
"output",
"=",
"'min'",
")",
":",
"org_name",
"=",
"_get_config_value",
"(",
"profile",
",",
"'org_name'",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_issues | Returns information for all issues in a given repository, based on the search options.
.. versionadded:: 2016.11.0
repo_name
The name of the repository for which to list issues. This argument is
required, either passed via the CLI, or defined in the configured
profile. A ``repo_name`` ... | salt/modules/github.py | def get_issues(repo_name=None,
profile='github',
milestone=None,
state='open',
assignee=None,
creator=None,
mentioned=None,
labels=None,
sort='created',
direction='desc',
... | def get_issues(repo_name=None,
profile='github',
milestone=None,
state='open',
assignee=None,
creator=None,
mentioned=None,
labels=None,
sort='created',
direction='desc',
... | [
"Returns",
"information",
"for",
"all",
"issues",
"in",
"a",
"given",
"repository",
"based",
"on",
"the",
"search",
"options",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L440-L568 | [
"def",
"get_issues",
"(",
"repo_name",
"=",
"None",
",",
"profile",
"=",
"'github'",
",",
"milestone",
"=",
"None",
",",
"state",
"=",
"'open'",
",",
"assignee",
"=",
"None",
",",
"creator",
"=",
"None",
",",
"mentioned",
"=",
"None",
",",
"labels",
"=... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_milestones | Return information about milestones for a given repository.
.. versionadded:: 2016.11.0
repo_name
The name of the repository for which to list issues. This argument is
required, either passed via the CLI, or defined in the configured
profile. A ``repo_name`` passed as a CLI argument wi... | salt/modules/github.py | def get_milestones(repo_name=None,
profile='github',
state='open',
sort='due_on',
direction='asc',
output='min',
per_page=None):
'''
Return information about milestones for a given repository.
... | def get_milestones(repo_name=None,
profile='github',
state='open',
sort='due_on',
direction='asc',
output='min',
per_page=None):
'''
Return information about milestones for a given repository.
... | [
"Return",
"information",
"about",
"milestones",
"for",
"a",
"given",
"repository",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L571-L650 | [
"def",
"get_milestones",
"(",
"repo_name",
"=",
"None",
",",
"profile",
"=",
"'github'",
",",
"state",
"=",
"'open'",
",",
"sort",
"=",
"'due_on'",
",",
"direction",
"=",
"'asc'",
",",
"output",
"=",
"'min'",
",",
"per_page",
"=",
"None",
")",
":",
"or... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_milestone | Return information about a single milestone in a named repository.
.. versionadded:: 2016.11.0
number
The number of the milestone to retrieve. If provided, this option
will be favored over ``name``.
name
The name of the milestone to retrieve.
repo_name
The name of the... | salt/modules/github.py | def get_milestone(number=None,
name=None,
repo_name=None,
profile='github',
output='min'):
'''
Return information about a single milestone in a named repository.
.. versionadded:: 2016.11.0
number
The number of the milesto... | def get_milestone(number=None,
name=None,
repo_name=None,
profile='github',
output='min'):
'''
Return information about a single milestone in a named repository.
.. versionadded:: 2016.11.0
number
The number of the milesto... | [
"Return",
"information",
"about",
"a",
"single",
"milestone",
"in",
"a",
"named",
"repository",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L653-L723 | [
"def",
"get_milestone",
"(",
"number",
"=",
"None",
",",
"name",
"=",
"None",
",",
"repo_name",
"=",
"None",
",",
"profile",
"=",
"'github'",
",",
"output",
"=",
"'min'",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"not",
"any",
"(",
"[",
"number",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_repo_info | Return information for a given repo.
.. versionadded:: 2016.11.0
repo_name
The name of the repository.
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. code-block:: bash
salt myminion github.get_repo_info salt
salt my... | salt/modules/github.py | def get_repo_info(repo_name, profile='github', ignore_cache=False):
'''
Return information for a given repo.
.. versionadded:: 2016.11.0
repo_name
The name of the repository.
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. co... | def get_repo_info(repo_name, profile='github', ignore_cache=False):
'''
Return information for a given repo.
.. versionadded:: 2016.11.0
repo_name
The name of the repository.
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. co... | [
"Return",
"information",
"for",
"a",
"given",
"repo",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L752-L800 | [
"def",
"get_repo_info",
"(",
"repo_name",
",",
"profile",
"=",
"'github'",
",",
"ignore_cache",
"=",
"False",
")",
":",
"org_name",
"=",
"_get_config_value",
"(",
"profile",
",",
"'org_name'",
")",
"key",
"=",
"\"github.{0}:{1}:repo_info\"",
".",
"format",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_repo_teams | Return teams belonging to a repository.
.. versionadded:: 2017.7.0
repo_name
The name of the repository from which to retrieve teams.
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. code-block:: bash
salt myminion github.get... | salt/modules/github.py | def get_repo_teams(repo_name, profile='github'):
'''
Return teams belonging to a repository.
.. versionadded:: 2017.7.0
repo_name
The name of the repository from which to retrieve teams.
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example... | def get_repo_teams(repo_name, profile='github'):
'''
Return teams belonging to a repository.
.. versionadded:: 2017.7.0
repo_name
The name of the repository from which to retrieve teams.
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example... | [
"Return",
"teams",
"belonging",
"to",
"a",
"repository",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L803-L846 | [
"def",
"get_repo_teams",
"(",
"repo_name",
",",
"profile",
"=",
"'github'",
")",
":",
"ret",
"=",
"[",
"]",
"org_name",
"=",
"_get_config_value",
"(",
"profile",
",",
"'org_name'",
")",
"client",
"=",
"_get_client",
"(",
"profile",
")",
"try",
":",
"repo",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_private_repos | List private repositories within the organization. Dependent upon the access
rights of the profile token.
.. versionadded:: 2016.11.0
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. code-block:: bash
salt myminion github.list_private... | salt/modules/github.py | def list_private_repos(profile='github'):
'''
List private repositories within the organization. Dependent upon the access
rights of the profile token.
.. versionadded:: 2016.11.0
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. code-b... | def list_private_repos(profile='github'):
'''
List private repositories within the organization. Dependent upon the access
rights of the profile token.
.. versionadded:: 2016.11.0
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. code-b... | [
"List",
"private",
"repositories",
"within",
"the",
"organization",
".",
"Dependent",
"upon",
"the",
"access",
"rights",
"of",
"the",
"profile",
"token",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L870-L891 | [
"def",
"list_private_repos",
"(",
"profile",
"=",
"'github'",
")",
":",
"repos",
"=",
"[",
"]",
"for",
"repo",
"in",
"_get_repos",
"(",
"profile",
")",
":",
"if",
"repo",
".",
"private",
"is",
"True",
":",
"repos",
".",
"append",
"(",
"repo",
".",
"n... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_public_repos | List public repositories within the organization.
.. versionadded:: 2016.11.0
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. code-block:: bash
salt myminion github.list_public_repos
salt myminion github.list_public_repos profile... | salt/modules/github.py | def list_public_repos(profile='github'):
'''
List public repositories within the organization.
.. versionadded:: 2016.11.0
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. code-block:: bash
salt myminion github.list_public_repos
... | def list_public_repos(profile='github'):
'''
List public repositories within the organization.
.. versionadded:: 2016.11.0
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. code-block:: bash
salt myminion github.list_public_repos
... | [
"List",
"public",
"repositories",
"within",
"the",
"organization",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L894-L914 | [
"def",
"list_public_repos",
"(",
"profile",
"=",
"'github'",
")",
":",
"repos",
"=",
"[",
"]",
"for",
"repo",
"in",
"_get_repos",
"(",
"profile",
")",
":",
"if",
"repo",
".",
"private",
"is",
"False",
":",
"repos",
".",
"append",
"(",
"repo",
".",
"n... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | add_repo | Create a new github repository.
name
The name of the team to be created.
description
The description of the repository.
homepage
The URL with more information about the repository.
private
The visiblity of the repository. Note that private repositories require
... | salt/modules/github.py | def add_repo(name,
description=None,
homepage=None,
private=None,
has_issues=None,
has_wiki=None,
has_downloads=None,
auto_init=None,
gitignore_template=None,
license_template=None,
profile=... | def add_repo(name,
description=None,
homepage=None,
private=None,
has_issues=None,
has_wiki=None,
has_downloads=None,
auto_init=None,
gitignore_template=None,
license_template=None,
profile=... | [
"Create",
"a",
"new",
"github",
"repository",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L917-L1002 | [
"def",
"add_repo",
"(",
"name",
",",
"description",
"=",
"None",
",",
"homepage",
"=",
"None",
",",
"private",
"=",
"None",
",",
"has_issues",
"=",
"None",
",",
"has_wiki",
"=",
"None",
",",
"has_downloads",
"=",
"None",
",",
"auto_init",
"=",
"None",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | edit_repo | Updates an existing Github repository.
name
The name of the team to be created.
description
The description of the repository.
homepage
The URL with more information about the repository.
private
The visiblity of the repository. Note that private repositories require
... | salt/modules/github.py | def edit_repo(name,
description=None,
homepage=None,
private=None,
has_issues=None,
has_wiki=None,
has_downloads=None,
profile="github"):
'''
Updates an existing Github repository.
name
The name of the... | def edit_repo(name,
description=None,
homepage=None,
private=None,
has_issues=None,
has_wiki=None,
has_downloads=None,
profile="github"):
'''
Updates an existing Github repository.
name
The name of the... | [
"Updates",
"an",
"existing",
"Github",
"repository",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L1005-L1089 | [
"def",
"edit_repo",
"(",
"name",
",",
"description",
"=",
"None",
",",
"homepage",
"=",
"None",
",",
"private",
"=",
"None",
",",
"has_issues",
"=",
"None",
",",
"has_wiki",
"=",
"None",
",",
"has_downloads",
"=",
"None",
",",
"profile",
"=",
"\"github\"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | remove_repo | Remove a Github repository.
name
The name of the repository to be removed.
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. code-block:: bash
salt myminion github.remove_repo 'my-repo'
.. versionadded:: 2016.11.0 | salt/modules/github.py | def remove_repo(name, profile="github"):
'''
Remove a Github repository.
name
The name of the repository to be removed.
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. code-block:: bash
salt myminion github.remove_repo 'm... | def remove_repo(name, profile="github"):
'''
Remove a Github repository.
name
The name of the repository to be removed.
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. code-block:: bash
salt myminion github.remove_repo 'm... | [
"Remove",
"a",
"Github",
"repository",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L1092-L1125 | [
"def",
"remove_repo",
"(",
"name",
",",
"profile",
"=",
"\"github\"",
")",
":",
"repo_info",
"=",
"get_repo_info",
"(",
"name",
",",
"profile",
"=",
"profile",
")",
"if",
"not",
"repo_info",
":",
"log",
".",
"error",
"(",
"'Repo %s to be removed does not exist... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | add_team | Create a new Github team within an organization.
name
The name of the team to be created.
description
The description of the team.
repo_names
The names of repositories to add the team to.
privacy
The level of privacy for the team, can be 'secret' or 'closed'.
per... | salt/modules/github.py | def add_team(name,
description=None,
repo_names=None,
privacy=None,
permission=None,
profile="github"):
'''
Create a new Github team within an organization.
name
The name of the team to be created.
description
The descrip... | def add_team(name,
description=None,
repo_names=None,
privacy=None,
permission=None,
profile="github"):
'''
Create a new Github team within an organization.
name
The name of the team to be created.
description
The descrip... | [
"Create",
"a",
"new",
"Github",
"team",
"within",
"an",
"organization",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L1148-L1210 | [
"def",
"add_team",
"(",
"name",
",",
"description",
"=",
"None",
",",
"repo_names",
"=",
"None",
",",
"privacy",
"=",
"None",
",",
"permission",
"=",
"None",
",",
"profile",
"=",
"\"github\"",
")",
":",
"try",
":",
"client",
"=",
"_get_client",
"(",
"p... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | edit_team | Updates an existing Github team.
name
The name of the team to be edited.
description
The description of the team.
privacy
The level of privacy for the team, can be 'secret' or 'closed'.
permission
The default permission for new repositories added to the team, can be
... | salt/modules/github.py | def edit_team(name,
description=None,
privacy=None,
permission=None,
profile="github"):
'''
Updates an existing Github team.
name
The name of the team to be edited.
description
The description of the team.
privacy
The... | def edit_team(name,
description=None,
privacy=None,
permission=None,
profile="github"):
'''
Updates an existing Github team.
name
The name of the team to be edited.
description
The description of the team.
privacy
The... | [
"Updates",
"an",
"existing",
"Github",
"team",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L1213-L1274 | [
"def",
"edit_team",
"(",
"name",
",",
"description",
"=",
"None",
",",
"privacy",
"=",
"None",
",",
"permission",
"=",
"None",
",",
"profile",
"=",
"\"github\"",
")",
":",
"team",
"=",
"get_team",
"(",
"name",
",",
"profile",
"=",
"profile",
")",
"if",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | remove_team | Remove a github team.
name
The name of the team to be removed.
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. code-block:: bash
salt myminion github.remove_team 'team_name'
.. versionadded:: 2016.11.0 | salt/modules/github.py | def remove_team(name, profile="github"):
'''
Remove a github team.
name
The name of the team to be removed.
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. code-block:: bash
salt myminion github.remove_team 'team_name'
... | def remove_team(name, profile="github"):
'''
Remove a github team.
name
The name of the team to be removed.
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. code-block:: bash
salt myminion github.remove_team 'team_name'
... | [
"Remove",
"a",
"github",
"team",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L1277-L1309 | [
"def",
"remove_team",
"(",
"name",
",",
"profile",
"=",
"\"github\"",
")",
":",
"team_info",
"=",
"get_team",
"(",
"name",
",",
"profile",
"=",
"profile",
")",
"if",
"not",
"team_info",
":",
"log",
".",
"error",
"(",
"'Team %s to be removed does not exist.'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_team_repos | Gets the repo details for a given team as a dict from repo_name to repo details.
Note that repo names are always in lower case.
team_name
The name of the team from which to list repos.
profile
The name of the profile configuration to use. Defaults to ``github``.
ignore_cache
B... | salt/modules/github.py | def list_team_repos(team_name, profile="github", ignore_cache=False):
'''
Gets the repo details for a given team as a dict from repo_name to repo details.
Note that repo names are always in lower case.
team_name
The name of the team from which to list repos.
profile
The name of the... | def list_team_repos(team_name, profile="github", ignore_cache=False):
'''
Gets the repo details for a given team as a dict from repo_name to repo details.
Note that repo names are always in lower case.
team_name
The name of the team from which to list repos.
profile
The name of the... | [
"Gets",
"the",
"repo",
"details",
"for",
"a",
"given",
"team",
"as",
"a",
"dict",
"from",
"repo_name",
"to",
"repo",
"details",
".",
"Note",
"that",
"repo",
"names",
"are",
"always",
"in",
"lower",
"case",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L1312-L1367 | [
"def",
"list_team_repos",
"(",
"team_name",
",",
"profile",
"=",
"\"github\"",
",",
"ignore_cache",
"=",
"False",
")",
":",
"cached_team",
"=",
"get_team",
"(",
"team_name",
",",
"profile",
"=",
"profile",
")",
"if",
"not",
"cached_team",
":",
"log",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | add_team_repo | Adds a repository to a team with team_name.
repo_name
The name of the repository to add.
team_name
The name of the team of which to add the repository.
profile
The name of the profile configuration to use. Defaults to ``github``.
permission
The permission for team mem... | salt/modules/github.py | def add_team_repo(repo_name, team_name, profile="github", permission=None):
'''
Adds a repository to a team with team_name.
repo_name
The name of the repository to add.
team_name
The name of the team of which to add the repository.
profile
The name of the profile configura... | def add_team_repo(repo_name, team_name, profile="github", permission=None):
'''
Adds a repository to a team with team_name.
repo_name
The name of the repository to add.
team_name
The name of the team of which to add the repository.
profile
The name of the profile configura... | [
"Adds",
"a",
"repository",
"to",
"a",
"team",
"with",
"team_name",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L1370-L1423 | [
"def",
"add_team_repo",
"(",
"repo_name",
",",
"team_name",
",",
"profile",
"=",
"\"github\"",
",",
"permission",
"=",
"None",
")",
":",
"team",
"=",
"get_team",
"(",
"team_name",
",",
"profile",
"=",
"profile",
")",
"if",
"not",
"team",
":",
"log",
".",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | remove_team_repo | Removes a repository from a team with team_name.
repo_name
The name of the repository to remove.
team_name
The name of the team of which to remove the repository.
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. code-block:: b... | salt/modules/github.py | def remove_team_repo(repo_name, team_name, profile="github"):
'''
Removes a repository from a team with team_name.
repo_name
The name of the repository to remove.
team_name
The name of the team of which to remove the repository.
profile
The name of the profile configuratio... | def remove_team_repo(repo_name, team_name, profile="github"):
'''
Removes a repository from a team with team_name.
repo_name
The name of the repository to remove.
team_name
The name of the team of which to remove the repository.
profile
The name of the profile configuratio... | [
"Removes",
"a",
"repository",
"from",
"a",
"team",
"with",
"team_name",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L1426-L1462 | [
"def",
"remove_team_repo",
"(",
"repo_name",
",",
"team_name",
",",
"profile",
"=",
"\"github\"",
")",
":",
"team",
"=",
"get_team",
"(",
"team_name",
",",
"profile",
"=",
"profile",
")",
"if",
"not",
"team",
":",
"log",
".",
"error",
"(",
"'Team %s does n... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_team_members | Gets the names of team members in lower case.
team_name
The name of the team from which to list members.
profile
The name of the profile configuration to use. Defaults to ``github``.
ignore_cache
Bypasses the use of cached team members.
CLI Example:
.. code-block:: bash
... | salt/modules/github.py | def list_team_members(team_name, profile="github", ignore_cache=False):
'''
Gets the names of team members in lower case.
team_name
The name of the team from which to list members.
profile
The name of the profile configuration to use. Defaults to ``github``.
ignore_cache
B... | def list_team_members(team_name, profile="github", ignore_cache=False):
'''
Gets the names of team members in lower case.
team_name
The name of the team from which to list members.
profile
The name of the profile configuration to use. Defaults to ``github``.
ignore_cache
B... | [
"Gets",
"the",
"names",
"of",
"team",
"members",
"in",
"lower",
"case",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L1465-L1508 | [
"def",
"list_team_members",
"(",
"team_name",
",",
"profile",
"=",
"\"github\"",
",",
"ignore_cache",
"=",
"False",
")",
":",
"cached_team",
"=",
"get_team",
"(",
"team_name",
",",
"profile",
"=",
"profile",
")",
"if",
"not",
"cached_team",
":",
"log",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_members_without_mfa | List all members (in lower case) without MFA turned on.
profile
The name of the profile configuration to use. Defaults to ``github``.
ignore_cache
Bypasses the use of cached team repos.
CLI Example:
.. code-block:: bash
salt myminion github.list_members_without_mfa
.. v... | salt/modules/github.py | def list_members_without_mfa(profile="github", ignore_cache=False):
'''
List all members (in lower case) without MFA turned on.
profile
The name of the profile configuration to use. Defaults to ``github``.
ignore_cache
Bypasses the use of cached team repos.
CLI Example:
.. co... | def list_members_without_mfa(profile="github", ignore_cache=False):
'''
List all members (in lower case) without MFA turned on.
profile
The name of the profile configuration to use. Defaults to ``github``.
ignore_cache
Bypasses the use of cached team repos.
CLI Example:
.. co... | [
"List",
"all",
"members",
"(",
"in",
"lower",
"case",
")",
"without",
"MFA",
"turned",
"on",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L1511-L1547 | [
"def",
"list_members_without_mfa",
"(",
"profile",
"=",
"\"github\"",
",",
"ignore_cache",
"=",
"False",
")",
":",
"key",
"=",
"\"github.{0}:non_mfa_users\"",
".",
"format",
"(",
"_get_config_value",
"(",
"profile",
",",
"'org_name'",
")",
")",
"if",
"key",
"not... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | is_team_member | Returns True if the github user is in the team with team_name, or False
otherwise.
name
The name of the user whose membership to check.
team_name
The name of the team to check membership in.
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI... | salt/modules/github.py | def is_team_member(name, team_name, profile="github"):
'''
Returns True if the github user is in the team with team_name, or False
otherwise.
name
The name of the user whose membership to check.
team_name
The name of the team to check membership in.
profile
The name of... | def is_team_member(name, team_name, profile="github"):
'''
Returns True if the github user is in the team with team_name, or False
otherwise.
name
The name of the user whose membership to check.
team_name
The name of the team to check membership in.
profile
The name of... | [
"Returns",
"True",
"if",
"the",
"github",
"user",
"is",
"in",
"the",
"team",
"with",
"team_name",
"or",
"False",
"otherwise",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L1550-L1572 | [
"def",
"is_team_member",
"(",
"name",
",",
"team_name",
",",
"profile",
"=",
"\"github\"",
")",
":",
"return",
"name",
".",
"lower",
"(",
")",
"in",
"list_team_members",
"(",
"team_name",
",",
"profile",
"=",
"profile",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | add_team_member | Adds a team member to a team with team_name.
name
The name of the team member to add.
team_name
The name of the team of which to add the user.
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. code-block:: bash
salt my... | salt/modules/github.py | def add_team_member(name, team_name, profile="github"):
'''
Adds a team member to a team with team_name.
name
The name of the team member to add.
team_name
The name of the team of which to add the user.
profile
The name of the profile configuration to use. Defaults to ``gi... | def add_team_member(name, team_name, profile="github"):
'''
Adds a team member to a team with team_name.
name
The name of the team member to add.
team_name
The name of the team of which to add the user.
profile
The name of the profile configuration to use. Defaults to ``gi... | [
"Adds",
"a",
"team",
"member",
"to",
"a",
"team",
"with",
"team_name",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L1575-L1623 | [
"def",
"add_team_member",
"(",
"name",
",",
"team_name",
",",
"profile",
"=",
"\"github\"",
")",
":",
"team",
"=",
"get_team",
"(",
"team_name",
",",
"profile",
"=",
"profile",
")",
"if",
"not",
"team",
":",
"log",
".",
"error",
"(",
"'Team %s does not exi... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | remove_team_member | Removes a team member from a team with team_name.
name
The name of the team member to remove.
team_name
The name of the team from which to remove the user.
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. code-block:: bash
... | salt/modules/github.py | def remove_team_member(name, team_name, profile="github"):
'''
Removes a team member from a team with team_name.
name
The name of the team member to remove.
team_name
The name of the team from which to remove the user.
profile
The name of the profile configuration to use. ... | def remove_team_member(name, team_name, profile="github"):
'''
Removes a team member from a team with team_name.
name
The name of the team member to remove.
team_name
The name of the team from which to remove the user.
profile
The name of the profile configuration to use. ... | [
"Removes",
"a",
"team",
"member",
"from",
"a",
"team",
"with",
"team_name",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L1626-L1668 | [
"def",
"remove_team_member",
"(",
"name",
",",
"team_name",
",",
"profile",
"=",
"\"github\"",
")",
":",
"team",
"=",
"get_team",
"(",
"team_name",
",",
"profile",
"=",
"profile",
")",
"if",
"not",
"team",
":",
"log",
".",
"error",
"(",
"'Team %s does not ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_teams | Lists all teams with the organization.
profile
The name of the profile configuration to use. Defaults to ``github``.
ignore_cache
Bypasses the use of cached teams.
CLI Example:
.. code-block:: bash
salt myminion github.list_teams
.. versionadded:: 2016.11.0 | salt/modules/github.py | def list_teams(profile="github", ignore_cache=False):
'''
Lists all teams with the organization.
profile
The name of the profile configuration to use. Defaults to ``github``.
ignore_cache
Bypasses the use of cached teams.
CLI Example:
.. code-block:: bash
salt mymini... | def list_teams(profile="github", ignore_cache=False):
'''
Lists all teams with the organization.
profile
The name of the profile configuration to use. Defaults to ``github``.
ignore_cache
Bypasses the use of cached teams.
CLI Example:
.. code-block:: bash
salt mymini... | [
"Lists",
"all",
"teams",
"with",
"the",
"organization",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L1671-L1714 | [
"def",
"list_teams",
"(",
"profile",
"=",
"\"github\"",
",",
"ignore_cache",
"=",
"False",
")",
":",
"key",
"=",
"'github.{0}:teams'",
".",
"format",
"(",
"_get_config_value",
"(",
"profile",
",",
"'org_name'",
")",
")",
"if",
"key",
"not",
"in",
"__context_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_prs | Returns information for all pull requests in a given repository, based on
the search options provided.
.. versionadded:: 2017.7.0
repo_name
The name of the repository for which to list pull requests. This
argument is required, either passed via the CLI, or defined in the
configured... | salt/modules/github.py | def get_prs(repo_name=None,
profile='github',
state='open',
head=None,
base=None,
sort='created',
direction='desc',
output='min',
per_page=None):
'''
Returns information for all pull requests in a given repository, b... | def get_prs(repo_name=None,
profile='github',
state='open',
head=None,
base=None,
sort='created',
direction='desc',
output='min',
per_page=None):
'''
Returns information for all pull requests in a given repository, b... | [
"Returns",
"information",
"for",
"all",
"pull",
"requests",
"in",
"a",
"given",
"repository",
"based",
"on",
"the",
"search",
"options",
"provided",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L1717-L1813 | [
"def",
"get_prs",
"(",
"repo_name",
"=",
"None",
",",
"profile",
"=",
"'github'",
",",
"state",
"=",
"'open'",
",",
"head",
"=",
"None",
",",
"base",
"=",
"None",
",",
"sort",
"=",
"'created'",
",",
"direction",
"=",
"'desc'",
",",
"output",
"=",
"'m... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _format_pr | Helper function to format API return information into a more manageable
and useful dictionary for pull request information.
pr_
The pull request to format. | salt/modules/github.py | def _format_pr(pr_):
'''
Helper function to format API return information into a more manageable
and useful dictionary for pull request information.
pr_
The pull request to format.
'''
ret = {'id': pr_.get('id'),
'pr_number': pr_.get('number'),
'state': pr_.get('st... | def _format_pr(pr_):
'''
Helper function to format API return information into a more manageable
and useful dictionary for pull request information.
pr_
The pull request to format.
'''
ret = {'id': pr_.get('id'),
'pr_number': pr_.get('number'),
'state': pr_.get('st... | [
"Helper",
"function",
"to",
"format",
"API",
"return",
"information",
"into",
"a",
"more",
"manageable",
"and",
"useful",
"dictionary",
"for",
"pull",
"request",
"information",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L1816-L1832 | [
"def",
"_format_pr",
"(",
"pr_",
")",
":",
"ret",
"=",
"{",
"'id'",
":",
"pr_",
".",
"get",
"(",
"'id'",
")",
",",
"'pr_number'",
":",
"pr_",
".",
"get",
"(",
"'number'",
")",
",",
"'state'",
":",
"pr_",
".",
"get",
"(",
"'state'",
")",
",",
"'... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _format_issue | Helper function to format API return information into a more manageable
and useful dictionary for issue information.
issue
The issue to format. | salt/modules/github.py | def _format_issue(issue):
'''
Helper function to format API return information into a more manageable
and useful dictionary for issue information.
issue
The issue to format.
'''
ret = {'id': issue.get('id'),
'issue_number': issue.get('number'),
'state': issue.get('... | def _format_issue(issue):
'''
Helper function to format API return information into a more manageable
and useful dictionary for issue information.
issue
The issue to format.
'''
ret = {'id': issue.get('id'),
'issue_number': issue.get('number'),
'state': issue.get('... | [
"Helper",
"function",
"to",
"format",
"API",
"return",
"information",
"into",
"a",
"more",
"manageable",
"and",
"useful",
"dictionary",
"for",
"issue",
"information",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L1835-L1867 | [
"def",
"_format_issue",
"(",
"issue",
")",
":",
"ret",
"=",
"{",
"'id'",
":",
"issue",
".",
"get",
"(",
"'id'",
")",
",",
"'issue_number'",
":",
"issue",
".",
"get",
"(",
"'number'",
")",
",",
"'state'",
":",
"issue",
".",
"get",
"(",
"'state'",
")... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _query | Make a web call to the GitHub API and deal with paginated results. | salt/modules/github.py | def _query(profile,
action=None,
command=None,
args=None,
method='GET',
header_dict=None,
data=None,
url='https://api.github.com/',
per_page=None):
'''
Make a web call to the GitHub API and deal with paginated results.
'... | def _query(profile,
action=None,
command=None,
args=None,
method='GET',
header_dict=None,
data=None,
url='https://api.github.com/',
per_page=None):
'''
Make a web call to the GitHub API and deal with paginated results.
'... | [
"Make",
"a",
"web",
"call",
"to",
"the",
"GitHub",
"API",
"and",
"deal",
"with",
"paginated",
"results",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L1870-L1959 | [
"def",
"_query",
"(",
"profile",
",",
"action",
"=",
"None",
",",
"command",
"=",
"None",
",",
"args",
"=",
"None",
",",
"method",
"=",
"'GET'",
",",
"header_dict",
"=",
"None",
",",
"data",
"=",
"None",
",",
"url",
"=",
"'https://api.github.com/'",
",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_baseline_from_tag | Returns the last created baseline snapshot marked with `tag` | salt/states/snapper.py | def _get_baseline_from_tag(config, tag):
'''
Returns the last created baseline snapshot marked with `tag`
'''
last_snapshot = None
for snapshot in __salt__['snapper.list_snapshots'](config):
if tag == snapshot['userdata'].get("baseline_tag"):
if not last_snapshot or last_snapshot... | def _get_baseline_from_tag(config, tag):
'''
Returns the last created baseline snapshot marked with `tag`
'''
last_snapshot = None
for snapshot in __salt__['snapper.list_snapshots'](config):
if tag == snapshot['userdata'].get("baseline_tag"):
if not last_snapshot or last_snapshot... | [
"Returns",
"the",
"last",
"created",
"baseline",
"snapshot",
"marked",
"with",
"tag"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/snapper.py#L122-L131 | [
"def",
"_get_baseline_from_tag",
"(",
"config",
",",
"tag",
")",
":",
"last_snapshot",
"=",
"None",
"for",
"snapshot",
"in",
"__salt__",
"[",
"'snapper.list_snapshots'",
"]",
"(",
"config",
")",
":",
"if",
"tag",
"==",
"snapshot",
"[",
"'userdata'",
"]",
"."... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | baseline_snapshot | Enforces that no file is modified comparing against a previously
defined snapshot identified by number.
number
Number of selected baseline snapshot.
tag
Tag of the selected baseline snapshot. Most recent baseline baseline
snapshot is used in case of multiple snapshots with the same... | salt/states/snapper.py | def baseline_snapshot(name, number=None, tag=None, include_diff=True, config='root', ignore=None):
'''
Enforces that no file is modified comparing against a previously
defined snapshot identified by number.
number
Number of selected baseline snapshot.
tag
Tag of the selected baseli... | def baseline_snapshot(name, number=None, tag=None, include_diff=True, config='root', ignore=None):
'''
Enforces that no file is modified comparing against a previously
defined snapshot identified by number.
number
Number of selected baseline snapshot.
tag
Tag of the selected baseli... | [
"Enforces",
"that",
"no",
"file",
"is",
"modified",
"comparing",
"against",
"a",
"previously",
"defined",
"snapshot",
"identified",
"by",
"number",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/snapper.py#L134-L219 | [
"def",
"baseline_snapshot",
"(",
"name",
",",
"number",
"=",
"None",
",",
"tag",
"=",
"None",
",",
"include_diff",
"=",
"True",
",",
"config",
"=",
"'root'",
",",
"ignore",
"=",
"None",
")",
":",
"if",
"not",
"ignore",
":",
"ignore",
"=",
"[",
"]",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _verify_run | Crash to the log if command execution was not successful. | salt/utils/fsutils.py | def _verify_run(out, cmd=None):
'''
Crash to the log if command execution was not successful.
'''
if out.get('retcode', 0) and out['stderr']:
if cmd:
log.debug('Command: \'%s\'', cmd)
log.debug('Return code: %s', out.get('retcode'))
log.debug('Error output:\n%s', out... | def _verify_run(out, cmd=None):
'''
Crash to the log if command execution was not successful.
'''
if out.get('retcode', 0) and out['stderr']:
if cmd:
log.debug('Command: \'%s\'', cmd)
log.debug('Return code: %s', out.get('retcode'))
log.debug('Error output:\n%s', out... | [
"Crash",
"to",
"the",
"log",
"if",
"command",
"execution",
"was",
"not",
"successful",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/fsutils.py#L25-L36 | [
"def",
"_verify_run",
"(",
"out",
",",
"cmd",
"=",
"None",
")",
":",
"if",
"out",
".",
"get",
"(",
"'retcode'",
",",
"0",
")",
"and",
"out",
"[",
"'stderr'",
"]",
":",
"if",
"cmd",
":",
"log",
".",
"debug",
"(",
"'Command: \\'%s\\''",
",",
"cmd",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_mounts | List mounted filesystems. | salt/utils/fsutils.py | def _get_mounts(fs_type=None):
'''
List mounted filesystems.
'''
mounts = {}
with salt.utils.files.fopen('/proc/mounts') as fhr:
for line in fhr.readlines():
line = salt.utils.stringutils.to_unicode(line)
device, mntpnt, fstype, options, fs_freq, fs_passno = line.stri... | def _get_mounts(fs_type=None):
'''
List mounted filesystems.
'''
mounts = {}
with salt.utils.files.fopen('/proc/mounts') as fhr:
for line in fhr.readlines():
line = salt.utils.stringutils.to_unicode(line)
device, mntpnt, fstype, options, fs_freq, fs_passno = line.stri... | [
"List",
"mounted",
"filesystems",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/fsutils.py#L39-L60 | [
"def",
"_get_mounts",
"(",
"fs_type",
"=",
"None",
")",
":",
"mounts",
"=",
"{",
"}",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"'/proc/mounts'",
")",
"as",
"fhr",
":",
"for",
"line",
"in",
"fhr",
".",
"readlines",
"(",
")",
":... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _blkid_output | Parse blkid output. | salt/utils/fsutils.py | def _blkid_output(out, fs_type=None):
'''
Parse blkid output.
'''
flt = lambda data: [el for el in data if el.strip()]
data = {}
for dev_meta in flt(out.split('\n\n')):
dev = {}
for items in flt(dev_meta.strip().split('\n')):
key, val = items.split('=', 1)
... | def _blkid_output(out, fs_type=None):
'''
Parse blkid output.
'''
flt = lambda data: [el for el in data if el.strip()]
data = {}
for dev_meta in flt(out.split('\n\n')):
dev = {}
for items in flt(dev_meta.strip().split('\n')):
key, val = items.split('=', 1)
... | [
"Parse",
"blkid",
"output",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/fsutils.py#L64-L86 | [
"def",
"_blkid_output",
"(",
"out",
",",
"fs_type",
"=",
"None",
")",
":",
"flt",
"=",
"lambda",
"data",
":",
"[",
"el",
"for",
"el",
"in",
"data",
"if",
"el",
".",
"strip",
"(",
")",
"]",
"data",
"=",
"{",
"}",
"for",
"dev_meta",
"in",
"flt",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _blkid | Return available media devices.
:param fs_type: Filter only devices that are formatted by that file system. | salt/utils/fsutils.py | def _blkid(fs_type=None):
'''
Return available media devices.
:param fs_type: Filter only devices that are formatted by that file system.
'''
flt = lambda data: [el for el in data if el.strip()]
data = dict()
for dev_meta in flt(os.popen("blkid -o full").read().split(os.linesep)): # No __s... | def _blkid(fs_type=None):
'''
Return available media devices.
:param fs_type: Filter only devices that are formatted by that file system.
'''
flt = lambda data: [el for el in data if el.strip()]
data = dict()
for dev_meta in flt(os.popen("blkid -o full").read().split(os.linesep)): # No __s... | [
"Return",
"available",
"media",
"devices",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/fsutils.py#L89-L114 | [
"def",
"_blkid",
"(",
"fs_type",
"=",
"None",
")",
":",
"flt",
"=",
"lambda",
"data",
":",
"[",
"el",
"for",
"el",
"in",
"data",
"if",
"el",
".",
"strip",
"(",
")",
"]",
"data",
"=",
"dict",
"(",
")",
"for",
"dev_meta",
"in",
"flt",
"(",
"os",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _is_device | Return True if path is a physical device. | salt/utils/fsutils.py | def _is_device(path):
'''
Return True if path is a physical device.
'''
out = __salt__['cmd.run_all']('file -i {0}'.format(path))
_verify_run(out)
# Always [device, mime, charset]. See (file --help)
return re.split(r'\s+', out['stdout'])[1][:-1] == 'inode/blockdevice' | def _is_device(path):
'''
Return True if path is a physical device.
'''
out = __salt__['cmd.run_all']('file -i {0}'.format(path))
_verify_run(out)
# Always [device, mime, charset]. See (file --help)
return re.split(r'\s+', out['stdout'])[1][:-1] == 'inode/blockdevice' | [
"Return",
"True",
"if",
"path",
"is",
"a",
"physical",
"device",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/fsutils.py#L117-L125 | [
"def",
"_is_device",
"(",
"path",
")",
":",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"'file -i {0}'",
".",
"format",
"(",
"path",
")",
")",
"_verify_run",
"(",
"out",
")",
"# Always [device, mime, charset]. See (file --help)",
"return",
"re",
".",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | returner | Send an mattermost message with the data | salt/returners/mattermost_returner.py | def returner(ret):
'''
Send an mattermost message with the data
'''
_options = _get_options(ret)
api_url = _options.get('api_url')
channel = _options.get('channel')
username = _options.get('username')
hook = _options.get('hook')
if not hook:
log.error('mattermost.hook not ... | def returner(ret):
'''
Send an mattermost message with the data
'''
_options = _get_options(ret)
api_url = _options.get('api_url')
channel = _options.get('channel')
username = _options.get('username')
hook = _options.get('hook')
if not hook:
log.error('mattermost.hook not ... | [
"Send",
"an",
"mattermost",
"message",
"with",
"the",
"data"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mattermost_returner.py#L96-L130 | [
"def",
"returner",
"(",
"ret",
")",
":",
"_options",
"=",
"_get_options",
"(",
"ret",
")",
"api_url",
"=",
"_options",
".",
"get",
"(",
"'api_url'",
")",
"channel",
"=",
"_options",
".",
"get",
"(",
"'channel'",
")",
"username",
"=",
"_options",
".",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | event_return | Send the events to a mattermost room.
:param events: List of events
:return: Boolean if messages were sent successfully. | salt/returners/mattermost_returner.py | def event_return(events):
'''
Send the events to a mattermost room.
:param events: List of events
:return: Boolean if messages were sent successfully.
'''
_options = _get_options()
api_url = _options.get('api_url')
channel = _options.get('channel')
username = _optio... | def event_return(events):
'''
Send the events to a mattermost room.
:param events: List of events
:return: Boolean if messages were sent successfully.
'''
_options = _get_options()
api_url = _options.get('api_url')
channel = _options.get('channel')
username = _optio... | [
"Send",
"the",
"events",
"to",
"a",
"mattermost",
"room",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mattermost_returner.py#L133-L162 | [
"def",
"event_return",
"(",
"events",
")",
":",
"_options",
"=",
"_get_options",
"(",
")",
"api_url",
"=",
"_options",
".",
"get",
"(",
"'api_url'",
")",
"channel",
"=",
"_options",
".",
"get",
"(",
"'channel'",
")",
"username",
"=",
"_options",
".",
"ge... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | post_message | Send a message to a mattermost room.
:param channel: The room name.
:param message: The message to send to the mattermost room.
:param username: Specify who the message is from.
:param hook: The mattermost hook, if not specified in the configuration.
:return: Boolean if... | salt/returners/mattermost_returner.py | def post_message(channel,
message,
username,
api_url,
hook):
'''
Send a message to a mattermost room.
:param channel: The room name.
:param message: The message to send to the mattermost room.
:param username: Specify wh... | def post_message(channel,
message,
username,
api_url,
hook):
'''
Send a message to a mattermost room.
:param channel: The room name.
:param message: The message to send to the mattermost room.
:param username: Specify wh... | [
"Send",
"a",
"message",
"to",
"a",
"mattermost",
"room",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mattermost_returner.py#L165-L193 | [
"def",
"post_message",
"(",
"channel",
",",
"message",
",",
"username",
",",
"api_url",
",",
"hook",
")",
":",
"parameters",
"=",
"dict",
"(",
")",
"if",
"channel",
":",
"parameters",
"[",
"'channel'",
"]",
"=",
"channel",
"if",
"username",
":",
"paramet... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create | Create Znode
path
path of znode to create
value
value to assign to znode (Default: '')
acls
list of acl dictionaries to be assigned (Default: None)
ephemeral
indicate node is ephemeral (Default: False)
sequence
indicate node is suffixed with a unique inde... | salt/modules/zookeeper.py | def create(path, value='', acls=None, ephemeral=False, sequence=False, makepath=False, profile=None,
hosts=None, scheme=None, username=None, password=None, default_acl=None):
'''
Create Znode
path
path of znode to create
value
value to assign to znode (Default: '')
acls... | def create(path, value='', acls=None, ephemeral=False, sequence=False, makepath=False, profile=None,
hosts=None, scheme=None, username=None, password=None, default_acl=None):
'''
Create Znode
path
path of znode to create
value
value to assign to znode (Default: '')
acls... | [
"Create",
"Znode"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zookeeper.py#L134-L187 | [
"def",
"create",
"(",
"path",
",",
"value",
"=",
"''",
",",
"acls",
"=",
"None",
",",
"ephemeral",
"=",
"False",
",",
"sequence",
"=",
"False",
",",
"makepath",
"=",
"False",
",",
"profile",
"=",
"None",
",",
"hosts",
"=",
"None",
",",
"scheme",
"=... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ensure_path | Ensure Znode path exists
path
Parent path to create
acls
list of acls dictionaries to be assigned (Default: None)
profile
Configured Zookeeper profile to authenticate with (Default: None)
hosts
Lists of Zookeeper Hosts (Default: '127.0.0.1:2181)
scheme
Sc... | salt/modules/zookeeper.py | def ensure_path(path, acls=None, profile=None, hosts=None, scheme=None,
username=None, password=None, default_acl=None):
'''
Ensure Znode path exists
path
Parent path to create
acls
list of acls dictionaries to be assigned (Default: None)
profile
Configured... | def ensure_path(path, acls=None, profile=None, hosts=None, scheme=None,
username=None, password=None, default_acl=None):
'''
Ensure Znode path exists
path
Parent path to create
acls
list of acls dictionaries to be assigned (Default: None)
profile
Configured... | [
"Ensure",
"Znode",
"path",
"exists"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zookeeper.py#L190-L231 | [
"def",
"ensure_path",
"(",
"path",
",",
"acls",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"hosts",
"=",
"None",
",",
"scheme",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"default_acl",
"=",
"None",
")",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | exists | Check if path exists
path
path to check
profile
Configured Zookeeper profile to authenticate with (Default: None)
hosts
Lists of Zookeeper Hosts (Default: '127.0.0.1:2181)
scheme
Scheme to authenticate with (Default: 'digest')
username
Username to authent... | salt/modules/zookeeper.py | def exists(path, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None):
'''
Check if path exists
path
path to check
profile
Configured Zookeeper profile to authenticate with (Default: None)
hosts
Lists of Zookeeper Hosts (Default: '127.0.0.... | def exists(path, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None):
'''
Check if path exists
path
path to check
profile
Configured Zookeeper profile to authenticate with (Default: None)
hosts
Lists of Zookeeper Hosts (Default: '127.0.0.... | [
"Check",
"if",
"path",
"exists"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zookeeper.py#L234-L268 | [
"def",
"exists",
"(",
"path",
",",
"profile",
"=",
"None",
",",
"hosts",
"=",
"None",
",",
"scheme",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"default_acl",
"=",
"None",
")",
":",
"conn",
"=",
"_get_zk_conn",
"(",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get | Get value saved in znode
path
path to check
profile
Configured Zookeeper profile to authenticate with (Default: None)
hosts
Lists of Zookeeper Hosts (Default: '127.0.0.1:2181)
scheme
Scheme to authenticate with (Default: 'digest')
username
Username to aut... | salt/modules/zookeeper.py | def get(path, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None):
'''
Get value saved in znode
path
path to check
profile
Configured Zookeeper profile to authenticate with (Default: None)
hosts
Lists of Zookeeper Hosts (Default: '127.0.0... | def get(path, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None):
'''
Get value saved in znode
path
path to check
profile
Configured Zookeeper profile to authenticate with (Default: None)
hosts
Lists of Zookeeper Hosts (Default: '127.0.0... | [
"Get",
"value",
"saved",
"in",
"znode"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zookeeper.py#L271-L306 | [
"def",
"get",
"(",
"path",
",",
"profile",
"=",
"None",
",",
"hosts",
"=",
"None",
",",
"scheme",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"default_acl",
"=",
"None",
")",
":",
"conn",
"=",
"_get_zk_conn",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_children | Get children in znode path
path
path to check
profile
Configured Zookeeper profile to authenticate with (Default: None)
hosts
Lists of Zookeeper Hosts (Default: '127.0.0.1:2181)
scheme
Scheme to authenticate with (Default: 'digest')
username
Username to a... | salt/modules/zookeeper.py | def get_children(path, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None):
'''
Get children in znode path
path
path to check
profile
Configured Zookeeper profile to authenticate with (Default: None)
hosts
Lists of Zookeeper Hosts (Defaul... | def get_children(path, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None):
'''
Get children in znode path
path
path to check
profile
Configured Zookeeper profile to authenticate with (Default: None)
hosts
Lists of Zookeeper Hosts (Defaul... | [
"Get",
"children",
"in",
"znode",
"path"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zookeeper.py#L309-L344 | [
"def",
"get_children",
"(",
"path",
",",
"profile",
"=",
"None",
",",
"hosts",
"=",
"None",
",",
"scheme",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"default_acl",
"=",
"None",
")",
":",
"conn",
"=",
"_get_zk_conn",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set | Update znode with new value
path
znode to update
value
value to set in znode
version
only update znode if version matches (Default: -1 (always matches))
profile
Configured Zookeeper profile to authenticate with (Default: None)
hosts
Lists of Zookeeper Hos... | salt/modules/zookeeper.py | def set(path, value, version=-1, profile=None, hosts=None, scheme=None,
username=None, password=None, default_acl=None):
'''
Update znode with new value
path
znode to update
value
value to set in znode
version
only update znode if version matches (Default: -1 (alwa... | def set(path, value, version=-1, profile=None, hosts=None, scheme=None,
username=None, password=None, default_acl=None):
'''
Update znode with new value
path
znode to update
value
value to set in znode
version
only update znode if version matches (Default: -1 (alwa... | [
"Update",
"znode",
"with",
"new",
"value"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zookeeper.py#L347-L388 | [
"def",
"set",
"(",
"path",
",",
"value",
",",
"version",
"=",
"-",
"1",
",",
"profile",
"=",
"None",
",",
"hosts",
"=",
"None",
",",
"scheme",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"default_acl",
"=",
"None",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_acls | Get acls on a znode
path
path to znode
profile
Configured Zookeeper profile to authenticate with (Default: None)
hosts
Lists of Zookeeper Hosts (Default: '127.0.0.1:2181)
scheme
Scheme to authenticate with (Default: 'digest')
username
Username to authenti... | salt/modules/zookeeper.py | def get_acls(path, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None):
'''
Get acls on a znode
path
path to znode
profile
Configured Zookeeper profile to authenticate with (Default: None)
hosts
Lists of Zookeeper Hosts (Default: '127.0.0... | def get_acls(path, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None):
'''
Get acls on a znode
path
path to znode
profile
Configured Zookeeper profile to authenticate with (Default: None)
hosts
Lists of Zookeeper Hosts (Default: '127.0.0... | [
"Get",
"acls",
"on",
"a",
"znode"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zookeeper.py#L391-L425 | [
"def",
"get_acls",
"(",
"path",
",",
"profile",
"=",
"None",
",",
"hosts",
"=",
"None",
",",
"scheme",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"default_acl",
"=",
"None",
")",
":",
"conn",
"=",
"_get_zk_conn",
"(... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_acls | Set acls on a znode
path
path to znode
acls
list of acl dictionaries to set on the znode
version
only set acls if version matches (Default: -1 (always matches))
profile
Configured Zookeeper profile to authenticate with (Default: None)
hosts
Lists of Zooke... | salt/modules/zookeeper.py | def set_acls(path, acls, version=-1, profile=None, hosts=None, scheme=None,
username=None, password=None, default_acl=None):
'''
Set acls on a znode
path
path to znode
acls
list of acl dictionaries to set on the znode
version
only set acls if version matches (... | def set_acls(path, acls, version=-1, profile=None, hosts=None, scheme=None,
username=None, password=None, default_acl=None):
'''
Set acls on a znode
path
path to znode
acls
list of acl dictionaries to set on the znode
version
only set acls if version matches (... | [
"Set",
"acls",
"on",
"a",
"znode"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zookeeper.py#L428-L474 | [
"def",
"set_acls",
"(",
"path",
",",
"acls",
",",
"version",
"=",
"-",
"1",
",",
"profile",
"=",
"None",
",",
"hosts",
"=",
"None",
",",
"scheme",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"default_acl",
"=",
"No... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete | Delete znode
path
path to znode
version
only delete if version matches (Default: -1 (always matches))
profile
Configured Zookeeper profile to authenticate with (Default: None)
hosts
Lists of Zookeeper Hosts (Default: '127.0.0.1:2181)
scheme
Scheme to auth... | salt/modules/zookeeper.py | def delete(path, version=-1, recursive=False, profile=None, hosts=None, scheme=None,
username=None, password=None, default_acl=None):
'''
Delete znode
path
path to znode
version
only delete if version matches (Default: -1 (always matches))
profile
Configured Zoo... | def delete(path, version=-1, recursive=False, profile=None, hosts=None, scheme=None,
username=None, password=None, default_acl=None):
'''
Delete znode
path
path to znode
version
only delete if version matches (Default: -1 (always matches))
profile
Configured Zoo... | [
"Delete",
"znode"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zookeeper.py#L477-L515 | [
"def",
"delete",
"(",
"path",
",",
"version",
"=",
"-",
"1",
",",
"recursive",
"=",
"False",
",",
"profile",
"=",
"None",
",",
"hosts",
"=",
"None",
",",
"scheme",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"defau... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | make_digest_acl | Generate acl object
.. note:: This is heavily used in the zookeeper state and probably is not useful as a cli module
username
username of acl
password
plain text password of acl
read
read acl
write
write acl
create
create acl
delete
dele... | salt/modules/zookeeper.py | def make_digest_acl(username, password, read=False, write=False, create=False, delete=False, admin=False,
allperms=False):
'''
Generate acl object
.. note:: This is heavily used in the zookeeper state and probably is not useful as a cli module
username
username of acl
... | def make_digest_acl(username, password, read=False, write=False, create=False, delete=False, admin=False,
allperms=False):
'''
Generate acl object
.. note:: This is heavily used in the zookeeper state and probably is not useful as a cli module
username
username of acl
... | [
"Generate",
"acl",
"object"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zookeeper.py#L518-L555 | [
"def",
"make_digest_acl",
"(",
"username",
",",
"password",
",",
"read",
"=",
"False",
",",
"write",
"=",
"False",
",",
"create",
"=",
"False",
",",
"delete",
"=",
"False",
",",
"admin",
"=",
"False",
",",
"allperms",
"=",
"False",
")",
":",
"return",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | query | Mattermost object method function to construct and execute on the API URL.
:param api_url: The Mattermost API URL
:param hook: The Mattermost hook.
:param data: The data to be sent for POST method.
:return: The json response from the API call or False. | salt/utils/mattermost.py | def query(hook=None,
api_url=None,
data=None):
'''
Mattermost object method function to construct and execute on the API URL.
:param api_url: The Mattermost API URL
:param hook: The Mattermost hook.
:param data: The data to be sent for POST method.
:return: ... | def query(hook=None,
api_url=None,
data=None):
'''
Mattermost object method function to construct and execute on the API URL.
:param api_url: The Mattermost API URL
:param hook: The Mattermost hook.
:param data: The data to be sent for POST method.
:return: ... | [
"Mattermost",
"object",
"method",
"function",
"to",
"construct",
"and",
"execute",
"on",
"the",
"API",
"URL",
".",
":",
"param",
"api_url",
":",
"The",
"Mattermost",
"API",
"URL",
":",
"param",
"hook",
":",
"The",
"Mattermost",
"hook",
".",
":",
"param",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/mattermost.py#L29-L72 | [
"def",
"query",
"(",
"hook",
"=",
"None",
",",
"api_url",
"=",
"None",
",",
"data",
"=",
"None",
")",
":",
"method",
"=",
"'POST'",
"ret",
"=",
"{",
"'message'",
":",
"''",
",",
"'res'",
":",
"True",
"}",
"base_url",
"=",
"_urljoin",
"(",
"api_url"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ext_pillar | Read pillar data from Confidant via its API. | salt/pillar/confidant.py | def ext_pillar(minion_id, pillar, profile=None):
'''
Read pillar data from Confidant via its API.
'''
if profile is None:
profile = {}
# default to returning failure
ret = {
'credentials_result': False,
'credentials': None,
'credentials_metadata': None
}
p... | def ext_pillar(minion_id, pillar, profile=None):
'''
Read pillar data from Confidant via its API.
'''
if profile is None:
profile = {}
# default to returning failure
ret = {
'credentials_result': False,
'credentials': None,
'credentials_metadata': None
}
p... | [
"Read",
"pillar",
"data",
"from",
"Confidant",
"via",
"its",
"API",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/confidant.py#L70-L123 | [
"def",
"ext_pillar",
"(",
"minion_id",
",",
"pillar",
",",
"profile",
"=",
"None",
")",
":",
"if",
"profile",
"is",
"None",
":",
"profile",
"=",
"{",
"}",
"# default to returning failure",
"ret",
"=",
"{",
"'credentials_result'",
":",
"False",
",",
"'credent... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | setup_temp_logger | Setup the temporary console logger | salt/log/setup.py | def setup_temp_logger(log_level='error'):
'''
Setup the temporary console logger
'''
if is_temp_logging_configured():
logging.getLogger(__name__).warning(
'Temporary logging is already configured'
)
return
if log_level is None:
log_level = 'warning'
... | def setup_temp_logger(log_level='error'):
'''
Setup the temporary console logger
'''
if is_temp_logging_configured():
logging.getLogger(__name__).warning(
'Temporary logging is already configured'
)
return
if log_level is None:
log_level = 'warning'
... | [
"Setup",
"the",
"temporary",
"console",
"logger"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/log/setup.py#L457-L508 | [
"def",
"setup_temp_logger",
"(",
"log_level",
"=",
"'error'",
")",
":",
"if",
"is_temp_logging_configured",
"(",
")",
":",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
".",
"warning",
"(",
"'Temporary logging is already configured'",
")",
"return",
"if",
"lo... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | setup_console_logger | Setup the console logger | salt/log/setup.py | def setup_console_logger(log_level='error', log_format=None, date_format=None):
'''
Setup the console logger
'''
if is_console_configured():
logging.getLogger(__name__).warning('Console logging already configured')
return
# Remove the temporary logging handler
__remove_temp_logg... | def setup_console_logger(log_level='error', log_format=None, date_format=None):
'''
Setup the console logger
'''
if is_console_configured():
logging.getLogger(__name__).warning('Console logging already configured')
return
# Remove the temporary logging handler
__remove_temp_logg... | [
"Setup",
"the",
"console",
"logger"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/log/setup.py#L511-L559 | [
"def",
"setup_console_logger",
"(",
"log_level",
"=",
"'error'",
",",
"log_format",
"=",
"None",
",",
"date_format",
"=",
"None",
")",
":",
"if",
"is_console_configured",
"(",
")",
":",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
".",
"warning",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | setup_logfile_logger | Setup the logfile logger
Since version 0.10.6 we support logging to syslog, some examples:
tcp://localhost:514/LOG_USER
tcp://localhost/LOG_DAEMON
udp://localhost:5145/LOG_KERN
udp://localhost
file:///dev/log
file:///dev/log/LOG_SYSLOG
file:///dev/log/LOG_DA... | salt/log/setup.py | def setup_logfile_logger(log_path, log_level='error', log_format=None,
date_format=None, max_bytes=0, backup_count=0):
'''
Setup the logfile logger
Since version 0.10.6 we support logging to syslog, some examples:
tcp://localhost:514/LOG_USER
tcp://localhost/LOG_DA... | def setup_logfile_logger(log_path, log_level='error', log_format=None,
date_format=None, max_bytes=0, backup_count=0):
'''
Setup the logfile logger
Since version 0.10.6 we support logging to syslog, some examples:
tcp://localhost:514/LOG_USER
tcp://localhost/LOG_DA... | [
"Setup",
"the",
"logfile",
"logger"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/log/setup.py#L562-L739 | [
"def",
"setup_logfile_logger",
"(",
"log_path",
",",
"log_level",
"=",
"'error'",
",",
"log_format",
"=",
"None",
",",
"date_format",
"=",
"None",
",",
"max_bytes",
"=",
"0",
",",
"backup_count",
"=",
"0",
")",
":",
"if",
"is_logfile_configured",
"(",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | setup_extended_logging | Setup any additional logging handlers, internal or external | salt/log/setup.py | def setup_extended_logging(opts):
'''
Setup any additional logging handlers, internal or external
'''
if is_extended_logging_configured() is True:
# Don't re-configure external loggers
return
# Explicit late import of salt's loader
import salt.loader
# Let's keep a referenc... | def setup_extended_logging(opts):
'''
Setup any additional logging handlers, internal or external
'''
if is_extended_logging_configured() is True:
# Don't re-configure external loggers
return
# Explicit late import of salt's loader
import salt.loader
# Let's keep a referenc... | [
"Setup",
"any",
"additional",
"logging",
"handlers",
"internal",
"or",
"external"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/log/setup.py#L742-L824 | [
"def",
"setup_extended_logging",
"(",
"opts",
")",
":",
"if",
"is_extended_logging_configured",
"(",
")",
"is",
"True",
":",
"# Don't re-configure external loggers",
"return",
"# Explicit late import of salt's loader",
"import",
"salt",
".",
"loader",
"# Let's keep a referenc... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_multiprocessing_logging_level_by_opts | This will set the multiprocessing logging level to the lowest
logging level of all the types of logging that are configured. | salt/log/setup.py | def set_multiprocessing_logging_level_by_opts(opts):
'''
This will set the multiprocessing logging level to the lowest
logging level of all the types of logging that are configured.
'''
global __MP_LOGGING_LEVEL
log_levels = [
LOG_LEVELS.get(opts.get('log_level', '').lower(), logging.ER... | def set_multiprocessing_logging_level_by_opts(opts):
'''
This will set the multiprocessing logging level to the lowest
logging level of all the types of logging that are configured.
'''
global __MP_LOGGING_LEVEL
log_levels = [
LOG_LEVELS.get(opts.get('log_level', '').lower(), logging.ER... | [
"This",
"will",
"set",
"the",
"multiprocessing",
"logging",
"level",
"to",
"the",
"lowest",
"logging",
"level",
"of",
"all",
"the",
"types",
"of",
"logging",
"that",
"are",
"configured",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/log/setup.py#L854-L870 | [
"def",
"set_multiprocessing_logging_level_by_opts",
"(",
"opts",
")",
":",
"global",
"__MP_LOGGING_LEVEL",
"log_levels",
"=",
"[",
"LOG_LEVELS",
".",
"get",
"(",
"opts",
".",
"get",
"(",
"'log_level'",
",",
"''",
")",
".",
"lower",
"(",
")",
",",
"logging",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | setup_multiprocessing_logging | This code should be called from within a running multiprocessing
process instance. | salt/log/setup.py | def setup_multiprocessing_logging(queue=None):
'''
This code should be called from within a running multiprocessing
process instance.
'''
from salt.utils.platform import is_windows
global __MP_LOGGING_CONFIGURED
global __MP_LOGGING_QUEUE_HANDLER
if __MP_IN_MAINPROCESS is True and not i... | def setup_multiprocessing_logging(queue=None):
'''
This code should be called from within a running multiprocessing
process instance.
'''
from salt.utils.platform import is_windows
global __MP_LOGGING_CONFIGURED
global __MP_LOGGING_QUEUE_HANDLER
if __MP_IN_MAINPROCESS is True and not i... | [
"This",
"code",
"should",
"be",
"called",
"from",
"within",
"a",
"running",
"multiprocessing",
"process",
"instance",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/log/setup.py#L899-L950 | [
"def",
"setup_multiprocessing_logging",
"(",
"queue",
"=",
"None",
")",
":",
"from",
"salt",
".",
"utils",
".",
"platform",
"import",
"is_windows",
"global",
"__MP_LOGGING_CONFIGURED",
"global",
"__MP_LOGGING_QUEUE_HANDLER",
"if",
"__MP_IN_MAINPROCESS",
"is",
"True",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_logger_level | Tweak a specific logger's logging level | salt/log/setup.py | def set_logger_level(logger_name, log_level='error'):
'''
Tweak a specific logger's logging level
'''
logging.getLogger(logger_name).setLevel(
LOG_LEVELS.get(log_level.lower(), logging.ERROR)
) | def set_logger_level(logger_name, log_level='error'):
'''
Tweak a specific logger's logging level
'''
logging.getLogger(logger_name).setLevel(
LOG_LEVELS.get(log_level.lower(), logging.ERROR)
) | [
"Tweak",
"a",
"specific",
"logger",
"s",
"logging",
"level"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/log/setup.py#L1060-L1066 | [
"def",
"set_logger_level",
"(",
"logger_name",
",",
"log_level",
"=",
"'error'",
")",
":",
"logging",
".",
"getLogger",
"(",
"logger_name",
")",
".",
"setLevel",
"(",
"LOG_LEVELS",
".",
"get",
"(",
"log_level",
".",
"lower",
"(",
")",
",",
"logging",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | patch_python_logging_handlers | Patch the python logging handlers with out mixed-in classes | salt/log/setup.py | def patch_python_logging_handlers():
'''
Patch the python logging handlers with out mixed-in classes
'''
logging.StreamHandler = StreamHandler
logging.FileHandler = FileHandler
logging.handlers.SysLogHandler = SysLogHandler
logging.handlers.WatchedFileHandler = WatchedFileHandler
logging... | def patch_python_logging_handlers():
'''
Patch the python logging handlers with out mixed-in classes
'''
logging.StreamHandler = StreamHandler
logging.FileHandler = FileHandler
logging.handlers.SysLogHandler = SysLogHandler
logging.handlers.WatchedFileHandler = WatchedFileHandler
logging... | [
"Patch",
"the",
"python",
"logging",
"handlers",
"with",
"out",
"mixed",
"-",
"in",
"classes"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/log/setup.py#L1069-L1079 | [
"def",
"patch_python_logging_handlers",
"(",
")",
":",
"logging",
".",
"StreamHandler",
"=",
"StreamHandler",
"logging",
".",
"FileHandler",
"=",
"FileHandler",
"logging",
".",
"handlers",
".",
"SysLogHandler",
"=",
"SysLogHandler",
"logging",
".",
"handlers",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __remove_null_logging_handler | This function will run once the temporary logging has been configured. It
just removes the NullHandler from the logging handlers. | salt/log/setup.py | def __remove_null_logging_handler():
'''
This function will run once the temporary logging has been configured. It
just removes the NullHandler from the logging handlers.
'''
global LOGGING_NULL_HANDLER
if LOGGING_NULL_HANDLER is None:
# Already removed
return
root_logger = ... | def __remove_null_logging_handler():
'''
This function will run once the temporary logging has been configured. It
just removes the NullHandler from the logging handlers.
'''
global LOGGING_NULL_HANDLER
if LOGGING_NULL_HANDLER is None:
# Already removed
return
root_logger = ... | [
"This",
"function",
"will",
"run",
"once",
"the",
"temporary",
"logging",
"has",
"been",
"configured",
".",
"It",
"just",
"removes",
"the",
"NullHandler",
"from",
"the",
"logging",
"handlers",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/log/setup.py#L1132-L1149 | [
"def",
"__remove_null_logging_handler",
"(",
")",
":",
"global",
"LOGGING_NULL_HANDLER",
"if",
"LOGGING_NULL_HANDLER",
"is",
"None",
":",
"# Already removed",
"return",
"root_logger",
"=",
"logging",
".",
"getLogger",
"(",
")",
"for",
"handler",
"in",
"root_logger",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __remove_queue_logging_handler | This function will run once the additional loggers have been synchronized.
It just removes the QueueLoggingHandler from the logging handlers. | salt/log/setup.py | def __remove_queue_logging_handler():
'''
This function will run once the additional loggers have been synchronized.
It just removes the QueueLoggingHandler from the logging handlers.
'''
global LOGGING_STORE_HANDLER
if LOGGING_STORE_HANDLER is None:
# Already removed
return
... | def __remove_queue_logging_handler():
'''
This function will run once the additional loggers have been synchronized.
It just removes the QueueLoggingHandler from the logging handlers.
'''
global LOGGING_STORE_HANDLER
if LOGGING_STORE_HANDLER is None:
# Already removed
return
... | [
"This",
"function",
"will",
"run",
"once",
"the",
"additional",
"loggers",
"have",
"been",
"synchronized",
".",
"It",
"just",
"removes",
"the",
"QueueLoggingHandler",
"from",
"the",
"logging",
"handlers",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/log/setup.py#L1152-L1169 | [
"def",
"__remove_queue_logging_handler",
"(",
")",
":",
"global",
"LOGGING_STORE_HANDLER",
"if",
"LOGGING_STORE_HANDLER",
"is",
"None",
":",
"# Already removed",
"return",
"root_logger",
"=",
"logging",
".",
"getLogger",
"(",
")",
"for",
"handler",
"in",
"root_logger"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __remove_temp_logging_handler | This function will run once logging has been configured. It just removes
the temporary stream Handler from the logging handlers. | salt/log/setup.py | def __remove_temp_logging_handler():
'''
This function will run once logging has been configured. It just removes
the temporary stream Handler from the logging handlers.
'''
if is_logging_configured():
# In this case, the temporary logging handler has been removed, return!
return
... | def __remove_temp_logging_handler():
'''
This function will run once logging has been configured. It just removes
the temporary stream Handler from the logging handlers.
'''
if is_logging_configured():
# In this case, the temporary logging handler has been removed, return!
return
... | [
"This",
"function",
"will",
"run",
"once",
"logging",
"has",
"been",
"configured",
".",
"It",
"just",
"removes",
"the",
"temporary",
"stream",
"Handler",
"from",
"the",
"logging",
"handlers",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/log/setup.py#L1172-L1197 | [
"def",
"__remove_temp_logging_handler",
"(",
")",
":",
"if",
"is_logging_configured",
"(",
")",
":",
"# In this case, the temporary logging handler has been removed, return!",
"return",
"# This should already be done, but...",
"__remove_null_logging_handler",
"(",
")",
"root_logger",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __global_logging_exception_handler | This function will log all un-handled python exceptions. | salt/log/setup.py | def __global_logging_exception_handler(exc_type, exc_value, exc_traceback):
'''
This function will log all un-handled python exceptions.
'''
if exc_type.__name__ == "KeyboardInterrupt":
# Do not log the exception or display the traceback on Keyboard Interrupt
# Stop the logging queue lis... | def __global_logging_exception_handler(exc_type, exc_value, exc_traceback):
'''
This function will log all un-handled python exceptions.
'''
if exc_type.__name__ == "KeyboardInterrupt":
# Do not log the exception or display the traceback on Keyboard Interrupt
# Stop the logging queue lis... | [
"This",
"function",
"will",
"log",
"all",
"un",
"-",
"handled",
"python",
"exceptions",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/log/setup.py#L1200-L1221 | [
"def",
"__global_logging_exception_handler",
"(",
"exc_type",
",",
"exc_value",
",",
"exc_traceback",
")",
":",
"if",
"exc_type",
".",
"__name__",
"==",
"\"KeyboardInterrupt\"",
":",
"# Do not log the exception or display the traceback on Keyboard Interrupt",
"# Stop the logging ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | conf | Parse GRUB conf file
CLI Example:
.. code-block:: bash
salt '*' grub.conf | salt/modules/grub_legacy.py | def conf():
'''
Parse GRUB conf file
CLI Example:
.. code-block:: bash
salt '*' grub.conf
'''
stanza = ''
stanzas = []
in_stanza = False
ret = {}
pos = 0
try:
with salt.utils.files.fopen(_detect_conf(), 'r') as _fp:
for line in _fp:
... | def conf():
'''
Parse GRUB conf file
CLI Example:
.. code-block:: bash
salt '*' grub.conf
'''
stanza = ''
stanzas = []
in_stanza = False
ret = {}
pos = 0
try:
with salt.utils.files.fopen(_detect_conf(), 'r') as _fp:
for line in _fp:
... | [
"Parse",
"GRUB",
"conf",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grub_legacy.py#L55-L115 | [
"def",
"conf",
"(",
")",
":",
"stanza",
"=",
"''",
"stanzas",
"=",
"[",
"]",
"in_stanza",
"=",
"False",
"ret",
"=",
"{",
"}",
"pos",
"=",
"0",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"_detect_conf",
"(",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parse_line | Used by conf() to break config lines into
name/value pairs | salt/modules/grub_legacy.py | def _parse_line(line=''):
'''
Used by conf() to break config lines into
name/value pairs
'''
parts = line.split()
key = parts.pop(0)
value = ' '.join(parts)
return key, value | def _parse_line(line=''):
'''
Used by conf() to break config lines into
name/value pairs
'''
parts = line.split()
key = parts.pop(0)
value = ' '.join(parts)
return key, value | [
"Used",
"by",
"conf",
"()",
"to",
"break",
"config",
"lines",
"into",
"name",
"/",
"value",
"pairs"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grub_legacy.py#L118-L126 | [
"def",
"_parse_line",
"(",
"line",
"=",
"''",
")",
":",
"parts",
"=",
"line",
".",
"split",
"(",
")",
"key",
"=",
"parts",
".",
"pop",
"(",
"0",
")",
"value",
"=",
"' '",
".",
"join",
"(",
"parts",
")",
"return",
"key",
",",
"value"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | check_upgrade_impact | Display upgrade impact information without actually upgrading the device.
system_image (Mandatory Option)
Path on bootflash: to system image upgrade file.
kickstart_image
Path on bootflash: to kickstart image upgrade file.
(Not required if using combined system/kickstart image file)
... | salt/modules/nxos_upgrade.py | def check_upgrade_impact(system_image, kickstart_image=None, issu=True, **kwargs):
'''
Display upgrade impact information without actually upgrading the device.
system_image (Mandatory Option)
Path on bootflash: to system image upgrade file.
kickstart_image
Path on bootflash: to kickst... | def check_upgrade_impact(system_image, kickstart_image=None, issu=True, **kwargs):
'''
Display upgrade impact information without actually upgrading the device.
system_image (Mandatory Option)
Path on bootflash: to system image upgrade file.
kickstart_image
Path on bootflash: to kickst... | [
"Display",
"upgrade",
"impact",
"information",
"without",
"actually",
"upgrading",
"the",
"device",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos_upgrade.py#L77-L139 | [
"def",
"check_upgrade_impact",
"(",
"system_image",
",",
"kickstart_image",
"=",
"None",
",",
"issu",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"# Input Validation",
"if",
"not",
"isinstance",
"(",
"issu",
",",
"bool",
")",
":",
"return",
"'Input Error... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | upgrade | Upgrade NX-OS switch.
system_image (Mandatory Option)
Path on bootflash: to system image upgrade file.
kickstart_image
Path on bootflash: to kickstart image upgrade file.
(Not required if using combined system/kickstart image file)
Default: None
issu
Set this optio... | salt/modules/nxos_upgrade.py | def upgrade(system_image, kickstart_image=None, issu=True, **kwargs):
'''
Upgrade NX-OS switch.
system_image (Mandatory Option)
Path on bootflash: to system image upgrade file.
kickstart_image
Path on bootflash: to kickstart image upgrade file.
(Not required if using combined s... | def upgrade(system_image, kickstart_image=None, issu=True, **kwargs):
'''
Upgrade NX-OS switch.
system_image (Mandatory Option)
Path on bootflash: to system image upgrade file.
kickstart_image
Path on bootflash: to kickstart image upgrade file.
(Not required if using combined s... | [
"Upgrade",
"NX",
"-",
"OS",
"switch",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos_upgrade.py#L142-L248 | [
"def",
"upgrade",
"(",
"system_image",
",",
"kickstart_image",
"=",
"None",
",",
"issu",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"# Input Validation",
"if",
"not",
"isinstance",
"(",
"issu",
",",
"bool",
")",
":",
"return",
"'Input Error: The [issu] ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _upgrade | Helper method that does the heavy lifting for upgrades. | salt/modules/nxos_upgrade.py | def _upgrade(system_image, kickstart_image, issu, **kwargs):
'''
Helper method that does the heavy lifting for upgrades.
'''
si = system_image
ki = kickstart_image
dev = 'bootflash'
cmd = 'terminal dont-ask ; install all'
if ki is None:
logmsg = 'Upgrading device using combined ... | def _upgrade(system_image, kickstart_image, issu, **kwargs):
'''
Helper method that does the heavy lifting for upgrades.
'''
si = system_image
ki = kickstart_image
dev = 'bootflash'
cmd = 'terminal dont-ask ; install all'
if ki is None:
logmsg = 'Upgrading device using combined ... | [
"Helper",
"method",
"that",
"does",
"the",
"heavy",
"lifting",
"for",
"upgrades",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos_upgrade.py#L251-L297 | [
"def",
"_upgrade",
"(",
"system_image",
",",
"kickstart_image",
",",
"issu",
",",
"*",
"*",
"kwargs",
")",
":",
"si",
"=",
"system_image",
"ki",
"=",
"kickstart_image",
"dev",
"=",
"'bootflash'",
"cmd",
"=",
"'terminal dont-ask ; install all'",
"if",
"ki",
"is... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parse_upgrade_data | Helper method to parse upgrade data from the NX-OS device. | salt/modules/nxos_upgrade.py | def _parse_upgrade_data(data):
'''
Helper method to parse upgrade data from the NX-OS device.
'''
upgrade_result = {}
upgrade_result['upgrade_data'] = None
upgrade_result['succeeded'] = False
upgrade_result['upgrade_required'] = False
upgrade_result['upgrade_non_disruptive'] = False
... | def _parse_upgrade_data(data):
'''
Helper method to parse upgrade data from the NX-OS device.
'''
upgrade_result = {}
upgrade_result['upgrade_data'] = None
upgrade_result['succeeded'] = False
upgrade_result['upgrade_required'] = False
upgrade_result['upgrade_non_disruptive'] = False
... | [
"Helper",
"method",
"to",
"parse",
"upgrade",
"data",
"from",
"the",
"NX",
"-",
"OS",
"device",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos_upgrade.py#L300-L405 | [
"def",
"_parse_upgrade_data",
"(",
"data",
")",
":",
"upgrade_result",
"=",
"{",
"}",
"upgrade_result",
"[",
"'upgrade_data'",
"]",
"=",
"None",
"upgrade_result",
"[",
"'succeeded'",
"]",
"=",
"False",
"upgrade_result",
"[",
"'upgrade_required'",
"]",
"=",
"Fals... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __standardize_result | Standardizes all responses
:param status:
:param message:
:param data:
:param debug_msg:
:return: | salt/modules/dockercompose.py | def __standardize_result(status, message, data=None, debug_msg=None):
'''
Standardizes all responses
:param status:
:param message:
:param data:
:param debug_msg:
:return:
'''
result = {
'status': status,
'message': message
}
if data is not None:
res... | def __standardize_result(status, message, data=None, debug_msg=None):
'''
Standardizes all responses
:param status:
:param message:
:param data:
:param debug_msg:
:return:
'''
result = {
'status': status,
'message': message
}
if data is not None:
res... | [
"Standardizes",
"all",
"responses"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockercompose.py#L160-L181 | [
"def",
"__standardize_result",
"(",
"status",
",",
"message",
",",
"data",
"=",
"None",
",",
"debug_msg",
"=",
"None",
")",
":",
"result",
"=",
"{",
"'status'",
":",
"status",
",",
"'message'",
":",
"message",
"}",
"if",
"data",
"is",
"not",
"None",
":... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __get_docker_file_path | Determines the filepath to use
:param path:
:return: | salt/modules/dockercompose.py | def __get_docker_file_path(path):
'''
Determines the filepath to use
:param path:
:return:
'''
if os.path.isfile(path):
return path
for dc_filename in DEFAULT_DC_FILENAMES:
file_path = os.path.join(path, dc_filename)
if os.path.isfile(file_path):
return f... | def __get_docker_file_path(path):
'''
Determines the filepath to use
:param path:
:return:
'''
if os.path.isfile(path):
return path
for dc_filename in DEFAULT_DC_FILENAMES:
file_path = os.path.join(path, dc_filename)
if os.path.isfile(file_path):
return f... | [
"Determines",
"the",
"filepath",
"to",
"use"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockercompose.py#L184-L196 | [
"def",
"__get_docker_file_path",
"(",
"path",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"path",
")",
":",
"return",
"path",
"for",
"dc_filename",
"in",
"DEFAULT_DC_FILENAMES",
":",
"file_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"path... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __read_docker_compose_file | Read the compose file if it exists in the directory
:param file_path:
:return: | salt/modules/dockercompose.py | def __read_docker_compose_file(file_path):
'''
Read the compose file if it exists in the directory
:param file_path:
:return:
'''
if not os.path.isfile(file_path):
return __standardize_result(False,
'Path {} is not present'.format(file_path),
... | def __read_docker_compose_file(file_path):
'''
Read the compose file if it exists in the directory
:param file_path:
:return:
'''
if not os.path.isfile(file_path):
return __standardize_result(False,
'Path {} is not present'.format(file_path),
... | [
"Read",
"the",
"compose",
"file",
"if",
"it",
"exists",
"in",
"the",
"directory"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockercompose.py#L200-L223 | [
"def",
"__read_docker_compose_file",
"(",
"file_path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"file_path",
")",
":",
"return",
"__standardize_result",
"(",
"False",
",",
"'Path {} is not present'",
".",
"format",
"(",
"file_path",
")",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __load_docker_compose | Read the compose file and load its' contents
:param path:
:return: | salt/modules/dockercompose.py | def __load_docker_compose(path):
'''
Read the compose file and load its' contents
:param path:
:return:
'''
file_path = __get_docker_file_path(path)
if file_path is None:
msg = 'Could not find docker-compose file at {0}'.format(path)
return None, __standardize_result(False, ... | def __load_docker_compose(path):
'''
Read the compose file and load its' contents
:param path:
:return:
'''
file_path = __get_docker_file_path(path)
if file_path is None:
msg = 'Could not find docker-compose file at {0}'.format(path)
return None, __standardize_result(False, ... | [
"Read",
"the",
"compose",
"file",
"and",
"load",
"its",
"contents"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockercompose.py#L226-L263 | [
"def",
"__load_docker_compose",
"(",
"path",
")",
":",
"file_path",
"=",
"__get_docker_file_path",
"(",
"path",
")",
"if",
"file_path",
"is",
"None",
":",
"msg",
"=",
"'Could not find docker-compose file at {0}'",
".",
"format",
"(",
"path",
")",
"return",
"None",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __dump_docker_compose | Dumps
:param path:
:param content: the not-yet dumped content
:return: | salt/modules/dockercompose.py | def __dump_docker_compose(path, content, already_existed):
'''
Dumps
:param path:
:param content: the not-yet dumped content
:return:
'''
try:
dumped = yaml.safe_dump(content, indent=2, default_flow_style=False)
return __write_docker_compose(path, dumped, already_existed)
... | def __dump_docker_compose(path, content, already_existed):
'''
Dumps
:param path:
:param content: the not-yet dumped content
:return:
'''
try:
dumped = yaml.safe_dump(content, indent=2, default_flow_style=False)
return __write_docker_compose(path, dumped, already_existed)
... | [
"Dumps"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockercompose.py#L266-L280 | [
"def",
"__dump_docker_compose",
"(",
"path",
",",
"content",
",",
"already_existed",
")",
":",
"try",
":",
"dumped",
"=",
"yaml",
".",
"safe_dump",
"(",
"content",
",",
"indent",
"=",
"2",
",",
"default_flow_style",
"=",
"False",
")",
"return",
"__write_dock... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __write_docker_compose | Write docker-compose to a path
in order to use it with docker-compose ( config check )
:param path:
docker_compose
contains the docker-compose file
:return: | salt/modules/dockercompose.py | def __write_docker_compose(path, docker_compose, already_existed):
'''
Write docker-compose to a path
in order to use it with docker-compose ( config check )
:param path:
docker_compose
contains the docker-compose file
:return:
'''
if path.lower().endswith(('.yml', '.yaml')):
... | def __write_docker_compose(path, docker_compose, already_existed):
'''
Write docker-compose to a path
in order to use it with docker-compose ( config check )
:param path:
docker_compose
contains the docker-compose file
:return:
'''
if path.lower().endswith(('.yml', '.yaml')):
... | [
"Write",
"docker",
"-",
"compose",
"to",
"a",
"path",
"in",
"order",
"to",
"use",
"it",
"with",
"docker",
"-",
"compose",
"(",
"config",
"check",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockercompose.py#L283-L315 | [
"def",
"__write_docker_compose",
"(",
"path",
",",
"docker_compose",
",",
"already_existed",
")",
":",
"if",
"path",
".",
"lower",
"(",
")",
".",
"endswith",
"(",
"(",
"'.yml'",
",",
"'.yaml'",
")",
")",
":",
"file_path",
"=",
"path",
"dir_name",
"=",
"o... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __load_project | Load a docker-compose project from path
:param path:
:return: | salt/modules/dockercompose.py | def __load_project(path):
'''
Load a docker-compose project from path
:param path:
:return:
'''
file_path = __get_docker_file_path(path)
if file_path is None:
msg = 'Could not find docker-compose file at {0}'.format(path)
return __standardize_result(False,
... | def __load_project(path):
'''
Load a docker-compose project from path
:param path:
:return:
'''
file_path = __get_docker_file_path(path)
if file_path is None:
msg = 'Could not find docker-compose file at {0}'.format(path)
return __standardize_result(False,
... | [
"Load",
"a",
"docker",
"-",
"compose",
"project",
"from",
"path"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockercompose.py#L318-L331 | [
"def",
"__load_project",
"(",
"path",
")",
":",
"file_path",
"=",
"__get_docker_file_path",
"(",
"path",
")",
"if",
"file_path",
"is",
"None",
":",
"msg",
"=",
"'Could not find docker-compose file at {0}'",
".",
"format",
"(",
"path",
")",
"return",
"__standardize... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __load_project_from_file_path | Load a docker-compose project from file path
:param path:
:return: | salt/modules/dockercompose.py | def __load_project_from_file_path(file_path):
'''
Load a docker-compose project from file path
:param path:
:return:
'''
try:
project = get_project(project_dir=os.path.dirname(file_path),
config_path=[os.path.basename(file_path)])
except Exception as in... | def __load_project_from_file_path(file_path):
'''
Load a docker-compose project from file path
:param path:
:return:
'''
try:
project = get_project(project_dir=os.path.dirname(file_path),
config_path=[os.path.basename(file_path)])
except Exception as in... | [
"Load",
"a",
"docker",
"-",
"compose",
"project",
"from",
"file",
"path"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockercompose.py#L334-L346 | [
"def",
"__load_project_from_file_path",
"(",
"file_path",
")",
":",
"try",
":",
"project",
"=",
"get_project",
"(",
"project_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"file_path",
")",
",",
"config_path",
"=",
"[",
"os",
".",
"path",
".",
"basenam... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __load_compose_definitions | Will load the compose file located at path
Then determines the format/contents of the sent definition
err or results are only set if there were any
:param path:
:param definition:
:return tuple(compose_result, loaded_definition, err): | salt/modules/dockercompose.py | def __load_compose_definitions(path, definition):
'''
Will load the compose file located at path
Then determines the format/contents of the sent definition
err or results are only set if there were any
:param path:
:param definition:
:return tuple(compose_result, loaded_definition, err):
... | def __load_compose_definitions(path, definition):
'''
Will load the compose file located at path
Then determines the format/contents of the sent definition
err or results are only set if there were any
:param path:
:param definition:
:return tuple(compose_result, loaded_definition, err):
... | [
"Will",
"load",
"the",
"compose",
"file",
"located",
"at",
"path",
"Then",
"determines",
"the",
"format",
"/",
"contents",
"of",
"the",
"sent",
"definition"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockercompose.py#L349-L379 | [
"def",
"__load_compose_definitions",
"(",
"path",
",",
"definition",
")",
":",
"compose_result",
",",
"err",
"=",
"__load_docker_compose",
"(",
"path",
")",
"if",
"err",
":",
"return",
"None",
",",
"None",
",",
"err",
"if",
"isinstance",
"(",
"definition",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __dump_compose_file | Utility function to dump the compose result to a file.
:param path:
:param compose_result:
:param success_msg: the message to give upon success
:return: | salt/modules/dockercompose.py | def __dump_compose_file(path, compose_result, success_msg, already_existed):
'''
Utility function to dump the compose result to a file.
:param path:
:param compose_result:
:param success_msg: the message to give upon success
:return:
'''
ret = __dump_docker_compose(path,
... | def __dump_compose_file(path, compose_result, success_msg, already_existed):
'''
Utility function to dump the compose result to a file.
:param path:
:param compose_result:
:param success_msg: the message to give upon success
:return:
'''
ret = __dump_docker_compose(path,
... | [
"Utility",
"function",
"to",
"dump",
"the",
"compose",
"result",
"to",
"a",
"file",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockercompose.py#L382-L397 | [
"def",
"__dump_compose_file",
"(",
"path",
",",
"compose_result",
",",
"success_msg",
",",
"already_existed",
")",
":",
"ret",
"=",
"__dump_docker_compose",
"(",
"path",
",",
"compose_result",
"[",
"'compose_content'",
"]",
",",
"already_existed",
")",
"if",
"isin... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_convergence_plans | Get action executed for each container
:param project:
:param service_names:
:return: | salt/modules/dockercompose.py | def _get_convergence_plans(project, service_names):
'''
Get action executed for each container
:param project:
:param service_names:
:return:
'''
ret = {}
plans = project._get_convergence_plans(project.get_services(service_names),
ConvergenceSt... | def _get_convergence_plans(project, service_names):
'''
Get action executed for each container
:param project:
:param service_names:
:return:
'''
ret = {}
plans = project._get_convergence_plans(project.get_services(service_names),
ConvergenceSt... | [
"Get",
"action",
"executed",
"for",
"each",
"container"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockercompose.py#L413-L434 | [
"def",
"_get_convergence_plans",
"(",
"project",
",",
"service_names",
")",
":",
"ret",
"=",
"{",
"}",
"plans",
"=",
"project",
".",
"_get_convergence_plans",
"(",
"project",
".",
"get_services",
"(",
"service_names",
")",
",",
"ConvergenceStrategy",
".",
"chang... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get | Get the content of the docker-compose file into a directory
path
Path where the docker-compose file is stored on the server
CLI Example:
.. code-block:: bash
salt myminion dockercompose.get /path/where/docker-compose/stored | salt/modules/dockercompose.py | def get(path):
'''
Get the content of the docker-compose file into a directory
path
Path where the docker-compose file is stored on the server
CLI Example:
.. code-block:: bash
salt myminion dockercompose.get /path/where/docker-compose/stored
'''
file_path = __get_docker_... | def get(path):
'''
Get the content of the docker-compose file into a directory
path
Path where the docker-compose file is stored on the server
CLI Example:
.. code-block:: bash
salt myminion dockercompose.get /path/where/docker-compose/stored
'''
file_path = __get_docker_... | [
"Get",
"the",
"content",
"of",
"the",
"docker",
"-",
"compose",
"file",
"into",
"a",
"directory"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockercompose.py#L437-L463 | [
"def",
"get",
"(",
"path",
")",
":",
"file_path",
"=",
"__get_docker_file_path",
"(",
"path",
")",
"if",
"file_path",
"is",
"None",
":",
"return",
"__standardize_result",
"(",
"False",
",",
"'Path {} is not present'",
".",
"format",
"(",
"path",
")",
",",
"N... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create | Create and validate a docker-compose file into a directory
path
Path where the docker-compose file will be stored on the server
docker_compose
docker_compose file
CLI Example:
.. code-block:: bash
salt myminion dockercompose.create /path/where/docker-compose/stored content | salt/modules/dockercompose.py | def create(path, docker_compose):
'''
Create and validate a docker-compose file into a directory
path
Path where the docker-compose file will be stored on the server
docker_compose
docker_compose file
CLI Example:
.. code-block:: bash
salt myminion dockercompose.crea... | def create(path, docker_compose):
'''
Create and validate a docker-compose file into a directory
path
Path where the docker-compose file will be stored on the server
docker_compose
docker_compose file
CLI Example:
.. code-block:: bash
salt myminion dockercompose.crea... | [
"Create",
"and",
"validate",
"a",
"docker",
"-",
"compose",
"file",
"into",
"a",
"directory"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockercompose.py#L466-L495 | [
"def",
"create",
"(",
"path",
",",
"docker_compose",
")",
":",
"if",
"docker_compose",
":",
"ret",
"=",
"__write_docker_compose",
"(",
"path",
",",
"docker_compose",
",",
"already_existed",
"=",
"False",
")",
"if",
"isinstance",
"(",
"ret",
",",
"dict",
")",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | pull | Pull image for containers in the docker-compose file, service_names is a
python list, if omitted pull all images
path
Path where the docker-compose file is stored on the server
service_names
If specified will pull only the image for the specified services
CLI Example:
.. code-bloc... | salt/modules/dockercompose.py | def pull(path, service_names=None):
'''
Pull image for containers in the docker-compose file, service_names is a
python list, if omitted pull all images
path
Path where the docker-compose file is stored on the server
service_names
If specified will pull only the image for the specif... | def pull(path, service_names=None):
'''
Pull image for containers in the docker-compose file, service_names is a
python list, if omitted pull all images
path
Path where the docker-compose file is stored on the server
service_names
If specified will pull only the image for the specif... | [
"Pull",
"image",
"for",
"containers",
"in",
"the",
"docker",
"-",
"compose",
"file",
"service_names",
"is",
"a",
"python",
"list",
"if",
"omitted",
"pull",
"all",
"images"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockercompose.py#L498-L525 | [
"def",
"pull",
"(",
"path",
",",
"service_names",
"=",
"None",
")",
":",
"project",
"=",
"__load_project",
"(",
"path",
")",
"if",
"isinstance",
"(",
"project",
",",
"dict",
")",
":",
"return",
"project",
"else",
":",
"try",
":",
"project",
".",
"pull"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | pause | Pause running containers in the docker-compose file, service_names is a python
list, if omitted pause all containers
path
Path where the docker-compose file is stored on the server
service_names
If specified will pause only the specified services
CLI Example:
.. code-block:: bash
... | salt/modules/dockercompose.py | def pause(path, service_names=None):
'''
Pause running containers in the docker-compose file, service_names is a python
list, if omitted pause all containers
path
Path where the docker-compose file is stored on the server
service_names
If specified will pause only the specified serv... | def pause(path, service_names=None):
'''
Pause running containers in the docker-compose file, service_names is a python
list, if omitted pause all containers
path
Path where the docker-compose file is stored on the server
service_names
If specified will pause only the specified serv... | [
"Pause",
"running",
"containers",
"in",
"the",
"docker",
"-",
"compose",
"file",
"service_names",
"is",
"a",
"python",
"list",
"if",
"omitted",
"pause",
"all",
"containers"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockercompose.py#L637-L671 | [
"def",
"pause",
"(",
"path",
",",
"service_names",
"=",
"None",
")",
":",
"project",
"=",
"__load_project",
"(",
"path",
")",
"debug_ret",
"=",
"{",
"}",
"result",
"=",
"{",
"}",
"if",
"isinstance",
"(",
"project",
",",
"dict",
")",
":",
"return",
"p... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | rm | Remove stopped containers in the docker-compose file, service_names is a python
list, if omitted remove all stopped containers
path
Path where the docker-compose file is stored on the server
service_names
If specified will remove only the specified stopped services
CLI Example:
..... | salt/modules/dockercompose.py | def rm(path, service_names=None):
'''
Remove stopped containers in the docker-compose file, service_names is a python
list, if omitted remove all stopped containers
path
Path where the docker-compose file is stored on the server
service_names
If specified will remove only the specif... | def rm(path, service_names=None):
'''
Remove stopped containers in the docker-compose file, service_names is a python
list, if omitted remove all stopped containers
path
Path where the docker-compose file is stored on the server
service_names
If specified will remove only the specif... | [
"Remove",
"stopped",
"containers",
"in",
"the",
"docker",
"-",
"compose",
"file",
"service_names",
"is",
"a",
"python",
"list",
"if",
"omitted",
"remove",
"all",
"stopped",
"containers"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockercompose.py#L785-L811 | [
"def",
"rm",
"(",
"path",
",",
"service_names",
"=",
"None",
")",
":",
"project",
"=",
"__load_project",
"(",
"path",
")",
"if",
"isinstance",
"(",
"project",
",",
"dict",
")",
":",
"return",
"project",
"else",
":",
"try",
":",
"project",
".",
"remove_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.