mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 08:35:21 +00:00
Merge branch '2016.11' into '2017.7'
Conflicts: - .kitchen.yml - salt/modules/win_system.py
This commit is contained in:
commit
edbbd5fc2b
@ -31,7 +31,7 @@ provisioner:
|
||||
log_level: info
|
||||
require_chef: false
|
||||
remote_states:
|
||||
name: git://github.com/gtmanfred/salt-jenkins.git
|
||||
name: git://github.com/saltstack/salt-jenkins.git
|
||||
branch: 2017.7
|
||||
repo: git
|
||||
testingdir: /testing
|
||||
|
@ -19,14 +19,18 @@ Salt SSH allows for salt routines to be executed using only SSH for transport
|
||||
Options
|
||||
=======
|
||||
|
||||
.. program:: salt-ssh
|
||||
|
||||
.. include:: _includes/common-options.rst
|
||||
|
||||
.. option:: --hard-crash
|
||||
|
||||
Raise any original exception rather than exiting gracefully. Default: False.
|
||||
|
||||
.. option:: -r, --raw, --raw-shell
|
||||
|
||||
Execute a raw shell command.
|
||||
|
||||
.. option:: --priv
|
||||
|
||||
Specify the SSH private key file to be used for authentication.
|
||||
|
||||
.. option:: --roster
|
||||
|
||||
Define which roster system to use, this defines if a database backend,
|
||||
@ -53,10 +57,65 @@ Options
|
||||
the more running process the faster communication should be, default
|
||||
is 25.
|
||||
|
||||
.. option:: --extra-filerefs=EXTRA_FILEREFS
|
||||
|
||||
Pass in extra files to include in the state tarball.
|
||||
|
||||
.. option:: --min-extra-modules=MIN_EXTRA_MODS
|
||||
|
||||
One or comma-separated list of extra Python modulesto be included
|
||||
into Minimal Salt.
|
||||
|
||||
.. option:: --thin-extra-modules=THIN_EXTRA_MODS
|
||||
|
||||
One or comma-separated list of extra Python modulesto be included
|
||||
into Thin Salt.
|
||||
|
||||
.. option:: -v, --verbose
|
||||
|
||||
Turn on command verbosity, display jid.
|
||||
|
||||
.. option:: -s, --static
|
||||
|
||||
Return the data from minions as a group after they all return.
|
||||
|
||||
.. option:: -w, --wipe
|
||||
|
||||
Remove the deployment of the salt files when done executing.
|
||||
|
||||
.. option:: -W, --rand-thin-dir
|
||||
|
||||
Select a random temp dir to deploy on the remote system. The dir
|
||||
will be cleaned after the execution.
|
||||
|
||||
.. option:: -t, --regen-thin, --thin
|
||||
|
||||
Trigger a thin tarball regeneration. This is needed if custom
|
||||
grains/modules/states have been added or updated.
|
||||
|
||||
.. option:: --python2-bin=PYTHON2_BIN
|
||||
|
||||
Path to a python2 binary which has salt installed.
|
||||
|
||||
.. option:: --python3-bin=PYTHON3_BIN
|
||||
|
||||
Path to a python3 binary which has salt installed.
|
||||
|
||||
.. option:: --jid=JID
|
||||
|
||||
Pass a JID to be used instead of generating one.
|
||||
|
||||
Authentication Options
|
||||
----------------------
|
||||
|
||||
.. option:: --priv=SSH_PRIV
|
||||
|
||||
Specify the SSH private key file to be used for authentication.
|
||||
|
||||
.. option:: -i, --ignore-host-keys
|
||||
|
||||
Disables StrictHostKeyChecking to relax acceptance of new and unknown
|
||||
host keys.
|
||||
By default ssh host keys are honored and connections will ask for
|
||||
approval. Use this option to disable StrictHostKeyChecking.
|
||||
|
||||
.. option:: --no-host-keys
|
||||
|
||||
@ -64,27 +123,51 @@ Options
|
||||
would ask for approval. Useful if the host key of a remote server has
|
||||
changed and would still error with --ignore-host-keys.
|
||||
|
||||
.. option:: --user=SSH_USER
|
||||
|
||||
Set the default user to attempt to use when authenticating.
|
||||
|
||||
.. option:: --passwd
|
||||
|
||||
Set the default password to attempt to use when authenticating.
|
||||
|
||||
.. option:: --askpass
|
||||
|
||||
Interactively ask for the SSH password with no echo - avoids password
|
||||
in process args and stored in history.
|
||||
|
||||
.. option:: --key-deploy
|
||||
|
||||
Set this flag to attempt to deploy the authorized ssh key with all
|
||||
minions. This combined with --passwd can make initial deployment of keys
|
||||
very fast and easy.
|
||||
|
||||
.. program:: salt
|
||||
.. option:: --identities-only
|
||||
|
||||
.. include:: _includes/common-options.rst
|
||||
Use the only authentication identity files configured in the ssh_config
|
||||
files. See IdentitiesOnly flag in man ssh_config.
|
||||
|
||||
.. include:: _includes/target-selection-ssh.rst
|
||||
.. option:: --sudo
|
||||
|
||||
Run command via sudo.
|
||||
|
||||
Scan Roster Options
|
||||
-------------------
|
||||
|
||||
.. option:: --scan-ports=SSH_SCAN_PORTS
|
||||
|
||||
Comma-separated list of ports to scan in the scan roster.
|
||||
|
||||
.. option:: --scan-timeout=SSH_SCAN_TIMEOUT
|
||||
|
||||
Scanning socket timeout for the scan roster.
|
||||
|
||||
.. include:: _includes/logging-options.rst
|
||||
.. |logfile| replace:: /var/log/salt/ssh
|
||||
.. |loglevel| replace:: ``warning``
|
||||
|
||||
.. include:: _includes/target-selection-ssh.rst
|
||||
|
||||
.. include:: _includes/output-options.rst
|
||||
|
||||
|
||||
|
@ -92,28 +92,31 @@ def halt(timeout=5, in_seconds=False):
|
||||
Halt a running system.
|
||||
|
||||
Args:
|
||||
timeout (int): Number of seconds before halting the system. Default is
|
||||
5 seconds.
|
||||
|
||||
in_seconds (bool): Whether to treat timeout as seconds or minutes.
|
||||
timeout (int):
|
||||
Number of seconds before halting the system. Default is 5 seconds.
|
||||
|
||||
in_seconds (bool):
|
||||
Whether to treat timeout as seconds or minutes.
|
||||
|
||||
.. versionadded:: 2015.8.0
|
||||
|
||||
Returns:
|
||||
bool: True if successful, otherwise False
|
||||
bool: ``True`` if successful, otherwise ``False``
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt '*' system.halt 5
|
||||
salt '*' system.halt 5 True
|
||||
'''
|
||||
return shutdown(timeout=timeout, in_seconds=in_seconds)
|
||||
|
||||
|
||||
def init(runlevel): # pylint: disable=unused-argument
|
||||
'''
|
||||
Change the system runlevel on sysV compatible systems
|
||||
Change the system runlevel on sysV compatible systems. Not applicable to
|
||||
Windows
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -136,14 +139,18 @@ def poweroff(timeout=5, in_seconds=False):
|
||||
Power off a running system.
|
||||
|
||||
Args:
|
||||
timeout (int): Number of seconds before powering off the system. Default
|
||||
is 5 seconds.
|
||||
|
||||
in_seconds (bool): Whether to treat timeout as seconds or minutes.
|
||||
timeout (int):
|
||||
Number of seconds before powering off the system. Default is 5
|
||||
seconds.
|
||||
|
||||
in_seconds (bool):
|
||||
Whether to treat timeout as seconds or minutes.
|
||||
|
||||
.. versionadded:: 2015.8.0
|
||||
|
||||
Returns:
|
||||
bool: True if successful, otherwise False
|
||||
bool: ``True`` if successful, otherwise ``False``
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -160,29 +167,35 @@ def reboot(timeout=5, in_seconds=False, wait_for_reboot=False, # pylint: disabl
|
||||
Reboot a running system.
|
||||
|
||||
Args:
|
||||
timeout (int): Number of minutes/seconds before rebooting the system.
|
||||
Minutes vs seconds depends on the value of ``in_seconds``. Default
|
||||
|
||||
timeout (int):
|
||||
The number of minutes/seconds before rebooting the system. Use of
|
||||
minutes or seconds depends on the value of ``in_seconds``. Default
|
||||
is 5 minutes.
|
||||
|
||||
in_seconds (bool): Whether to treat timeout as seconds or minutes.
|
||||
in_seconds (bool):
|
||||
``True`` will cause the ``timeout`` parameter to be in seconds.
|
||||
``False`` will be in minutes. Default is ``False``.
|
||||
|
||||
.. versionadded:: 2015.8.0
|
||||
|
||||
wait_for_reboot (bool): Sleeps for timeout + 30 seconds after reboot has
|
||||
been initiated. This may be useful for use in a highstate if a
|
||||
reboot should be performed and the return data of the highstate is
|
||||
not required. If return data is required, consider using the reboot
|
||||
state instead of this module.
|
||||
wait_for_reboot (bool)
|
||||
``True`` will sleep for timeout + 30 seconds after reboot has been
|
||||
initiated. This is useful for use in a highstate. For example, you
|
||||
may have states that you want to apply only after the reboot.
|
||||
Default is ``False``.
|
||||
|
||||
.. versionadded:: 2015.8.0
|
||||
|
||||
only_on_pending_reboot (bool): If this is set to True, then the reboot
|
||||
will only proceed if the system reports a pending reboot. To
|
||||
optionally reboot in a highstate, consider using the reboot state
|
||||
instead of this module.
|
||||
only_on_pending_reboot (bool):
|
||||
If this is set to ``True``, then the reboot will only proceed
|
||||
if the system reports a pending reboot. Setting this parameter to
|
||||
``True`` could be useful when calling this function from a final
|
||||
housekeeping state intended to be executed at the end of a state run
|
||||
(using *order: last*). Default is ``False``.
|
||||
|
||||
Returns:
|
||||
bool: True if successful (a reboot will occur), otherwise False
|
||||
bool: ``True`` if successful (a reboot will occur), otherwise ``False``
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -191,20 +204,16 @@ def reboot(timeout=5, in_seconds=False, wait_for_reboot=False, # pylint: disabl
|
||||
salt '*' system.reboot 5
|
||||
salt '*' system.reboot 5 True
|
||||
|
||||
As example of invoking this function from within a final housekeeping state
|
||||
is as follows:
|
||||
|
||||
Example:
|
||||
Invoking this function from a final housekeeping state:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
final housekeeping:
|
||||
final_housekeeping:
|
||||
module.run:
|
||||
- name: system.reboot
|
||||
- only_on_pending_reboot: True
|
||||
- order: last
|
||||
'''
|
||||
|
||||
ret = shutdown(timeout=timeout, reboot=True, in_seconds=in_seconds,
|
||||
only_on_pending_reboot=only_on_pending_reboot)
|
||||
|
||||
@ -221,50 +230,63 @@ def shutdown(message=None, timeout=5, force_close=True, reboot=False, # pylint:
|
||||
Shutdown a running system.
|
||||
|
||||
Args:
|
||||
message (str): A message to display to the user before shutting down.
|
||||
|
||||
timeout (int): The length of time that the shutdown dialog box should be
|
||||
displayed, in seconds. While this dialog box is displayed, the
|
||||
shutdown can be stopped by the shutdown_abort function.
|
||||
message (str):
|
||||
The message to display to the user before shutting down.
|
||||
|
||||
timeout (int):
|
||||
The length of time (in seconds) that the shutdown dialog box should
|
||||
be displayed. While this dialog box is displayed, the shutdown can
|
||||
be aborted using the ``system.shutdown_abort`` function.
|
||||
|
||||
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.
|
||||
user who called the function, 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 (system
|
||||
modal). The dialog box can be moved but not closed. A timer counts
|
||||
down the remaining time before the shutdown occurs.
|
||||
|
||||
If timeout is zero, the computer shuts down without displaying the
|
||||
dialog box, and the shutdown cannot be stopped by shutdown_abort.
|
||||
If timeout is zero, the computer shuts down immediately without
|
||||
displaying the dialog box and cannot be stopped by
|
||||
``system.shutdown_abort``.
|
||||
|
||||
Default is 5 minutes
|
||||
|
||||
in_seconds (bool): Whether to treat timeout as seconds or minutes.
|
||||
in_seconds (bool):
|
||||
``True`` will cause the ``timeout`` parameter to be in seconds.
|
||||
``False`` will be in minutes. Default is ``False``.
|
||||
|
||||
.. versionadded:: 2015.8.0
|
||||
|
||||
force_close (bool): True to force close all open applications. False
|
||||
displays a dialog box instructing the user to close the
|
||||
applications.
|
||||
force_close (bool):
|
||||
``True`` will force close all open applications. ``False`` will
|
||||
display a dialog box instructing the user to close open
|
||||
applications. Default is ``True``.
|
||||
|
||||
reboot (bool): True restarts the computer immediately after shutdown.
|
||||
False caches to disk and safely powers down the system.
|
||||
reboot (bool):
|
||||
``True`` restarts the computer immediately after shutdown. ``False``
|
||||
powers down the system. Default is ``False``.
|
||||
|
||||
only_on_pending_reboot (bool): If this is set to True, then the shutdown
|
||||
will only proceed if the system reports a pending reboot. To
|
||||
optionally shutdown in a highstate, consider using the shutdown
|
||||
state instead of this module.
|
||||
|
||||
only_on_pending_reboot (bool):
|
||||
If ``True`` the shutdown will only proceed if there is a reboot
|
||||
pending. ``False`` will shutdown the system. Default is ``False``.
|
||||
|
||||
Returns:
|
||||
bool: True if successful (a shutdown or reboot will occur), otherwise
|
||||
False
|
||||
bool:
|
||||
``True`` if successful (a shutdown or reboot will occur), otherwise
|
||||
``False``
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt '*' system.shutdown 5
|
||||
salt '*' system.shutdown "System will shutdown in 5 minutes"
|
||||
'''
|
||||
if six.PY2:
|
||||
message = _to_unicode(message)
|
||||
@ -294,7 +316,7 @@ def shutdown_hard():
|
||||
Shutdown a running system with no timeout or warning.
|
||||
|
||||
Returns:
|
||||
bool: True if successful, otherwise False
|
||||
bool: ``True`` if successful, otherwise ``False``
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -312,7 +334,7 @@ def shutdown_abort():
|
||||
aborted.
|
||||
|
||||
Returns:
|
||||
bool: True if successful, otherwise False
|
||||
bool: ``True`` if successful, otherwise ``False``
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -337,7 +359,7 @@ def lock():
|
||||
Lock the workstation.
|
||||
|
||||
Returns:
|
||||
bool: True if successful, otherwise False
|
||||
bool: ``True`` if successful, otherwise ``False``
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -353,12 +375,14 @@ def set_computer_name(name):
|
||||
Set the Windows computer name
|
||||
|
||||
Args:
|
||||
name (str): The new name to give the computer. Requires a reboot to take
|
||||
effect.
|
||||
|
||||
name (str):
|
||||
The new name to give the computer. Requires a reboot to take effect.
|
||||
|
||||
Returns:
|
||||
dict: Returns a dictionary containing the old and new names if
|
||||
successful. False if not.
|
||||
dict:
|
||||
Returns a dictionary containing the old and new names if successful.
|
||||
``False`` if not.
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -389,7 +413,9 @@ def get_pending_computer_name():
|
||||
error message will be logged to the minion log.
|
||||
|
||||
Returns:
|
||||
str: The pending name if restart is pending, otherwise returns None.
|
||||
str:
|
||||
Returns the pending name if pending restart. Returns ``None`` if not
|
||||
pending restart.
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -412,7 +438,7 @@ def get_computer_name():
|
||||
Get the Windows computer name
|
||||
|
||||
Returns:
|
||||
str: Returns the computer name if found. Otherwise returns False
|
||||
str: Returns the computer name if found. Otherwise returns ``False``.
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -429,10 +455,12 @@ def set_computer_desc(desc=None):
|
||||
Set the Windows computer description
|
||||
|
||||
Args:
|
||||
desc (str): The computer description
|
||||
|
||||
desc (str):
|
||||
The computer description
|
||||
|
||||
Returns:
|
||||
bool: True if successful, otherwise False
|
||||
str: Description if successful, otherwise ``False``
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -475,8 +503,8 @@ def get_system_info():
|
||||
Get system information.
|
||||
|
||||
Returns:
|
||||
dict: Returns a Dictionary containing information about the system to
|
||||
include name, description, version, etc...
|
||||
dict: Dictionary containing information about the system to include
|
||||
name, description, version, etc...
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -529,7 +557,8 @@ def get_computer_desc():
|
||||
Get the Windows computer description
|
||||
|
||||
Returns:
|
||||
str: The computer description if found, otherwise False
|
||||
str: Returns the computer description if found. Otherwise returns
|
||||
``False``.
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -546,12 +575,12 @@ get_computer_description = salt.utils.alias_function(get_computer_desc, 'get_com
|
||||
|
||||
def get_hostname():
|
||||
'''
|
||||
.. versionadded:: 2016.3.0
|
||||
|
||||
Get the hostname of the windows minion
|
||||
|
||||
.. versionadded:: 2016.3.0
|
||||
|
||||
Returns:
|
||||
str: The hostname of the windows minion
|
||||
str: Returns the hostname of the windows minion
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -566,16 +595,16 @@ def get_hostname():
|
||||
|
||||
def set_hostname(hostname):
|
||||
'''
|
||||
.. versionadded:: 2016.3.0
|
||||
Set the hostname of the windows minion, requires a restart before this will
|
||||
be updated.
|
||||
|
||||
Set the hostname of the windows minion, requires a restart before this
|
||||
will be updated.
|
||||
.. versionadded:: 2016.3.0
|
||||
|
||||
Args:
|
||||
hostname (str): The hostname to set
|
||||
|
||||
Returns:
|
||||
bool: True if successful, otherwise False
|
||||
bool: ``True`` if successful, otherwise ``False``
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -597,37 +626,41 @@ def join_domain(domain,
|
||||
account_exists=False,
|
||||
restart=False):
|
||||
'''
|
||||
Join a computer to an Active Directory domain. Requires reboot.
|
||||
Join a computer to an Active Directory domain. Requires a reboot.
|
||||
|
||||
Args:
|
||||
domain (str): The domain to which the computer should be joined, e.g.
|
||||
|
||||
domain (str):
|
||||
The domain to which the computer should be joined, e.g.
|
||||
``example.com``
|
||||
|
||||
username (str): Username of an account which is authorized to join
|
||||
computers to the specified domain. Need to be either fully qualified
|
||||
like ``user@domain.tld`` or simply ``user``
|
||||
username (str):
|
||||
Username of an account which is authorized to join computers to the
|
||||
specified domain. Needs to be either fully qualified like
|
||||
``user@domain.tld`` or simply ``user``
|
||||
|
||||
password (str): Password of the specified user
|
||||
password (str):
|
||||
Password of the specified user
|
||||
|
||||
account_ou (str): The DN of the OU below which the account for this
|
||||
computer should be created when joining the domain, e.g.
|
||||
account_ou (str):
|
||||
The DN of the OU below which the account for this computer should be
|
||||
created when joining the domain, e.g.
|
||||
``ou=computers,ou=departm_432,dc=my-company,dc=com``
|
||||
|
||||
account_exists (bool): If set to ``True`` the computer will only join
|
||||
the domain if the account already exists. If set to ``False`` the
|
||||
computer account will be created if it does not exist, otherwise it
|
||||
will use the existing account. Default is False.
|
||||
account_exists (bool):
|
||||
If set to ``True`` the computer will only join the domain if the
|
||||
account already exists. If set to ``False`` the computer account
|
||||
will be created if it does not exist, otherwise it will use the
|
||||
existing account. Default is ``False``
|
||||
|
||||
restart (bool): Restarts the computer after a successful join
|
||||
restart (bool):
|
||||
``True`` will restart the computer after a successful join. Default
|
||||
is ``False``
|
||||
|
||||
.. versionadded:: 2015.8.2/2015.5.7
|
||||
|
||||
Returns:
|
||||
dict: Dictionary if successful
|
||||
|
||||
Raises:
|
||||
CommandExecutionError: Raises an error if _join_domain returns anything
|
||||
other than 0
|
||||
dict: Returns a dictionary if successful, otherwise ``False``
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -741,33 +774,41 @@ def unjoin_domain(username=None,
|
||||
disable=False,
|
||||
restart=False):
|
||||
r'''
|
||||
Unjoin a computer from an Active Directory Domain. Requires restart.
|
||||
Unjoin a computer from an Active Directory Domain. Requires a restart.
|
||||
|
||||
Args:
|
||||
username (str): Username of an account which is authorized to manage
|
||||
computer accounts on the domain. Need to be fully qualified like
|
||||
``user@domain.tld`` or ``domain.tld\user``. If domain not specified,
|
||||
the passed domain will be used. If computer account doesn't need to
|
||||
be disabled, can be None.
|
||||
|
||||
password (str): Password of the specified user
|
||||
username (str):
|
||||
Username of an account which is authorized to manage computer
|
||||
accounts on the domain. Needs to be a fully qualified name like
|
||||
``user@domain.tld`` or ``domain.tld\user``. If the domain is not
|
||||
specified, the passed domain will be used. If the computer account
|
||||
doesn't need to be disabled after the computer is unjoined, this can
|
||||
be ``None``.
|
||||
|
||||
domain (str): The domain from which to unjoin the computer. Can be None.
|
||||
password (str):
|
||||
The password of the specified user
|
||||
|
||||
workgroup (str): The workgroup to join the computer to. Default is
|
||||
``WORKGROUP``
|
||||
domain (str):
|
||||
The domain from which to unjoin the computer. Can be ``None``
|
||||
|
||||
workgroup (str):
|
||||
The workgroup to join the computer to. Default is ``WORKGROUP``
|
||||
|
||||
.. versionadded:: 2015.8.2/2015.5.7
|
||||
|
||||
disable (bool): Disable the computer account in Active Directory. True
|
||||
to disable. Default is False
|
||||
disable (bool):
|
||||
``True`` to disable the computer account in Active Directory.
|
||||
Default is ``False``
|
||||
|
||||
restart (bool): Restart the computer after successful unjoin
|
||||
restart (bool):
|
||||
``True`` will restart the computer after successful unjoin. Default
|
||||
is ``False``
|
||||
|
||||
.. versionadded:: 2015.8.2/2015.5.7
|
||||
|
||||
Returns:
|
||||
dict: Dictionary if successful, otherwise False
|
||||
dict: Returns a dictionary if successful, otherwise ``False``
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -859,15 +900,16 @@ def get_domain_workgroup():
|
||||
|
||||
def _try_parse_datetime(time_str, fmts):
|
||||
'''
|
||||
Attempts to parse the input time_str as a date.
|
||||
A helper function that attempts to parse the input time_str as a date.
|
||||
|
||||
Args:
|
||||
|
||||
time_str (str): A string representing the time
|
||||
|
||||
fmts (list): A list of date format strings
|
||||
|
||||
Returns:
|
||||
datetime: A datetime object if parsed properly, otherwise None
|
||||
datetime: Returns a datetime object if parsed properly, otherwise None
|
||||
'''
|
||||
result = None
|
||||
for fmt in fmts:
|
||||
@ -910,7 +952,9 @@ def set_system_time(newtime):
|
||||
Set the system time.
|
||||
|
||||
Args:
|
||||
newtime (str): The time to set. Can be any of the following formats.
|
||||
|
||||
newtime (str):
|
||||
The time to set. Can be any of the following formats:
|
||||
|
||||
- HH:MM:SS AM/PM
|
||||
- HH:MM AM/PM
|
||||
@ -918,7 +962,7 @@ def set_system_time(newtime):
|
||||
- HH:MM (24 hour)
|
||||
|
||||
Returns:
|
||||
bool: True if successful, otherwise False
|
||||
bool: ``True`` if successful, otherwise ``False``
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -951,24 +995,16 @@ def set_system_date_time(years=None,
|
||||
system year will be used. (Used by set_system_date and set_system_time)
|
||||
|
||||
Args:
|
||||
|
||||
years (int): Years digit, ie: 2015
|
||||
|
||||
months (int): Months digit: 1 - 12
|
||||
|
||||
days (int): Days digit: 1 - 31
|
||||
|
||||
hours (int): Hours digit: 0 - 23
|
||||
|
||||
minutes (int): Minutes digit: 0 - 59
|
||||
|
||||
seconds (int): Seconds digit: 0 - 59
|
||||
|
||||
Returns:
|
||||
bool: True if successful
|
||||
|
||||
Raises:
|
||||
CommandExecutionError: Raises an error if ``SetLocalTime`` function
|
||||
fails
|
||||
bool: ``True`` if successful, otherwise ``False``
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -1037,7 +1073,7 @@ def get_system_date():
|
||||
Get the Windows system date
|
||||
|
||||
Returns:
|
||||
str: The system date
|
||||
str: Returns the system date
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -1054,7 +1090,8 @@ def set_system_date(newdate):
|
||||
Set the Windows system date. Use <mm-dd-yy> format for the date.
|
||||
|
||||
Args:
|
||||
newdate (str): The date to set. Can be any of the following formats:
|
||||
newdate (str):
|
||||
The date to set. Can be any of the following formats
|
||||
|
||||
- YYYY-MM-DD
|
||||
- MM-DD-YYYY
|
||||
@ -1063,6 +1100,9 @@ def set_system_date(newdate):
|
||||
- MM/DD/YY
|
||||
- YYYY/MM/DD
|
||||
|
||||
Returns:
|
||||
bool: ``True`` if successful, otherwise ``False``
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
@ -1087,7 +1127,7 @@ def start_time_service():
|
||||
Start the Windows time service
|
||||
|
||||
Returns:
|
||||
bool: True if successful, otherwise False.
|
||||
bool: ``True`` if successful, otherwise ``False``
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -1103,7 +1143,7 @@ def stop_time_service():
|
||||
Stop the Windows time service
|
||||
|
||||
Returns:
|
||||
bool: True if successful, otherwise False
|
||||
bool: ``True`` if successful, otherwise ``False``
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -1122,7 +1162,8 @@ def get_pending_component_servicing():
|
||||
.. versionadded:: 2016.11.0
|
||||
|
||||
Returns:
|
||||
bool: True if a reboot is pending, otherwise False.
|
||||
bool: ``True`` if there are pending Component Based Servicing tasks,
|
||||
otherwise ``False``
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -1146,12 +1187,14 @@ def get_pending_component_servicing():
|
||||
|
||||
def get_pending_domain_join():
|
||||
'''
|
||||
Determine whether there is a pending domain join action that requires a reboot.
|
||||
Determine whether there is a pending domain join action that requires a
|
||||
reboot.
|
||||
|
||||
.. versionadded:: 2016.11.0
|
||||
|
||||
Returns:
|
||||
bool: True if a reboot is pending, otherwise False.
|
||||
bool: ``True`` if there is a pending domain join action, otherwise
|
||||
``False``
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -1193,7 +1236,8 @@ def get_pending_file_rename():
|
||||
.. versionadded:: 2016.11.0
|
||||
|
||||
Returns:
|
||||
bool: True if a reboot is pending, otherwise False.
|
||||
bool: ``True`` if there are pending file rename operations, otherwise
|
||||
``False``
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -1228,7 +1272,8 @@ def get_pending_servermanager():
|
||||
.. versionadded:: 2016.11.0
|
||||
|
||||
Returns:
|
||||
bool: True if a reboot is pending, otherwise False.
|
||||
bool: ``True`` if there are pending Server Manager tasks, otherwise
|
||||
``False``
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -1265,7 +1310,7 @@ def get_pending_update():
|
||||
.. versionadded:: 2016.11.0
|
||||
|
||||
Returns:
|
||||
bool: True if a reboot is pending, otherwise False.
|
||||
bool: ``True`` if there are pending updates, otherwise ``False``
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -1305,14 +1350,14 @@ def set_reboot_required_witnessed():
|
||||
current boot session. Also, in the scope of this key, the name *'Reboot
|
||||
required'* will be assigned the value of *1*.
|
||||
|
||||
(For the time being, this this function is being used whenever an install
|
||||
completes with exit code 3010 and this usage can be extended where
|
||||
appropriate in the future.)
|
||||
For the time being, this function is being used whenever an install
|
||||
completes with exit code 3010 and can be extended where appropriate in the
|
||||
future.
|
||||
|
||||
.. versionadded:: 2016.11.0
|
||||
|
||||
Returns:
|
||||
bool: True if registry entry set successfuly, otherwise False.
|
||||
bool: ``True`` if successful, otherwise ``False``
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -1330,16 +1375,18 @@ def set_reboot_required_witnessed():
|
||||
|
||||
def get_reboot_required_witnessed():
|
||||
'''
|
||||
This tells us if, at any time during the current boot session the salt
|
||||
minion witnessed an event indicating that a reboot is required. (For the
|
||||
time being, this function will return True if an install completed with exit
|
||||
code 3010 during the current boot session and this usage can be extended
|
||||
where appropriate in the future)
|
||||
Determine if at any time during the current boot session the salt minion
|
||||
witnessed an event indicating that a reboot is required.
|
||||
|
||||
This function will return ``True`` if an install completed with exit
|
||||
code 3010 during the current boot session and can be extended where
|
||||
appropriate in the future.
|
||||
|
||||
.. versionadded:: 2016.11.0
|
||||
|
||||
Returns:
|
||||
bool: True if reboot required, otherwise False.
|
||||
bool: ``True`` if the ``Requires reboot`` registry flag is set to ``1``,
|
||||
otherwise ``False``
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -1361,7 +1408,7 @@ def get_pending_reboot():
|
||||
.. versionadded:: 2016.11.0
|
||||
|
||||
Returns:
|
||||
bool: True if pending reboot, otherwise False.
|
||||
bool: ``True`` if the system is pending reboot, otherwise ``False``
|
||||
|
||||
CLI Example:
|
||||
|
||||
|
@ -300,7 +300,7 @@ def present(name,
|
||||
|
||||
identifier
|
||||
Custom-defined identifier for tracking the cron line for future crontab
|
||||
edits. This defaults to the state id
|
||||
edits. This defaults to the state name
|
||||
|
||||
special
|
||||
A special keyword to specify periodicity (eg. @reboot, @hourly...).
|
||||
@ -387,7 +387,7 @@ def absent(name,
|
||||
|
||||
identifier
|
||||
Custom-defined identifier for tracking the cron line for future crontab
|
||||
edits. This defaults to the state id
|
||||
edits. This defaults to the state name
|
||||
|
||||
special
|
||||
The special keyword used in the job (eg. @reboot, @hourly...).
|
||||
|
Loading…
Reference in New Issue
Block a user