repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/utils/listdiffer.py | ListDictDiffer.changes_str | def changes_str(self):
'''Returns a string describing the changes'''
changes = ''
for item in self._get_recursive_difference(type='intersect'):
if item.diffs:
changes = ''.join([changes,
# Tabulate comment deeper, show the key attrib... | python | def changes_str(self):
'''Returns a string describing the changes'''
changes = ''
for item in self._get_recursive_difference(type='intersect'):
if item.diffs:
changes = ''.join([changes,
# Tabulate comment deeper, show the key attrib... | [
"def",
"changes_str",
"(",
"self",
")",
":",
"changes",
"=",
"''",
"for",
"item",
"in",
"self",
".",
"_get_recursive_difference",
"(",
"type",
"=",
"'intersect'",
")",
":",
"if",
"item",
".",
"diffs",
":",
"changes",
"=",
"''",
".",
"join",
"(",
"[",
... | Returns a string describing the changes | [
"Returns",
"a",
"string",
"describing",
"the",
"changes"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/listdiffer.py#L131-L158 | train |
saltstack/salt | salt/utils/listdiffer.py | ListDictDiffer.changes_str2 | def changes_str2(self, tab_string=' '):
'''
Returns a string in a more compact format describing the changes.
The output better alligns with the one in recursive_diff.
'''
changes = []
for item in self._get_recursive_difference(type='intersect'):
if item.dif... | python | def changes_str2(self, tab_string=' '):
'''
Returns a string in a more compact format describing the changes.
The output better alligns with the one in recursive_diff.
'''
changes = []
for item in self._get_recursive_difference(type='intersect'):
if item.dif... | [
"def",
"changes_str2",
"(",
"self",
",",
"tab_string",
"=",
"' '",
")",
":",
"changes",
"=",
"[",
"]",
"for",
"item",
"in",
"self",
".",
"_get_recursive_difference",
"(",
"type",
"=",
"'intersect'",
")",
":",
"if",
"item",
".",
"diffs",
":",
"changes",
... | Returns a string in a more compact format describing the changes.
The output better alligns with the one in recursive_diff. | [
"Returns",
"a",
"string",
"in",
"a",
"more",
"compact",
"format",
"describing",
"the",
"changes",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/listdiffer.py#L161-L185 | train |
saltstack/salt | salt/utils/listdiffer.py | ListDictDiffer.new_values | def new_values(self):
'''Returns the new values from the diff'''
def get_new_values_and_key(item):
values = item.new_values
if item.past_dict:
values.update({self._key: item.past_dict[self._key]})
else:
# This is a new item as it has no... | python | def new_values(self):
'''Returns the new values from the diff'''
def get_new_values_and_key(item):
values = item.new_values
if item.past_dict:
values.update({self._key: item.past_dict[self._key]})
else:
# This is a new item as it has no... | [
"def",
"new_values",
"(",
"self",
")",
":",
"def",
"get_new_values_and_key",
"(",
"item",
")",
":",
"values",
"=",
"item",
".",
"new_values",
"if",
"item",
".",
"past_dict",
":",
"values",
".",
"update",
"(",
"{",
"self",
".",
"_key",
":",
"item",
".",... | Returns the new values from the diff | [
"Returns",
"the",
"new",
"values",
"from",
"the",
"diff"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/listdiffer.py#L188-L201 | train |
saltstack/salt | salt/utils/listdiffer.py | ListDictDiffer.old_values | def old_values(self):
'''Returns the old values from the diff'''
def get_old_values_and_key(item):
values = item.old_values
values.update({self._key: item.past_dict[self._key]})
return values
return [get_old_values_and_key(el)
for el in self._... | python | def old_values(self):
'''Returns the old values from the diff'''
def get_old_values_and_key(item):
values = item.old_values
values.update({self._key: item.past_dict[self._key]})
return values
return [get_old_values_and_key(el)
for el in self._... | [
"def",
"old_values",
"(",
"self",
")",
":",
"def",
"get_old_values_and_key",
"(",
"item",
")",
":",
"values",
"=",
"item",
".",
"old_values",
"values",
".",
"update",
"(",
"{",
"self",
".",
"_key",
":",
"item",
".",
"past_dict",
"[",
"self",
".",
"_key... | Returns the old values from the diff | [
"Returns",
"the",
"old",
"values",
"from",
"the",
"diff"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/listdiffer.py#L204-L213 | train |
saltstack/salt | salt/utils/listdiffer.py | ListDictDiffer.changed | def changed(self, selection='all'):
'''
Returns the list of changed values.
The key is added to each item.
selection
Specifies the desired changes.
Supported values are
``all`` - all changed items are included in the output
``inter... | python | def changed(self, selection='all'):
'''
Returns the list of changed values.
The key is added to each item.
selection
Specifies the desired changes.
Supported values are
``all`` - all changed items are included in the output
``inter... | [
"def",
"changed",
"(",
"self",
",",
"selection",
"=",
"'all'",
")",
":",
"changed",
"=",
"[",
"]",
"if",
"selection",
"==",
"'all'",
":",
"for",
"recursive_item",
"in",
"self",
".",
"_get_recursive_difference",
"(",
"type",
"=",
"'all'",
")",
":",
"# We ... | Returns the list of changed values.
The key is added to each item.
selection
Specifies the desired changes.
Supported values are
``all`` - all changed items are included in the output
``intersect`` - changed items present in both lists are include... | [
"Returns",
"the",
"list",
"of",
"changed",
"values",
".",
"The",
"key",
"is",
"added",
"to",
"each",
"item",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/listdiffer.py#L215-L250 | train |
saltstack/salt | salt/runners/salt.py | cmd | def cmd(fun, *args, **kwargs):
'''
.. versionchanged:: 2018.3.0
Added ``with_pillar`` argument
Execute ``fun`` with the given ``args`` and ``kwargs``. Parameter ``fun``
should be the string :ref:`name <all-salt.modules>` of the execution module
to call.
.. note::
Execution mod... | python | def cmd(fun, *args, **kwargs):
'''
.. versionchanged:: 2018.3.0
Added ``with_pillar`` argument
Execute ``fun`` with the given ``args`` and ``kwargs``. Parameter ``fun``
should be the string :ref:`name <all-salt.modules>` of the execution module
to call.
.. note::
Execution mod... | [
"def",
"cmd",
"(",
"fun",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"log",
".",
"debug",
"(",
"'Called salt.cmd runner with minion function %s'",
",",
"fun",
")",
"kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",... | .. versionchanged:: 2018.3.0
Added ``with_pillar`` argument
Execute ``fun`` with the given ``args`` and ``kwargs``. Parameter ``fun``
should be the string :ref:`name <all-salt.modules>` of the execution module
to call.
.. note::
Execution modules will be loaded *every time* this funct... | [
"..",
"versionchanged",
"::",
"2018",
".",
"3",
".",
"0",
"Added",
"with_pillar",
"argument"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/salt.py#L48-L114 | train |
saltstack/salt | salt/runners/salt.py | execute | def execute(tgt,
fun,
arg=(),
timeout=None,
tgt_type='glob',
ret='',
jid='',
kwarg=None,
**kwargs):
'''
.. versionadded:: 2017.7.0
Execute ``fun`` on all minions matched by ``tgt`` and ``tgt_type``.
Paramete... | python | def execute(tgt,
fun,
arg=(),
timeout=None,
tgt_type='glob',
ret='',
jid='',
kwarg=None,
**kwargs):
'''
.. versionadded:: 2017.7.0
Execute ``fun`` on all minions matched by ``tgt`` and ``tgt_type``.
Paramete... | [
"def",
"execute",
"(",
"tgt",
",",
"fun",
",",
"arg",
"=",
"(",
")",
",",
"timeout",
"=",
"None",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"jid",
"=",
"''",
",",
"kwarg",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"cli... | .. versionadded:: 2017.7.0
Execute ``fun`` on all minions matched by ``tgt`` and ``tgt_type``.
Parameter ``fun`` is the name of execution module function to call.
This function should mainly be used as a helper for runner modules,
in order to avoid redundant code.
For example, when inside a runner... | [
"..",
"versionadded",
"::",
"2017",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/salt.py#L117-L172 | train |
saltstack/salt | salt/modules/win_file.py | _resolve_symlink | def _resolve_symlink(path, max_depth=64):
'''
Resolves the given symlink path to its real path, up to a maximum of the
`max_depth` parameter which defaults to 64.
If the path is not a symlink path, it is simply returned.
'''
if sys.getwindowsversion().major < 6:
raise SaltInvocationErro... | python | def _resolve_symlink(path, max_depth=64):
'''
Resolves the given symlink path to its real path, up to a maximum of the
`max_depth` parameter which defaults to 64.
If the path is not a symlink path, it is simply returned.
'''
if sys.getwindowsversion().major < 6:
raise SaltInvocationErro... | [
"def",
"_resolve_symlink",
"(",
"path",
",",
"max_depth",
"=",
"64",
")",
":",
"if",
"sys",
".",
"getwindowsversion",
"(",
")",
".",
"major",
"<",
"6",
":",
"raise",
"SaltInvocationError",
"(",
"'Symlinks are only supported on Windows Vista or later.'",
")",
"# ma... | Resolves the given symlink path to its real path, up to a maximum of the
`max_depth` parameter which defaults to 64.
If the path is not a symlink path, it is simply returned. | [
"Resolves",
"the",
"given",
"symlink",
"path",
"to",
"its",
"real",
"path",
"up",
"to",
"a",
"maximum",
"of",
"the",
"max_depth",
"parameter",
"which",
"defaults",
"to",
"64",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L214-L236 | train |
saltstack/salt | salt/modules/win_file.py | gid_to_group | def gid_to_group(gid):
'''
Convert the group id to the group name on this system
Under Windows, because groups are just another ACL entity, this function
behaves the same as uid_to_user.
For maintaining Windows systems, this function is superfluous and only
exists for API compatibility with Un... | python | def gid_to_group(gid):
'''
Convert the group id to the group name on this system
Under Windows, because groups are just another ACL entity, this function
behaves the same as uid_to_user.
For maintaining Windows systems, this function is superfluous and only
exists for API compatibility with Un... | [
"def",
"gid_to_group",
"(",
"gid",
")",
":",
"func_name",
"=",
"'{0}.gid_to_group'",
".",
"format",
"(",
"__virtualname__",
")",
"if",
"__opts__",
".",
"get",
"(",
"'fun'",
",",
"''",
")",
"==",
"func_name",
":",
"log",
".",
"info",
"(",
"'The function %s ... | Convert the group id to the group name on this system
Under Windows, because groups are just another ACL entity, this function
behaves the same as uid_to_user.
For maintaining Windows systems, this function is superfluous and only
exists for API compatibility with Unix. Use the uid_to_user function
... | [
"Convert",
"the",
"group",
"id",
"to",
"the",
"group",
"name",
"on",
"this",
"system"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L239-L268 | train |
saltstack/salt | salt/modules/win_file.py | group_to_gid | def group_to_gid(group):
'''
Convert the group to the gid on this system
Under Windows, because groups are just another ACL entity, this function
behaves the same as user_to_uid, except if None is given, '' is returned.
For maintaining Windows systems, this function is superfluous and only
exi... | python | def group_to_gid(group):
'''
Convert the group to the gid on this system
Under Windows, because groups are just another ACL entity, this function
behaves the same as user_to_uid, except if None is given, '' is returned.
For maintaining Windows systems, this function is superfluous and only
exi... | [
"def",
"group_to_gid",
"(",
"group",
")",
":",
"func_name",
"=",
"'{0}.group_to_gid'",
".",
"format",
"(",
"__virtualname__",
")",
"if",
"__opts__",
".",
"get",
"(",
"'fun'",
",",
"''",
")",
"==",
"func_name",
":",
"log",
".",
"info",
"(",
"'The function %... | Convert the group to the gid on this system
Under Windows, because groups are just another ACL entity, this function
behaves the same as user_to_uid, except if None is given, '' is returned.
For maintaining Windows systems, this function is superfluous and only
exists for API compatibility with Unix. ... | [
"Convert",
"the",
"group",
"to",
"the",
"gid",
"on",
"this",
"system"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L271-L303 | train |
saltstack/salt | salt/modules/win_file.py | get_pgid | def get_pgid(path, follow_symlinks=True):
'''
Return the id of the primary group that owns a given file (Windows only)
This function will return the rarely used primary group of a file. This
generally has no bearing on permissions unless intentionally configured
and is most commonly used to provide... | python | def get_pgid(path, follow_symlinks=True):
'''
Return the id of the primary group that owns a given file (Windows only)
This function will return the rarely used primary group of a file. This
generally has no bearing on permissions unless intentionally configured
and is most commonly used to provide... | [
"def",
"get_pgid",
"(",
"path",
",",
"follow_symlinks",
"=",
"True",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"raise",
"CommandExecutionError",
"(",
"'Path not found: {0}'",
".",
"format",
"(",
"path",
")",
")",
"# ... | Return the id of the primary group that owns a given file (Windows only)
This function will return the rarely used primary group of a file. This
generally has no bearing on permissions unless intentionally configured
and is most commonly used to provide Unix compatibility (e.g. Services
For Unix, NFS s... | [
"Return",
"the",
"id",
"of",
"the",
"primary",
"group",
"that",
"owns",
"a",
"given",
"file",
"(",
"Windows",
"only",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L306-L345 | train |
saltstack/salt | salt/modules/win_file.py | get_gid | def get_gid(path, follow_symlinks=True):
'''
Return the id of the group that owns a given file
Under Windows, this will return the uid of the file.
While a file in Windows does have a 'primary group', this rarely used
attribute generally has no bearing on permissions unless intentionally
confi... | python | def get_gid(path, follow_symlinks=True):
'''
Return the id of the group that owns a given file
Under Windows, this will return the uid of the file.
While a file in Windows does have a 'primary group', this rarely used
attribute generally has no bearing on permissions unless intentionally
confi... | [
"def",
"get_gid",
"(",
"path",
",",
"follow_symlinks",
"=",
"True",
")",
":",
"func_name",
"=",
"'{0}.get_gid'",
".",
"format",
"(",
"__virtualname__",
")",
"if",
"__opts__",
".",
"get",
"(",
"'fun'",
",",
"''",
")",
"==",
"func_name",
":",
"log",
".",
... | Return the id of the group that owns a given file
Under Windows, this will return the uid of the file.
While a file in Windows does have a 'primary group', this rarely used
attribute generally has no bearing on permissions unless intentionally
configured and is only used to support Unix compatibility ... | [
"Return",
"the",
"id",
"of",
"the",
"group",
"that",
"owns",
"a",
"given",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L383-L424 | train |
saltstack/salt | salt/modules/win_file.py | get_group | def get_group(path, follow_symlinks=True):
'''
Return the group that owns a given file
Under Windows, this will return the user (owner) of the file.
While a file in Windows does have a 'primary group', this rarely used
attribute generally has no bearing on permissions unless intentionally
conf... | python | def get_group(path, follow_symlinks=True):
'''
Return the group that owns a given file
Under Windows, this will return the user (owner) of the file.
While a file in Windows does have a 'primary group', this rarely used
attribute generally has no bearing on permissions unless intentionally
conf... | [
"def",
"get_group",
"(",
"path",
",",
"follow_symlinks",
"=",
"True",
")",
":",
"func_name",
"=",
"'{0}.get_group'",
".",
"format",
"(",
"__virtualname__",
")",
"if",
"__opts__",
".",
"get",
"(",
"'fun'",
",",
"''",
")",
"==",
"func_name",
":",
"log",
".... | Return the group that owns a given file
Under Windows, this will return the user (owner) of the file.
While a file in Windows does have a 'primary group', this rarely used
attribute generally has no bearing on permissions unless intentionally
configured and is only used to support Unix compatibility f... | [
"Return",
"the",
"group",
"that",
"owns",
"a",
"given",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L427-L468 | train |
saltstack/salt | salt/modules/win_file.py | user_to_uid | def user_to_uid(user):
'''
Convert user name to a uid
Args:
user (str): The user to lookup
Returns:
str: The user id of the user
CLI Example:
.. code-block:: bash
salt '*' file.user_to_uid myusername
'''
if user is None:
user = salt.utils.user.get_use... | python | def user_to_uid(user):
'''
Convert user name to a uid
Args:
user (str): The user to lookup
Returns:
str: The user id of the user
CLI Example:
.. code-block:: bash
salt '*' file.user_to_uid myusername
'''
if user is None:
user = salt.utils.user.get_use... | [
"def",
"user_to_uid",
"(",
"user",
")",
":",
"if",
"user",
"is",
"None",
":",
"user",
"=",
"salt",
".",
"utils",
".",
"user",
".",
"get_user",
"(",
")",
"return",
"salt",
".",
"utils",
".",
"win_dacl",
".",
"get_sid_string",
"(",
"user",
")"
] | Convert user name to a uid
Args:
user (str): The user to lookup
Returns:
str: The user id of the user
CLI Example:
.. code-block:: bash
salt '*' file.user_to_uid myusername | [
"Convert",
"user",
"name",
"to",
"a",
"uid"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L493-L512 | train |
saltstack/salt | salt/modules/win_file.py | get_uid | def get_uid(path, follow_symlinks=True):
'''
Return the id of the user that owns a given file
Symlinks are followed by default to mimic Unix behavior. Specify
`follow_symlinks=False` to turn off this behavior.
Args:
path (str): The path to the file or directory
follow_symlinks (bo... | python | def get_uid(path, follow_symlinks=True):
'''
Return the id of the user that owns a given file
Symlinks are followed by default to mimic Unix behavior. Specify
`follow_symlinks=False` to turn off this behavior.
Args:
path (str): The path to the file or directory
follow_symlinks (bo... | [
"def",
"get_uid",
"(",
"path",
",",
"follow_symlinks",
"=",
"True",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"raise",
"CommandExecutionError",
"(",
"'Path not found: {0}'",
".",
"format",
"(",
"path",
")",
")",
"# U... | Return the id of the user that owns a given file
Symlinks are followed by default to mimic Unix behavior. Specify
`follow_symlinks=False` to turn off this behavior.
Args:
path (str): The path to the file or directory
follow_symlinks (bool):
If the object specified by ``path`` ... | [
"Return",
"the",
"id",
"of",
"the",
"user",
"that",
"owns",
"a",
"given",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L515-L552 | train |
saltstack/salt | salt/modules/win_file.py | get_user | def get_user(path, follow_symlinks=True):
'''
Return the user that owns a given file
Symlinks are followed by default to mimic Unix behavior. Specify
`follow_symlinks=False` to turn off this behavior.
Args:
path (str): The path to the file or directory
follow_symlinks (bool):
... | python | def get_user(path, follow_symlinks=True):
'''
Return the user that owns a given file
Symlinks are followed by default to mimic Unix behavior. Specify
`follow_symlinks=False` to turn off this behavior.
Args:
path (str): The path to the file or directory
follow_symlinks (bool):
... | [
"def",
"get_user",
"(",
"path",
",",
"follow_symlinks",
"=",
"True",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"raise",
"CommandExecutionError",
"(",
"'Path not found: {0}'",
".",
"format",
"(",
"path",
")",
")",
"# ... | Return the user that owns a given file
Symlinks are followed by default to mimic Unix behavior. Specify
`follow_symlinks=False` to turn off this behavior.
Args:
path (str): The path to the file or directory
follow_symlinks (bool):
If the object specified by ``path`` is a symli... | [
"Return",
"the",
"user",
"that",
"owns",
"a",
"given",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L555-L591 | train |
saltstack/salt | salt/modules/win_file.py | get_mode | def get_mode(path):
'''
Return the mode of a file
Right now we're just returning None because Windows' doesn't have a mode
like Linux
Args:
path (str): The path to the file or directory
Returns:
None
CLI Example:
.. code-block:: bash
salt '*' file.get_mode /... | python | def get_mode(path):
'''
Return the mode of a file
Right now we're just returning None because Windows' doesn't have a mode
like Linux
Args:
path (str): The path to the file or directory
Returns:
None
CLI Example:
.. code-block:: bash
salt '*' file.get_mode /... | [
"def",
"get_mode",
"(",
"path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"raise",
"CommandExecutionError",
"(",
"'Path not found: {0}'",
".",
"format",
"(",
"path",
")",
")",
"func_name",
"=",
"'{0}.get_mode'",
".",
... | Return the mode of a file
Right now we're just returning None because Windows' doesn't have a mode
like Linux
Args:
path (str): The path to the file or directory
Returns:
None
CLI Example:
.. code-block:: bash
salt '*' file.get_mode /etc/passwd | [
"Return",
"the",
"mode",
"of",
"a",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L594-L622 | train |
saltstack/salt | salt/modules/win_file.py | lchown | def lchown(path, user, group=None, pgroup=None):
'''
Chown a file, pass the file the desired user and group without following any
symlinks.
Under Windows, the group parameter will be ignored.
This is because while files in Windows do have a 'primary group'
property, this is rarely used. It ge... | python | def lchown(path, user, group=None, pgroup=None):
'''
Chown a file, pass the file the desired user and group without following any
symlinks.
Under Windows, the group parameter will be ignored.
This is because while files in Windows do have a 'primary group'
property, this is rarely used. It ge... | [
"def",
"lchown",
"(",
"path",
",",
"user",
",",
"group",
"=",
"None",
",",
"pgroup",
"=",
"None",
")",
":",
"if",
"group",
":",
"func_name",
"=",
"'{0}.lchown'",
".",
"format",
"(",
"__virtualname__",
")",
"if",
"__opts__",
".",
"get",
"(",
"'fun'",
... | Chown a file, pass the file the desired user and group without following any
symlinks.
Under Windows, the group parameter will be ignored.
This is because while files in Windows do have a 'primary group'
property, this is rarely used. It generally has no bearing on
permissions unless intentionall... | [
"Chown",
"a",
"file",
"pass",
"the",
"file",
"the",
"desired",
"user",
"and",
"group",
"without",
"following",
"any",
"symlinks",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L625-L671 | train |
saltstack/salt | salt/modules/win_file.py | chown | def chown(path, user, group=None, pgroup=None, follow_symlinks=True):
'''
Chown a file, pass the file the desired user and group
Under Windows, the group parameter will be ignored.
This is because while files in Windows do have a 'primary group'
property, this is rarely used. It generally has no ... | python | def chown(path, user, group=None, pgroup=None, follow_symlinks=True):
'''
Chown a file, pass the file the desired user and group
Under Windows, the group parameter will be ignored.
This is because while files in Windows do have a 'primary group'
property, this is rarely used. It generally has no ... | [
"def",
"chown",
"(",
"path",
",",
"user",
",",
"group",
"=",
"None",
",",
"pgroup",
"=",
"None",
",",
"follow_symlinks",
"=",
"True",
")",
":",
"# the group parameter is not used; only provided for API compatibility",
"if",
"group",
"is",
"not",
"None",
":",
"fu... | Chown a file, pass the file the desired user and group
Under Windows, the group parameter will be ignored.
This is because while files in Windows do have a 'primary group'
property, this is rarely used. It generally has no bearing on
permissions unless intentionally configured and is most commonly us... | [
"Chown",
"a",
"file",
"pass",
"the",
"file",
"the",
"desired",
"user",
"and",
"group"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L674-L728 | train |
saltstack/salt | salt/modules/win_file.py | chgrp | def chgrp(path, group):
'''
Change the group of a file
Under Windows, this will do nothing.
While a file in Windows does have a 'primary group', this rarely used
attribute generally has no bearing on permissions unless intentionally
configured and is only used to support Unix compatibility fea... | python | def chgrp(path, group):
'''
Change the group of a file
Under Windows, this will do nothing.
While a file in Windows does have a 'primary group', this rarely used
attribute generally has no bearing on permissions unless intentionally
configured and is only used to support Unix compatibility fea... | [
"def",
"chgrp",
"(",
"path",
",",
"group",
")",
":",
"func_name",
"=",
"'{0}.chgrp'",
".",
"format",
"(",
"__virtualname__",
")",
"if",
"__opts__",
".",
"get",
"(",
"'fun'",
",",
"''",
")",
"==",
"func_name",
":",
"log",
".",
"info",
"(",
"'The functio... | Change the group of a file
Under Windows, this will do nothing.
While a file in Windows does have a 'primary group', this rarely used
attribute generally has no bearing on permissions unless intentionally
configured and is only used to support Unix compatibility features (e.g.
Services For Unix, N... | [
"Change",
"the",
"group",
"of",
"a",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L759-L799 | train |
saltstack/salt | salt/modules/win_file.py | stats | def stats(path, hash_type='sha256', follow_symlinks=True):
'''
Return a dict containing the stats about a given file
Under Windows, `gid` will equal `uid` and `group` will equal `user`.
While a file in Windows does have a 'primary group', this rarely used
attribute generally has no bearing on perm... | python | def stats(path, hash_type='sha256', follow_symlinks=True):
'''
Return a dict containing the stats about a given file
Under Windows, `gid` will equal `uid` and `group` will equal `user`.
While a file in Windows does have a 'primary group', this rarely used
attribute generally has no bearing on perm... | [
"def",
"stats",
"(",
"path",
",",
"hash_type",
"=",
"'sha256'",
",",
"follow_symlinks",
"=",
"True",
")",
":",
"# This is to mirror the behavior of file.py. `check_file_meta` expects an",
"# empty dictionary when the file does not exist",
"if",
"not",
"os",
".",
"path",
"."... | Return a dict containing the stats about a given file
Under Windows, `gid` will equal `uid` and `group` will equal `user`.
While a file in Windows does have a 'primary group', this rarely used
attribute generally has no bearing on permissions unless intentionally
configured and is only used to support... | [
"Return",
"a",
"dict",
"containing",
"the",
"stats",
"about",
"a",
"given",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L802-L876 | train |
saltstack/salt | salt/modules/win_file.py | get_attributes | def get_attributes(path):
'''
Return a dictionary object with the Windows
file attributes for a file.
Args:
path (str): The path to the file or directory
Returns:
dict: A dictionary of file attributes
CLI Example:
.. code-block:: bash
salt '*' file.get_attributes... | python | def get_attributes(path):
'''
Return a dictionary object with the Windows
file attributes for a file.
Args:
path (str): The path to the file or directory
Returns:
dict: A dictionary of file attributes
CLI Example:
.. code-block:: bash
salt '*' file.get_attributes... | [
"def",
"get_attributes",
"(",
"path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"raise",
"CommandExecutionError",
"(",
"'Path not found: {0}'",
".",
"format",
"(",
"path",
")",
")",
"# set up dictionary for attribute values"... | Return a dictionary object with the Windows
file attributes for a file.
Args:
path (str): The path to the file or directory
Returns:
dict: A dictionary of file attributes
CLI Example:
.. code-block:: bash
salt '*' file.get_attributes c:\\temp\\a.txt | [
"Return",
"a",
"dictionary",
"object",
"with",
"the",
"Windows",
"file",
"attributes",
"for",
"a",
"file",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L879-L939 | train |
saltstack/salt | salt/modules/win_file.py | set_attributes | def set_attributes(path, archive=None, hidden=None, normal=None,
notIndexed=None, readonly=None, system=None, temporary=None):
'''
Set file attributes for a file. Note that the normal attribute
means that all others are false. So setting it will clear all others.
Args:
path... | python | def set_attributes(path, archive=None, hidden=None, normal=None,
notIndexed=None, readonly=None, system=None, temporary=None):
'''
Set file attributes for a file. Note that the normal attribute
means that all others are false. So setting it will clear all others.
Args:
path... | [
"def",
"set_attributes",
"(",
"path",
",",
"archive",
"=",
"None",
",",
"hidden",
"=",
"None",
",",
"normal",
"=",
"None",
",",
"notIndexed",
"=",
"None",
",",
"readonly",
"=",
"None",
",",
"system",
"=",
"None",
",",
"temporary",
"=",
"None",
")",
"... | Set file attributes for a file. Note that the normal attribute
means that all others are false. So setting it will clear all others.
Args:
path (str): The path to the file or directory
archive (bool): Sets the archive attribute. Default is None
hidden (bool): Sets the hidden attribute... | [
"Set",
"file",
"attributes",
"for",
"a",
"file",
".",
"Note",
"that",
"the",
"normal",
"attribute",
"means",
"that",
"all",
"others",
"are",
"false",
".",
"So",
"setting",
"it",
"will",
"clear",
"all",
"others",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L942-L1016 | train |
saltstack/salt | salt/modules/win_file.py | set_mode | def set_mode(path, mode):
'''
Set the mode of a file
This just calls get_mode, which returns None because we don't use mode on
Windows
Args:
path: The path to the file or directory
mode: The mode (not used)
Returns:
None
CLI Example:
.. code-block:: bash
... | python | def set_mode(path, mode):
'''
Set the mode of a file
This just calls get_mode, which returns None because we don't use mode on
Windows
Args:
path: The path to the file or directory
mode: The mode (not used)
Returns:
None
CLI Example:
.. code-block:: bash
... | [
"def",
"set_mode",
"(",
"path",
",",
"mode",
")",
":",
"func_name",
"=",
"'{0}.set_mode'",
".",
"format",
"(",
"__virtualname__",
")",
"if",
"__opts__",
".",
"get",
"(",
"'fun'",
",",
"''",
")",
"==",
"func_name",
":",
"log",
".",
"info",
"(",
"'The fu... | Set the mode of a file
This just calls get_mode, which returns None because we don't use mode on
Windows
Args:
path: The path to the file or directory
mode: The mode (not used)
Returns:
None
CLI Example:
.. code-block:: bash
salt '*' file.set_mode /etc/passw... | [
"Set",
"the",
"mode",
"of",
"a",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L1019-L1045 | train |
saltstack/salt | salt/modules/win_file.py | remove | 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:
.... | python | 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",
")",
":",
"# 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",
".... | 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.... | [
"Remove",
"the",
"named",
"file",
"or",
"directory"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L1048-L1107 | train |
saltstack/salt | salt/modules/win_file.py | symlink | 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... | python | 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",
")",
":",
"# 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",
"<",
... | 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.
... | [
"Create",
"a",
"symbolic",
"link",
"to",
"a",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L1110-L1161 | train |
saltstack/salt | salt/modules/win_file.py | is_link | 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... | python | 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",
")",
":",
"if",
"sys",
".",
"getwindowsversion",
"(",
")",
".",
"major",
"<",
"6",
":",
"raise",
"SaltInvocationError",
"(",
"'Symlinks are only supported on Windows Vista or later.'",
")",
"try",
":",
"return",
"salt",
".",
"utils... | 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... | [
"Check",
"if",
"the",
"path",
"is",
"a",
"symlink"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L1164-L1192 | train |
saltstack/salt | salt/modules/win_file.py | readlink | 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:
... | python | 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",
")",
":",
"if",
"sys",
".",
"getwindowsversion",
"(",
")",
".",
"major",
"<",
"6",
":",
"raise",
"SaltInvocationError",
"(",
"'Symlinks are only supported on Windows Vista or later.'",
")",
"try",
":",
"return",
"salt",
".",
"util... | 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 ... | [
"Return",
"the",
"path",
"that",
"a",
"symlink",
"points",
"to"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L1195-L1227 | train |
saltstack/salt | salt/modules/win_file.py | mkdir | 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):
... | python | 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",
")",
":",
"# Make sure the drive is valid",
"drive",
"=",
"os",
".",
"pa... | 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... | [
"Ensure",
"that",
"the",
"directory",
"is",
"available",
"and",
"permissions",
"are",
"set",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L1230-L1332 | train |
saltstack/salt | salt/modules/win_file.py | makedirs_ | 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... | python | 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",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"expanduser",
"("... | 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
... | [
"Ensure",
"that",
"the",
"parent",
"directory",
"containing",
"this",
"path",
"is",
"available",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L1335-L1463 | train |
saltstack/salt | salt/modules/win_file.py | makedirs_perms | 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... | python | 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",
")",
":",
"# Expand any environment variables",
"path",
"=",
"os",
... | 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):
... | [
"Set",
"owner",
"and",
"permissions",
"for",
"each",
"directory",
"created",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L1466-L1576 | train |
saltstack/salt | salt/modules/win_file.py | check_perms | 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... | python | 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",
")",
":",
"if",
"not",
"os",
".",
"... | 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... | [
"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",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L1579-L1649 | train |
saltstack/salt | salt/modules/win_file.py | set_perms | 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 ... | python | 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",
")",
":",
"return",
"__utils__",
"[",
"'dacl.set_perms'",
"]",
"(",
"obj_name",
"=",
"path",
",... | 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... | [
"Set",
"permissions",
"for",
"the",
"given",
"path"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_file.py#L1652-L1735 | train |
saltstack/salt | salt/beacons/haproxy.py | validate | 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... | python | 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",
")",
":",
"if",
"not",
"isinstance",
"(",
"config",
",",
"list",
")",
":",
"return",
"False",
",",
"(",
"'Configuration for haproxy beacon must '",
"'be a list.'",
")",
"else",
":",
"_config",
"=",
"{",
"}",
"list",
"(",
"... | Validate the beacon configuration | [
"Validate",
"the",
"beacon",
"configuration"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/haproxy.py#L30-L59 | train |
saltstack/salt | salt/beacons/haproxy.py | beacon | 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... | python | 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",
")",
":",
"ret",
"=",
"[",
"]",
"_config",
"=",
"{",
"}",
"list",
"(",
"map",
"(",
"_config",
".",
"update",
",",
"config",
")",
")",
"for",
"backend",
"in",
"_config",
".",
"get",
"(",
"'backends'",
",",
"(",
")",... | 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
... | [
"Check",
"if",
"current",
"number",
"of",
"sessions",
"of",
"a",
"server",
"for",
"a",
"specific",
"haproxy",
"backend",
"is",
"over",
"a",
"defined",
"threshold",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/haproxy.py#L62-L101 | train |
saltstack/salt | salt/modules/boto_iot.py | thing_type_exists | 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... | python | 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",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"... | 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 | [
"Given",
"a",
"thing",
"type",
"name",
"check",
"to",
"see",
"if",
"the",
"given",
"thing",
"type",
"exists"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L101-L130 | train |
saltstack/salt | salt/modules/boto_iot.py | describe_thing_type | 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... | python | 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",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
... | 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 | [
"Given",
"a",
"thing",
"type",
"name",
"describe",
"its",
"properties",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L133-L167 | train |
saltstack/salt | salt/modules/boto_iot.py | create_thing_type | 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... | python | 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",
")",
":",
"try",
":",
"conn",
"=",
... | 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 \\
... | [
"Given",
"a",
"valid",
"config",
"create",
"a",
"thing",
"type",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L170-L209 | train |
saltstack/salt | salt/modules/boto_iot.py | deprecate_thing_type | 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... | python | 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",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"... | 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-... | [
"Given",
"a",
"thing",
"type",
"name",
"deprecate",
"it",
"when",
"undoDeprecate",
"is",
"False",
"and",
"undeprecate",
"it",
"when",
"undoDeprecate",
"is",
"True",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L212-L240 | train |
saltstack/salt | salt/modules/boto_iot.py | delete_thing_type | 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... | python | 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",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"... | 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 | [
"Given",
"a",
"thing",
"type",
"name",
"delete",
"it",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L243-L269 | train |
saltstack/salt | salt/modules/boto_iot.py | policy_exists | 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
... | python | 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",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"... | 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 | [
"Given",
"a",
"policy",
"name",
"check",
"to",
"see",
"if",
"the",
"given",
"policy",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L272-L296 | train |
saltstack/salt | salt/modules/boto_iot.py | create_policy | 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... | python | 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",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",... | 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... | [
"Given",
"a",
"valid",
"config",
"create",
"a",
"policy",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L299-L333 | train |
saltstack/salt | salt/modules/boto_iot.py | describe_policy | 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
'''
... | python | 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",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
... | 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",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L360-L388 | train |
saltstack/salt | salt/modules/boto_iot.py | policy_version_exists | 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... | python | 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",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
... | 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 | [
"Given",
"a",
"policy",
"name",
"and",
"version",
"ID",
"check",
"to",
"see",
"if",
"the",
"given",
"policy",
"version",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L391-L416 | train |
saltstack/salt | salt/modules/boto_iot.py | delete_policy_version | 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... | python | 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",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
... | 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 | [
"Given",
"a",
"policy",
"name",
"and",
"version",
"delete",
"it",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L454-L476 | train |
saltstack/salt | salt/modules/boto_iot.py | describe_policy_version | 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... | python | 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",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
... | 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 | [
"Given",
"a",
"policy",
"name",
"and",
"version",
"describe",
"its",
"properties",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L479-L508 | train |
saltstack/salt | salt/modules/boto_iot.py | list_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:
- {...}
- {...}
... | python | 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",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"key",
",",
"keyid",... | 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"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L511-L543 | train |
saltstack/salt | salt/modules/boto_iot.py | list_policy_versions | 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
... | python | 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",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"... | 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:
- {...}
- {...} | [
"List",
"the",
"versions",
"available",
"for",
"the",
"given",
"policy",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L546-L578 | train |
saltstack/salt | salt/modules/boto_iot.py | topic_rule_exists | 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 ... | python | 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",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
... | 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 | [
"Given",
"a",
"rule",
"name",
"check",
"to",
"see",
"if",
"the",
"given",
"rule",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L694-L723 | train |
saltstack/salt | salt/modules/boto_iot.py | create_topic_rule | 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... | python | 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",
")",
":",
"try"... | 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... | [
"Given",
"a",
"valid",
"config",
"create",
"a",
"topic",
"rule",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L726-L756 | train |
saltstack/salt | salt/modules/boto_iot.py | delete_topic_rule | 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... | python | 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",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
... | 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 | [
"Given",
"a",
"rule",
"name",
"delete",
"it",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L792-L813 | train |
saltstack/salt | salt/modules/boto_iot.py | describe_topic_rule | 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
'... | python | 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",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",... | 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",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L816-L842 | train |
saltstack/salt | salt/modules/boto_iot.py | list_topic_rules | 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:
... | python | 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",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
... | 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:
- {...}
- {...} | [
"List",
"all",
"rules",
"(",
"for",
"a",
"given",
"topic",
"if",
"specified",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L845-L884 | train |
saltstack/salt | salt/modules/netbsdservice.py | _get_svc | 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... | python | 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",
")",
":",
"ena",
"=",
"None",
"lines",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'{0} rcvar'",
".",
"format",
"(",
"rcd",
")",
")",
".",
"splitlines",
"(",
")",
"for",
"rcvar",
"in",
"lines",
... | Returns a unique service status | [
"Returns",
"a",
"unique",
"service",
"status"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbsdservice.py#L146-L162 | train |
saltstack/salt | salt/modules/netbsdservice.py | _get_svc_list | 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) | python | 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",
")",
":",
"prefix",
"=",
"'/etc/rc.d/'",
"ret",
"=",
"set",
"(",
")",
"lines",
"=",
"glob",
".",
"glob",
"(",
"'{0}*'",
".",
"format",
"(",
"prefix",
")",
")",
"for",
"line",
"in",
"lines",
":",
"svc",
"... | Returns all service statuses | [
"Returns",
"all",
"service",
"statuses"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbsdservice.py#L165-L177 | train |
saltstack/salt | salt/modules/netbsdservice.py | _rcconf_status | 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... | python | 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",
")",
":",
"rcconf",
"=",
"'/etc/rc.conf'",
"rxname",
"=",
"'^{0}=.*'",
".",
"format",
"(",
"name",
")",
"newstatus",
"=",
"'{0}={1}'",
".",
"format",
"(",
"name",
",",
"service_status",
")",
"ret",... | Modifies /etc/rc.conf so a service is started or not at boot time and
can be started via /etc/rc.d/<service> | [
"Modifies",
"/",
"etc",
"/",
"rc",
".",
"conf",
"so",
"a",
"service",
"is",
"started",
"or",
"not",
"at",
"boot",
"time",
"and",
"can",
"be",
"started",
"via",
"/",
"etc",
"/",
"rc",
".",
"d",
"/",
"<service",
">"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbsdservice.py#L248-L262 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | get_conn | 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... | python | 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",
"ProfitBricksService",
"(",
"username",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'username'",
",",
"get_configured_provider",
"(",
")",
",",
"__opts__",
",",
"search_global",
"=",
"False",
")",
",",
"passwor... | Return a conn object for the passed VM data | [
"Return",
"a",
"conn",
"object",
"for",
"the",
"passed",
"VM",
"data"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L179-L196 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | avail_locations | 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... | python | 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",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The avail_images function must be called with '",
"'-f or --function, or with the --list-locations option'",
")",
"ret",
"=",
"{",
"}"... | Return a dict of all available VM locations on the cloud provider with
relevant data | [
"Return",
"a",
"dict",
"of",
"all",
"available",
"VM",
"locations",
"on",
"the",
"cloud",
"provider",
"with",
"relevant",
"data"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L199-L221 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | avail_images | 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... | python | 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",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The avail_images function must be called with '",
"'-f or --function, or with the --list-images option'",
")",
"ret",
"=",
"{",
"}",
"c... | Return a list of the images that are on the provider | [
"Return",
"a",
"list",
"of",
"the",
"images",
"that",
"are",
"on",
"the",
"provider"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L224-L242 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | list_images | 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... | python | 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",
")",
":",
"if",
"call",
"!=",
"'function'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_images function must be called with '",
"'-f or --function.'",
")",
"if",
"not",
"version_com... | List all the images with alias by location
CLI Example:
.. code-block:: bash
salt-cloud -f list_images my-profitbricks-config location=us/las | [
"List",
"all",
"the",
"images",
"with",
"alias",
"by",
"location"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L245-L278 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | get_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... | python | 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_",
")",
":",
"vm_size",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'size'",
",",
"vm_",
",",
"__opts__",
")",
"sizes",
"=",
"avail_sizes",
"(",
")",
"if",
"not",
"vm_size",
":",
"return",
"sizes",
"[",
"'Small Instance'... | Return the VM's size object | [
"Return",
"the",
"VM",
"s",
"size",
"object"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L340-L356 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | get_datacenter_id | 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... | python | 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",
"(",
")",
":",
"datacenter_id",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'datacenter_id'",
",",
"get_configured_provider",
"(",
")",
",",
"__opts__",
",",
"search_global",
"=",
"False",
")",
"conn",
"=",
"get_conn",
"(",
")... | Return datacenter ID from provider configuration | [
"Return",
"datacenter",
"ID",
"from",
"provider",
"configuration"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L359-L378 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | list_loadbalancers | 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'
)
... | python | 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",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The avail_images function must be called with '",
"'-f or --function, or with the --list-loadbalancers option'",
")",
"ret",
"=",
"{"... | Return a list of the loadbalancers that are on the provider | [
"Return",
"a",
"list",
"of",
"the",
"loadbalancers",
"that",
"are",
"on",
"the",
"provider"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L381-L400 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | create_loadbalancer | 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(
... | python | 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",
")",
":",
"if",
"call",
"!=",
"'function'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The create_address function must be called with -f or --function.'",
")",
"if",
"kwargs",
"is",
... | Creates a loadbalancer within the datacenter from the provider config.
CLI Example:
.. code-block:: bash
salt-cloud -f create_loadbalancer profitbricks name=mylb | [
"Creates",
"a",
"loadbalancer",
"within",
"the",
"datacenter",
"from",
"the",
"provider",
"config",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L403-L430 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | get_datacenter | 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... | python | 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",
")",
":",
"datacenter_id",
"=",
"get_datacenter_id",
"(",
")",
"for",
"item",
"in",
"conn",
".",
"list_datacenters",
"(",
")",
"[",
"'items'",
"]",
":",
"if",
"item",
"[",
"'id'",
"]",
"==",
"datacenter_id",
":",
"re... | Return the datacenter from the config provider datacenter ID | [
"Return",
"the",
"datacenter",
"from",
"the",
"config",
"provider",
"datacenter",
"ID"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L433-L447 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | create_datacenter | 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'... | python | 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",
")",
":",
"if",
"call",
"!=",
"'function'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The create_address function must be called with -f or --function.'",
")",
"if",
"kwargs",
"is",
... | 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" | [
"Creates",
"a",
"virtual",
"datacenter",
"based",
"on",
"supplied",
"parameters",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L450-L483 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | list_datacenters | 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... | python | 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",
")",
":",
"if",
"call",
"!=",
"'function'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_datacenters function must be called with '",
"'-f or --function.'",
")",
"datacenters",
"=",... | List all the data centers
CLI Example:
.. code-block:: bash
salt-cloud -f list_datacenters my-profitbricks-config | [
"List",
"all",
"the",
"data",
"centers"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L524-L550 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | list_nodes | 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... | python | 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",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_nodes function must be called with -f or --function.'",
")",
"if",
"not",
"conn",
":",
"conn",
... | Return a list of VMs that are on the provider | [
"Return",
"a",
"list",
"of",
"VMs",
"that",
"are",
"on",
"the",
"provider"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L553-L581 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | list_nodes_full | 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:
... | python | 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",
")",
":",
"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 | [
"Return",
"a",
"list",
"of",
"the",
"VMs",
"that",
"are",
"on",
"the",
"provider",
"with",
"all",
"fields"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L584-L625 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | reserve_ipblock | 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 = {}
... | python | 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",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The reserve_ipblock function must be called with -f or '",
"'--function.'",
")",
"conn",
"=",
"get_c... | Reserve the IP Block | [
"Reserve",
"the",
"IP",
"Block"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L628-L658 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | get_node | 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... | python | 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",
")",
":",
"datacenter_id",
"=",
"get_datacenter_id",
"(",
")",
"for",
"item",
"in",
"conn",
".",
"list_servers",
"(",
"datacenter_id",
")",
"[",
"'items'",
"]",
":",
"if",
"item",
"[",
"'properties'",
"]",
"["... | Return a node for the named VM | [
"Return",
"a",
"node",
"for",
"the",
"named",
"VM"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L679-L689 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | _get_nics | 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... | python | 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_",
")",
":",
"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. | [
"Create",
"network",
"interfaces",
"on",
"appropriate",
"LANs",
"as",
"defined",
"in",
"cloud",
"profile",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L703-L733 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | set_public_lan | 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)... | python | 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",
")",
":",
"conn",
"=",
"get_conn",
"(",
")",
"datacenter_id",
"=",
"get_datacenter_id",
"(",
")",
"try",
":",
"lan",
"=",
"conn",
".",
"get_lan",
"(",
"datacenter_id",
"=",
"datacenter_id",
",",
"lan_id",
"=",
"lan_i... | Enables public Internet access for the specified public_lan. If no public
LAN is available, then a new public LAN is created. | [
"Enables",
"public",
"Internet",
"access",
"for",
"the",
"specified",
"public_lan",
".",
"If",
"no",
"public",
"LAN",
"is",
"available",
"then",
"a",
"new",
"public",
"LAN",
"is",
"created",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L736-L755 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | get_public_keys | 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... | python | 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_",
")",
":",
"key_filename",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'ssh_public_key'",
",",
"vm_",
",",
"__opts__",
",",
"search_global",
"=",
"False",
",",
"default",
"=",
"None",
")",
"if",
"key_filename",
"is"... | Retrieve list of SSH public keys. | [
"Retrieve",
"list",
"of",
"SSH",
"public",
"keys",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L758-L778 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | get_key_filename | 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... | python | 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_",
")",
":",
"key_filename",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'ssh_private_key'",
",",
"vm_",
",",
"__opts__",
",",
"search_global",
"=",
"False",
",",
"default",
"=",
"None",
")",
"if",
"key_filename",
"i... | Check SSH private key file and return absolute path if exists. | [
"Check",
"SSH",
"private",
"key",
"file",
"and",
"return",
"absolute",
"path",
"if",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L781-L797 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | create | 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
... | python | 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_",
")",
":",
"try",
":",
"# Check for required profile parameters before sending any API calls.",
"if",
"(",
"vm_",
"[",
"'profile'",
"]",
"and",
"config",
".",
"is_profile_configured",
"(",
"__opts__",
",",
"(",
"__active_provider_name__",
"... | Create a single VM from a data dict | [
"Create",
"a",
"single",
"VM",
"from",
"a",
"data",
"dict"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L817-L951 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | destroy | 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
... | python | 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",
")",
":",
"if",
"call",
"==",
"'function'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The destroy action must be called with -d, --destroy, '",
"'-a or --action.'",
")",
"__utils__",
"[",
"'cloud.fire_event'",
... | 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 | [
"destroy",
"a",
"machine",
"by",
"name"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L954-L1030 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | reboot | 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... | python | 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",
")",
":",
"datacenter_id",
"=",
"get_datacenter_id",
"(",
")",
"conn",
"=",
"get_conn",
"(",
")",
"node",
"=",
"get_node",
"(",
"conn",
",",
"name",
")",
"conn",
".",
"reboot_server",
"(",
"datace... | 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 | [
"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"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L1033-L1052 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | stop | 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()
... | python | 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",
")",
":",
"datacenter_id",
"=",
"get_datacenter_id",
"(",
")",
"conn",
"=",
"get_conn",
"(",
")",
"node",
"=",
"get_node",
"(",
"conn",
",",
"name",
")",
"conn",
".",
"stop_server",
"(",
"datacenter... | 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 | [
"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"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L1055-L1074 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | start | 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(... | python | 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",
")",
":",
"datacenter_id",
"=",
"get_datacenter_id",
"(",
")",
"conn",
"=",
"get_conn",
"(",
")",
"node",
"=",
"get_node",
"(",
"conn",
",",
"name",
")",
"conn",
".",
"start_server",
"(",
"datacent... | 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 | [
"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"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L1077-L1097 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | _override_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 | python | 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_",
")",
":",
"vm_size",
"=",
"get_size",
"(",
"vm_",
")",
"if",
"'cores'",
"in",
"vm_",
":",
"vm_size",
"[",
"'cores'",
"]",
"=",
"vm_",
"[",
"'cores'",
"]",
"if",
"'ram'",
"in",
"vm_",
":",
"vm_size",
"[",
"'ram'",
... | Apply any extra component overrides to VM from the cloud profile. | [
"Apply",
"any",
"extra",
"component",
"overrides",
"to",
"VM",
"from",
"the",
"cloud",
"profile",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L1100-L1112 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | _get_server | 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... | python | 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",
")",
":",
"# 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... | Construct server instance from cloud profile config | [
"Construct",
"server",
"instance",
"from",
"cloud",
"profile",
"config"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L1115-L1143 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | _get_system_volume | 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... | python | 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_",
")",
":",
"# 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... | Construct VM system volume list from cloud profile config | [
"Construct",
"VM",
"system",
"volume",
"list",
"from",
"cloud",
"profile",
"config"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L1146-L1179 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | _get_data_volumes | 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... | python | 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_",
")",
":",
"ret",
"=",
"[",
"]",
"volumes",
"=",
"vm_",
"[",
"'volumes'",
"]",
"for",
"key",
",",
"value",
"in",
"six",
".",
"iteritems",
"(",
"volumes",
")",
":",
"# Verify the required 'disk_size' property is present in... | Construct a list of optional data volumes from the cloud profile | [
"Construct",
"a",
"list",
"of",
"optional",
"data",
"volumes",
"from",
"the",
"cloud",
"profile"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L1182-L1213 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | _get_firewall_rules | 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 ... | python | 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",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"key",
",",
"value",
"in",
"six",
".",
"iteritems",
"(",
"firewall_rules",
")",
":",
"# Verify the required 'protocol' property is present in the cloud",
"# profile config",
"i... | Construct a list of optional firewall rules from the cloud profile. | [
"Construct",
"a",
"list",
"of",
"optional",
"firewall",
"rules",
"from",
"the",
"cloud",
"profile",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L1227-L1251 | train |
saltstack/salt | salt/cloud/clouds/profitbricks.py | _wait_for_completion | 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(
... | python | 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",
")",
":",
"if",
"not",
"promise",
":",
"return",
"wait_timeout",
"=",
"time",
".",
"time",
"(",
")",
"+",
"wait_timeout",
"while",
"wait_timeout",
">",
"time",
"."... | Poll request status until resource is provisioned. | [
"Poll",
"request",
"status",
"until",
"resource",
"is",
"provisioned",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L1254-L1281 | train |
saltstack/salt | salt/modules/flatpak.py | 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... | python | 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",
")",
":",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"FLATPAK_BINARY_NAME",
"+",
"' info '",
"+",
"name",
")",
"if",
"out",
"[",
"'retcode'",
"]",
"and",
"out",
"[",
"'stderr'",
"]",
":",
"return",
"False"... | 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 | [
"Determine",
"if",
"a",
"package",
"or",
"runtime",
"is",
"installed",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/flatpak.py#L58-L79 | train |
saltstack/salt | salt/modules/flatpak.py | uninstall | 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': ''}
... | python | 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",
")",
":",
"ret",
"=",
"{",
"'result'",
":",
"None",
",",
"'output'",
":",
"''",
"}",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"FLATPAK_BINARY_NAME",
"+",
"' uninstall '",
"+",
"pkg",
")",
"if",
"out",
"[",... | 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 | [
"Uninstall",
"the",
"specified",
"package",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/flatpak.py#L82-L109 | train |
saltstack/salt | salt/modules/flatpak.py | add_remote | 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
... | python | 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",
")",
":",
"ret",
"=",
"{",
"'result'",
":",
"None",
",",
"'output'",
":",
"''",
"}",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"FLATPAK_BINARY_NAME",
"+",
"' remote-add '",
"+",
"name",
"+"... | 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://... | [
"Adds",
"a",
"new",
"location",
"to",
"install",
"flatpak",
"packages",
"from",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/flatpak.py#L112-L139 | train |
saltstack/salt | salt/modules/flatpak.py | is_remote_added | 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... | python | 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",
")",
":",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"FLATPAK_BINARY_NAME",
"+",
"' remotes'",
")",
"lines",
"=",
"out",
".",
"splitlines",
"(",
")",
"for",
"item",
"in",
"lines",
":",
"i",
"=",
"re",... | 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 | [
"Determines",
"if",
"a",
"remote",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/flatpak.py#L142-L165 | train |
saltstack/salt | salt/utils/compat.py | pack_dunder | 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__)) | python | 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",
")",
":",
"# TODO: Deprecate starting with Beryllium",
"mod",
"=",
"sys",
".",
"modules",
"[",
"name",
"]",
"if",
"not",
"hasattr",
"(",
"mod",
",",
"'__utils__'",
")",
":",
"setattr",
"(",
"mod",
",",
"'__utils__'",
",",
... | Compatibility helper function to make __utils__ available on demand. | [
"Compatibility",
"helper",
"function",
"to",
"make",
"__utils__",
"available",
"on",
"demand",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/compat.py#L18-L26 | train |
saltstack/salt | salt/utils/compat.py | deepcopy_bound | 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 ... | python | 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",
")",
":",
"def",
"_deepcopy_method",
"(",
"x",
",",
"memo",
")",
":",
"return",
"type",
"(",
"x",
")",
"(",
"x",
".",
"im_func",
",",
"copy",
".",
"deepcopy",
"(",
"x",
".",
"im_self",
",",
"memo",
")",
",",
... | 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!
-... | [
"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",
"."... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/compat.py#L29-L50 | train |
saltstack/salt | salt/modules/pkgutil.py | upgrade_available | 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 = ... | python | 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",
")",
":",
"version_num",
"=",
"None",
"cmd",
"=",
"'/opt/csw/bin/pkgutil -c --parse --single {0}'",
".",
"format",
"(",
"name",
")",
"out",
"=",
"__salt__",
"[",
"'cmd.run_stdout'",
"]",
"(",
"cmd",
")",
"if",
"out",
":... | Check if there is an upgrade available for a certain package
CLI Example:
.. code-block:: bash
salt '*' pkgutil.upgrade_available CSWpython | [
"Check",
"if",
"there",
"is",
"an",
"upgrade",
"available",
"for",
"a",
"certain",
"package"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgutil.py#L53-L74 | train |
saltstack/salt | salt/modules/pkgutil.py | list_upgrades | 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... | python | 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",
"if",
"salt",
".",
"utils",
".",
"data",
".",
"is_true",
"(",
"refresh",
")",
":",
"refresh_db",
"(",
")",
"upgrades",
"=",
"{",
"}",
"li... | List all available package upgrades on this system
CLI Example:
.. code-block:: bash
salt '*' pkgutil.list_upgrades | [
"List",
"all",
"available",
"package",
"upgrades",
"on",
"this",
"system"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgutil.py#L77-L99 | train |
saltstack/salt | salt/modules/pkgutil.py | 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
... | python | 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",
")",
":",
"if",
"salt",
".",
"utils",
".",
"data",
".",
"is_true",
"(",
"refresh",
")",
":",
"refresh_db",
"(",
")",
"old",
"=",
"list_pkgs",
"(",
")",
"# Install or upgrade the package",
"# If package is alread... | 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",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgutil.py#L102-L128 | train |
saltstack/salt | salt/modules/pkgutil.py | install | 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... | python | 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",
")",
":",
"if",
"refresh",
":",
"refresh_db",
"(",
")",
"try",
":",
"# Ignore 'sources' argument",... | 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.
... | [
"Install",
"packages",
"using",
"the",
"pkgutil",
"tool",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgutil.py#L248-L307 | train |
saltstack/salt | salt/modules/pkgutil.py | remove | 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
... | python | 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",
")",
":",
"try",
":",
"pkg_params",
"=",
"__salt__",
"[",
"'pkg_resource.parse_targets'",
"]",
"(",
"name",
",",
"pkgs",
")",
"[",
"0",
"]",
"except",
"Mini... | 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... | [
"Remove",
"a",
"package",
"and",
"all",
"its",
"dependencies",
"which",
"are",
"not",
"in",
"use",
"by",
"other",
"packages",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgutil.py#L310-L351 | train |
saltstack/salt | salt/states/zenoss.py | monitored | 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... | python | 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",
")",
":",
"ret",
"=",
"{",
"}",
"ret",
"[",
"'name'",
"]",
"=",
"name",
"# If device is already monitored, return early",
... | 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
-... | [
"Ensure",
"a",
"device",
"is",
"monitored",
".",
"The",
"name",
"given",
"will",
"be",
"used",
"for",
"Zenoss",
"device",
"name",
"and",
"should",
"be",
"resolvable",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zenoss.py#L37-L92 | train |
saltstack/salt | salt/states/docker_volume.py | _find_volume | 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 | python | 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",
")",
":",
"docker_volumes",
"=",
"__salt__",
"[",
"'docker.volumes'",
"]",
"(",
")",
"[",
"'Volumes'",
"]",
"if",
"docker_volumes",
":",
"volumes",
"=",
"[",
"v",
"for",
"v",
"in",
"docker_volumes",
"if",
"v",
"[",
"'N... | Find volume by name on minion | [
"Find",
"volume",
"by",
"name",
"on",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/docker_volume.py#L56-L66 | train |
saltstack/salt | salt/states/docker_volume.py | present | 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... | python | 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",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment... | 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... | [
"Ensure",
"that",
"a",
"volume",
"is",
"present",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/docker_volume.py#L69-L192 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.