Update kernelpkg documentation

This commit is contained in:
Adam Mendlik 2017-08-16 17:29:07 -06:00
parent 9f5682f076
commit 898d69b1e1
4 changed files with 39 additions and 15 deletions

View File

@ -13,7 +13,7 @@ salt.modules.kernelpkg
Execution Module Used for
============================================ ========================================
:py:mod:`~salt.modules.kernelpkg_linux_apt` Debian/Ubuntu-based distros which use
``apt-get(8)`` for package management
``apt-get`` for package management
:py:mod:`~salt.modules.kernelpkg_linux_yum` RedHat-based distros and derivatives
using ``yum(8)`` or ``dnf(8)``
using ``yum`` or ``dnf``
============================================ ========================================

View File

@ -116,9 +116,9 @@ def latest_installed():
.. note::
This function may not return the same value as
:py:func:`~salt.modules.kernelpkg.active` if a new kernel
:py:func:`~salt.modules.kernelpkg_linux_apt.active` if a new kernel
has been installed and the system has not yet been rebooted.
The :py:func:`~salt.modules.kernelpkg.needs_reboot` function
The :py:func:`~salt.modules.kernelpkg_linux_apt.needs_reboot` function
exists to detect this condition.
'''
pkgs = list_installed()
@ -206,8 +206,14 @@ def remove(release):
release
The release number of an installed kernel. This must be the entire release
number as returned by :py:func:`~salt.modules.kernelpkg.list_installed`,
number as returned by :py:func:`~salt.modules.kernelpkg_linux_apt.list_installed`,
not the package name.
CLI Example:
.. code-block:: bash
salt '*' kernelpkg.remove 4.4.0-70-generic
'''
if release not in list_installed():
raise CommandExecutionError('Kernel release \'{0}\' is not installed'.format(release))
@ -231,6 +237,12 @@ def cleanup(keep_latest=True):
In the event that the active kernel is not the latest one installed, setting this to True
will retain the latest kernel package, in addition to the active one. If False, all kernel
packages other than the active one will be removed.
CLI Example:
.. code-block:: bash
salt '*' kernelpkg.cleanup
'''
removed = []

View File

@ -108,9 +108,9 @@ def latest_installed():
.. note::
This function may not return the same value as
:py:func:`~salt.modules.kernelpkg.active` if a new kernel
:py:func:`~salt.modules.kernelpkg_linux_yum.active` if a new kernel
has been installed and the system has not yet been rebooted.
The :py:func:`~salt.modules.kernelpkg.needs_reboot` function
The :py:func:`~salt.modules.kernelpkg_linux_yum.needs_reboot` function
exists to detect this condition.
'''
pkgs = list_installed()
@ -197,8 +197,14 @@ def remove(release):
release
The release number of an installed kernel. This must be the entire release
number as returned by :py:func:`~salt.modules.kernelpkg.list_installed`,
number as returned by :py:func:`~salt.modules.kernelpkg_linux_yum.list_installed`,
not the package name.
CLI Example:
.. code-block:: bash
salt '*' kernelpkg.remove 3.10.0-327.el7
'''
if release not in list_installed():
raise CommandExecutionError('Kernel release \'{0}\' is not installed'.format(release))
@ -247,6 +253,12 @@ def cleanup(keep_latest=True):
In the event that the active kernel is not the latest one installed, setting this to True
will retain the latest kernel package, in addition to the active one. If False, all kernel
packages other than the active one will be removed.
CLI Example:
.. code-block:: bash
salt '*' kernelpkg.cleanup
'''
removed = []

View File

@ -52,7 +52,7 @@ log = logging.getLogger(__name__)
def __virtual__():
'''
Only make these states available if a pkg provider has been detected or
Only make these states available if a kernelpkg provider has been detected or
assigned for this minion
'''
return 'kernelpkg.upgrade' in __salt__
@ -67,8 +67,8 @@ def latest_installed(name, **kwargs): # pylint: disable=unused-argument
This state only installs the kernel, but does not activate it.
The new kernel should become active at the next reboot.
See :mod:`kernelpkg.needs_reboot <salt.modules.kernelpkg.needs_reboot>` for details on
how to detect this condition, :mod:`kernelpkg.latest_active <salt.states.kernelpkg.latest_active>`
See :py:func:`kernelpkg.needs_reboot <salt.modules.kernelpkg_linux_yum.needs_reboot>` for details on
how to detect this condition, and :py:func:`~salt.states.kernelpkg.latest_active`
to initiale a reboot when needed.
name
@ -113,8 +113,8 @@ def latest_active(name, at_time=None, **kwargs): # pylint: disable=unused-argum
system. If the running version is not the latest one installed, this
state will reboot the system.
See :mod:`kernelpkg.upgrade <salt.modules.kernelpkg.upgrade>` and
:mod:`kernelpkg.latest_installed <salt.states.kernelpkg.latest_installed>`
See :py:func:`kernelpkg.upgrade <salt.modules.kernelpkg_linux_yum.upgrade>` and
:py:func:`~salt.states.kernelpkg.latest_installed`
for ways to install new kernel packages.
This module does not attempt to understand or manage boot loader configurations
@ -124,7 +124,7 @@ def latest_active(name, at_time=None, **kwargs): # pylint: disable=unused-argum
Because this state function may cause the system to reboot, it may be preferable
to move it to the very end of the state run.
See :mod:`kernelpkg.latest_wait <salt.states.kernelpkg.latest_wait>`
See :py:func:`~salt.states.kernelpkg.latest_wait`
for a waitable state that can be called with the `listen` requesite.
name
@ -170,7 +170,7 @@ def latest_active(name, at_time=None, **kwargs): # pylint: disable=unused-argum
def latest_wait(name, at_time=None, **kwargs): # pylint: disable=unused-argument
'''
Initiate a reboot if the running kernel is not the latest one installed. This is the
waitable version of :mod:`kernelpkg.latest_active <salt.states.kernelpkg.latest_active>` and
waitable version of :py:func:`~salt.states.kernelpkg.latest_active` and
will not take any action unless triggered by a watch or listen requesite.
.. note::