mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Merge pull request #28665 from jfindlay/win_fixorz
fixes to windows execution and state modules
This commit is contained in:
commit
019c13948a
@ -134,19 +134,16 @@ def reboot(timeout=5, in_seconds=False):
|
||||
|
||||
:param int timeout:
|
||||
Number of seconds before rebooting the system.
|
||||
Default is 5 seconds.
|
||||
Default is 5 minutes.
|
||||
|
||||
:return: True if successful
|
||||
:rtype: bool
|
||||
|
||||
timeout
|
||||
The wait time before the system will be shutdown.
|
||||
|
||||
in_seconds
|
||||
:param bool in_seconds:
|
||||
Whether to treat timeout as seconds or minutes.
|
||||
|
||||
.. versionadded:: 2015.8.0
|
||||
|
||||
:return: True if successful
|
||||
:rtype: bool
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
@ -168,18 +165,18 @@ def shutdown(message=None, timeout=5, force_close=True, reboot=False, in_seconds
|
||||
seconds. While this dialog box is displayed, the shutdown can be stopped
|
||||
by the shutdown_abort function.
|
||||
|
||||
If dwTimeout is not zero, InitiateSystemShutdown displays a dialog box
|
||||
on the specified computer. The dialog box displays the name of the user
|
||||
who called the function, displays the message specified by the lpMessage
|
||||
parameter, and prompts the user to log off. The dialog box beeps when it
|
||||
is created and remains on top of other windows in the system. The dialog
|
||||
box can be moved but not closed. A timer counts down the remaining time
|
||||
before a forced shutdown.
|
||||
If timeout is not zero, InitiateSystemShutdown displays a dialog box on
|
||||
the specified computer. The dialog box displays the name of the user
|
||||
who called the function, displays the message specified by the
|
||||
lpMessage parameter, and prompts the user to log off. The dialog box
|
||||
beeps when it is created and remains on top of other windows in the
|
||||
system. The dialog box can be moved but not closed. A timer counts down
|
||||
the remaining time before a forced shutdown.
|
||||
|
||||
If dwTimeout is zero, the computer shuts down without displaying the
|
||||
If timeout is zero, the computer shuts down without displaying the
|
||||
dialog box, and the shutdown cannot be stopped by shutdown_abort.
|
||||
|
||||
Default is 5
|
||||
Default is 5 minutes
|
||||
|
||||
:param bool in_seconds:
|
||||
Whether to treat timeout as seconds or minutes.
|
||||
@ -224,10 +221,6 @@ def shutdown_hard():
|
||||
'''
|
||||
Shutdown a running system with no timeout or warning.
|
||||
|
||||
:param int timeout:
|
||||
Number of seconds before shutting down the system.
|
||||
Default is 5 seconds.
|
||||
|
||||
:return: True if successful
|
||||
:rtype: bool
|
||||
|
||||
|
@ -9,11 +9,14 @@ Module for managing Windows Updates using the Windows Update Agent.
|
||||
- pythoncom
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from salt.ext.six.moves import range # pylint: disable=no-name-in-module,redefined-builtin
|
||||
|
||||
# Import Python libs
|
||||
import logging
|
||||
|
||||
# Import Salt libs
|
||||
from salt.ext import six
|
||||
from salt.ext.six.moves import range # pylint: disable=no-name-in-module,redefined-builtin
|
||||
|
||||
# Import 3rd-party libs
|
||||
try:
|
||||
import win32com.client
|
||||
@ -1060,9 +1063,15 @@ def set_wu_settings(level=None,
|
||||
ret['Success'] = False
|
||||
|
||||
if time is not None:
|
||||
# Check for time as a string: if the time is not quoted, yaml will
|
||||
# treat it as an integer
|
||||
if not isinstance(time, six.string_types):
|
||||
ret['Comment'] = "Time argument needs to be a string; it may need to"\
|
||||
"be quoted. Passed {0}. Time not set.".format(time)
|
||||
ret['Success'] = False
|
||||
# Check for colon in the time
|
||||
if ':' not in time:
|
||||
ret['Comment'] = "Time needs to be in 00:00 format." \
|
||||
elif ':' not in time:
|
||||
ret['Comment'] = "Time argument needs to be in 00:00 format." \
|
||||
" Passed {0}. Time not set.".format(time)
|
||||
ret['Success'] = False
|
||||
else:
|
||||
|
@ -68,6 +68,7 @@ import logging
|
||||
import salt.utils
|
||||
import salt.utils.validate.net
|
||||
from salt.ext.six.moves import range
|
||||
from salt.exceptions import CommandExecutionError
|
||||
|
||||
# Set up logging
|
||||
log = logging.getLogger(__name__)
|
||||
@ -274,7 +275,10 @@ def managed(name,
|
||||
ret['comment'] += ' (already disabled)'
|
||||
return ret
|
||||
else:
|
||||
currently_enabled = __salt__['ip.is_disabled'](name)
|
||||
try:
|
||||
currently_enabled = __salt__['ip.is_disabled'](name)
|
||||
except CommandExecutionError:
|
||||
currently_enabled = False
|
||||
if not currently_enabled:
|
||||
if __opts__['test']:
|
||||
ret['result'] = None
|
||||
|
Loading…
Reference in New Issue
Block a user