Merge pull request #50508 from damon-atkins/win_pkg_min_repo

Set Windows winrepo_cache_expire_min improve performance for windows package processing
This commit is contained in:
Mike Place 2018-11-16 12:40:21 -07:00 committed by GitHub
commit fa2dda85a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 22 deletions

View File

@ -3240,7 +3240,7 @@ have other services that need to go with it.
.. versionadded:: 2016.11.0
Default: ``0``
Default: ``1800``
If set to a nonzero integer, then passing ``refresh=True`` to functions in the
:mod:`windows pkg module <salt.modules.win_pkg>` will not refresh the windows

View File

@ -1183,6 +1183,7 @@ The :py:func:`event.send <salt.states.event.send>` state does not know the
results of the sent event, so returns changed every state run. It can now be
set to return changed or unchanged.
:py:mod:`influxdb_user.present <salt.states.influxdb_user>` Influxdb User Module State
---------------------------------------------------------------------------------------
@ -1211,6 +1212,18 @@ New behavior:
- user: admin
- password: adminpassword
:conf_minion:`winrepo_cache_expire_min` Windows Package Definitions Caching
---------------------------------------------------------------------------
The :conf_minion:`winrepo_cache_expire_min` has been changed from 0 to 1800 (30 minutes)
For example if you run highstate the package definitions are normally updated,
however now if the package definitions are younger than :conf_minion:`winrepo_cache_expire_min`
(30 minutes) the package definitions will not be refreshed, reducing the amount
of time taken to run a 2nd highstate. To get the old behaviour change the value
back to 0 in the minion configuration file. This also effects the behaviour of
other functions which default to refresh. The ``pkg.refresh_db`` will always
refresh the package definitions.
LDAP External Authentication
============================

View File

@ -62,6 +62,11 @@ the package repository.
salt -G 'os:windows' pkg.refresh_db
.. note::
Use ``pkg.refresh_db`` from 2016.11 when developing new Windows package
definitions to check for errors in the definitions against one or more
Windows minions.
Install Windows Software
========================
@ -182,7 +187,7 @@ by modifying or extending the :conf_master:`winrepo_remotes` and
``winrepo_remotes`` was called ``win_gitrepos`` in Salt versions earlier
than 2015.8.0
Package definitions are pulled down from the online repository by running the
Package definitions are pulled down from the online git repository by running the
:mod:`winrepo.update_git_repos <salt.runners.winrepo.update_git_repos>` runner.
This command is run on the master:
@ -204,9 +209,9 @@ This will pull down the software definition files for older minions
Additionally, when you run ``winrepo.genrepo`` and ``pkg.refresh_db`` the
entire contents under ``win/repo`` and ``win/repo-ng``, to include all
subdirectories, are used to create the msgpack file.
subdirectories, are used to create the meta database file.
The next step (if you have older minions) is to create the msgpack file for the
The next step (if you have older minions) is to create the meta database file for the
repo (``winrepo.p``). This is done by running the
:mod:`winrepo.genrepo <salt.runners.winrepo.genrepo>` runner. This is also run
on the master:
@ -229,8 +234,8 @@ on the master as well:
On older minions (older than 2015.8.0) this will copy the winrepo.p file down to
the minion. On newer minions (2015.8.0 and newer) this will copy all the
software definition files (.sls) down to the minion and then create the msgpack
file (``winrepo.p``) locally. The reason this is done locally is because the
software definition files (.sls) down to the minion and then create the meta
database file (``winrepo.p``) locally. The reason this is done locally is because the
jinja needs to be parsed using the minion's grains.
.. important::
@ -245,7 +250,7 @@ jinja needs to be parsed using the minion's grains.
If the ``winrepo.genrepo`` or the ``pkg.refresh_db`` fails, it is likely a
problem with the jinja in one of the software definition files. This will
cause the operations to stop. You'll need to fix the syntax in order for the
msgpack file to be created successfully.
meta database file to be created successfully.
To disable one of the repos, set it to an empty list ``[]`` in the master
config. For example, to disable :conf_master:`winrepo_remotes` set the following
@ -262,7 +267,7 @@ Creating a Package Definition SLS File
The package definition file is a yaml file that contains all the information
needed to install a piece of software using salt. It defines information about
the package to include version, full name, flags required for the installer and
uninstaller, whether or not to use the windows task scheduler to install the
uninstaller, whether or not to use the Windows task scheduler to install the
package, where to find the installation package, etc.
Take a look at this example for Firefox:
@ -623,20 +628,29 @@ proper relative path. For example, if the ``base`` environment in
into right location.
Config Options for Minions 2015.8.0 and Later
=============================================
Configeration options for Minions 2015.8.0 and later
====================================================
The :conf_minion:`winrepo_source_dir` config parameter (default:
``salt://win/repo``) controls where :mod:`pkg.refresh_db
<salt.modules.win_pkg.refresh_db>` looks for the cachefile (default:
``winrepo.p``). This means that the default location for the winrepo cachefile
would be ``salt://win/repo/winrepo.p``. Both :conf_minion:`winrepo_source_dir`
and :conf_minion:`winrepo_cachefile` can be adjusted to match the actual
location of this file on the Salt fileserver.
``salt://win/repo-ng/``) controls where :mod:`pkg.refresh_db <salt.modules.win_pkg.refresh_db>`
fetches the software package definitions. :mod:`pkg.refresh_db <salt.modules.win_pkg.refresh_db>`
generates meta database file called :conf_minion:`winrepo_cachefile` on the minion.
Cache configeration options for Minions 2016.11.0 and later
===========================================================
Software package definitions are automatically refresh if stale after
:conf_minion:`winrepo_cache_expire_max`. Running a highstate normal forces the refresh
of the package definition and generation of meta database, unless the meta database is younger
than :conf_minion:`winrepo_cache_expire_max`. Refreshing the package definition can take
some time, these options were introduced to allow more control of when it occurs.
It's important use :py:func:`pkg.refresh_db <salt.modules.win_pkg.refresh_db>` to check for errors and ensure
the latest package definition is on any minion your testing new definitions on.
Config Options for Minions Before 2015.8.0
==========================================
Configeration options for Minions before 2015.8.0
=================================================
If connected to a master, the minion will by default look for the winrepo
cachefile (the file generated by the :mod:`winrepo.genrepo runner
@ -646,8 +660,6 @@ cachefile is in a different path on the salt fileserver, then
location.
.. _2015-8-0-winrepo-changes:
Changes in Version 2015.8.0
===========================
@ -862,7 +874,7 @@ Packages management under Windows 2003
--------------------------------------
On Windows server 2003, you need to install optional Windows component "wmi
windows installer provider" to have full list of installed packages. If you
Windows installer provider" to have full list of installed packages. If you
don't have this, salt-minion can't report some installed software.

View File

@ -1434,7 +1434,7 @@ DEFAULT_MINION_OPTS = {
'winrepo_dir_ng': os.path.join(salt.syspaths.BASE_FILE_ROOTS_DIR, 'win', 'repo-ng'),
'winrepo_cachefile': 'winrepo.p',
'winrepo_cache_expire_max': 21600,
'winrepo_cache_expire_min': 0,
'winrepo_cache_expire_min': 1800,
'winrepo_remotes': ['https://github.com/saltstack/salt-winrepo.git'],
'winrepo_remotes_ng': ['https://github.com/saltstack/salt-winrepo-ng.git'],
'winrepo_branch': 'master',