Saltstack module freezer 详解

freezer.restore

Make sure that the system contains the packages and repos from a
frozen state.

Read the list of packages and repositories from the freeze file,
and compare it with the current list of packages and repos. If
there is any difference, all the missing packages are repos will
be installed, and all the extra packages and repos will be
removed.

As this module is build on top of the pkg module, the user can
send extra attributes to the underlying pkg module via kwargs.
This function will call ``pkg.list_repos``, ``pkg.mod_repo``,
``pkg.list_pkgs``, ``pkg.install``, ``pkg.remove`` and
``pkg.del_repo``, and any additional arguments will be passed
through to those functions.

name
    Name of the frozen state. Optional.

clean
    If True remove the frozen information YAML from the cache

    New in version 3000

CLI Example:

    salt '*' freezer.restore
    salt '*' freezer.restore root=/chroot

freezer.freeze

Save the list of package and repos in a freeze file.

As this module is build on top of the pkg module, the user can
send extra attributes to the underlying pkg module via kwargs.
This function will call ``pkg.list_pkgs`` and ``pkg.list_repos``,
and any additional arguments will be passed through to those
functions.

name
    Name of the frozen state. Optional.

force
    If true, overwrite the state. Optional.

CLI Example:

    salt '*' freezer.freeze
    salt '*' freezer.freeze pre_install
    salt '*' freezer.freeze force=True root=/chroot

freezer.fopen

Wrapper around open() built-in to set CLOEXEC on the fd.

This flag specifies that the file descriptor should be closed when an exec
function is invoked;

When a file descriptor is allocated (as with open or dup), this bit is
initially cleared on the new file descriptor, meaning that descriptor will
survive into the new program after exec.

NB! We still have small race condition between open and fcntl.

freezer.list

Return the list of frozen states.

CLI Example:

    salt '*' freezer.list

freezer.status

Return True if there is already a frozen state.

A frozen state is merely a list of packages (including the
version) in a specific time. This information can be used to
compare with the current list of packages, and revert the
installation of some extra packages that are in the system.

name
    Name of the frozen state. Optional.

CLI Example:

    salt '*' freezer.status
    salt '*' freezer.status pre_install

freezer.clean_kwargs

Return a dict without any of the __pub* keys (or any other keys starting
with a dunder) from the kwargs dict passed into the execution module
functions. These keys are useful for tracking what was used to invoke
the function call, but they may not be desirable to have if passing the
kwargs forward wholesale.

Usage example:

    kwargs = __utils__['args.clean_kwargs'](**kwargs)
posted @ 2020-03-28 20:59  random_lee  阅读(142)  评论(0编辑  收藏  举报