mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix typos (the the
> the
) (#52711)
* Fix typos (`the the` > `the`) It looks like humans aren't only very bad at recognizing a double `the` in a sentence when reading [1], but they're also very good at sneaking them in unintentionally without noticing. Fix this by running: ``` ack --ignore-dir=doc/man --ignore-dir=doc/topics/releases -i 'the the\W' -l | xargs sed -i 's|the the\(\W\)|the\1|g' ``` [1] Eye movements and word skipping during reading: Effects of word length and predictability: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3543826/ * Blacken changed files * Blacken changed files * Re-add unintentional delete * Bad merge fix * Fix broken docstring * Another try * pre-commit should pass now? Co-authored-by: Daniel A. Wozniak <dwozniak@saltstack.com> Co-authored-by: Wayne Werner <wwerner@saltstack.com>
This commit is contained in:
parent
a8d3c06414
commit
34fb50b134
24 changed files with 89 additions and 86 deletions
|
@ -53,7 +53,7 @@ build_stubs() {
|
||||||
get_excludes() {
|
get_excludes() {
|
||||||
# This is a tad convoluted. We need to list all top-level files and
|
# This is a tad convoluted. We need to list all top-level files and
|
||||||
# directories in the main Salt dir _except_ for the main __init__.py file
|
# directories in the main Salt dir _except_ for the main __init__.py file
|
||||||
# and the the module directory for the module we're building for.
|
# and the module directory for the module we're building for.
|
||||||
# ...that way sphinx-apidoc will exclude them from the build. (o_O)
|
# ...that way sphinx-apidoc will exclude them from the build. (o_O)
|
||||||
|
|
||||||
exclude="${1:?Dirname to exclude is required.}"
|
exclude="${1:?Dirname to exclude is required.}"
|
||||||
|
|
|
@ -176,7 +176,6 @@ execution of the tests. Additionally, if the ``libcloud`` library is not
|
||||||
available, since that's not actually part of what's being tested, we mocked that
|
available, since that's not actually part of what's being tested, we mocked that
|
||||||
import by patching ``sys.modules`` when tests are running.
|
import by patching ``sys.modules`` when tests are running.
|
||||||
|
|
||||||
|
|
||||||
Mocking Filehandles
|
Mocking Filehandles
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
@ -341,7 +340,7 @@ Multiple File Contents
|
||||||
|
|
||||||
For cases in which a file is being read more than once, and it is necessary to
|
For cases in which a file is being read more than once, and it is necessary to
|
||||||
test a function's behavior based on what the file looks like the second (or
|
test a function's behavior based on what the file looks like the second (or
|
||||||
third, etc.) time it is read, just specify the the contents for that file as a
|
third, etc.) time it is read, just specify the contents for that file as a
|
||||||
list. Each time the file is opened, ``mock_open`` will cycle through the list
|
list. Each time the file is opened, ``mock_open`` will cycle through the list
|
||||||
and produce a mocked filehandle with the specified contents. For example:
|
and produce a mocked filehandle with the specified contents. For example:
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ FirewallD use the command line client ``firewall-cmd``.
|
||||||
|
|
||||||
firewall-cmd --permanent --zone=<zone> --add-port=4505-4506/tcp
|
firewall-cmd --permanent --zone=<zone> --add-port=4505-4506/tcp
|
||||||
|
|
||||||
A network zone defines the security level of trust for the the network.
|
A network zone defines the security level of trust for the network.
|
||||||
The user should choose an appropriate zone value for their setup.
|
The user should choose an appropriate zone value for their setup.
|
||||||
Possible values include: drop, block, public, external, dmz, work, home, internal, trusted.
|
Possible values include: drop, block, public, external, dmz, work, home, internal, trusted.
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ Function Start_Process_and_test_exitcode {
|
||||||
# This function is a wrapper for Start-Process that checks the exitcode
|
# This function is a wrapper for Start-Process that checks the exitcode
|
||||||
# It receives 3 parameters:
|
# It receives 3 parameters:
|
||||||
# $fun - the process that shall be started
|
# $fun - the process that shall be started
|
||||||
# $args - the the arguments of $fun
|
# $args - the arguments of $fun
|
||||||
# $descr - the short description shown in the case of an error
|
# $descr - the short description shown in the case of an error
|
||||||
|
|
||||||
Param(
|
Param(
|
||||||
|
|
|
@ -107,7 +107,7 @@ __virtualname__ = "status"
|
||||||
|
|
||||||
def validate(config):
|
def validate(config):
|
||||||
"""
|
"""
|
||||||
Validate the the config is a dict
|
Validate the config is a dict
|
||||||
"""
|
"""
|
||||||
if not isinstance(config, list):
|
if not isinstance(config, list):
|
||||||
return False, ("Configuration for status beacon must be a list.")
|
return False, ("Configuration for status beacon must be a list.")
|
||||||
|
|
|
@ -26,13 +26,13 @@ from __future__ import absolute_import, division, print_function
|
||||||
|
|
||||||
import functools
|
import functools
|
||||||
import platform
|
import platform
|
||||||
|
import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
import traceback
|
import traceback
|
||||||
import sys
|
|
||||||
|
|
||||||
from salt.ext.tornado.log import app_log
|
from salt.ext.tornado.log import app_log
|
||||||
from salt.ext.tornado.stack_context import ExceptionStackContext, wrap
|
from salt.ext.tornado.stack_context import ExceptionStackContext, wrap
|
||||||
from salt.ext.tornado.util import raise_exc_info, ArgReplacer, is_finalizing
|
from salt.ext.tornado.util import ArgReplacer, is_finalizing, raise_exc_info
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from concurrent import futures
|
from concurrent import futures
|
||||||
|
@ -47,13 +47,16 @@ except ImportError:
|
||||||
|
|
||||||
# Can the garbage collector handle cycles that include __del__ methods?
|
# Can the garbage collector handle cycles that include __del__ methods?
|
||||||
# This is true in cpython beginning with version 3.4 (PEP 442).
|
# This is true in cpython beginning with version 3.4 (PEP 442).
|
||||||
_GC_CYCLE_FINALIZERS = (platform.python_implementation() == 'CPython' and
|
_GC_CYCLE_FINALIZERS = platform.python_implementation() == "CPython" and sys.version_info >= (
|
||||||
sys.version_info >= (3, 4))
|
3,
|
||||||
|
4,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class ReturnValueIgnoredError(Exception):
|
class ReturnValueIgnoredError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
# This class and associated code in the future object is derived
|
# This class and associated code in the future object is derived
|
||||||
# from the Trollius project, a backport of asyncio to Python 2.x - 3.x
|
# from the Trollius project, a backport of asyncio to Python 2.x - 3.x
|
||||||
|
|
||||||
|
@ -86,7 +89,7 @@ class _TracebackLogger(object):
|
||||||
the Future is collected, and the helper is present, the helper
|
the Future is collected, and the helper is present, the helper
|
||||||
object is also collected, and its __del__() method will log the
|
object is also collected, and its __del__() method will log the
|
||||||
traceback. When the Future's result() or exception() method is
|
traceback. When the Future's result() or exception() method is
|
||||||
called (and a helper object is present), it removes the the helper
|
called (and a helper object is present), it removes the helper
|
||||||
object, after calling its clear() method to prevent it from
|
object, after calling its clear() method to prevent it from
|
||||||
logging.
|
logging.
|
||||||
|
|
||||||
|
@ -108,7 +111,7 @@ class _TracebackLogger(object):
|
||||||
in a discussion about closing files when they are collected.
|
in a discussion about closing files when they are collected.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__slots__ = ('exc_info', 'formatted_tb')
|
__slots__ = ("exc_info", "formatted_tb")
|
||||||
|
|
||||||
def __init__(self, exc_info):
|
def __init__(self, exc_info):
|
||||||
self.exc_info = exc_info
|
self.exc_info = exc_info
|
||||||
|
@ -126,8 +129,10 @@ class _TracebackLogger(object):
|
||||||
|
|
||||||
def __del__(self, is_finalizing=is_finalizing):
|
def __del__(self, is_finalizing=is_finalizing):
|
||||||
if not is_finalizing() and self.formatted_tb:
|
if not is_finalizing() and self.formatted_tb:
|
||||||
app_log.error('Future exception was never retrieved: %s',
|
app_log.error(
|
||||||
''.join(self.formatted_tb).rstrip())
|
"Future exception was never retrieved: %s",
|
||||||
|
"".join(self.formatted_tb).rstrip(),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class Future(object):
|
class Future(object):
|
||||||
|
@ -166,23 +171,28 @@ class Future(object):
|
||||||
suppress the logging by ensuring that the exception is observed:
|
suppress the logging by ensuring that the exception is observed:
|
||||||
``f.add_done_callback(lambda f: f.exception())``.
|
``f.add_done_callback(lambda f: f.exception())``.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._done = False
|
self._done = False
|
||||||
self._result = None
|
self._result = None
|
||||||
self._exc_info = None
|
self._exc_info = None
|
||||||
|
|
||||||
self._log_traceback = False # Used for Python >= 3.4
|
self._log_traceback = False # Used for Python >= 3.4
|
||||||
self._tb_logger = None # Used for Python <= 3.3
|
self._tb_logger = None # Used for Python <= 3.3
|
||||||
|
|
||||||
self._callbacks = []
|
self._callbacks = []
|
||||||
|
|
||||||
# Implement the Python 3.5 Awaitable protocol if possible
|
# Implement the Python 3.5 Awaitable protocol if possible
|
||||||
# (we can't use return and yield together until py33).
|
# (we can't use return and yield together until py33).
|
||||||
if sys.version_info >= (3, 3):
|
if sys.version_info >= (3, 3):
|
||||||
exec(textwrap.dedent("""
|
exec(
|
||||||
|
textwrap.dedent(
|
||||||
|
"""
|
||||||
def __await__(self):
|
def __await__(self):
|
||||||
return (yield self)
|
return (yield self)
|
||||||
"""))
|
"""
|
||||||
|
)
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
# Py2-compatible version for use with cython.
|
# Py2-compatible version for use with cython.
|
||||||
def __await__(self):
|
def __await__(self):
|
||||||
|
@ -282,9 +292,8 @@ class Future(object):
|
||||||
def set_exception(self, exception):
|
def set_exception(self, exception):
|
||||||
"""Sets the exception of a ``Future.``"""
|
"""Sets the exception of a ``Future.``"""
|
||||||
self.set_exc_info(
|
self.set_exc_info(
|
||||||
(exception.__class__,
|
(exception.__class__, exception, getattr(exception, "__traceback__", None))
|
||||||
exception,
|
)
|
||||||
getattr(exception, '__traceback__', None)))
|
|
||||||
|
|
||||||
def exc_info(self):
|
def exc_info(self):
|
||||||
"""Returns a tuple in the same format as `sys.exc_info` or None.
|
"""Returns a tuple in the same format as `sys.exc_info` or None.
|
||||||
|
@ -325,14 +334,14 @@ class Future(object):
|
||||||
try:
|
try:
|
||||||
cb(self)
|
cb(self)
|
||||||
except Exception:
|
except Exception:
|
||||||
app_log.exception('Exception in callback %r for %r',
|
app_log.exception("Exception in callback %r for %r", cb, self)
|
||||||
cb, self)
|
|
||||||
self._callbacks = None
|
self._callbacks = None
|
||||||
|
|
||||||
# On Python 3.3 or older, objects with a destructor part of a reference
|
# On Python 3.3 or older, objects with a destructor part of a reference
|
||||||
# cycle are never destroyed. It's no longer the case on Python 3.4 thanks to
|
# cycle are never destroyed. It's no longer the case on Python 3.4 thanks to
|
||||||
# the PEP 442.
|
# the PEP 442.
|
||||||
if _GC_CYCLE_FINALIZERS:
|
if _GC_CYCLE_FINALIZERS:
|
||||||
|
|
||||||
def __del__(self, is_finalizing=is_finalizing):
|
def __del__(self, is_finalizing=is_finalizing):
|
||||||
if is_finalizing() or not self._log_traceback:
|
if is_finalizing() or not self._log_traceback:
|
||||||
# set_exception() was not called, or result() or exception()
|
# set_exception() was not called, or result() or exception()
|
||||||
|
@ -341,8 +350,11 @@ class Future(object):
|
||||||
|
|
||||||
tb = traceback.format_exception(*self._exc_info)
|
tb = traceback.format_exception(*self._exc_info)
|
||||||
|
|
||||||
app_log.error('Future %r exception was never retrieved: %s',
|
app_log.error(
|
||||||
self, ''.join(tb).rstrip())
|
"Future %r exception was never retrieved: %s",
|
||||||
|
self,
|
||||||
|
"".join(tb).rstrip(),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
TracebackFuture = Future
|
TracebackFuture = Future
|
||||||
|
@ -390,6 +402,7 @@ def run_on_executor(*args, **kwargs):
|
||||||
.. versionchanged:: 4.2
|
.. versionchanged:: 4.2
|
||||||
Added keyword arguments to use alternative attributes.
|
Added keyword arguments to use alternative attributes.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def run_on_executor_decorator(fn):
|
def run_on_executor_decorator(fn):
|
||||||
executor = kwargs.get("executor", "executor")
|
executor = kwargs.get("executor", "executor")
|
||||||
io_loop = kwargs.get("io_loop", "io_loop")
|
io_loop = kwargs.get("io_loop", "io_loop")
|
||||||
|
@ -400,9 +413,12 @@ def run_on_executor(*args, **kwargs):
|
||||||
future = getattr(self, executor).submit(fn, self, *args, **kwargs)
|
future = getattr(self, executor).submit(fn, self, *args, **kwargs)
|
||||||
if callback:
|
if callback:
|
||||||
getattr(self, io_loop).add_future(
|
getattr(self, io_loop).add_future(
|
||||||
future, lambda future: callback(future.result()))
|
future, lambda future: callback(future.result())
|
||||||
|
)
|
||||||
return future
|
return future
|
||||||
|
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
if args and kwargs:
|
if args and kwargs:
|
||||||
raise ValueError("cannot combine positional and keyword args")
|
raise ValueError("cannot combine positional and keyword args")
|
||||||
if len(args) == 1:
|
if len(args) == 1:
|
||||||
|
@ -454,18 +470,19 @@ def return_future(f):
|
||||||
same function, provided ``@return_future`` appears first. However,
|
same function, provided ``@return_future`` appears first. However,
|
||||||
consider using ``@gen.coroutine`` instead of this combination.
|
consider using ``@gen.coroutine`` instead of this combination.
|
||||||
"""
|
"""
|
||||||
replacer = ArgReplacer(f, 'callback')
|
replacer = ArgReplacer(f, "callback")
|
||||||
|
|
||||||
@functools.wraps(f)
|
@functools.wraps(f)
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
future = TracebackFuture()
|
future = TracebackFuture()
|
||||||
callback, args, kwargs = replacer.replace(
|
callback, args, kwargs = replacer.replace(
|
||||||
lambda value=_NO_RESULT: future.set_result(value),
|
lambda value=_NO_RESULT: future.set_result(value), args, kwargs
|
||||||
args, kwargs)
|
)
|
||||||
|
|
||||||
def handle_error(typ, value, tb):
|
def handle_error(typ, value, tb):
|
||||||
future.set_exc_info((typ, value, tb))
|
future.set_exc_info((typ, value, tb))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
exc_info = None
|
exc_info = None
|
||||||
with ExceptionStackContext(handle_error):
|
with ExceptionStackContext(handle_error):
|
||||||
try:
|
try:
|
||||||
|
@ -473,7 +490,8 @@ def return_future(f):
|
||||||
if result is not None:
|
if result is not None:
|
||||||
raise ReturnValueIgnoredError(
|
raise ReturnValueIgnoredError(
|
||||||
"@return_future should not be used with functions "
|
"@return_future should not be used with functions "
|
||||||
"that return values")
|
"that return values"
|
||||||
|
)
|
||||||
except:
|
except:
|
||||||
exc_info = sys.exc_info()
|
exc_info = sys.exc_info()
|
||||||
raise
|
raise
|
||||||
|
@ -490,14 +508,17 @@ def return_future(f):
|
||||||
# immediate exception, and again when the future resolves and
|
# immediate exception, and again when the future resolves and
|
||||||
# the callback triggers its exception by calling future.result()).
|
# the callback triggers its exception by calling future.result()).
|
||||||
if callback is not None:
|
if callback is not None:
|
||||||
|
|
||||||
def run_callback(future):
|
def run_callback(future):
|
||||||
result = future.result()
|
result = future.result()
|
||||||
if result is _NO_RESULT:
|
if result is _NO_RESULT:
|
||||||
callback()
|
callback()
|
||||||
else:
|
else:
|
||||||
callback(future.result())
|
callback(future.result())
|
||||||
|
|
||||||
future.add_done_callback(wrap(run_callback))
|
future.add_done_callback(wrap(run_callback))
|
||||||
return future
|
return future
|
||||||
|
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
|
@ -507,16 +528,20 @@ def chain_future(a, b):
|
||||||
The result (success or failure) of ``a`` will be copied to ``b``, unless
|
The result (success or failure) of ``a`` will be copied to ``b``, unless
|
||||||
``b`` has already been completed or cancelled by the time ``a`` finishes.
|
``b`` has already been completed or cancelled by the time ``a`` finishes.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def copy(future):
|
def copy(future):
|
||||||
assert future is a
|
assert future is a
|
||||||
if b.done():
|
if b.done():
|
||||||
return
|
return
|
||||||
if (isinstance(a, TracebackFuture) and
|
if (
|
||||||
isinstance(b, TracebackFuture) and
|
isinstance(a, TracebackFuture)
|
||||||
a.exc_info() is not None):
|
and isinstance(b, TracebackFuture)
|
||||||
|
and a.exc_info() is not None
|
||||||
|
):
|
||||||
b.set_exc_info(a.exc_info())
|
b.set_exc_info(a.exc_info())
|
||||||
elif a.exception() is not None:
|
elif a.exception() is not None:
|
||||||
b.set_exception(a.exception())
|
b.set_exception(a.exception())
|
||||||
else:
|
else:
|
||||||
b.set_result(a.result())
|
b.set_result(a.result())
|
||||||
|
|
||||||
a.add_done_callback(copy)
|
a.add_done_callback(copy)
|
||||||
|
|
|
@ -66,7 +66,7 @@ def compare_changes(obj, **kwargs):
|
||||||
|
|
||||||
def _clean_kwargs(keep_name=False, **kwargs):
|
def _clean_kwargs(keep_name=False, **kwargs):
|
||||||
"""
|
"""
|
||||||
Sanatize the the arguments for use with shade
|
Sanatize the arguments for use with shade
|
||||||
"""
|
"""
|
||||||
if "name" in kwargs and not keep_name:
|
if "name" in kwargs and not keep_name:
|
||||||
kwargs["name_or_id"] = kwargs.pop("name")
|
kwargs["name_or_id"] = kwargs.pop("name")
|
||||||
|
|
|
@ -89,7 +89,7 @@ def get_entity(ent_type, **kwargs):
|
||||||
|
|
||||||
def _clean_kwargs(keep_name=False, **kwargs):
|
def _clean_kwargs(keep_name=False, **kwargs):
|
||||||
"""
|
"""
|
||||||
Sanatize the the arguments for use with shade
|
Sanatize the arguments for use with shade
|
||||||
"""
|
"""
|
||||||
if "name" in kwargs and not keep_name:
|
if "name" in kwargs and not keep_name:
|
||||||
kwargs["name_or_id"] = kwargs.pop("name")
|
kwargs["name_or_id"] = kwargs.pop("name")
|
||||||
|
|
|
@ -8,7 +8,6 @@ lxc >= 1.0 (even beta alpha) is required
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Import python libs
|
|
||||||
from __future__ import absolute_import, print_function, unicode_literals
|
from __future__ import absolute_import, print_function, unicode_literals
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
@ -26,8 +25,6 @@ import textwrap
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import salt.config
|
import salt.config
|
||||||
|
|
||||||
# Import salt libs
|
|
||||||
import salt.utils.args
|
import salt.utils.args
|
||||||
import salt.utils.cloud
|
import salt.utils.cloud
|
||||||
import salt.utils.data
|
import salt.utils.data
|
||||||
|
@ -40,12 +37,10 @@ import salt.utils.odict
|
||||||
import salt.utils.path
|
import salt.utils.path
|
||||||
import salt.utils.stringutils
|
import salt.utils.stringutils
|
||||||
from salt.exceptions import CommandExecutionError, SaltInvocationError
|
from salt.exceptions import CommandExecutionError, SaltInvocationError
|
||||||
|
|
||||||
# Import 3rd-party libs
|
|
||||||
from salt.ext import six
|
from salt.ext import six
|
||||||
|
|
||||||
# pylint: disable=import-error,no-name-in-module
|
# pylint: disable=import-error,no-name-in-module
|
||||||
from salt.ext.six.moves import range # pylint: disable=redefined-builtin
|
from salt.ext.six.moves import range
|
||||||
from salt.ext.six.moves.urllib.parse import urlparse as _urlparse
|
from salt.ext.six.moves.urllib.parse import urlparse as _urlparse
|
||||||
from salt.utils.versions import LooseVersion as _LooseVersion
|
from salt.utils.versions import LooseVersion as _LooseVersion
|
||||||
|
|
||||||
|
@ -1962,7 +1957,7 @@ def create(
|
||||||
def select(key, default=None):
|
def select(key, default=None):
|
||||||
kw_overrides_match = kw_overrides.pop(key, None)
|
kw_overrides_match = kw_overrides.pop(key, None)
|
||||||
profile_match = profile.pop(key, default)
|
profile_match = profile.pop(key, default)
|
||||||
# Return the profile match if the the kwarg match was None, as the
|
# Return the profile match if the kwarg match was None, as the
|
||||||
# lxc.present state will pass these kwargs set to None by default.
|
# lxc.present state will pass these kwargs set to None by default.
|
||||||
if kw_overrides_match is None:
|
if kw_overrides_match is None:
|
||||||
return profile_match
|
return profile_match
|
||||||
|
|
|
@ -243,7 +243,7 @@ def get_last_change(name):
|
||||||
|
|
||||||
def get_login_failed_count(name):
|
def get_login_failed_count(name):
|
||||||
"""
|
"""
|
||||||
Get the the number of failed login attempts
|
Get the number of failed login attempts
|
||||||
|
|
||||||
:param str name: The username of the account
|
:param str name: The username of the account
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ def compare_changes(obj, **kwargs):
|
||||||
|
|
||||||
def _clean_kwargs(keep_name=False, **kwargs):
|
def _clean_kwargs(keep_name=False, **kwargs):
|
||||||
"""
|
"""
|
||||||
Sanatize the the arguments for use with shade
|
Sanatize the arguments for use with shade
|
||||||
"""
|
"""
|
||||||
if "name" in kwargs and not keep_name:
|
if "name" in kwargs and not keep_name:
|
||||||
kwargs["name_or_id"] = kwargs.pop("name")
|
kwargs["name_or_id"] = kwargs.pop("name")
|
||||||
|
|
|
@ -504,7 +504,7 @@ def install(
|
||||||
``user@proxy.server:port`` then you will be prompted for a password.
|
``user@proxy.server:port`` then you will be prompted for a password.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
If the the Minion has a globaly configured proxy - it will be used
|
If the Minion has a globaly configured proxy - it will be used
|
||||||
even if no proxy was set here. To explicitly disable proxy for pip
|
even if no proxy was set here. To explicitly disable proxy for pip
|
||||||
you should pass ``False`` as a value.
|
you should pass ``False`` as a value.
|
||||||
|
|
||||||
|
@ -1050,7 +1050,7 @@ def uninstall(
|
||||||
``user@proxy.server:port`` then you will be prompted for a password.
|
``user@proxy.server:port`` then you will be prompted for a password.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
If the the Minion has a globaly configured proxy - it will be used
|
If the Minion has a globaly configured proxy - it will be used
|
||||||
even if no proxy was set here. To explicitly disable proxy for pip
|
even if no proxy was set here. To explicitly disable proxy for pip
|
||||||
you should pass ``False`` as a value.
|
you should pass ``False`` as a value.
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ can have a value assigned to them under the (Default)
|
||||||
|
|
||||||
When passing a key on the CLI it must be quoted correctly depending on the
|
When passing a key on the CLI it must be quoted correctly depending on the
|
||||||
backslashes being used (``\`` vs ``\\``). The following are valid methods of
|
backslashes being used (``\`` vs ``\\``). The following are valid methods of
|
||||||
passing the the key on the CLI:
|
passing the key on the CLI:
|
||||||
|
|
||||||
Using single backslashes:
|
Using single backslashes:
|
||||||
``"SOFTWARE\Python"``
|
``"SOFTWARE\Python"``
|
||||||
|
|
|
@ -2371,7 +2371,7 @@ def system_info(host, username, password, protocol=None, port=None):
|
||||||
@ignores_kwargs("credstore")
|
@ignores_kwargs("credstore")
|
||||||
def list_datacenters(host, username, password, protocol=None, port=None):
|
def list_datacenters(host, username, password, protocol=None, port=None):
|
||||||
"""
|
"""
|
||||||
Returns a list of datacenters for the the specified host.
|
Returns a list of datacenters for the specified host.
|
||||||
|
|
||||||
host
|
host
|
||||||
The location of the host.
|
The location of the host.
|
||||||
|
@ -2407,7 +2407,7 @@ def list_datacenters(host, username, password, protocol=None, port=None):
|
||||||
@ignores_kwargs("credstore")
|
@ignores_kwargs("credstore")
|
||||||
def list_clusters(host, username, password, protocol=None, port=None):
|
def list_clusters(host, username, password, protocol=None, port=None):
|
||||||
"""
|
"""
|
||||||
Returns a list of clusters for the the specified host.
|
Returns a list of clusters for the specified host.
|
||||||
|
|
||||||
host
|
host
|
||||||
The location of the host.
|
The location of the host.
|
||||||
|
@ -2443,7 +2443,7 @@ def list_clusters(host, username, password, protocol=None, port=None):
|
||||||
@ignores_kwargs("credstore")
|
@ignores_kwargs("credstore")
|
||||||
def list_datastore_clusters(host, username, password, protocol=None, port=None):
|
def list_datastore_clusters(host, username, password, protocol=None, port=None):
|
||||||
"""
|
"""
|
||||||
Returns a list of datastore clusters for the the specified host.
|
Returns a list of datastore clusters for the specified host.
|
||||||
|
|
||||||
host
|
host
|
||||||
The location of the host.
|
The location of the host.
|
||||||
|
@ -2478,7 +2478,7 @@ def list_datastore_clusters(host, username, password, protocol=None, port=None):
|
||||||
@ignores_kwargs("credstore")
|
@ignores_kwargs("credstore")
|
||||||
def list_datastores(host, username, password, protocol=None, port=None):
|
def list_datastores(host, username, password, protocol=None, port=None):
|
||||||
"""
|
"""
|
||||||
Returns a list of datastores for the the specified host.
|
Returns a list of datastores for the specified host.
|
||||||
|
|
||||||
host
|
host
|
||||||
The location of the host.
|
The location of the host.
|
||||||
|
@ -2513,7 +2513,7 @@ def list_datastores(host, username, password, protocol=None, port=None):
|
||||||
@ignores_kwargs("credstore")
|
@ignores_kwargs("credstore")
|
||||||
def list_hosts(host, username, password, protocol=None, port=None):
|
def list_hosts(host, username, password, protocol=None, port=None):
|
||||||
"""
|
"""
|
||||||
Returns a list of hosts for the the specified VMware environment.
|
Returns a list of hosts for the specified VMware environment.
|
||||||
|
|
||||||
host
|
host
|
||||||
The location of the host.
|
The location of the host.
|
||||||
|
@ -2548,7 +2548,7 @@ def list_hosts(host, username, password, protocol=None, port=None):
|
||||||
@ignores_kwargs("credstore")
|
@ignores_kwargs("credstore")
|
||||||
def list_resourcepools(host, username, password, protocol=None, port=None):
|
def list_resourcepools(host, username, password, protocol=None, port=None):
|
||||||
"""
|
"""
|
||||||
Returns a list of resource pools for the the specified host.
|
Returns a list of resource pools for the specified host.
|
||||||
|
|
||||||
host
|
host
|
||||||
The location of the host.
|
The location of the host.
|
||||||
|
@ -2583,7 +2583,7 @@ def list_resourcepools(host, username, password, protocol=None, port=None):
|
||||||
@ignores_kwargs("credstore")
|
@ignores_kwargs("credstore")
|
||||||
def list_networks(host, username, password, protocol=None, port=None):
|
def list_networks(host, username, password, protocol=None, port=None):
|
||||||
"""
|
"""
|
||||||
Returns a list of networks for the the specified host.
|
Returns a list of networks for the specified host.
|
||||||
|
|
||||||
host
|
host
|
||||||
The location of the host.
|
The location of the host.
|
||||||
|
@ -2618,7 +2618,7 @@ def list_networks(host, username, password, protocol=None, port=None):
|
||||||
@ignores_kwargs("credstore")
|
@ignores_kwargs("credstore")
|
||||||
def list_vms(host, username, password, protocol=None, port=None):
|
def list_vms(host, username, password, protocol=None, port=None):
|
||||||
"""
|
"""
|
||||||
Returns a list of VMs for the the specified host.
|
Returns a list of VMs for the specified host.
|
||||||
|
|
||||||
host
|
host
|
||||||
The location of the host.
|
The location of the host.
|
||||||
|
@ -2653,7 +2653,7 @@ def list_vms(host, username, password, protocol=None, port=None):
|
||||||
@ignores_kwargs("credstore")
|
@ignores_kwargs("credstore")
|
||||||
def list_folders(host, username, password, protocol=None, port=None):
|
def list_folders(host, username, password, protocol=None, port=None):
|
||||||
"""
|
"""
|
||||||
Returns a list of folders for the the specified host.
|
Returns a list of folders for the specified host.
|
||||||
|
|
||||||
host
|
host
|
||||||
The location of the host.
|
The location of the host.
|
||||||
|
@ -2688,7 +2688,7 @@ def list_folders(host, username, password, protocol=None, port=None):
|
||||||
@ignores_kwargs("credstore")
|
@ignores_kwargs("credstore")
|
||||||
def list_dvs(host, username, password, protocol=None, port=None):
|
def list_dvs(host, username, password, protocol=None, port=None):
|
||||||
"""
|
"""
|
||||||
Returns a list of distributed virtual switches for the the specified host.
|
Returns a list of distributed virtual switches for the specified host.
|
||||||
|
|
||||||
host
|
host
|
||||||
The location of the host.
|
The location of the host.
|
||||||
|
@ -2723,7 +2723,7 @@ def list_dvs(host, username, password, protocol=None, port=None):
|
||||||
@ignores_kwargs("credstore")
|
@ignores_kwargs("credstore")
|
||||||
def list_vapps(host, username, password, protocol=None, port=None):
|
def list_vapps(host, username, password, protocol=None, port=None):
|
||||||
"""
|
"""
|
||||||
Returns a list of vApps for the the specified host.
|
Returns a list of vApps for the specified host.
|
||||||
|
|
||||||
host
|
host
|
||||||
The location of the host.
|
The location of the host.
|
||||||
|
@ -5405,7 +5405,7 @@ def update_storage_policy(policy, policy_dict, service_instance=None):
|
||||||
@gets_service_instance_via_proxy
|
@gets_service_instance_via_proxy
|
||||||
def list_default_storage_policy_of_datastore(datastore, service_instance=None):
|
def list_default_storage_policy_of_datastore(datastore, service_instance=None):
|
||||||
"""
|
"""
|
||||||
Returns a list of datastores assign the the storage policies.
|
Returns a list of datastores assign the storage policies.
|
||||||
|
|
||||||
datastore
|
datastore
|
||||||
Name of the datastore to assign.
|
Name of the datastore to assign.
|
||||||
|
@ -6503,7 +6503,7 @@ def list_hosts_via_proxy(
|
||||||
hostnames=None, datacenter=None, cluster=None, service_instance=None
|
hostnames=None, datacenter=None, cluster=None, service_instance=None
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Returns a list of hosts for the the specified VMware environment. The list
|
Returns a list of hosts for the specified VMware environment. The list
|
||||||
of hosts can be filtered by datacenter name and/or cluster name
|
of hosts can be filtered by datacenter name and/or cluster name
|
||||||
|
|
||||||
hostnames
|
hostnames
|
||||||
|
|
|
@ -365,7 +365,7 @@ def apply_config(path, source=None, salt_env="base"):
|
||||||
|
|
||||||
CLI Example:
|
CLI Example:
|
||||||
|
|
||||||
To apply a config that already exists on the the system
|
To apply a config that already exists on the system
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
|
|
|
@ -837,7 +837,7 @@ def set_wu_settings(
|
||||||
# Apparently the Windows Update framework in Windows Vista - Windows 8.1 has
|
# Apparently the Windows Update framework in Windows Vista - Windows 8.1 has
|
||||||
# been changed quite a bit in Windows 10 / Server 2016. It is now called the
|
# been changed quite a bit in Windows 10 / Server 2016. It is now called the
|
||||||
# Unified Update Platform (UUP). I haven't found an API or a Powershell
|
# Unified Update Platform (UUP). I haven't found an API or a Powershell
|
||||||
# commandlet for working with the the UUP. Perhaps there will be something
|
# commandlet for working with the UUP. Perhaps there will be something
|
||||||
# forthcoming. The `win_lgpo` module might be an option for changing the
|
# forthcoming. The `win_lgpo` module might be an option for changing the
|
||||||
# Windows Update settings using local group policy.
|
# Windows Update settings using local group policy.
|
||||||
ret = {"Success": True}
|
ret = {"Success": True}
|
||||||
|
|
|
@ -135,7 +135,7 @@ may be updating for an ESXi host either via the
|
||||||
execution module function or via the
|
execution module function or via the
|
||||||
:mod:`esxi.password_present <salt.states.esxi.password_present>` state
|
:mod:`esxi.password_present <salt.states.esxi.password_present>` state
|
||||||
function. This way, after the password is changed, you should not need to
|
function. This way, after the password is changed, you should not need to
|
||||||
restart the proxy minion--it should just pick up the the new password
|
restart the proxy minion--it should just pick up the new password
|
||||||
provided in the list. You can then change pillar at will to move that
|
provided in the list. You can then change pillar at will to move that
|
||||||
password to the front and retire the unused ones.
|
password to the front and retire the unused ones.
|
||||||
|
|
||||||
|
@ -270,22 +270,18 @@ for standing up an ESXi host from scratch.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Import Python Libs
|
|
||||||
from __future__ import absolute_import, print_function, unicode_literals
|
from __future__ import absolute_import, print_function, unicode_literals
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from salt.config.schemas.esxi import EsxiProxySchema
|
from salt.config.schemas.esxi import EsxiProxySchema
|
||||||
|
|
||||||
# Import Salt Libs
|
|
||||||
from salt.exceptions import InvalidConfigError, SaltSystemExit
|
from salt.exceptions import InvalidConfigError, SaltSystemExit
|
||||||
from salt.utils.dictupdate import merge
|
from salt.utils.dictupdate import merge
|
||||||
|
|
||||||
# This must be present or the Salt loader won't load this module.
|
# This must be present or the Salt loader won't load this module.
|
||||||
__proxyenabled__ = ["esxi"]
|
__proxyenabled__ = ["esxi"]
|
||||||
|
|
||||||
# External libraries
|
|
||||||
try:
|
try:
|
||||||
import jsonschema
|
import jsonschema
|
||||||
|
|
||||||
|
|
|
@ -54,11 +54,7 @@ import os
|
||||||
import salt.utils.args
|
import salt.utils.args
|
||||||
import salt.utils.data
|
import salt.utils.data
|
||||||
import salt.utils.dockermod
|
import salt.utils.dockermod
|
||||||
|
|
||||||
# Import Salt libs
|
|
||||||
from salt.exceptions import CommandExecutionError
|
from salt.exceptions import CommandExecutionError
|
||||||
|
|
||||||
# Import 3rd-party libs
|
|
||||||
from salt.ext import six
|
from salt.ext import six
|
||||||
|
|
||||||
# Enable proper logging
|
# Enable proper logging
|
||||||
|
@ -2017,7 +2013,7 @@ def running(
|
||||||
# "not cleanup_temp" means that the temp container became permanent, either
|
# "not cleanup_temp" means that the temp container became permanent, either
|
||||||
# because the named container did not exist or changes were detected
|
# because the named container did not exist or changes were detected
|
||||||
# "cleanup_temp" means that the container already existed and no changes
|
# "cleanup_temp" means that the container already existed and no changes
|
||||||
# were detected, so the the temp container was discarded
|
# were detected, so the temp container was discarded
|
||||||
if (
|
if (
|
||||||
not cleanup_temp
|
not cleanup_temp
|
||||||
and (not exists or (exists and start))
|
and (not exists or (exists and start))
|
||||||
|
|
|
@ -67,7 +67,7 @@ def init(
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Initalizes the LXD Daemon, as LXD doesn't tell if its initialized
|
Initalizes the LXD Daemon, as LXD doesn't tell if its initialized
|
||||||
we touch the the done_file and check if it exist.
|
we touch the done_file and check if it exist.
|
||||||
|
|
||||||
This can only be called once per host unless you remove the done_file.
|
This can only be called once per host unless you remove the done_file.
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ The following can be retrieved:
|
||||||
(1) List of added, removed, intersect elements
|
(1) List of added, removed, intersect elements
|
||||||
(2) List of diffs having the following format:
|
(2) List of diffs having the following format:
|
||||||
<key_val>: {<elem_key: {'old': <old_value>, 'new': <new_value>}}
|
<key_val>: {<elem_key: {'old': <old_value>, 'new': <new_value>}}
|
||||||
A recursive diff is done between the the values (dicts) with the same
|
A recursive diff is done between the values (dicts) with the same
|
||||||
key
|
key
|
||||||
(3) List with the new values for each key
|
(3) List with the new values for each key
|
||||||
(4) List with the old values for each key
|
(4) List with the old values for each key
|
||||||
|
|
|
@ -14,23 +14,18 @@ There are 3 functions in this salt util.
|
||||||
- get_interface_info_wmi
|
- get_interface_info_wmi
|
||||||
- get_interface_info
|
- get_interface_info
|
||||||
The ``get_interface_info`` function will call one of the other two functions
|
The ``get_interface_info`` function will call one of the other two functions
|
||||||
depending on the the version of Windows this is run on. Once support for Windows
|
depending on the version of Windows this is run on. Once support for Windows
|
||||||
7 is dropped we can remove the WMI stuff and just use .NET.
|
7 is dropped we can remove the WMI stuff and just use .NET.
|
||||||
:depends: - pythonnet
|
:depends: - pythonnet
|
||||||
- wmi
|
- wmi
|
||||||
"""
|
"""
|
||||||
# https://docs.microsoft.com/en-us/dotnet/api/system.net.networkinformation.networkinterface.getallnetworkinterfaces?view=netframework-4.7.2
|
# https://docs.microsoft.com/en-us/dotnet/api/system.net.networkinformation.networkinterface.getallnetworkinterfaces?view=netframework-4.7.2
|
||||||
# Import python libs
|
|
||||||
from __future__ import absolute_import, print_function, unicode_literals
|
from __future__ import absolute_import, print_function, unicode_literals
|
||||||
|
|
||||||
import ipaddress
|
import ipaddress
|
||||||
import platform
|
import platform
|
||||||
|
|
||||||
# Import 3rd party libs
|
|
||||||
# I don't understand why I need this import, but the linter fails without it
|
|
||||||
from salt.ext.six.moves import range
|
from salt.ext.six.moves import range
|
||||||
|
|
||||||
# Import Salt libs
|
|
||||||
from salt.utils.versions import StrictVersion
|
from salt.utils.versions import StrictVersion
|
||||||
|
|
||||||
IS_WINDOWS = platform.system() == "Windows"
|
IS_WINDOWS = platform.system() == "Windows"
|
||||||
|
|
|
@ -27,7 +27,6 @@ The wheel key functions can also be called via a ``salt`` command at the CLI
|
||||||
using the :mod:`saltutil execution module <salt.modules.saltutil>`.
|
using the :mod:`saltutil execution module <salt.modules.saltutil>`.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Import python libs
|
|
||||||
from __future__ import absolute_import, print_function, unicode_literals
|
from __future__ import absolute_import, print_function, unicode_literals
|
||||||
|
|
||||||
import hashlib
|
import hashlib
|
||||||
|
@ -38,8 +37,6 @@ import salt.crypt
|
||||||
import salt.utils.crypt
|
import salt.utils.crypt
|
||||||
import salt.utils.files
|
import salt.utils.files
|
||||||
import salt.utils.platform
|
import salt.utils.platform
|
||||||
|
|
||||||
# Import salt libs
|
|
||||||
from salt.key import get_key
|
from salt.key import get_key
|
||||||
from salt.utils.sanitizers import clean
|
from salt.utils.sanitizers import clean
|
||||||
|
|
||||||
|
@ -352,7 +349,7 @@ def gen(id_=None, keysize=2048):
|
||||||
r"""
|
r"""
|
||||||
Generate a key pair. No keys are stored on the master. A key pair is
|
Generate a key pair. No keys are stored on the master. A key pair is
|
||||||
returned as a dict containing pub and priv keys. Returns a dictionary
|
returned as a dict containing pub and priv keys. Returns a dictionary
|
||||||
containing the the ``pub`` and ``priv`` keys with their generated values.
|
containing the ``pub`` and ``priv`` keys with their generated values.
|
||||||
|
|
||||||
id\_
|
id\_
|
||||||
Set a name to generate a key pair for use with salt. If not specified,
|
Set a name to generate a key pair for use with salt. If not specified,
|
||||||
|
|
|
@ -19,7 +19,7 @@ from tests.support.unit import skipIf
|
||||||
class WinPKGTest(ModuleCase):
|
class WinPKGTest(ModuleCase):
|
||||||
"""
|
"""
|
||||||
Tests for salt.modules.win_pkg. There are already
|
Tests for salt.modules.win_pkg. There are already
|
||||||
some pkg execution module tests in the the test
|
some pkg execution module tests in the test
|
||||||
integration.modules.test_pkg but this will be for
|
integration.modules.test_pkg but this will be for
|
||||||
specific windows software repository tests while
|
specific windows software repository tests while
|
||||||
using the win_pkg module.
|
using the win_pkg module.
|
||||||
|
|
|
@ -1366,7 +1366,7 @@ class OpenNebulaTestCase(TestCase, LoaderModuleMockMixin):
|
||||||
|
|
||||||
def test_vm_migrate_no_host_id_or_host_name(self):
|
def test_vm_migrate_no_host_id_or_host_name(self):
|
||||||
"""
|
"""
|
||||||
Tests that a SaltCloudSystemExit is raised when the the host_id and the
|
Tests that a SaltCloudSystemExit is raised when the host_id and the
|
||||||
host_name args are missing.
|
host_name args are missing.
|
||||||
"""
|
"""
|
||||||
self.assertRaises(
|
self.assertRaises(
|
||||||
|
|
Loading…
Add table
Reference in a new issue