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 | remove | Remove the named file or directory
Args:
path (str): The path to the file or directory to remove.
force (bool): Remove even if marked Read-Only. Default is False
Returns:
bool: True if successful, False if unsuccessful
CLI Example:
.. code-block:: bash
salt '*' file.... | salt/modules/win_file.py | def remove(path, force=False):
'''
Remove the named file or directory
Args:
path (str): The path to the file or directory to remove.
force (bool): Remove even if marked Read-Only. Default is False
Returns:
bool: True if successful, False if unsuccessful
CLI Example:
.... | def remove(path, force=False):
'''
Remove the named file or directory
Args:
path (str): The path to the file or directory to remove.
force (bool): Remove even if marked Read-Only. Default is False
Returns:
bool: True if successful, False if unsuccessful
CLI Example:
.... | [
"Remove",
"the",
"named",
"file",
"or",
"directory"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L1048-L1107 | [
"def",
"remove",
"(",
"path",
",",
"force",
"=",
"False",
")",
":",
"# This must be a recursive function in windows to properly deal with",
"# Symlinks. The shutil.rmtree function will remove the contents of",
"# the Symlink source in windows.",
"path",
"=",
"os",
".",
"path",
".... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | symlink | Create a symbolic link to a file
This is only supported with Windows Vista or later and must be executed by
a user with the SeCreateSymbolicLink privilege.
The behavior of this function matches the Unix equivalent, with one
exception - invalid symlinks cannot be created. The source path must exist.
... | salt/modules/win_file.py | def symlink(src, link):
'''
Create a symbolic link to a file
This is only supported with Windows Vista or later and must be executed by
a user with the SeCreateSymbolicLink privilege.
The behavior of this function matches the Unix equivalent, with one
exception - invalid symlinks cannot be cre... | def symlink(src, link):
'''
Create a symbolic link to a file
This is only supported with Windows Vista or later and must be executed by
a user with the SeCreateSymbolicLink privilege.
The behavior of this function matches the Unix equivalent, with one
exception - invalid symlinks cannot be cre... | [
"Create",
"a",
"symbolic",
"link",
"to",
"a",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L1110-L1161 | [
"def",
"symlink",
"(",
"src",
",",
"link",
")",
":",
"# When Python 3.2 or later becomes the minimum version, this function can be",
"# replaced with the built-in os.symlink function, which supports Windows.",
"if",
"sys",
".",
"getwindowsversion",
"(",
")",
".",
"major",
"<",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | is_link | Check if the path is a symlink
This is only supported on Windows Vista or later.
Inline with Unix behavior, this function will raise an error if the path
is not a symlink, however, the error raised will be a SaltInvocationError,
not an OSError.
Args:
path (str): The path to a file or dire... | salt/modules/win_file.py | def is_link(path):
'''
Check if the path is a symlink
This is only supported on Windows Vista or later.
Inline with Unix behavior, this function will raise an error if the path
is not a symlink, however, the error raised will be a SaltInvocationError,
not an OSError.
Args:
path (s... | def is_link(path):
'''
Check if the path is a symlink
This is only supported on Windows Vista or later.
Inline with Unix behavior, this function will raise an error if the path
is not a symlink, however, the error raised will be a SaltInvocationError,
not an OSError.
Args:
path (s... | [
"Check",
"if",
"the",
"path",
"is",
"a",
"symlink"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L1164-L1192 | [
"def",
"is_link",
"(",
"path",
")",
":",
"if",
"sys",
".",
"getwindowsversion",
"(",
")",
".",
"major",
"<",
"6",
":",
"raise",
"SaltInvocationError",
"(",
"'Symlinks are only supported on Windows Vista or later.'",
")",
"try",
":",
"return",
"salt",
".",
"utils... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | readlink | Return the path that a symlink points to
This is only supported on Windows Vista or later.
Inline with Unix behavior, this function will raise an error if the path is
not a symlink, however, the error raised will be a SaltInvocationError, not
an OSError.
Args:
path (str): The path to the ... | salt/modules/win_file.py | def readlink(path):
'''
Return the path that a symlink points to
This is only supported on Windows Vista or later.
Inline with Unix behavior, this function will raise an error if the path is
not a symlink, however, the error raised will be a SaltInvocationError, not
an OSError.
Args:
... | def readlink(path):
'''
Return the path that a symlink points to
This is only supported on Windows Vista or later.
Inline with Unix behavior, this function will raise an error if the path is
not a symlink, however, the error raised will be a SaltInvocationError, not
an OSError.
Args:
... | [
"Return",
"the",
"path",
"that",
"a",
"symlink",
"points",
"to"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L1195-L1227 | [
"def",
"readlink",
"(",
"path",
")",
":",
"if",
"sys",
".",
"getwindowsversion",
"(",
")",
".",
"major",
"<",
"6",
":",
"raise",
"SaltInvocationError",
"(",
"'Symlinks are only supported on Windows Vista or later.'",
")",
"try",
":",
"return",
"salt",
".",
"util... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | mkdir | Ensure that the directory is available and permissions are set.
Args:
path (str):
The full path to the directory.
owner (str):
The owner of the directory. If not passed, it will be the account
that created the directory, likely SYSTEM
grant_perms (dict... | salt/modules/win_file.py | def mkdir(path,
owner=None,
grant_perms=None,
deny_perms=None,
inheritance=True,
reset=False):
'''
Ensure that the directory is available and permissions are set.
Args:
path (str):
The full path to the directory.
owner (str):
... | def mkdir(path,
owner=None,
grant_perms=None,
deny_perms=None,
inheritance=True,
reset=False):
'''
Ensure that the directory is available and permissions are set.
Args:
path (str):
The full path to the directory.
owner (str):
... | [
"Ensure",
"that",
"the",
"directory",
"is",
"available",
"and",
"permissions",
"are",
"set",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L1230-L1332 | [
"def",
"mkdir",
"(",
"path",
",",
"owner",
"=",
"None",
",",
"grant_perms",
"=",
"None",
",",
"deny_perms",
"=",
"None",
",",
"inheritance",
"=",
"True",
",",
"reset",
"=",
"False",
")",
":",
"# Make sure the drive is valid",
"drive",
"=",
"os",
".",
"pa... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | makedirs_ | Ensure that the parent directory containing this path is available.
Args:
path (str):
The full path to the directory.
.. note::
The path must end with a trailing slash otherwise the
directory(s) will be created up to the parent directory. For
... | salt/modules/win_file.py | def makedirs_(path,
owner=None,
grant_perms=None,
deny_perms=None,
inheritance=True,
reset=False):
'''
Ensure that the parent directory containing this path is available.
Args:
path (str):
The full path to the direct... | def makedirs_(path,
owner=None,
grant_perms=None,
deny_perms=None,
inheritance=True,
reset=False):
'''
Ensure that the parent directory containing this path is available.
Args:
path (str):
The full path to the direct... | [
"Ensure",
"that",
"the",
"parent",
"directory",
"containing",
"this",
"path",
"is",
"available",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L1335-L1463 | [
"def",
"makedirs_",
"(",
"path",
",",
"owner",
"=",
"None",
",",
"grant_perms",
"=",
"None",
",",
"deny_perms",
"=",
"None",
",",
"inheritance",
"=",
"True",
",",
"reset",
"=",
"False",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"expanduser",
"("... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | makedirs_perms | Set owner and permissions for each directory created.
Args:
path (str):
The full path to the directory.
owner (str):
The owner of the directory. If not passed, it will be the account
that created the directory, likely SYSTEM.
grant_perms (dict):
... | salt/modules/win_file.py | def makedirs_perms(path,
owner=None,
grant_perms=None,
deny_perms=None,
inheritance=True,
reset=True):
'''
Set owner and permissions for each directory created.
Args:
path (str):
The full pat... | def makedirs_perms(path,
owner=None,
grant_perms=None,
deny_perms=None,
inheritance=True,
reset=True):
'''
Set owner and permissions for each directory created.
Args:
path (str):
The full pat... | [
"Set",
"owner",
"and",
"permissions",
"for",
"each",
"directory",
"created",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L1466-L1576 | [
"def",
"makedirs_perms",
"(",
"path",
",",
"owner",
"=",
"None",
",",
"grant_perms",
"=",
"None",
",",
"deny_perms",
"=",
"None",
",",
"inheritance",
"=",
"True",
",",
"reset",
"=",
"True",
")",
":",
"# Expand any environment variables",
"path",
"=",
"os",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | check_perms | Check owner and permissions for the passed directory. This function checks
the permissions and sets them, returning the changes made. Used by the file
state to populate the return dict
Args:
path (str):
The full path to the directory.
ret (dict):
A dictionary to ap... | salt/modules/win_file.py | def check_perms(path,
ret=None,
owner=None,
grant_perms=None,
deny_perms=None,
inheritance=True,
reset=False):
'''
Check owner and permissions for the passed directory. This function checks
the permissions and se... | def check_perms(path,
ret=None,
owner=None,
grant_perms=None,
deny_perms=None,
inheritance=True,
reset=False):
'''
Check owner and permissions for the passed directory. This function checks
the permissions and se... | [
"Check",
"owner",
"and",
"permissions",
"for",
"the",
"passed",
"directory",
".",
"This",
"function",
"checks",
"the",
"permissions",
"and",
"sets",
"them",
"returning",
"the",
"changes",
"made",
".",
"Used",
"by",
"the",
"file",
"state",
"to",
"populate",
"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L1579-L1649 | [
"def",
"check_perms",
"(",
"path",
",",
"ret",
"=",
"None",
",",
"owner",
"=",
"None",
",",
"grant_perms",
"=",
"None",
",",
"deny_perms",
"=",
"None",
",",
"inheritance",
"=",
"True",
",",
"reset",
"=",
"False",
")",
":",
"if",
"not",
"os",
".",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_perms | Set permissions for the given path
Args:
path (str):
The full path to the directory.
grant_perms (dict):
A dictionary containing the user/group and the basic permissions to
grant, ie: ``{'user': {'perms': 'basic_permission'}}``. You can also
set the... | salt/modules/win_file.py | def set_perms(path,
grant_perms=None,
deny_perms=None,
inheritance=True,
reset=False):
'''
Set permissions for the given path
Args:
path (str):
The full path to the directory.
grant_perms (dict):
A dictionary ... | def set_perms(path,
grant_perms=None,
deny_perms=None,
inheritance=True,
reset=False):
'''
Set permissions for the given path
Args:
path (str):
The full path to the directory.
grant_perms (dict):
A dictionary ... | [
"Set",
"permissions",
"for",
"the",
"given",
"path"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L1652-L1735 | [
"def",
"set_perms",
"(",
"path",
",",
"grant_perms",
"=",
"None",
",",
"deny_perms",
"=",
"None",
",",
"inheritance",
"=",
"True",
",",
"reset",
"=",
"False",
")",
":",
"return",
"__utils__",
"[",
"'dacl.set_perms'",
"]",
"(",
"obj_name",
"=",
"path",
",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | validate | Validate the beacon configuration | salt/beacons/haproxy.py | def validate(config):
'''
Validate the beacon configuration
'''
if not isinstance(config, list):
return False, ('Configuration for haproxy beacon must '
'be a list.')
else:
_config = {}
list(map(_config.update, config))
if 'backends' not in _co... | def validate(config):
'''
Validate the beacon configuration
'''
if not isinstance(config, list):
return False, ('Configuration for haproxy beacon must '
'be a list.')
else:
_config = {}
list(map(_config.update, config))
if 'backends' not in _co... | [
"Validate",
"the",
"beacon",
"configuration"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/haproxy.py#L30-L59 | [
"def",
"validate",
"(",
"config",
")",
":",
"if",
"not",
"isinstance",
"(",
"config",
",",
"list",
")",
":",
"return",
"False",
",",
"(",
"'Configuration for haproxy beacon must '",
"'be a list.'",
")",
"else",
":",
"_config",
"=",
"{",
"}",
"list",
"(",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | beacon | Check if current number of sessions of a server for a specific haproxy backend
is over a defined threshold.
.. code-block:: yaml
beacons:
haproxy:
- backends:
www-backend:
threshold: 45
servers:
- web1
... | salt/beacons/haproxy.py | def beacon(config):
'''
Check if current number of sessions of a server for a specific haproxy backend
is over a defined threshold.
.. code-block:: yaml
beacons:
haproxy:
- backends:
www-backend:
threshold: 45
server... | def beacon(config):
'''
Check if current number of sessions of a server for a specific haproxy backend
is over a defined threshold.
.. code-block:: yaml
beacons:
haproxy:
- backends:
www-backend:
threshold: 45
server... | [
"Check",
"if",
"current",
"number",
"of",
"sessions",
"of",
"a",
"server",
"for",
"a",
"specific",
"haproxy",
"backend",
"is",
"over",
"a",
"defined",
"threshold",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/haproxy.py#L62-L101 | [
"def",
"beacon",
"(",
"config",
")",
":",
"ret",
"=",
"[",
"]",
"_config",
"=",
"{",
"}",
"list",
"(",
"map",
"(",
"_config",
".",
"update",
",",
"config",
")",
")",
"for",
"backend",
"in",
"_config",
".",
"get",
"(",
"'backends'",
",",
"(",
")",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | thing_type_exists | Given a thing type name, check to see if the given thing type exists
Returns True if the given thing type exists and returns False if the
given thing type does not exist.
.. versionadded:: 2016.11.0
CLI Example:
.. code-block:: bash
salt myminion boto_iot.thing_type_exists mythingtype | salt/modules/boto_iot.py | def thing_type_exists(thingTypeName,
region=None, key=None, keyid=None, profile=None):
'''
Given a thing type name, check to see if the given thing type exists
Returns True if the given thing type exists and returns False if the
given thing type does not exist.
.. versionadded:: 2016.1... | def thing_type_exists(thingTypeName,
region=None, key=None, keyid=None, profile=None):
'''
Given a thing type name, check to see if the given thing type exists
Returns True if the given thing type exists and returns False if the
given thing type does not exist.
.. versionadded:: 2016.1... | [
"Given",
"a",
"thing",
"type",
"name",
"check",
"to",
"see",
"if",
"the",
"given",
"thing",
"type",
"exists"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L101-L130 | [
"def",
"thing_type_exists",
"(",
"thingTypeName",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | describe_thing_type | Given a thing type name describe its properties.
Returns a dictionary of interesting properties.
.. versionadded:: 2016.11.0
CLI Example:
.. code-block:: bash
salt myminion boto_iot.describe_thing_type mythingtype | salt/modules/boto_iot.py | def describe_thing_type(thingTypeName,
region=None, key=None, keyid=None, profile=None):
'''
Given a thing type name describe its properties.
Returns a dictionary of interesting properties.
.. versionadded:: 2016.11.0
CLI Example:
.. code-block:: bash
salt myminion boto_iot.desc... | def describe_thing_type(thingTypeName,
region=None, key=None, keyid=None, profile=None):
'''
Given a thing type name describe its properties.
Returns a dictionary of interesting properties.
.. versionadded:: 2016.11.0
CLI Example:
.. code-block:: bash
salt myminion boto_iot.desc... | [
"Given",
"a",
"thing",
"type",
"name",
"describe",
"its",
"properties",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L133-L167 | [
"def",
"describe_thing_type",
"(",
"thingTypeName",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_thing_type | Given a valid config, create a thing type.
Returns {created: true} if the thing type was created and returns
{created: False} if the thing type was not created.
.. versionadded:: 2016.11.0
CLI Example:
.. code-block:: bash
salt myminion boto_iot.create_thing_type mythingtype \\
... | salt/modules/boto_iot.py | def create_thing_type(thingTypeName, thingTypeDescription,
searchableAttributesList, region=None, key=None,
keyid=None, profile=None):
'''
Given a valid config, create a thing type.
Returns {created: true} if the thing type was created and returns
{created: False} if the thing type was not crea... | def create_thing_type(thingTypeName, thingTypeDescription,
searchableAttributesList, region=None, key=None,
keyid=None, profile=None):
'''
Given a valid config, create a thing type.
Returns {created: true} if the thing type was created and returns
{created: False} if the thing type was not crea... | [
"Given",
"a",
"valid",
"config",
"create",
"a",
"thing",
"type",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L170-L209 | [
"def",
"create_thing_type",
"(",
"thingTypeName",
",",
"thingTypeDescription",
",",
"searchableAttributesList",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | deprecate_thing_type | Given a thing type name, deprecate it when undoDeprecate is False
and undeprecate it when undoDeprecate is True.
Returns {deprecated: true} if the thing type was deprecated and returns
{deprecated: false} if the thing type was not deprecated.
.. versionadded:: 2016.11.0
CLI Example:
.. code-... | salt/modules/boto_iot.py | def deprecate_thing_type(thingTypeName, undoDeprecate=False,
region=None, key=None, keyid=None, profile=None):
'''
Given a thing type name, deprecate it when undoDeprecate is False
and undeprecate it when undoDeprecate is True.
Returns {deprecated: true} if the thing type was deprecated and returns... | def deprecate_thing_type(thingTypeName, undoDeprecate=False,
region=None, key=None, keyid=None, profile=None):
'''
Given a thing type name, deprecate it when undoDeprecate is False
and undeprecate it when undoDeprecate is True.
Returns {deprecated: true} if the thing type was deprecated and returns... | [
"Given",
"a",
"thing",
"type",
"name",
"deprecate",
"it",
"when",
"undoDeprecate",
"is",
"False",
"and",
"undeprecate",
"it",
"when",
"undoDeprecate",
"is",
"True",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L212-L240 | [
"def",
"deprecate_thing_type",
"(",
"thingTypeName",
",",
"undoDeprecate",
"=",
"False",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete_thing_type | Given a thing type name, delete it.
Returns {deleted: true} if the thing type was deleted and returns
{deleted: false} if the thing type was not deleted.
.. versionadded:: 2016.11.0
CLI Example:
.. code-block:: bash
salt myminion boto_iot.delete_thing_type mythingtype | salt/modules/boto_iot.py | def delete_thing_type(thingTypeName,
region=None, key=None, keyid=None, profile=None):
'''
Given a thing type name, delete it.
Returns {deleted: true} if the thing type was deleted and returns
{deleted: false} if the thing type was not deleted.
.. versionadded:: 2016.11.0
CLI Exam... | def delete_thing_type(thingTypeName,
region=None, key=None, keyid=None, profile=None):
'''
Given a thing type name, delete it.
Returns {deleted: true} if the thing type was deleted and returns
{deleted: false} if the thing type was not deleted.
.. versionadded:: 2016.11.0
CLI Exam... | [
"Given",
"a",
"thing",
"type",
"name",
"delete",
"it",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L243-L269 | [
"def",
"delete_thing_type",
"(",
"thingTypeName",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | policy_exists | Given a policy name, check to see if the given policy exists.
Returns True if the given policy exists and returns False if the given
policy does not exist.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.policy_exists mypolicy | salt/modules/boto_iot.py | def policy_exists(policyName,
region=None, key=None, keyid=None, profile=None):
'''
Given a policy name, check to see if the given policy exists.
Returns True if the given policy exists and returns False if the given
policy does not exist.
CLI Example:
.. code-block:: bash
... | def policy_exists(policyName,
region=None, key=None, keyid=None, profile=None):
'''
Given a policy name, check to see if the given policy exists.
Returns True if the given policy exists and returns False if the given
policy does not exist.
CLI Example:
.. code-block:: bash
... | [
"Given",
"a",
"policy",
"name",
"check",
"to",
"see",
"if",
"the",
"given",
"policy",
"exists",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L272-L296 | [
"def",
"policy_exists",
"(",
"policyName",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_policy | Given a valid config, create a policy.
Returns {created: true} if the policy was created and returns
{created: False} if the policy was not created.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.create_policy my_policy \\
'{"Version":"2015-12-12",\\
"St... | salt/modules/boto_iot.py | def create_policy(policyName, policyDocument,
region=None, key=None, keyid=None, profile=None):
'''
Given a valid config, create a policy.
Returns {created: true} if the policy was created and returns
{created: False} if the policy was not created.
CLI Example:
.. code-block:: bas... | def create_policy(policyName, policyDocument,
region=None, key=None, keyid=None, profile=None):
'''
Given a valid config, create a policy.
Returns {created: true} if the policy was created and returns
{created: False} if the policy was not created.
CLI Example:
.. code-block:: bas... | [
"Given",
"a",
"valid",
"config",
"create",
"a",
"policy",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L299-L333 | [
"def",
"create_policy",
"(",
"policyName",
",",
"policyDocument",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | describe_policy | Given a policy name describe its properties.
Returns a dictionary of interesting properties.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.describe_policy mypolicy | salt/modules/boto_iot.py | def describe_policy(policyName,
region=None, key=None, keyid=None, profile=None):
'''
Given a policy name describe its properties.
Returns a dictionary of interesting properties.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.describe_policy mypolicy
'''
... | def describe_policy(policyName,
region=None, key=None, keyid=None, profile=None):
'''
Given a policy name describe its properties.
Returns a dictionary of interesting properties.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.describe_policy mypolicy
'''
... | [
"Given",
"a",
"policy",
"name",
"describe",
"its",
"properties",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L360-L388 | [
"def",
"describe_policy",
"(",
"policyName",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | policy_version_exists | Given a policy name and version ID, check to see if the given policy version exists.
Returns True if the given policy version exists and returns False if the given
policy version does not exist.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.policy_version_exists mypolicy versionid | salt/modules/boto_iot.py | def policy_version_exists(policyName, policyVersionId,
region=None, key=None, keyid=None, profile=None):
'''
Given a policy name and version ID, check to see if the given policy version exists.
Returns True if the given policy version exists and returns False if the given
policy version does... | def policy_version_exists(policyName, policyVersionId,
region=None, key=None, keyid=None, profile=None):
'''
Given a policy name and version ID, check to see if the given policy version exists.
Returns True if the given policy version exists and returns False if the given
policy version does... | [
"Given",
"a",
"policy",
"name",
"and",
"version",
"ID",
"check",
"to",
"see",
"if",
"the",
"given",
"policy",
"version",
"exists",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L391-L416 | [
"def",
"policy_version_exists",
"(",
"policyName",
",",
"policyVersionId",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete_policy_version | Given a policy name and version, delete it.
Returns {deleted: true} if the policy version was deleted and returns
{deleted: false} if the policy version was not deleted.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.delete_policy_version mypolicy version | salt/modules/boto_iot.py | def delete_policy_version(policyName, policyVersionId,
region=None, key=None, keyid=None, profile=None):
'''
Given a policy name and version, delete it.
Returns {deleted: true} if the policy version was deleted and returns
{deleted: false} if the policy version was not deleted.
CLI Exa... | def delete_policy_version(policyName, policyVersionId,
region=None, key=None, keyid=None, profile=None):
'''
Given a policy name and version, delete it.
Returns {deleted: true} if the policy version was deleted and returns
{deleted: false} if the policy version was not deleted.
CLI Exa... | [
"Given",
"a",
"policy",
"name",
"and",
"version",
"delete",
"it",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L454-L476 | [
"def",
"delete_policy_version",
"(",
"policyName",
",",
"policyVersionId",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | describe_policy_version | Given a policy name and version describe its properties.
Returns a dictionary of interesting properties.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.describe_policy_version mypolicy version | salt/modules/boto_iot.py | def describe_policy_version(policyName, policyVersionId,
region=None, key=None, keyid=None, profile=None):
'''
Given a policy name and version describe its properties.
Returns a dictionary of interesting properties.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.de... | def describe_policy_version(policyName, policyVersionId,
region=None, key=None, keyid=None, profile=None):
'''
Given a policy name and version describe its properties.
Returns a dictionary of interesting properties.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.de... | [
"Given",
"a",
"policy",
"name",
"and",
"version",
"describe",
"its",
"properties",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L479-L508 | [
"def",
"describe_policy_version",
"(",
"policyName",
",",
"policyVersionId",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_policies | List all policies
Returns list of policies
CLI Example:
.. code-block:: bash
salt myminion boto_iot.list_policies
Example Return:
.. code-block:: yaml
policies:
- {...}
- {...} | salt/modules/boto_iot.py | def list_policies(region=None, key=None, keyid=None, profile=None):
'''
List all policies
Returns list of policies
CLI Example:
.. code-block:: bash
salt myminion boto_iot.list_policies
Example Return:
.. code-block:: yaml
policies:
- {...}
- {...}
... | def list_policies(region=None, key=None, keyid=None, profile=None):
'''
List all policies
Returns list of policies
CLI Example:
.. code-block:: bash
salt myminion boto_iot.list_policies
Example Return:
.. code-block:: yaml
policies:
- {...}
- {...}
... | [
"List",
"all",
"policies"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L511-L543 | [
"def",
"list_policies",
"(",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"key",
",",
"keyid",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_policy_versions | List the versions available for the given policy.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.list_policy_versions mypolicy
Example Return:
.. code-block:: yaml
policyVersions:
- {...}
- {...} | salt/modules/boto_iot.py | def list_policy_versions(policyName,
region=None, key=None, keyid=None, profile=None):
'''
List the versions available for the given policy.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.list_policy_versions mypolicy
Example Return:
.. code-block:: yaml
... | def list_policy_versions(policyName,
region=None, key=None, keyid=None, profile=None):
'''
List the versions available for the given policy.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.list_policy_versions mypolicy
Example Return:
.. code-block:: yaml
... | [
"List",
"the",
"versions",
"available",
"for",
"the",
"given",
"policy",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L546-L578 | [
"def",
"list_policy_versions",
"(",
"policyName",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | topic_rule_exists | Given a rule name, check to see if the given rule exists.
Returns True if the given rule exists and returns False if the given
rule does not exist.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.topic_rule_exists myrule | salt/modules/boto_iot.py | def topic_rule_exists(ruleName,
region=None, key=None, keyid=None, profile=None):
'''
Given a rule name, check to see if the given rule exists.
Returns True if the given rule exists and returns False if the given
rule does not exist.
CLI Example:
.. code-block:: bash
salt ... | def topic_rule_exists(ruleName,
region=None, key=None, keyid=None, profile=None):
'''
Given a rule name, check to see if the given rule exists.
Returns True if the given rule exists and returns False if the given
rule does not exist.
CLI Example:
.. code-block:: bash
salt ... | [
"Given",
"a",
"rule",
"name",
"check",
"to",
"see",
"if",
"the",
"given",
"rule",
"exists",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L694-L723 | [
"def",
"topic_rule_exists",
"(",
"ruleName",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_topic_rule | Given a valid config, create a topic rule.
Returns {created: true} if the rule was created and returns
{created: False} if the rule was not created.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.create_topic_rule my_rule "SELECT * FROM 'some/thing'" \\
'[{"lambda":{"fu... | salt/modules/boto_iot.py | def create_topic_rule(ruleName, sql, actions, description,
ruleDisabled=False,
region=None, key=None, keyid=None, profile=None):
'''
Given a valid config, create a topic rule.
Returns {created: true} if the rule was created and returns
{created: False} if the rule was not create... | def create_topic_rule(ruleName, sql, actions, description,
ruleDisabled=False,
region=None, key=None, keyid=None, profile=None):
'''
Given a valid config, create a topic rule.
Returns {created: true} if the rule was created and returns
{created: False} if the rule was not create... | [
"Given",
"a",
"valid",
"config",
"create",
"a",
"topic",
"rule",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L726-L756 | [
"def",
"create_topic_rule",
"(",
"ruleName",
",",
"sql",
",",
"actions",
",",
"description",
",",
"ruleDisabled",
"=",
"False",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete_topic_rule | Given a rule name, delete it.
Returns {deleted: true} if the rule was deleted and returns
{deleted: false} if the rule was not deleted.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.delete_rule myrule | salt/modules/boto_iot.py | def delete_topic_rule(ruleName,
region=None, key=None, keyid=None, profile=None):
'''
Given a rule name, delete it.
Returns {deleted: true} if the rule was deleted and returns
{deleted: false} if the rule was not deleted.
CLI Example:
.. code-block:: bash
salt myminion bo... | def delete_topic_rule(ruleName,
region=None, key=None, keyid=None, profile=None):
'''
Given a rule name, delete it.
Returns {deleted: true} if the rule was deleted and returns
{deleted: false} if the rule was not deleted.
CLI Example:
.. code-block:: bash
salt myminion bo... | [
"Given",
"a",
"rule",
"name",
"delete",
"it",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L792-L813 | [
"def",
"delete_topic_rule",
"(",
"ruleName",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | describe_topic_rule | Given a topic rule name describe its properties.
Returns a dictionary of interesting properties.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.describe_topic_rule myrule | salt/modules/boto_iot.py | def describe_topic_rule(ruleName,
region=None, key=None, keyid=None, profile=None):
'''
Given a topic rule name describe its properties.
Returns a dictionary of interesting properties.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.describe_topic_rule myrule
'... | def describe_topic_rule(ruleName,
region=None, key=None, keyid=None, profile=None):
'''
Given a topic rule name describe its properties.
Returns a dictionary of interesting properties.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.describe_topic_rule myrule
'... | [
"Given",
"a",
"topic",
"rule",
"name",
"describe",
"its",
"properties",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L816-L842 | [
"def",
"describe_topic_rule",
"(",
"ruleName",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_topic_rules | List all rules (for a given topic, if specified)
Returns list of rules
CLI Example:
.. code-block:: bash
salt myminion boto_iot.list_topic_rules
Example Return:
.. code-block:: yaml
rules:
- {...}
- {...} | salt/modules/boto_iot.py | def list_topic_rules(topic=None, ruleDisabled=None,
region=None, key=None, keyid=None, profile=None):
'''
List all rules (for a given topic, if specified)
Returns list of rules
CLI Example:
.. code-block:: bash
salt myminion boto_iot.list_topic_rules
Example Return:
... | def list_topic_rules(topic=None, ruleDisabled=None,
region=None, key=None, keyid=None, profile=None):
'''
List all rules (for a given topic, if specified)
Returns list of rules
CLI Example:
.. code-block:: bash
salt myminion boto_iot.list_topic_rules
Example Return:
... | [
"List",
"all",
"rules",
"(",
"for",
"a",
"given",
"topic",
"if",
"specified",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L845-L884 | [
"def",
"list_topic_rules",
"(",
"topic",
"=",
"None",
",",
"ruleDisabled",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_svc | Returns a unique service status | salt/modules/netbsdservice.py | def _get_svc(rcd, service_status):
'''
Returns a unique service status
'''
ena = None
lines = __salt__['cmd.run']('{0} rcvar'.format(rcd)).splitlines()
for rcvar in lines:
if rcvar.startswith('$') and '={0}'.format(service_status) in rcvar:
ena = 'yes'
elif rcvar.star... | def _get_svc(rcd, service_status):
'''
Returns a unique service status
'''
ena = None
lines = __salt__['cmd.run']('{0} rcvar'.format(rcd)).splitlines()
for rcvar in lines:
if rcvar.startswith('$') and '={0}'.format(service_status) in rcvar:
ena = 'yes'
elif rcvar.star... | [
"Returns",
"a",
"unique",
"service",
"status"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbsdservice.py#L146-L162 | [
"def",
"_get_svc",
"(",
"rcd",
",",
"service_status",
")",
":",
"ena",
"=",
"None",
"lines",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'{0} rcvar'",
".",
"format",
"(",
"rcd",
")",
")",
".",
"splitlines",
"(",
")",
"for",
"rcvar",
"in",
"lines",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_svc_list | Returns all service statuses | salt/modules/netbsdservice.py | def _get_svc_list(service_status):
'''
Returns all service statuses
'''
prefix = '/etc/rc.d/'
ret = set()
lines = glob.glob('{0}*'.format(prefix))
for line in lines:
svc = _get_svc(line, service_status)
if svc is not None:
ret.add(svc)
return sorted(ret) | def _get_svc_list(service_status):
'''
Returns all service statuses
'''
prefix = '/etc/rc.d/'
ret = set()
lines = glob.glob('{0}*'.format(prefix))
for line in lines:
svc = _get_svc(line, service_status)
if svc is not None:
ret.add(svc)
return sorted(ret) | [
"Returns",
"all",
"service",
"statuses"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbsdservice.py#L165-L177 | [
"def",
"_get_svc_list",
"(",
"service_status",
")",
":",
"prefix",
"=",
"'/etc/rc.d/'",
"ret",
"=",
"set",
"(",
")",
"lines",
"=",
"glob",
".",
"glob",
"(",
"'{0}*'",
".",
"format",
"(",
"prefix",
")",
")",
"for",
"line",
"in",
"lines",
":",
"svc",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _rcconf_status | Modifies /etc/rc.conf so a service is started or not at boot time and
can be started via /etc/rc.d/<service> | salt/modules/netbsdservice.py | def _rcconf_status(name, service_status):
'''
Modifies /etc/rc.conf so a service is started or not at boot time and
can be started via /etc/rc.d/<service>
'''
rcconf = '/etc/rc.conf'
rxname = '^{0}=.*'.format(name)
newstatus = '{0}={1}'.format(name, service_status)
ret = __salt__['cmd.re... | def _rcconf_status(name, service_status):
'''
Modifies /etc/rc.conf so a service is started or not at boot time and
can be started via /etc/rc.d/<service>
'''
rcconf = '/etc/rc.conf'
rxname = '^{0}=.*'.format(name)
newstatus = '{0}={1}'.format(name, service_status)
ret = __salt__['cmd.re... | [
"Modifies",
"/",
"etc",
"/",
"rc",
".",
"conf",
"so",
"a",
"service",
"is",
"started",
"or",
"not",
"at",
"boot",
"time",
"and",
"can",
"be",
"started",
"via",
"/",
"etc",
"/",
"rc",
".",
"d",
"/",
"<service",
">"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbsdservice.py#L248-L262 | [
"def",
"_rcconf_status",
"(",
"name",
",",
"service_status",
")",
":",
"rcconf",
"=",
"'/etc/rc.conf'",
"rxname",
"=",
"'^{0}=.*'",
".",
"format",
"(",
"name",
")",
"newstatus",
"=",
"'{0}={1}'",
".",
"format",
"(",
"name",
",",
"service_status",
")",
"ret",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_conn | Return a conn object for the passed VM data | salt/cloud/clouds/profitbricks.py | def get_conn():
'''
Return a conn object for the passed VM data
'''
return ProfitBricksService(
username=config.get_cloud_config_value(
'username',
get_configured_provider(),
__opts__,
search_global=False
),
password=config.get_clou... | def get_conn():
'''
Return a conn object for the passed VM data
'''
return ProfitBricksService(
username=config.get_cloud_config_value(
'username',
get_configured_provider(),
__opts__,
search_global=False
),
password=config.get_clou... | [
"Return",
"a",
"conn",
"object",
"for",
"the",
"passed",
"VM",
"data"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L179-L196 | [
"def",
"get_conn",
"(",
")",
":",
"return",
"ProfitBricksService",
"(",
"username",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'username'",
",",
"get_configured_provider",
"(",
")",
",",
"__opts__",
",",
"search_global",
"=",
"False",
")",
",",
"passwor... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | avail_locations | Return a dict of all available VM locations on the cloud provider with
relevant data | salt/cloud/clouds/profitbricks.py | def avail_locations(call=None):
'''
Return a dict of all available VM locations on the cloud provider with
relevant data
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_images function must be called with '
'-f or --function, or with the --list-location... | def avail_locations(call=None):
'''
Return a dict of all available VM locations on the cloud provider with
relevant data
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_images function must be called with '
'-f or --function, or with the --list-location... | [
"Return",
"a",
"dict",
"of",
"all",
"available",
"VM",
"locations",
"on",
"the",
"cloud",
"provider",
"with",
"relevant",
"data"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L199-L221 | [
"def",
"avail_locations",
"(",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The avail_images function must be called with '",
"'-f or --function, or with the --list-locations option'",
")",
"ret",
"=",
"{",
"}"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | avail_images | Return a list of the images that are on the provider | salt/cloud/clouds/profitbricks.py | def avail_images(call=None):
'''
Return a list of the images that are on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_images function must be called with '
'-f or --function, or with the --list-images option'
)
ret = {}
conn... | def avail_images(call=None):
'''
Return a list of the images that are on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_images function must be called with '
'-f or --function, or with the --list-images option'
)
ret = {}
conn... | [
"Return",
"a",
"list",
"of",
"the",
"images",
"that",
"are",
"on",
"the",
"provider"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L224-L242 | [
"def",
"avail_images",
"(",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The avail_images function must be called with '",
"'-f or --function, or with the --list-images option'",
")",
"ret",
"=",
"{",
"}",
"c... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_images | List all the images with alias by location
CLI Example:
.. code-block:: bash
salt-cloud -f list_images my-profitbricks-config location=us/las | salt/cloud/clouds/profitbricks.py | def list_images(call=None, kwargs=None):
'''
List all the images with alias by location
CLI Example:
.. code-block:: bash
salt-cloud -f list_images my-profitbricks-config location=us/las
'''
if call != 'function':
raise SaltCloudSystemExit(
'The list_images functio... | def list_images(call=None, kwargs=None):
'''
List all the images with alias by location
CLI Example:
.. code-block:: bash
salt-cloud -f list_images my-profitbricks-config location=us/las
'''
if call != 'function':
raise SaltCloudSystemExit(
'The list_images functio... | [
"List",
"all",
"the",
"images",
"with",
"alias",
"by",
"location"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L245-L278 | [
"def",
"list_images",
"(",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"if",
"call",
"!=",
"'function'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_images function must be called with '",
"'-f or --function.'",
")",
"if",
"not",
"version_com... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_size | Return the VM's size object | salt/cloud/clouds/profitbricks.py | def get_size(vm_):
'''
Return the VM's size object
'''
vm_size = config.get_cloud_config_value('size', vm_, __opts__)
sizes = avail_sizes()
if not vm_size:
return sizes['Small Instance']
for size in sizes:
combinations = (six.text_type(sizes[size]['id']), six.text_type(size... | def get_size(vm_):
'''
Return the VM's size object
'''
vm_size = config.get_cloud_config_value('size', vm_, __opts__)
sizes = avail_sizes()
if not vm_size:
return sizes['Small Instance']
for size in sizes:
combinations = (six.text_type(sizes[size]['id']), six.text_type(size... | [
"Return",
"the",
"VM",
"s",
"size",
"object"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L340-L356 | [
"def",
"get_size",
"(",
"vm_",
")",
":",
"vm_size",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'size'",
",",
"vm_",
",",
"__opts__",
")",
"sizes",
"=",
"avail_sizes",
"(",
")",
"if",
"not",
"vm_size",
":",
"return",
"sizes",
"[",
"'Small Instance'... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_datacenter_id | Return datacenter ID from provider configuration | salt/cloud/clouds/profitbricks.py | def get_datacenter_id():
'''
Return datacenter ID from provider configuration
'''
datacenter_id = config.get_cloud_config_value(
'datacenter_id',
get_configured_provider(),
__opts__,
search_global=False
)
conn = get_conn()
try:
conn.get_datacenter(da... | def get_datacenter_id():
'''
Return datacenter ID from provider configuration
'''
datacenter_id = config.get_cloud_config_value(
'datacenter_id',
get_configured_provider(),
__opts__,
search_global=False
)
conn = get_conn()
try:
conn.get_datacenter(da... | [
"Return",
"datacenter",
"ID",
"from",
"provider",
"configuration"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L359-L378 | [
"def",
"get_datacenter_id",
"(",
")",
":",
"datacenter_id",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'datacenter_id'",
",",
"get_configured_provider",
"(",
")",
",",
"__opts__",
",",
"search_global",
"=",
"False",
")",
"conn",
"=",
"get_conn",
"(",
")... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_loadbalancers | Return a list of the loadbalancers that are on the provider | salt/cloud/clouds/profitbricks.py | def list_loadbalancers(call=None):
'''
Return a list of the loadbalancers that are on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_images function must be called with '
'-f or --function, or with the --list-loadbalancers option'
)
... | def list_loadbalancers(call=None):
'''
Return a list of the loadbalancers that are on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_images function must be called with '
'-f or --function, or with the --list-loadbalancers option'
)
... | [
"Return",
"a",
"list",
"of",
"the",
"loadbalancers",
"that",
"are",
"on",
"the",
"provider"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L381-L400 | [
"def",
"list_loadbalancers",
"(",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The avail_images function must be called with '",
"'-f or --function, or with the --list-loadbalancers option'",
")",
"ret",
"=",
"{"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_loadbalancer | Creates a loadbalancer within the datacenter from the provider config.
CLI Example:
.. code-block:: bash
salt-cloud -f create_loadbalancer profitbricks name=mylb | salt/cloud/clouds/profitbricks.py | def create_loadbalancer(call=None, kwargs=None):
'''
Creates a loadbalancer within the datacenter from the provider config.
CLI Example:
.. code-block:: bash
salt-cloud -f create_loadbalancer profitbricks name=mylb
'''
if call != 'function':
raise SaltCloudSystemExit(
... | def create_loadbalancer(call=None, kwargs=None):
'''
Creates a loadbalancer within the datacenter from the provider config.
CLI Example:
.. code-block:: bash
salt-cloud -f create_loadbalancer profitbricks name=mylb
'''
if call != 'function':
raise SaltCloudSystemExit(
... | [
"Creates",
"a",
"loadbalancer",
"within",
"the",
"datacenter",
"from",
"the",
"provider",
"config",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L403-L430 | [
"def",
"create_loadbalancer",
"(",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"if",
"call",
"!=",
"'function'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The create_address function must be called with -f or --function.'",
")",
"if",
"kwargs",
"is",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_datacenter | Return the datacenter from the config provider datacenter ID | salt/cloud/clouds/profitbricks.py | def get_datacenter(conn):
'''
Return the datacenter from the config provider datacenter ID
'''
datacenter_id = get_datacenter_id()
for item in conn.list_datacenters()['items']:
if item['id'] == datacenter_id:
return item
raise SaltCloudNotFound(
'The specified datac... | def get_datacenter(conn):
'''
Return the datacenter from the config provider datacenter ID
'''
datacenter_id = get_datacenter_id()
for item in conn.list_datacenters()['items']:
if item['id'] == datacenter_id:
return item
raise SaltCloudNotFound(
'The specified datac... | [
"Return",
"the",
"datacenter",
"from",
"the",
"config",
"provider",
"datacenter",
"ID"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L433-L447 | [
"def",
"get_datacenter",
"(",
"conn",
")",
":",
"datacenter_id",
"=",
"get_datacenter_id",
"(",
")",
"for",
"item",
"in",
"conn",
".",
"list_datacenters",
"(",
")",
"[",
"'items'",
"]",
":",
"if",
"item",
"[",
"'id'",
"]",
"==",
"datacenter_id",
":",
"re... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_datacenter | Creates a virtual datacenter based on supplied parameters.
CLI Example:
.. code-block:: bash
salt-cloud -f create_datacenter profitbricks name=mydatacenter
location=us/las description="my description" | salt/cloud/clouds/profitbricks.py | def create_datacenter(call=None, kwargs=None):
'''
Creates a virtual datacenter based on supplied parameters.
CLI Example:
.. code-block:: bash
salt-cloud -f create_datacenter profitbricks name=mydatacenter
location=us/las description="my description"
'''
if call != 'function'... | def create_datacenter(call=None, kwargs=None):
'''
Creates a virtual datacenter based on supplied parameters.
CLI Example:
.. code-block:: bash
salt-cloud -f create_datacenter profitbricks name=mydatacenter
location=us/las description="my description"
'''
if call != 'function'... | [
"Creates",
"a",
"virtual",
"datacenter",
"based",
"on",
"supplied",
"parameters",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L450-L483 | [
"def",
"create_datacenter",
"(",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"if",
"call",
"!=",
"'function'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The create_address function must be called with -f or --function.'",
")",
"if",
"kwargs",
"is",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_datacenters | List all the data centers
CLI Example:
.. code-block:: bash
salt-cloud -f list_datacenters my-profitbricks-config | salt/cloud/clouds/profitbricks.py | def list_datacenters(conn=None, call=None):
'''
List all the data centers
CLI Example:
.. code-block:: bash
salt-cloud -f list_datacenters my-profitbricks-config
'''
if call != 'function':
raise SaltCloudSystemExit(
'The list_datacenters function must be called wit... | def list_datacenters(conn=None, call=None):
'''
List all the data centers
CLI Example:
.. code-block:: bash
salt-cloud -f list_datacenters my-profitbricks-config
'''
if call != 'function':
raise SaltCloudSystemExit(
'The list_datacenters function must be called wit... | [
"List",
"all",
"the",
"data",
"centers"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L524-L550 | [
"def",
"list_datacenters",
"(",
"conn",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"!=",
"'function'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_datacenters function must be called with '",
"'-f or --function.'",
")",
"datacenters",
"=",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_nodes | Return a list of VMs that are on the provider | salt/cloud/clouds/profitbricks.py | def list_nodes(conn=None, call=None):
'''
Return a list of VMs that are on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes function must be called with -f or --function.'
)
if not conn:
conn = get_conn()
ret = {}
datacent... | def list_nodes(conn=None, call=None):
'''
Return a list of VMs that are on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes function must be called with -f or --function.'
)
if not conn:
conn = get_conn()
ret = {}
datacent... | [
"Return",
"a",
"list",
"of",
"VMs",
"that",
"are",
"on",
"the",
"provider"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L553-L581 | [
"def",
"list_nodes",
"(",
"conn",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_nodes function must be called with -f or --function.'",
")",
"if",
"not",
"conn",
":",
"conn",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_nodes_full | Return a list of the VMs that are on the provider, with all fields | salt/cloud/clouds/profitbricks.py | def list_nodes_full(conn=None, call=None):
'''
Return a list of the VMs that are on the provider, with all fields
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes_full function must be called with -f or '
'--function.'
)
if not conn:
... | def list_nodes_full(conn=None, call=None):
'''
Return a list of the VMs that are on the provider, with all fields
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes_full function must be called with -f or '
'--function.'
)
if not conn:
... | [
"Return",
"a",
"list",
"of",
"the",
"VMs",
"that",
"are",
"on",
"the",
"provider",
"with",
"all",
"fields"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L584-L625 | [
"def",
"list_nodes_full",
"(",
"conn",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_nodes_full function must be called with -f or '",
"'--function.'",
")",
"if",
"not",
"conn",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | reserve_ipblock | Reserve the IP Block | salt/cloud/clouds/profitbricks.py | def reserve_ipblock(call=None, kwargs=None):
'''
Reserve the IP Block
'''
if call == 'action':
raise SaltCloudSystemExit(
'The reserve_ipblock function must be called with -f or '
'--function.'
)
conn = get_conn()
if kwargs is None:
kwargs = {}
... | def reserve_ipblock(call=None, kwargs=None):
'''
Reserve the IP Block
'''
if call == 'action':
raise SaltCloudSystemExit(
'The reserve_ipblock function must be called with -f or '
'--function.'
)
conn = get_conn()
if kwargs is None:
kwargs = {}
... | [
"Reserve",
"the",
"IP",
"Block"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L628-L658 | [
"def",
"reserve_ipblock",
"(",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The reserve_ipblock function must be called with -f or '",
"'--function.'",
")",
"conn",
"=",
"get_c... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_node | Return a node for the named VM | salt/cloud/clouds/profitbricks.py | def get_node(conn, name):
'''
Return a node for the named VM
'''
datacenter_id = get_datacenter_id()
for item in conn.list_servers(datacenter_id)['items']:
if item['properties']['name'] == name:
node = {'id': item['id']}
node.update(item['properties'])
re... | def get_node(conn, name):
'''
Return a node for the named VM
'''
datacenter_id = get_datacenter_id()
for item in conn.list_servers(datacenter_id)['items']:
if item['properties']['name'] == name:
node = {'id': item['id']}
node.update(item['properties'])
re... | [
"Return",
"a",
"node",
"for",
"the",
"named",
"VM"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L679-L689 | [
"def",
"get_node",
"(",
"conn",
",",
"name",
")",
":",
"datacenter_id",
"=",
"get_datacenter_id",
"(",
")",
"for",
"item",
"in",
"conn",
".",
"list_servers",
"(",
"datacenter_id",
")",
"[",
"'items'",
"]",
":",
"if",
"item",
"[",
"'properties'",
"]",
"["... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_nics | Create network interfaces on appropriate LANs as defined in cloud profile. | salt/cloud/clouds/profitbricks.py | def _get_nics(vm_):
'''
Create network interfaces on appropriate LANs as defined in cloud profile.
'''
nics = []
if 'public_lan' in vm_:
firewall_rules = []
# Set LAN to public if it already exists, otherwise create a new
# public LAN.
if 'public_firewall_rules' in vm... | def _get_nics(vm_):
'''
Create network interfaces on appropriate LANs as defined in cloud profile.
'''
nics = []
if 'public_lan' in vm_:
firewall_rules = []
# Set LAN to public if it already exists, otherwise create a new
# public LAN.
if 'public_firewall_rules' in vm... | [
"Create",
"network",
"interfaces",
"on",
"appropriate",
"LANs",
"as",
"defined",
"in",
"cloud",
"profile",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L703-L733 | [
"def",
"_get_nics",
"(",
"vm_",
")",
":",
"nics",
"=",
"[",
"]",
"if",
"'public_lan'",
"in",
"vm_",
":",
"firewall_rules",
"=",
"[",
"]",
"# Set LAN to public if it already exists, otherwise create a new",
"# public LAN.",
"if",
"'public_firewall_rules'",
"in",
"vm_",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_public_lan | Enables public Internet access for the specified public_lan. If no public
LAN is available, then a new public LAN is created. | salt/cloud/clouds/profitbricks.py | def set_public_lan(lan_id):
'''
Enables public Internet access for the specified public_lan. If no public
LAN is available, then a new public LAN is created.
'''
conn = get_conn()
datacenter_id = get_datacenter_id()
try:
lan = conn.get_lan(datacenter_id=datacenter_id, lan_id=lan_id)... | def set_public_lan(lan_id):
'''
Enables public Internet access for the specified public_lan. If no public
LAN is available, then a new public LAN is created.
'''
conn = get_conn()
datacenter_id = get_datacenter_id()
try:
lan = conn.get_lan(datacenter_id=datacenter_id, lan_id=lan_id)... | [
"Enables",
"public",
"Internet",
"access",
"for",
"the",
"specified",
"public_lan",
".",
"If",
"no",
"public",
"LAN",
"is",
"available",
"then",
"a",
"new",
"public",
"LAN",
"is",
"created",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L736-L755 | [
"def",
"set_public_lan",
"(",
"lan_id",
")",
":",
"conn",
"=",
"get_conn",
"(",
")",
"datacenter_id",
"=",
"get_datacenter_id",
"(",
")",
"try",
":",
"lan",
"=",
"conn",
".",
"get_lan",
"(",
"datacenter_id",
"=",
"datacenter_id",
",",
"lan_id",
"=",
"lan_i... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_public_keys | Retrieve list of SSH public keys. | salt/cloud/clouds/profitbricks.py | def get_public_keys(vm_):
'''
Retrieve list of SSH public keys.
'''
key_filename = config.get_cloud_config_value(
'ssh_public_key', vm_, __opts__, search_global=False, default=None
)
if key_filename is not None:
key_filename = os.path.expanduser(key_filename)
if not os.pa... | def get_public_keys(vm_):
'''
Retrieve list of SSH public keys.
'''
key_filename = config.get_cloud_config_value(
'ssh_public_key', vm_, __opts__, search_global=False, default=None
)
if key_filename is not None:
key_filename = os.path.expanduser(key_filename)
if not os.pa... | [
"Retrieve",
"list",
"of",
"SSH",
"public",
"keys",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L758-L778 | [
"def",
"get_public_keys",
"(",
"vm_",
")",
":",
"key_filename",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'ssh_public_key'",
",",
"vm_",
",",
"__opts__",
",",
"search_global",
"=",
"False",
",",
"default",
"=",
"None",
")",
"if",
"key_filename",
"is"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_key_filename | Check SSH private key file and return absolute path if exists. | salt/cloud/clouds/profitbricks.py | def get_key_filename(vm_):
'''
Check SSH private key file and return absolute path if exists.
'''
key_filename = config.get_cloud_config_value(
'ssh_private_key', vm_, __opts__, search_global=False, default=None
)
if key_filename is not None:
key_filename = os.path.expanduser(key... | def get_key_filename(vm_):
'''
Check SSH private key file and return absolute path if exists.
'''
key_filename = config.get_cloud_config_value(
'ssh_private_key', vm_, __opts__, search_global=False, default=None
)
if key_filename is not None:
key_filename = os.path.expanduser(key... | [
"Check",
"SSH",
"private",
"key",
"file",
"and",
"return",
"absolute",
"path",
"if",
"exists",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L781-L797 | [
"def",
"get_key_filename",
"(",
"vm_",
")",
":",
"key_filename",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'ssh_private_key'",
",",
"vm_",
",",
"__opts__",
",",
"search_global",
"=",
"False",
",",
"default",
"=",
"None",
")",
"if",
"key_filename",
"i... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create | Create a single VM from a data dict | salt/cloud/clouds/profitbricks.py | def create(vm_):
'''
Create a single VM from a data dict
'''
try:
# Check for required profile parameters before sending any API calls.
if (vm_['profile'] and
config.is_profile_configured(__opts__,
(__active_provider_name__ or
... | def create(vm_):
'''
Create a single VM from a data dict
'''
try:
# Check for required profile parameters before sending any API calls.
if (vm_['profile'] and
config.is_profile_configured(__opts__,
(__active_provider_name__ or
... | [
"Create",
"a",
"single",
"VM",
"from",
"a",
"data",
"dict"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L817-L951 | [
"def",
"create",
"(",
"vm_",
")",
":",
"try",
":",
"# Check for required profile parameters before sending any API calls.",
"if",
"(",
"vm_",
"[",
"'profile'",
"]",
"and",
"config",
".",
"is_profile_configured",
"(",
"__opts__",
",",
"(",
"__active_provider_name__",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | destroy | destroy a machine by name
:param name: name given to the machine
:param call: call value in this case is 'action'
:return: array of booleans , true if successfully stopped and true if
successfully removed
CLI Example:
.. code-block:: bash
salt-cloud -d vm_name | salt/cloud/clouds/profitbricks.py | def destroy(name, call=None):
'''
destroy a machine by name
:param name: name given to the machine
:param call: call value in this case is 'action'
:return: array of booleans , true if successfully stopped and true if
successfully removed
CLI Example:
.. code-block:: bash
... | def destroy(name, call=None):
'''
destroy a machine by name
:param name: name given to the machine
:param call: call value in this case is 'action'
:return: array of booleans , true if successfully stopped and true if
successfully removed
CLI Example:
.. code-block:: bash
... | [
"destroy",
"a",
"machine",
"by",
"name"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L954-L1030 | [
"def",
"destroy",
"(",
"name",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'function'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The destroy action must be called with -d, --destroy, '",
"'-a or --action.'",
")",
"__utils__",
"[",
"'cloud.fire_event'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | reboot | reboot a machine by name
:param name: name given to the machine
:param call: call value in this case is 'action'
:return: true if successful
CLI Example:
.. code-block:: bash
salt-cloud -a reboot vm_name | salt/cloud/clouds/profitbricks.py | def reboot(name, call=None):
'''
reboot a machine by name
:param name: name given to the machine
:param call: call value in this case is 'action'
:return: true if successful
CLI Example:
.. code-block:: bash
salt-cloud -a reboot vm_name
'''
datacenter_id = get_datacenter_i... | def reboot(name, call=None):
'''
reboot a machine by name
:param name: name given to the machine
:param call: call value in this case is 'action'
:return: true if successful
CLI Example:
.. code-block:: bash
salt-cloud -a reboot vm_name
'''
datacenter_id = get_datacenter_i... | [
"reboot",
"a",
"machine",
"by",
"name",
":",
"param",
"name",
":",
"name",
"given",
"to",
"the",
"machine",
":",
"param",
"call",
":",
"call",
"value",
"in",
"this",
"case",
"is",
"action",
":",
"return",
":",
"true",
"if",
"successful"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L1033-L1052 | [
"def",
"reboot",
"(",
"name",
",",
"call",
"=",
"None",
")",
":",
"datacenter_id",
"=",
"get_datacenter_id",
"(",
")",
"conn",
"=",
"get_conn",
"(",
")",
"node",
"=",
"get_node",
"(",
"conn",
",",
"name",
")",
"conn",
".",
"reboot_server",
"(",
"datace... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | stop | stop a machine by name
:param name: name given to the machine
:param call: call value in this case is 'action'
:return: true if successful
CLI Example:
.. code-block:: bash
salt-cloud -a stop vm_name | salt/cloud/clouds/profitbricks.py | def stop(name, call=None):
'''
stop a machine by name
:param name: name given to the machine
:param call: call value in this case is 'action'
:return: true if successful
CLI Example:
.. code-block:: bash
salt-cloud -a stop vm_name
'''
datacenter_id = get_datacenter_id()
... | def stop(name, call=None):
'''
stop a machine by name
:param name: name given to the machine
:param call: call value in this case is 'action'
:return: true if successful
CLI Example:
.. code-block:: bash
salt-cloud -a stop vm_name
'''
datacenter_id = get_datacenter_id()
... | [
"stop",
"a",
"machine",
"by",
"name",
":",
"param",
"name",
":",
"name",
"given",
"to",
"the",
"machine",
":",
"param",
"call",
":",
"call",
"value",
"in",
"this",
"case",
"is",
"action",
":",
"return",
":",
"true",
"if",
"successful"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L1055-L1074 | [
"def",
"stop",
"(",
"name",
",",
"call",
"=",
"None",
")",
":",
"datacenter_id",
"=",
"get_datacenter_id",
"(",
")",
"conn",
"=",
"get_conn",
"(",
")",
"node",
"=",
"get_node",
"(",
"conn",
",",
"name",
")",
"conn",
".",
"stop_server",
"(",
"datacenter... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | start | start a machine by name
:param name: name given to the machine
:param call: call value in this case is 'action'
:return: true if successful
CLI Example:
.. code-block:: bash
salt-cloud -a start vm_name | salt/cloud/clouds/profitbricks.py | def start(name, call=None):
'''
start a machine by name
:param name: name given to the machine
:param call: call value in this case is 'action'
:return: true if successful
CLI Example:
.. code-block:: bash
salt-cloud -a start vm_name
'''
datacenter_id = get_datacenter_id(... | def start(name, call=None):
'''
start a machine by name
:param name: name given to the machine
:param call: call value in this case is 'action'
:return: true if successful
CLI Example:
.. code-block:: bash
salt-cloud -a start vm_name
'''
datacenter_id = get_datacenter_id(... | [
"start",
"a",
"machine",
"by",
"name",
":",
"param",
"name",
":",
"name",
"given",
"to",
"the",
"machine",
":",
"param",
"call",
":",
"call",
"value",
"in",
"this",
"case",
"is",
"action",
":",
"return",
":",
"true",
"if",
"successful"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L1077-L1097 | [
"def",
"start",
"(",
"name",
",",
"call",
"=",
"None",
")",
":",
"datacenter_id",
"=",
"get_datacenter_id",
"(",
")",
"conn",
"=",
"get_conn",
"(",
")",
"node",
"=",
"get_node",
"(",
"conn",
",",
"name",
")",
"conn",
".",
"start_server",
"(",
"datacent... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _override_size | Apply any extra component overrides to VM from the cloud profile. | salt/cloud/clouds/profitbricks.py | def _override_size(vm_):
'''
Apply any extra component overrides to VM from the cloud profile.
'''
vm_size = get_size(vm_)
if 'cores' in vm_:
vm_size['cores'] = vm_['cores']
if 'ram' in vm_:
vm_size['ram'] = vm_['ram']
return vm_size | def _override_size(vm_):
'''
Apply any extra component overrides to VM from the cloud profile.
'''
vm_size = get_size(vm_)
if 'cores' in vm_:
vm_size['cores'] = vm_['cores']
if 'ram' in vm_:
vm_size['ram'] = vm_['ram']
return vm_size | [
"Apply",
"any",
"extra",
"component",
"overrides",
"to",
"VM",
"from",
"the",
"cloud",
"profile",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L1100-L1112 | [
"def",
"_override_size",
"(",
"vm_",
")",
":",
"vm_size",
"=",
"get_size",
"(",
"vm_",
")",
"if",
"'cores'",
"in",
"vm_",
":",
"vm_size",
"[",
"'cores'",
"]",
"=",
"vm_",
"[",
"'cores'",
"]",
"if",
"'ram'",
"in",
"vm_",
":",
"vm_size",
"[",
"'ram'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_server | Construct server instance from cloud profile config | salt/cloud/clouds/profitbricks.py | def _get_server(vm_, volumes, nics):
'''
Construct server instance from cloud profile config
'''
# Apply component overrides to the size from the cloud profile config
vm_size = _override_size(vm_)
# Set the server availability zone from the cloud profile config
availability_zone = config.ge... | def _get_server(vm_, volumes, nics):
'''
Construct server instance from cloud profile config
'''
# Apply component overrides to the size from the cloud profile config
vm_size = _override_size(vm_)
# Set the server availability zone from the cloud profile config
availability_zone = config.ge... | [
"Construct",
"server",
"instance",
"from",
"cloud",
"profile",
"config"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L1115-L1143 | [
"def",
"_get_server",
"(",
"vm_",
",",
"volumes",
",",
"nics",
")",
":",
"# Apply component overrides to the size from the cloud profile config",
"vm_size",
"=",
"_override_size",
"(",
"vm_",
")",
"# Set the server availability zone from the cloud profile config",
"availability_z... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_system_volume | Construct VM system volume list from cloud profile config | salt/cloud/clouds/profitbricks.py | def _get_system_volume(vm_):
'''
Construct VM system volume list from cloud profile config
'''
# Override system volume size if 'disk_size' is defined in cloud profile
disk_size = get_size(vm_)['disk']
if 'disk_size' in vm_:
disk_size = vm_['disk_size']
# Construct the system volum... | def _get_system_volume(vm_):
'''
Construct VM system volume list from cloud profile config
'''
# Override system volume size if 'disk_size' is defined in cloud profile
disk_size = get_size(vm_)['disk']
if 'disk_size' in vm_:
disk_size = vm_['disk_size']
# Construct the system volum... | [
"Construct",
"VM",
"system",
"volume",
"list",
"from",
"cloud",
"profile",
"config"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L1146-L1179 | [
"def",
"_get_system_volume",
"(",
"vm_",
")",
":",
"# Override system volume size if 'disk_size' is defined in cloud profile",
"disk_size",
"=",
"get_size",
"(",
"vm_",
")",
"[",
"'disk'",
"]",
"if",
"'disk_size'",
"in",
"vm_",
":",
"disk_size",
"=",
"vm_",
"[",
"'d... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_data_volumes | Construct a list of optional data volumes from the cloud profile | salt/cloud/clouds/profitbricks.py | def _get_data_volumes(vm_):
'''
Construct a list of optional data volumes from the cloud profile
'''
ret = []
volumes = vm_['volumes']
for key, value in six.iteritems(volumes):
# Verify the required 'disk_size' property is present in the cloud
# profile config
if 'disk_si... | def _get_data_volumes(vm_):
'''
Construct a list of optional data volumes from the cloud profile
'''
ret = []
volumes = vm_['volumes']
for key, value in six.iteritems(volumes):
# Verify the required 'disk_size' property is present in the cloud
# profile config
if 'disk_si... | [
"Construct",
"a",
"list",
"of",
"optional",
"data",
"volumes",
"from",
"the",
"cloud",
"profile"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L1182-L1213 | [
"def",
"_get_data_volumes",
"(",
"vm_",
")",
":",
"ret",
"=",
"[",
"]",
"volumes",
"=",
"vm_",
"[",
"'volumes'",
"]",
"for",
"key",
",",
"value",
"in",
"six",
".",
"iteritems",
"(",
"volumes",
")",
":",
"# Verify the required 'disk_size' property is present in... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_firewall_rules | Construct a list of optional firewall rules from the cloud profile. | salt/cloud/clouds/profitbricks.py | def _get_firewall_rules(firewall_rules):
'''
Construct a list of optional firewall rules from the cloud profile.
'''
ret = []
for key, value in six.iteritems(firewall_rules):
# Verify the required 'protocol' property is present in the cloud
# profile config
if 'protocol' not ... | def _get_firewall_rules(firewall_rules):
'''
Construct a list of optional firewall rules from the cloud profile.
'''
ret = []
for key, value in six.iteritems(firewall_rules):
# Verify the required 'protocol' property is present in the cloud
# profile config
if 'protocol' not ... | [
"Construct",
"a",
"list",
"of",
"optional",
"firewall",
"rules",
"from",
"the",
"cloud",
"profile",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L1227-L1251 | [
"def",
"_get_firewall_rules",
"(",
"firewall_rules",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"key",
",",
"value",
"in",
"six",
".",
"iteritems",
"(",
"firewall_rules",
")",
":",
"# Verify the required 'protocol' property is present in the cloud",
"# profile config",
"i... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _wait_for_completion | Poll request status until resource is provisioned. | salt/cloud/clouds/profitbricks.py | def _wait_for_completion(conn, promise, wait_timeout, msg):
'''
Poll request status until resource is provisioned.
'''
if not promise:
return
wait_timeout = time.time() + wait_timeout
while wait_timeout > time.time():
time.sleep(5)
operation_result = conn.get_request(
... | def _wait_for_completion(conn, promise, wait_timeout, msg):
'''
Poll request status until resource is provisioned.
'''
if not promise:
return
wait_timeout = time.time() + wait_timeout
while wait_timeout > time.time():
time.sleep(5)
operation_result = conn.get_request(
... | [
"Poll",
"request",
"status",
"until",
"resource",
"is",
"provisioned",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L1254-L1281 | [
"def",
"_wait_for_completion",
"(",
"conn",
",",
"promise",
",",
"wait_timeout",
",",
"msg",
")",
":",
"if",
"not",
"promise",
":",
"return",
"wait_timeout",
"=",
"time",
".",
"time",
"(",
")",
"+",
"wait_timeout",
"while",
"wait_timeout",
">",
"time",
"."... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | is_installed | Determine if a package or runtime is installed.
Args:
name (str): The name of the package or the runtime.
Returns:
bool: True if the specified package or runtime is installed.
CLI Example:
.. code-block:: bash
salt '*' flatpak.is_installed org.gimp.GIMP | salt/modules/flatpak.py | def is_installed(name):
'''
Determine if a package or runtime is installed.
Args:
name (str): The name of the package or the runtime.
Returns:
bool: True if the specified package or runtime is installed.
CLI Example:
.. code-block:: bash
salt '*' flatpak.is_installed... | def is_installed(name):
'''
Determine if a package or runtime is installed.
Args:
name (str): The name of the package or the runtime.
Returns:
bool: True if the specified package or runtime is installed.
CLI Example:
.. code-block:: bash
salt '*' flatpak.is_installed... | [
"Determine",
"if",
"a",
"package",
"or",
"runtime",
"is",
"installed",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/flatpak.py#L58-L79 | [
"def",
"is_installed",
"(",
"name",
")",
":",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"FLATPAK_BINARY_NAME",
"+",
"' info '",
"+",
"name",
")",
"if",
"out",
"[",
"'retcode'",
"]",
"and",
"out",
"[",
"'stderr'",
"]",
":",
"return",
"False"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | uninstall | Uninstall the specified package.
Args:
pkg (str): The package name.
Returns:
dict: The ``result`` and ``output``.
CLI Example:
.. code-block:: bash
salt '*' flatpak.uninstall org.gimp.GIMP | salt/modules/flatpak.py | def uninstall(pkg):
'''
Uninstall the specified package.
Args:
pkg (str): The package name.
Returns:
dict: The ``result`` and ``output``.
CLI Example:
.. code-block:: bash
salt '*' flatpak.uninstall org.gimp.GIMP
'''
ret = {'result': None, 'output': ''}
... | def uninstall(pkg):
'''
Uninstall the specified package.
Args:
pkg (str): The package name.
Returns:
dict: The ``result`` and ``output``.
CLI Example:
.. code-block:: bash
salt '*' flatpak.uninstall org.gimp.GIMP
'''
ret = {'result': None, 'output': ''}
... | [
"Uninstall",
"the",
"specified",
"package",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/flatpak.py#L82-L109 | [
"def",
"uninstall",
"(",
"pkg",
")",
":",
"ret",
"=",
"{",
"'result'",
":",
"None",
",",
"'output'",
":",
"''",
"}",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"FLATPAK_BINARY_NAME",
"+",
"' uninstall '",
"+",
"pkg",
")",
"if",
"out",
"[",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | add_remote | Adds a new location to install flatpak packages from.
Args:
name (str): The repository's name.
location (str): The location of the repository.
Returns:
dict: The ``result`` and ``output``.
CLI Example:
.. code-block:: bash
salt '*' flatpak.add_remote flathub https://... | salt/modules/flatpak.py | def add_remote(name, location):
'''
Adds a new location to install flatpak packages from.
Args:
name (str): The repository's name.
location (str): The location of the repository.
Returns:
dict: The ``result`` and ``output``.
CLI Example:
.. code-block:: bash
... | def add_remote(name, location):
'''
Adds a new location to install flatpak packages from.
Args:
name (str): The repository's name.
location (str): The location of the repository.
Returns:
dict: The ``result`` and ``output``.
CLI Example:
.. code-block:: bash
... | [
"Adds",
"a",
"new",
"location",
"to",
"install",
"flatpak",
"packages",
"from",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/flatpak.py#L112-L139 | [
"def",
"add_remote",
"(",
"name",
",",
"location",
")",
":",
"ret",
"=",
"{",
"'result'",
":",
"None",
",",
"'output'",
":",
"''",
"}",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"FLATPAK_BINARY_NAME",
"+",
"' remote-add '",
"+",
"name",
"+"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | is_remote_added | Determines if a remote exists.
Args:
remote (str): The remote's name.
Returns:
bool: True if the remote has already been added.
CLI Example:
.. code-block:: bash
salt '*' flatpak.is_remote_added flathub | salt/modules/flatpak.py | def is_remote_added(remote):
'''
Determines if a remote exists.
Args:
remote (str): The remote's name.
Returns:
bool: True if the remote has already been added.
CLI Example:
.. code-block:: bash
salt '*' flatpak.is_remote_added flathub
'''
out = __salt__['cmd... | def is_remote_added(remote):
'''
Determines if a remote exists.
Args:
remote (str): The remote's name.
Returns:
bool: True if the remote has already been added.
CLI Example:
.. code-block:: bash
salt '*' flatpak.is_remote_added flathub
'''
out = __salt__['cmd... | [
"Determines",
"if",
"a",
"remote",
"exists",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/flatpak.py#L142-L165 | [
"def",
"is_remote_added",
"(",
"remote",
")",
":",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"FLATPAK_BINARY_NAME",
"+",
"' remotes'",
")",
"lines",
"=",
"out",
".",
"splitlines",
"(",
")",
"for",
"item",
"in",
"lines",
":",
"i",
"=",
"re",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | pack_dunder | Compatibility helper function to make __utils__ available on demand. | salt/utils/compat.py | def pack_dunder(name):
'''
Compatibility helper function to make __utils__ available on demand.
'''
# TODO: Deprecate starting with Beryllium
mod = sys.modules[name]
if not hasattr(mod, '__utils__'):
setattr(mod, '__utils__', salt.loader.utils(mod.__opts__)) | def pack_dunder(name):
'''
Compatibility helper function to make __utils__ available on demand.
'''
# TODO: Deprecate starting with Beryllium
mod = sys.modules[name]
if not hasattr(mod, '__utils__'):
setattr(mod, '__utils__', salt.loader.utils(mod.__opts__)) | [
"Compatibility",
"helper",
"function",
"to",
"make",
"__utils__",
"available",
"on",
"demand",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/compat.py#L18-L26 | [
"def",
"pack_dunder",
"(",
"name",
")",
":",
"# TODO: Deprecate starting with Beryllium",
"mod",
"=",
"sys",
".",
"modules",
"[",
"name",
"]",
"if",
"not",
"hasattr",
"(",
"mod",
",",
"'__utils__'",
")",
":",
"setattr",
"(",
"mod",
",",
"'__utils__'",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | deepcopy_bound | Compatibility helper function to allow copy.deepcopy copy bound methods
which is broken on Python 2.6, due to the following bug:
https://bugs.python.org/issue1515
Warnings:
- This method will mutate the global deepcopy dispatcher, which means that
this function is NOT threadsafe!
-... | salt/utils/compat.py | def deepcopy_bound(name):
'''
Compatibility helper function to allow copy.deepcopy copy bound methods
which is broken on Python 2.6, due to the following bug:
https://bugs.python.org/issue1515
Warnings:
- This method will mutate the global deepcopy dispatcher, which means that
this ... | def deepcopy_bound(name):
'''
Compatibility helper function to allow copy.deepcopy copy bound methods
which is broken on Python 2.6, due to the following bug:
https://bugs.python.org/issue1515
Warnings:
- This method will mutate the global deepcopy dispatcher, which means that
this ... | [
"Compatibility",
"helper",
"function",
"to",
"allow",
"copy",
".",
"deepcopy",
"copy",
"bound",
"methods",
"which",
"is",
"broken",
"on",
"Python",
"2",
".",
"6",
"due",
"to",
"the",
"following",
"bug",
":",
"https",
":",
"//",
"bugs",
".",
"python",
"."... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/compat.py#L29-L50 | [
"def",
"deepcopy_bound",
"(",
"name",
")",
":",
"def",
"_deepcopy_method",
"(",
"x",
",",
"memo",
")",
":",
"return",
"type",
"(",
"x",
")",
"(",
"x",
".",
"im_func",
",",
"copy",
".",
"deepcopy",
"(",
"x",
".",
"im_self",
",",
"memo",
")",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | upgrade_available | Check if there is an upgrade available for a certain package
CLI Example:
.. code-block:: bash
salt '*' pkgutil.upgrade_available CSWpython | salt/modules/pkgutil.py | def upgrade_available(name):
'''
Check if there is an upgrade available for a certain package
CLI Example:
.. code-block:: bash
salt '*' pkgutil.upgrade_available CSWpython
'''
version_num = None
cmd = '/opt/csw/bin/pkgutil -c --parse --single {0}'.format(
name)
out = ... | def upgrade_available(name):
'''
Check if there is an upgrade available for a certain package
CLI Example:
.. code-block:: bash
salt '*' pkgutil.upgrade_available CSWpython
'''
version_num = None
cmd = '/opt/csw/bin/pkgutil -c --parse --single {0}'.format(
name)
out = ... | [
"Check",
"if",
"there",
"is",
"an",
"upgrade",
"available",
"for",
"a",
"certain",
"package"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgutil.py#L53-L74 | [
"def",
"upgrade_available",
"(",
"name",
")",
":",
"version_num",
"=",
"None",
"cmd",
"=",
"'/opt/csw/bin/pkgutil -c --parse --single {0}'",
".",
"format",
"(",
"name",
")",
"out",
"=",
"__salt__",
"[",
"'cmd.run_stdout'",
"]",
"(",
"cmd",
")",
"if",
"out",
":... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_upgrades | List all available package upgrades on this system
CLI Example:
.. code-block:: bash
salt '*' pkgutil.list_upgrades | salt/modules/pkgutil.py | def list_upgrades(refresh=True, **kwargs): # pylint: disable=W0613
'''
List all available package upgrades on this system
CLI Example:
.. code-block:: bash
salt '*' pkgutil.list_upgrades
'''
if salt.utils.data.is_true(refresh):
refresh_db()
upgrades = {}
lines = __sal... | def list_upgrades(refresh=True, **kwargs): # pylint: disable=W0613
'''
List all available package upgrades on this system
CLI Example:
.. code-block:: bash
salt '*' pkgutil.list_upgrades
'''
if salt.utils.data.is_true(refresh):
refresh_db()
upgrades = {}
lines = __sal... | [
"List",
"all",
"available",
"package",
"upgrades",
"on",
"this",
"system"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgutil.py#L77-L99 | [
"def",
"list_upgrades",
"(",
"refresh",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=W0613",
"if",
"salt",
".",
"utils",
".",
"data",
".",
"is_true",
"(",
"refresh",
")",
":",
"refresh_db",
"(",
")",
"upgrades",
"=",
"{",
"}",
"li... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | upgrade | Upgrade all of the packages to the latest available version.
Returns a dict containing the changes::
{'<package>': {'old': '<old-version>',
'new': '<new-version>'}}
CLI Example:
.. code-block:: bash
salt '*' pkgutil.upgrade | salt/modules/pkgutil.py | def upgrade(refresh=True):
'''
Upgrade all of the packages to the latest available version.
Returns a dict containing the changes::
{'<package>': {'old': '<old-version>',
'new': '<new-version>'}}
CLI Example:
.. code-block:: bash
salt '*' pkgutil.upgrade
... | def upgrade(refresh=True):
'''
Upgrade all of the packages to the latest available version.
Returns a dict containing the changes::
{'<package>': {'old': '<old-version>',
'new': '<new-version>'}}
CLI Example:
.. code-block:: bash
salt '*' pkgutil.upgrade
... | [
"Upgrade",
"all",
"of",
"the",
"packages",
"to",
"the",
"latest",
"available",
"version",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgutil.py#L102-L128 | [
"def",
"upgrade",
"(",
"refresh",
"=",
"True",
")",
":",
"if",
"salt",
".",
"utils",
".",
"data",
".",
"is_true",
"(",
"refresh",
")",
":",
"refresh_db",
"(",
")",
"old",
"=",
"list_pkgs",
"(",
")",
"# Install or upgrade the package",
"# If package is alread... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | install | Install packages using the pkgutil tool.
CLI Example:
.. code-block:: bash
salt '*' pkg.install <package_name>
salt '*' pkg.install SMClgcc346
Multiple Package Installation Options:
pkgs
A list of packages to install from OpenCSW. Must be passed as a python
list.
... | salt/modules/pkgutil.py | def install(name=None, refresh=False, version=None, pkgs=None, **kwargs):
'''
Install packages using the pkgutil tool.
CLI Example:
.. code-block:: bash
salt '*' pkg.install <package_name>
salt '*' pkg.install SMClgcc346
Multiple Package Installation Options:
pkgs
A... | def install(name=None, refresh=False, version=None, pkgs=None, **kwargs):
'''
Install packages using the pkgutil tool.
CLI Example:
.. code-block:: bash
salt '*' pkg.install <package_name>
salt '*' pkg.install SMClgcc346
Multiple Package Installation Options:
pkgs
A... | [
"Install",
"packages",
"using",
"the",
"pkgutil",
"tool",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgutil.py#L248-L307 | [
"def",
"install",
"(",
"name",
"=",
"None",
",",
"refresh",
"=",
"False",
",",
"version",
"=",
"None",
",",
"pkgs",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"refresh",
":",
"refresh_db",
"(",
")",
"try",
":",
"# Ignore 'sources' argument",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | remove | Remove a package and all its dependencies which are not in use by other
packages.
name
The name of the package to be deleted.
Multiple Package Options:
pkgs
A list of packages to delete. Must be passed as a python list. The
``name`` parameter will be ignored if this option is... | salt/modules/pkgutil.py | def remove(name=None, pkgs=None, **kwargs):
'''
Remove a package and all its dependencies which are not in use by other
packages.
name
The name of the package to be deleted.
Multiple Package Options:
pkgs
A list of packages to delete. Must be passed as a python list. The
... | def remove(name=None, pkgs=None, **kwargs):
'''
Remove a package and all its dependencies which are not in use by other
packages.
name
The name of the package to be deleted.
Multiple Package Options:
pkgs
A list of packages to delete. Must be passed as a python list. The
... | [
"Remove",
"a",
"package",
"and",
"all",
"its",
"dependencies",
"which",
"are",
"not",
"in",
"use",
"by",
"other",
"packages",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgutil.py#L310-L351 | [
"def",
"remove",
"(",
"name",
"=",
"None",
",",
"pkgs",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"pkg_params",
"=",
"__salt__",
"[",
"'pkg_resource.parse_targets'",
"]",
"(",
"name",
",",
"pkgs",
")",
"[",
"0",
"]",
"except",
"Mini... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | monitored | Ensure a device is monitored. The 'name' given will be used for Zenoss device name and should be resolvable.
.. code-block:: yaml
enable_monitoring:
zenoss.monitored:
- name: web01.example.com
- device_class: /Servers/Linux
- collector: localhost
-... | salt/states/zenoss.py | def monitored(name, device_class=None, collector='localhost', prod_state=None):
'''
Ensure a device is monitored. The 'name' given will be used for Zenoss device name and should be resolvable.
.. code-block:: yaml
enable_monitoring:
zenoss.monitored:
- name: web01.example.com... | def monitored(name, device_class=None, collector='localhost', prod_state=None):
'''
Ensure a device is monitored. The 'name' given will be used for Zenoss device name and should be resolvable.
.. code-block:: yaml
enable_monitoring:
zenoss.monitored:
- name: web01.example.com... | [
"Ensure",
"a",
"device",
"is",
"monitored",
".",
"The",
"name",
"given",
"will",
"be",
"used",
"for",
"Zenoss",
"device",
"name",
"and",
"should",
"be",
"resolvable",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zenoss.py#L37-L92 | [
"def",
"monitored",
"(",
"name",
",",
"device_class",
"=",
"None",
",",
"collector",
"=",
"'localhost'",
",",
"prod_state",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"ret",
"[",
"'name'",
"]",
"=",
"name",
"# If device is already monitored, return early",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _find_volume | Find volume by name on minion | salt/states/docker_volume.py | def _find_volume(name):
'''
Find volume by name on minion
'''
docker_volumes = __salt__['docker.volumes']()['Volumes']
if docker_volumes:
volumes = [v for v in docker_volumes if v['Name'] == name]
if volumes:
return volumes[0]
return None | def _find_volume(name):
'''
Find volume by name on minion
'''
docker_volumes = __salt__['docker.volumes']()['Volumes']
if docker_volumes:
volumes = [v for v in docker_volumes if v['Name'] == name]
if volumes:
return volumes[0]
return None | [
"Find",
"volume",
"by",
"name",
"on",
"minion"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/docker_volume.py#L56-L66 | [
"def",
"_find_volume",
"(",
"name",
")",
":",
"docker_volumes",
"=",
"__salt__",
"[",
"'docker.volumes'",
"]",
"(",
")",
"[",
"'Volumes'",
"]",
"if",
"docker_volumes",
":",
"volumes",
"=",
"[",
"v",
"for",
"v",
"in",
"docker_volumes",
"if",
"v",
"[",
"'N... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | present | Ensure that a volume is present.
.. versionadded:: 2015.8.4
.. versionchanged:: 2015.8.6
This state no longer deletes and re-creates a volume if the existing
volume's driver does not match the ``driver`` parameter (unless the
``force`` parameter is set to ``True``).
.. versionchange... | salt/states/docker_volume.py | def present(name, driver=None, driver_opts=None, force=False):
'''
Ensure that a volume is present.
.. versionadded:: 2015.8.4
.. versionchanged:: 2015.8.6
This state no longer deletes and re-creates a volume if the existing
volume's driver does not match the ``driver`` parameter (unles... | def present(name, driver=None, driver_opts=None, force=False):
'''
Ensure that a volume is present.
.. versionadded:: 2015.8.4
.. versionchanged:: 2015.8.6
This state no longer deletes and re-creates a volume if the existing
volume's driver does not match the ``driver`` parameter (unles... | [
"Ensure",
"that",
"a",
"volume",
"is",
"present",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/docker_volume.py#L69-L192 | [
"def",
"present",
"(",
"name",
",",
"driver",
"=",
"None",
",",
"driver_opts",
"=",
"None",
",",
"force",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | absent | Ensure that a volume is absent.
.. versionadded:: 2015.8.4
.. versionchanged:: 2017.7.0
This state was renamed from **docker.volume_absent** to **docker_volume.absent**
name
Name of the volume
Usage Examples:
.. code-block:: yaml
volume_foo:
docker_volume.absen... | salt/states/docker_volume.py | def absent(name, driver=None):
'''
Ensure that a volume is absent.
.. versionadded:: 2015.8.4
.. versionchanged:: 2017.7.0
This state was renamed from **docker.volume_absent** to **docker_volume.absent**
name
Name of the volume
Usage Examples:
.. code-block:: yaml
... | def absent(name, driver=None):
'''
Ensure that a volume is absent.
.. versionadded:: 2015.8.4
.. versionchanged:: 2017.7.0
This state was renamed from **docker.volume_absent** to **docker_volume.absent**
name
Name of the volume
Usage Examples:
.. code-block:: yaml
... | [
"Ensure",
"that",
"a",
"volume",
"is",
"absent",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/docker_volume.py#L195-L231 | [
"def",
"absent",
"(",
"name",
",",
"driver",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
"volume",
"=",
"_find_volume",
"(",
"name"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _load | Generates a list of salt://<formula>/defaults.(json|yaml) files
and fetches them from the Salt master.
Returns first defaults file as python dict. | salt/modules/defaults.py | def _load(formula):
'''
Generates a list of salt://<formula>/defaults.(json|yaml) files
and fetches them from the Salt master.
Returns first defaults file as python dict.
'''
# Compute possibilities
_mk_client()
paths = []
for ext in ('yaml', 'json'):
source_url = salt.util... | def _load(formula):
'''
Generates a list of salt://<formula>/defaults.(json|yaml) files
and fetches them from the Salt master.
Returns first defaults file as python dict.
'''
# Compute possibilities
_mk_client()
paths = []
for ext in ('yaml', 'json'):
source_url = salt.util... | [
"Generates",
"a",
"list",
"of",
"salt",
":",
"//",
"<formula",
">",
"/",
"defaults",
".",
"(",
"json|yaml",
")",
"files",
"and",
"fetches",
"them",
"from",
"the",
"Salt",
"master",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/defaults.py#L34-L71 | [
"def",
"_load",
"(",
"formula",
")",
":",
"# Compute possibilities",
"_mk_client",
"(",
")",
"paths",
"=",
"[",
"]",
"for",
"ext",
"in",
"(",
"'yaml'",
",",
"'json'",
")",
":",
"source_url",
"=",
"salt",
".",
"utils",
".",
"url",
".",
"create",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get | defaults.get is used much like pillar.get except that it will read
a default value for a pillar from defaults.json or defaults.yaml
files that are stored in the root of a salt formula.
CLI Example:
.. code-block:: bash
salt '*' defaults.get core:users:root
The defaults is computed from p... | salt/modules/defaults.py | def get(key, default=''):
'''
defaults.get is used much like pillar.get except that it will read
a default value for a pillar from defaults.json or defaults.yaml
files that are stored in the root of a salt formula.
CLI Example:
.. code-block:: bash
salt '*' defaults.get core:users:roo... | def get(key, default=''):
'''
defaults.get is used much like pillar.get except that it will read
a default value for a pillar from defaults.json or defaults.yaml
files that are stored in the root of a salt formula.
CLI Example:
.. code-block:: bash
salt '*' defaults.get core:users:roo... | [
"defaults",
".",
"get",
"is",
"used",
"much",
"like",
"pillar",
".",
"get",
"except",
"that",
"it",
"will",
"read",
"a",
"default",
"value",
"for",
"a",
"pillar",
"from",
"defaults",
".",
"json",
"or",
"defaults",
".",
"yaml",
"files",
"that",
"are",
"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/defaults.py#L74-L106 | [
"def",
"get",
"(",
"key",
",",
"default",
"=",
"''",
")",
":",
"# Determine formula namespace from query",
"if",
"':'",
"in",
"key",
":",
"namespace",
",",
"key",
"=",
"key",
".",
"split",
"(",
"':'",
",",
"1",
")",
"else",
":",
"namespace",
",",
"key"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | merge | defaults.merge
Allows deep merging of dicts in formulas.
merge_lists : False
If True, it will also merge lists instead of replace their items.
in_place : True
If True, it will merge into dest dict,
if not it will make a new copy from that dict and return it.
CLI Exampl... | salt/modules/defaults.py | def merge(dest, src, merge_lists=False, in_place=True):
'''
defaults.merge
Allows deep merging of dicts in formulas.
merge_lists : False
If True, it will also merge lists instead of replace their items.
in_place : True
If True, it will merge into dest dict,
if not it wi... | def merge(dest, src, merge_lists=False, in_place=True):
'''
defaults.merge
Allows deep merging of dicts in formulas.
merge_lists : False
If True, it will also merge lists instead of replace their items.
in_place : True
If True, it will merge into dest dict,
if not it wi... | [
"defaults",
".",
"merge",
"Allows",
"deep",
"merging",
"of",
"dicts",
"in",
"formulas",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/defaults.py#L109-L133 | [
"def",
"merge",
"(",
"dest",
",",
"src",
",",
"merge_lists",
"=",
"False",
",",
"in_place",
"=",
"True",
")",
":",
"if",
"in_place",
":",
"merged",
"=",
"dest",
"else",
":",
"merged",
"=",
"copy",
".",
"deepcopy",
"(",
"dest",
")",
"return",
"dictupd... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | update | defaults.update
Allows to set defaults for group of data set e.g. group for nodes.
This function is a combination of defaults.merge
and defaults.deepcopy to avoid redundant in jinja.
Example:
.. code-block:: yaml
group01:
defaults:
en... | salt/modules/defaults.py | def update(dest, defaults, merge_lists=True, in_place=True):
'''
defaults.update
Allows to set defaults for group of data set e.g. group for nodes.
This function is a combination of defaults.merge
and defaults.deepcopy to avoid redundant in jinja.
Example:
.. code-bloc... | def update(dest, defaults, merge_lists=True, in_place=True):
'''
defaults.update
Allows to set defaults for group of data set e.g. group for nodes.
This function is a combination of defaults.merge
and defaults.deepcopy to avoid redundant in jinja.
Example:
.. code-bloc... | [
"defaults",
".",
"update",
"Allows",
"to",
"set",
"defaults",
"for",
"group",
"of",
"data",
"set",
"e",
".",
"g",
".",
"group",
"for",
"nodes",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/defaults.py#L150-L213 | [
"def",
"update",
"(",
"dest",
",",
"defaults",
",",
"merge_lists",
"=",
"True",
",",
"in_place",
"=",
"True",
")",
":",
"if",
"in_place",
":",
"nodes",
"=",
"dest",
"else",
":",
"nodes",
"=",
"deepcopy",
"(",
"dest",
")",
"for",
"node_name",
",",
"no... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_date_time_format | Copied from win_system.py (_get_date_time_format)
Function that detects the date/time format for the string passed.
:param str dt_string:
A date/time string
:return: The format of the passed dt_string
:rtype: str | salt/modules/win_task.py | def _get_date_time_format(dt_string):
'''
Copied from win_system.py (_get_date_time_format)
Function that detects the date/time format for the string passed.
:param str dt_string:
A date/time string
:return: The format of the passed dt_string
:rtype: str
'''
valid_formats = [
... | def _get_date_time_format(dt_string):
'''
Copied from win_system.py (_get_date_time_format)
Function that detects the date/time format for the string passed.
:param str dt_string:
A date/time string
:return: The format of the passed dt_string
:rtype: str
'''
valid_formats = [
... | [
"Copied",
"from",
"win_system",
".",
"py",
"(",
"_get_date_time_format",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L191-L221 | [
"def",
"_get_date_time_format",
"(",
"dt_string",
")",
":",
"valid_formats",
"=",
"[",
"'%I:%M:%S %p'",
",",
"'%I:%M %p'",
",",
"'%H:%M:%S'",
",",
"'%H:%M'",
",",
"'%Y-%m-%d'",
",",
"'%m-%d-%y'",
",",
"'%m-%d-%Y'",
",",
"'%m/%d/%y'",
",",
"'%m/%d/%Y'",
",",
"'%Y... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _reverse_lookup | Lookup the key in a dictionary by it's value. Will return the first match.
:param dict dictionary: The dictionary to search
:param str value: The value to search for.
:return: Returns the first key to match the value
:rtype: str | salt/modules/win_task.py | def _reverse_lookup(dictionary, value):
'''
Lookup the key in a dictionary by it's value. Will return the first match.
:param dict dictionary: The dictionary to search
:param str value: The value to search for.
:return: Returns the first key to match the value
:rtype: str
'''
value_in... | def _reverse_lookup(dictionary, value):
'''
Lookup the key in a dictionary by it's value. Will return the first match.
:param dict dictionary: The dictionary to search
:param str value: The value to search for.
:return: Returns the first key to match the value
:rtype: str
'''
value_in... | [
"Lookup",
"the",
"key",
"in",
"a",
"dictionary",
"by",
"it",
"s",
"value",
".",
"Will",
"return",
"the",
"first",
"match",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L241-L262 | [
"def",
"_reverse_lookup",
"(",
"dictionary",
",",
"value",
")",
":",
"value_index",
"=",
"-",
"1",
"for",
"idx",
",",
"dict_value",
"in",
"enumerate",
"(",
"dictionary",
".",
"values",
"(",
")",
")",
":",
"if",
"type",
"(",
"dict_value",
")",
"==",
"li... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _lookup_first | Lookup the first value given a key. Returns the first value if the key
refers to a list or the value itself.
:param dict dictionary: The dictionary to search
:param str key: The key to get
:return: Returns the first value available for the key
:rtype: str | salt/modules/win_task.py | def _lookup_first(dictionary, key):
'''
Lookup the first value given a key. Returns the first value if the key
refers to a list or the value itself.
:param dict dictionary: The dictionary to search
:param str key: The key to get
:return: Returns the first value available for the key
:rtyp... | def _lookup_first(dictionary, key):
'''
Lookup the first value given a key. Returns the first value if the key
refers to a list or the value itself.
:param dict dictionary: The dictionary to search
:param str key: The key to get
:return: Returns the first value available for the key
:rtyp... | [
"Lookup",
"the",
"first",
"value",
"given",
"a",
"key",
".",
"Returns",
"the",
"first",
"value",
"if",
"the",
"key",
"refers",
"to",
"a",
"list",
"or",
"the",
"value",
"itself",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L265-L281 | [
"def",
"_lookup_first",
"(",
"dictionary",
",",
"key",
")",
":",
"value",
"=",
"dictionary",
"[",
"key",
"]",
"if",
"type",
"(",
"value",
")",
"==",
"list",
":",
"return",
"value",
"[",
"0",
"]",
"else",
":",
"return",
"value"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _save_task_definition | Internal function to save the task definition.
:param str name: The name of the task.
:param str task_folder: The object representing the folder in which to save
the task
:param str task_definition: The object representing the task to be saved
:param str user_name: The user_account under which t... | salt/modules/win_task.py | def _save_task_definition(name,
task_folder,
task_definition,
user_name,
password,
logon_type):
'''
Internal function to save the task definition.
:param str name: The name of t... | def _save_task_definition(name,
task_folder,
task_definition,
user_name,
password,
logon_type):
'''
Internal function to save the task definition.
:param str name: The name of t... | [
"Internal",
"function",
"to",
"save",
"the",
"task",
"definition",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L284-L333 | [
"def",
"_save_task_definition",
"(",
"name",
",",
"task_folder",
",",
"task_definition",
",",
"user_name",
",",
"password",
",",
"logon_type",
")",
":",
"try",
":",
"task_folder",
".",
"RegisterTaskDefinition",
"(",
"name",
",",
"task_definition",
",",
"TASK_CREAT... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_tasks | r'''
List all tasks located in a specific location in the task scheduler.
:param str location: A string value representing the folder from which you
want to list tasks. Default is '\\' which is the root for the task
scheduler (C:\Windows\System32\tasks).
:return: Returns a list of tasks.
... | salt/modules/win_task.py | def list_tasks(location='\\'):
r'''
List all tasks located in a specific location in the task scheduler.
:param str location: A string value representing the folder from which you
want to list tasks. Default is '\\' which is the root for the task
scheduler (C:\Windows\System32\tasks).
... | def list_tasks(location='\\'):
r'''
List all tasks located in a specific location in the task scheduler.
:param str location: A string value representing the folder from which you
want to list tasks. Default is '\\' which is the root for the task
scheduler (C:\Windows\System32\tasks).
... | [
"r",
"List",
"all",
"tasks",
"located",
"in",
"a",
"specific",
"location",
"in",
"the",
"task",
"scheduler",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L336-L366 | [
"def",
"list_tasks",
"(",
"location",
"=",
"'\\\\'",
")",
":",
"# Create the task service object",
"with",
"salt",
".",
"utils",
".",
"winapi",
".",
"Com",
"(",
")",
":",
"task_service",
"=",
"win32com",
".",
"client",
".",
"Dispatch",
"(",
"\"Schedule.Service... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_folders | r'''
List all folders located in a specific location in the task scheduler.
:param str location: A string value representing the folder from which you
want to list tasks. Default is '\\' which is the root for the task
scheduler (C:\Windows\System32\tasks).
:return: Returns a list of folder... | salt/modules/win_task.py | def list_folders(location='\\'):
r'''
List all folders located in a specific location in the task scheduler.
:param str location: A string value representing the folder from which you
want to list tasks. Default is '\\' which is the root for the task
scheduler (C:\Windows\System32\tasks).
... | def list_folders(location='\\'):
r'''
List all folders located in a specific location in the task scheduler.
:param str location: A string value representing the folder from which you
want to list tasks. Default is '\\' which is the root for the task
scheduler (C:\Windows\System32\tasks).
... | [
"r",
"List",
"all",
"folders",
"located",
"in",
"a",
"specific",
"location",
"in",
"the",
"task",
"scheduler",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L369-L399 | [
"def",
"list_folders",
"(",
"location",
"=",
"'\\\\'",
")",
":",
"# Create the task service object",
"with",
"salt",
".",
"utils",
".",
"winapi",
".",
"Com",
"(",
")",
":",
"task_service",
"=",
"win32com",
".",
"client",
".",
"Dispatch",
"(",
"\"Schedule.Servi... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_triggers | r'''
List all triggers that pertain to a task in the specified location.
:param str name: The name of the task for which list triggers.
:param str location: A string value representing the location of the task
from which to list triggers. Default is '\\' which is the root for the
task sche... | salt/modules/win_task.py | def list_triggers(name, location='\\'):
r'''
List all triggers that pertain to a task in the specified location.
:param str name: The name of the task for which list triggers.
:param str location: A string value representing the location of the task
from which to list triggers. Default is '\\'... | def list_triggers(name, location='\\'):
r'''
List all triggers that pertain to a task in the specified location.
:param str name: The name of the task for which list triggers.
:param str location: A string value representing the location of the task
from which to list triggers. Default is '\\'... | [
"r",
"List",
"all",
"triggers",
"that",
"pertain",
"to",
"a",
"task",
"in",
"the",
"specified",
"location",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L402-L435 | [
"def",
"list_triggers",
"(",
"name",
",",
"location",
"=",
"'\\\\'",
")",
":",
"# Create the task service object",
"with",
"salt",
".",
"utils",
".",
"winapi",
".",
"Com",
"(",
")",
":",
"task_service",
"=",
"win32com",
".",
"client",
".",
"Dispatch",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_actions | r'''
List all actions that pertain to a task in the specified location.
:param str name: The name of the task for which list actions.
:param str location: A string value representing the location of the task
from which to list actions. Default is '\\' which is the root for the
task schedul... | salt/modules/win_task.py | def list_actions(name, location='\\'):
r'''
List all actions that pertain to a task in the specified location.
:param str name: The name of the task for which list actions.
:param str location: A string value representing the location of the task
from which to list actions. Default is '\\' whi... | def list_actions(name, location='\\'):
r'''
List all actions that pertain to a task in the specified location.
:param str name: The name of the task for which list actions.
:param str location: A string value representing the location of the task
from which to list actions. Default is '\\' whi... | [
"r",
"List",
"all",
"actions",
"that",
"pertain",
"to",
"a",
"task",
"in",
"the",
"specified",
"location",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L438-L471 | [
"def",
"list_actions",
"(",
"name",
",",
"location",
"=",
"'\\\\'",
")",
":",
"# Create the task service object",
"with",
"salt",
".",
"utils",
".",
"winapi",
".",
"Com",
"(",
")",
":",
"task_service",
"=",
"win32com",
".",
"client",
".",
"Dispatch",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_task | r'''
Create a new task in the designated location. This function has many keyword
arguments that are not listed here. For additional arguments see:
- :py:func:`edit_task`
- :py:func:`add_action`
- :py:func:`add_trigger`
:param str name: The name of the task. This will be displayed in the task
... | salt/modules/win_task.py | def create_task(name,
location='\\',
user_name='System',
password=None,
force=False,
**kwargs):
r'''
Create a new task in the designated location. This function has many keyword
arguments that are not listed here. For additional... | def create_task(name,
location='\\',
user_name='System',
password=None,
force=False,
**kwargs):
r'''
Create a new task in the designated location. This function has many keyword
arguments that are not listed here. For additional... | [
"r",
"Create",
"a",
"new",
"task",
"in",
"the",
"designated",
"location",
".",
"This",
"function",
"has",
"many",
"keyword",
"arguments",
"that",
"are",
"not",
"listed",
"here",
".",
"For",
"additional",
"arguments",
"see",
":"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L474-L554 | [
"def",
"create_task",
"(",
"name",
",",
"location",
"=",
"'\\\\'",
",",
"user_name",
"=",
"'System'",
",",
"password",
"=",
"None",
",",
"force",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# Check for existing task",
"if",
"name",
"in",
"list_tasks"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_task_from_xml | r'''
Create a task based on XML. Source can be a file or a string of XML.
:param str name: The name of the task. This will be displayed in the task
scheduler.
:param str location: A string value representing the location in which to
create the task. Default is '\\' which is the root for th... | salt/modules/win_task.py | def create_task_from_xml(name,
location='\\',
xml_text=None,
xml_path=None,
user_name='System',
password=None):
r'''
Create a task based on XML. Source can be a file or a string of XML.
... | def create_task_from_xml(name,
location='\\',
xml_text=None,
xml_path=None,
user_name='System',
password=None):
r'''
Create a task based on XML. Source can be a file or a string of XML.
... | [
"r",
"Create",
"a",
"task",
"based",
"on",
"XML",
".",
"Source",
"can",
"be",
"a",
"file",
"or",
"a",
"string",
"of",
"XML",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L557-L675 | [
"def",
"create_task_from_xml",
"(",
"name",
",",
"location",
"=",
"'\\\\'",
",",
"xml_text",
"=",
"None",
",",
"xml_path",
"=",
"None",
",",
"user_name",
"=",
"'System'",
",",
"password",
"=",
"None",
")",
":",
"# Check for existing task",
"if",
"name",
"in"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_folder | r'''
Create a folder in which to create tasks.
:param str name: The name of the folder. This will be displayed in the task
scheduler.
:param str location: A string value representing the location in which to
create the folder. Default is '\\' which is the root for the task
schedule... | salt/modules/win_task.py | def create_folder(name, location='\\'):
r'''
Create a folder in which to create tasks.
:param str name: The name of the folder. This will be displayed in the task
scheduler.
:param str location: A string value representing the location in which to
create the folder. Default is '\\' whi... | def create_folder(name, location='\\'):
r'''
Create a folder in which to create tasks.
:param str name: The name of the folder. This will be displayed in the task
scheduler.
:param str location: A string value representing the location in which to
create the folder. Default is '\\' whi... | [
"r",
"Create",
"a",
"folder",
"in",
"which",
"to",
"create",
"tasks",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L678-L716 | [
"def",
"create_folder",
"(",
"name",
",",
"location",
"=",
"'\\\\'",
")",
":",
"# Check for existing folder",
"if",
"name",
"in",
"list_folders",
"(",
"location",
")",
":",
"# Connect to an existing task definition",
"return",
"'{0} already exists'",
".",
"format",
"(... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | edit_task | r'''
Edit the parameters of a task. Triggers and Actions cannot be edited yet.
:param str name: The name of the task. This will be displayed in the task
scheduler.
:param str location: A string value representing the location in which to
create the task. Default is '\\' which is the root f... | salt/modules/win_task.py | def edit_task(name=None,
location='\\',
# General Tab
user_name=None,
password=None,
description=None,
enabled=None,
hidden=None,
# Conditions Tab
run_if_idle=None,
idle_duration=N... | def edit_task(name=None,
location='\\',
# General Tab
user_name=None,
password=None,
description=None,
enabled=None,
hidden=None,
# Conditions Tab
run_if_idle=None,
idle_duration=N... | [
"r",
"Edit",
"the",
"parameters",
"of",
"a",
"task",
".",
"Triggers",
"and",
"Actions",
"cannot",
"be",
"edited",
"yet",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L719-L1058 | [
"def",
"edit_task",
"(",
"name",
"=",
"None",
",",
"location",
"=",
"'\\\\'",
",",
"# General Tab",
"user_name",
"=",
"None",
",",
"password",
"=",
"None",
",",
"description",
"=",
"None",
",",
"enabled",
"=",
"None",
",",
"hidden",
"=",
"None",
",",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete_task | r'''
Delete a task from the task scheduler.
:param str name: The name of the task to delete.
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the task scheduler
(C:\Windows\System32\tasks).
:return: True if successful, Fa... | salt/modules/win_task.py | def delete_task(name, location='\\'):
r'''
Delete a task from the task scheduler.
:param str name: The name of the task to delete.
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the task scheduler
(C:\Windows\System32\ta... | def delete_task(name, location='\\'):
r'''
Delete a task from the task scheduler.
:param str name: The name of the task to delete.
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the task scheduler
(C:\Windows\System32\ta... | [
"r",
"Delete",
"a",
"task",
"from",
"the",
"task",
"scheduler",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L1061-L1098 | [
"def",
"delete_task",
"(",
"name",
",",
"location",
"=",
"'\\\\'",
")",
":",
"# Check for existing task",
"if",
"name",
"not",
"in",
"list_tasks",
"(",
"location",
")",
":",
"return",
"'{0} not found in {1}'",
".",
"format",
"(",
"name",
",",
"location",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | run | r'''
Run a scheduled task manually.
:param str name: The name of the task to run.
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the task scheduler
(C:\Windows\System32\tasks).
:return: True if successful, False if unsu... | salt/modules/win_task.py | def run(name, location='\\'):
r'''
Run a scheduled task manually.
:param str name: The name of the task to run.
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the task scheduler
(C:\Windows\System32\tasks).
:return:... | def run(name, location='\\'):
r'''
Run a scheduled task manually.
:param str name: The name of the task to run.
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the task scheduler
(C:\Windows\System32\tasks).
:return:... | [
"r",
"Run",
"a",
"scheduled",
"task",
"manually",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L1142-L1178 | [
"def",
"run",
"(",
"name",
",",
"location",
"=",
"'\\\\'",
")",
":",
"# Check for existing folder",
"if",
"name",
"not",
"in",
"list_tasks",
"(",
"location",
")",
":",
"return",
"'{0} not found in {1}'",
".",
"format",
"(",
"name",
",",
"location",
")",
"# c... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | run_wait | r'''
Run a scheduled task and return when the task finishes
:param str name: The name of the task to run.
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the task scheduler
(C:\Windows\System32\tasks).
:return: True if s... | salt/modules/win_task.py | def run_wait(name, location='\\'):
r'''
Run a scheduled task and return when the task finishes
:param str name: The name of the task to run.
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the task scheduler
(C:\Windows\S... | def run_wait(name, location='\\'):
r'''
Run a scheduled task and return when the task finishes
:param str name: The name of the task to run.
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the task scheduler
(C:\Windows\S... | [
"r",
"Run",
"a",
"scheduled",
"task",
"and",
"return",
"when",
"the",
"task",
"finishes"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L1181-L1235 | [
"def",
"run_wait",
"(",
"name",
",",
"location",
"=",
"'\\\\'",
")",
":",
"# Check for existing folder",
"if",
"name",
"not",
"in",
"list_tasks",
"(",
"location",
")",
":",
"return",
"'{0} not found in {1}'",
".",
"format",
"(",
"name",
",",
"location",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | status | r'''
Determine the status of a task. Is it Running, Queued, Ready, etc.
:param str name: The name of the task for which to return the status
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the task scheduler
(C:\Windows\Syste... | salt/modules/win_task.py | def status(name, location='\\'):
r'''
Determine the status of a task. Is it Running, Queued, Ready, etc.
:param str name: The name of the task for which to return the status
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the tas... | def status(name, location='\\'):
r'''
Determine the status of a task. Is it Running, Queued, Ready, etc.
:param str name: The name of the task for which to return the status
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the tas... | [
"r",
"Determine",
"the",
"status",
"of",
"a",
"task",
".",
"Is",
"it",
"Running",
"Queued",
"Ready",
"etc",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L1277-L1316 | [
"def",
"status",
"(",
"name",
",",
"location",
"=",
"'\\\\'",
")",
":",
"# Check for existing folder",
"if",
"name",
"not",
"in",
"list_tasks",
"(",
"location",
")",
":",
"return",
"'{0} not found in {1}'",
".",
"format",
"(",
"name",
",",
"location",
")",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | info | r'''
Get the details about a task in the task scheduler.
:param str name: The name of the task for which to return the status
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the task scheduler
(C:\Windows\System32\tasks).
... | salt/modules/win_task.py | def info(name, location='\\'):
r'''
Get the details about a task in the task scheduler.
:param str name: The name of the task for which to return the status
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the task scheduler
... | def info(name, location='\\'):
r'''
Get the details about a task in the task scheduler.
:param str name: The name of the task for which to return the status
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the task scheduler
... | [
"r",
"Get",
"the",
"details",
"about",
"a",
"task",
"in",
"the",
"task",
"scheduler",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L1319-L1451 | [
"def",
"info",
"(",
"name",
",",
"location",
"=",
"'\\\\'",
")",
":",
"# Check for existing folder",
"if",
"name",
"not",
"in",
"list_tasks",
"(",
"location",
")",
":",
"return",
"'{0} not found in {1}'",
".",
"format",
"(",
"name",
",",
"location",
")",
"# ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | add_action | r'''
Add an action to a task.
:param str name: The name of the task to which to add the action.
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the task scheduler
(C:\Windows\System32\tasks).
:param str action_type: The ... | salt/modules/win_task.py | def add_action(name=None,
location='\\',
action_type='Execute',
**kwargs):
r'''
Add an action to a task.
:param str name: The name of the task to which to add the action.
:param str location: A string value representing the location of the task.
Def... | def add_action(name=None,
location='\\',
action_type='Execute',
**kwargs):
r'''
Add an action to a task.
:param str name: The name of the task to which to add the action.
:param str location: A string value representing the location of the task.
Def... | [
"r",
"Add",
"an",
"action",
"to",
"a",
"task",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L1454-L1619 | [
"def",
"add_action",
"(",
"name",
"=",
"None",
",",
"location",
"=",
"'\\\\'",
",",
"action_type",
"=",
"'Execute'",
",",
"*",
"*",
"kwargs",
")",
":",
"save_definition",
"=",
"False",
"if",
"kwargs",
".",
"get",
"(",
"'task_definition'",
",",
"False",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | add_trigger | r'''
:param str name: The name of the task to which to add the trigger.
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the task scheduler
(C:\Windows\System32\tasks).
:param str trigger_type: The type of trigger to create. T... | salt/modules/win_task.py | def add_trigger(name=None,
location='\\',
trigger_type=None,
trigger_enabled=True,
start_date=None,
start_time=None,
end_date=None,
end_time=None,
random_delay=None,
repeat_int... | def add_trigger(name=None,
location='\\',
trigger_type=None,
trigger_enabled=True,
start_date=None,
start_time=None,
end_date=None,
end_time=None,
random_delay=None,
repeat_int... | [
"r",
":",
"param",
"str",
"name",
":",
"The",
"name",
"of",
"the",
"task",
"to",
"which",
"to",
"add",
"the",
"trigger",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L1666-L2202 | [
"def",
"add_trigger",
"(",
"name",
"=",
"None",
",",
"location",
"=",
"'\\\\'",
",",
"trigger_type",
"=",
"None",
",",
"trigger_enabled",
"=",
"True",
",",
"start_date",
"=",
"None",
",",
"start_time",
"=",
"None",
",",
"end_date",
"=",
"None",
",",
"end... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.