From 90bd91c43f98a82df025fb73a34c12c2f6c26b1e Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Tue, 31 Mar 2020 23:46:39 +0100 Subject: [PATCH] feat(ng): add `retry_options` to fix installation on `centos-8` --- .travis.yml | 4 ++-- pillar.example | 7 +++++++ test/salt/pillar/default.sls | 5 +++++ varnish/ng/install.sls | 3 +++ varnish/ng/repo.sls | 6 ++++++ 5 files changed, 23 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 79c9ac1..ff19435 100644 --- a/.travis.yml +++ b/.travis.yml @@ -62,14 +62,14 @@ jobs: # - env: INSTANCE=default-ubuntu-1804-master-py3 - env: INSTANCE=default-centos-8-master-py3 # - env: INSTANCE=default-fedora-31-master-py3 - # - env: INSTANCE=suse-opensuse-leap-151-master-py3 + - env: INSTANCE=suse-opensuse-leap-151-master-py3 # - env: INSTANCE=default-amazonlinux-2-master-py3 # - env: INSTANCE=default-arch-base-latest-master-py2 # - env: INSTANCE=default-debian-10-3000-py3 - env: INSTANCE=default-ubuntu-1804-3000-py3 # - env: INSTANCE=default-centos-8-3000-py3 # - env: INSTANCE=default-fedora-31-3000-py3 - - env: INSTANCE=suse-opensuse-leap-151-3000-py3 + # - env: INSTANCE=suse-opensuse-leap-151-3000-py3 - env: INSTANCE=default-amazonlinux-2-3000-py3 # - env: INSTANCE=default-arch-base-latest-3000-py2 # - env: INSTANCE=default-debian-10-2019-2-py3 diff --git a/pillar.example b/pillar.example index edd932c..e7dc2f5 100644 --- a/pillar.example +++ b/pillar.example @@ -84,3 +84,10 @@ varnish: source_path: salt://testing/mobile_detect.vcl varnishncsa: enabled: true # Manage varnishncsa service + + # https://docs.saltstack.com/en/latest/ref/states/requisites.html#retrying-states + retry_options: + attempts: 3 + until: true + interval: 15 + splay: 15 diff --git a/test/salt/pillar/default.sls b/test/salt/pillar/default.sls index 55ac189..2862497 100644 --- a/test/salt/pillar/default.sls +++ b/test/salt/pillar/default.sls @@ -13,3 +13,8 @@ varnish: -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,100m + retry_options: + attempts: 3 + until: true + interval: 5 + splay: 5 diff --git a/varnish/ng/install.sls b/varnish/ng/install.sls index bd32977..456807a 100644 --- a/varnish/ng/install.sls +++ b/varnish/ng/install.sls @@ -6,3 +6,6 @@ varnish.install: pkg.installed: - name: {{ varnish_settings.pkg }} + {%- if varnish_settings.get('retry_options', {}) %} + - retry: {{ varnish_settings.retry_options | json }} + {%- endif %} diff --git a/varnish/ng/repo.sls b/varnish/ng/repo.sls index 949c0b8..1ef2eec 100644 --- a/varnish/ng/repo.sls +++ b/varnish/ng/repo.sls @@ -11,6 +11,9 @@ varnish.repo.dependencies: - pkgs: - apt-transport-https - python{{ pkg_dep_pyver }}-apt + {%- if varnish_settings.get('retry_options', {}) %} + - retry: {{ varnish_settings.retry_options | json }} + {%- endif %} - require_in: - pkgrepo: varnish.repo.{{ varnish_settings.repo }} - pkgrepo: varnish.repo.{{ varnish_settings.repo }}_src @@ -47,6 +50,9 @@ varnish.repo.dependencies: - pygpgme {% endif %} - yum-utils + {%- if varnish_settings.get('retry_options', {}) %} + - retry: {{ varnish_settings.retry_options | json }} + {%- endif %} - require_in: {% if salt['grains.get']('osfinger', '') in ['CentOS Linux-7', 'Amazon Linux-2'] %} - pkgrepo: varnish_epel_repo