Skip to content

Commit

Permalink
Merge pull request #53621 from sathieu/git_pillar_update_interval
Browse files Browse the repository at this point in the history
Git pillar update interval
  • Loading branch information
dwoz authored Dec 23, 2019
2 parents 47d8f6d + a1844cf commit 7e4ab5e
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
15 changes: 15 additions & 0 deletions doc/ref/configuration/master.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4255,6 +4255,21 @@ explanation <git-pillar-multiple-remotes>` from the git_pillar documentation.
git_pillar_includes: False
``git_pillar_update_interval``
******************************

.. versionadded:: neon

Default: ``60``

This option defines the default update interval (in seconds) for git_pillar
remotes. The update is handled within the global loop, hence
``git_pillar_update_interval`` should be a multiple of ``loop_interval``.

.. code-block:: yaml
git_pillar_update_interval: 120
.. _git-ext-pillar-auth-opts:

Git External Pillar Authentication Options
Expand Down
3 changes: 3 additions & 0 deletions salt/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,7 @@ def _gather_buffer_space():
'roots_update_interval': int,
'azurefs_update_interval': int,
'gitfs_update_interval': int,
'git_pillar_update_interval': int,
'hgfs_update_interval': int,
'minionfs_update_interval': int,
's3fs_update_interval': int,
Expand Down Expand Up @@ -1289,6 +1290,7 @@ def _gather_buffer_space():
'roots_update_interval': DEFAULT_INTERVAL,
'azurefs_update_interval': DEFAULT_INTERVAL,
'gitfs_update_interval': DEFAULT_INTERVAL,
'git_pillar_update_interval': DEFAULT_INTERVAL,
'hgfs_update_interval': DEFAULT_INTERVAL,
'minionfs_update_interval': DEFAULT_INTERVAL,
's3fs_update_interval': DEFAULT_INTERVAL,
Expand Down Expand Up @@ -1533,6 +1535,7 @@ def _gather_buffer_space():
'roots_update_interval': DEFAULT_INTERVAL,
'azurefs_update_interval': DEFAULT_INTERVAL,
'gitfs_update_interval': DEFAULT_INTERVAL,
'git_pillar_update_interval': DEFAULT_INTERVAL,
'hgfs_update_interval': DEFAULT_INTERVAL,
'minionfs_update_interval': DEFAULT_INTERVAL,
's3fs_update_interval': DEFAULT_INTERVAL,
Expand Down
6 changes: 5 additions & 1 deletion salt/master.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,15 +224,19 @@ def run(self):

# Make Start Times
last = int(time.time())
last_git_pillar_update = last

git_pillar_update_interval = self.opts.get('git_pillar_update_interval', 0)
old_present = set()
while True:
now = int(time.time())
if (now - last) >= self.loop_interval:
salt.daemons.masterapi.clean_old_jobs(self.opts)
salt.daemons.masterapi.clean_expired_tokens(self.opts)
salt.daemons.masterapi.clean_pub_auth(self.opts)
self.handle_git_pillar()
if (now - last_git_pillar_update) >= git_pillar_update_interval:
last_git_pillar_update = now
self.handle_git_pillar()
self.handle_schedule()
self.handle_key_cache()
self.handle_presence(old_present)
Expand Down
15 changes: 15 additions & 0 deletions salt/pillar/git_pillar.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,21 @@
- __env__ https://mydomain.tld/pillar-appdata.git:
- mountpoint: web/server/
.. _git_pillar_update_interval:
git_pillar_update_interval
~~~~~~~~~~~~~~~~~~~~~~~~~~
.. versionadded:: neon
This option defines the default update interval (in seconds) for git_pillar
remotes. The update is handled within the global loop, hence
``git_pillar_update_interval`` should be a multiple of ``loop_interval``.
.. code-block:: yaml
git_pillar_update_interval: 120
'''
from __future__ import absolute_import, print_function, unicode_literals

Expand Down

0 comments on commit 7e4ab5e

Please sign in to comment.