From 42410e6f52d745a857e7fa0894c9f8df08d9d0bd Mon Sep 17 00:00:00 2001 From: Sylvain Laperche Date: Mon, 19 Aug 2019 11:28:52 +0200 Subject: [PATCH] TEST Signed-off-by: Sylvain Laperche --- salt/_states/metalk8s.py | 4 ++-- salt/metalk8s/orchestrate/etcd.sls | 1 + salt/metalk8s/salt/minion/running.sls | 8 ++++++++ scripts/bootstrap.sh.in | 4 ++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/salt/_states/metalk8s.py b/salt/_states/metalk8s.py index 2a2dc4e9b6..ba9f49fbb4 100644 --- a/salt/_states/metalk8s.py +++ b/salt/_states/metalk8s.py @@ -71,7 +71,7 @@ def static_pod_managed(name, ) -def module_run(name, attemps=1, sleep_time=10, **kwargs): +def module_run(name, attemps=1, sleep_time=10, until=True, **kwargs): """Classic module.run with a retry logic as it's buggy in salt version https://github.com/saltstack/salt/issues/44639 """ @@ -90,7 +90,7 @@ def module_run(name, attemps=1, sleep_time=10, **kwargs): ret['comment'] = str(exc) retry = retry - 1 - if retry and not ret['result']: + if retry and ret['result'] != until: time.sleep(sleep_time) return ret diff --git a/salt/metalk8s/orchestrate/etcd.sls b/salt/metalk8s/orchestrate/etcd.sls index a55324dd48..4d645b214a 100644 --- a/salt/metalk8s/orchestrate/etcd.sls +++ b/salt/metalk8s/orchestrate/etcd.sls @@ -32,6 +32,7 @@ Check etcd cluster health for {{ node }}: - metalk8s_etcd.check_etcd_health: - minion_id: {{ node }} - attemps: 5 + - until: "cluster is healthy" - require: - salt: Deploy etcd {{ node }} to {{ dest_version }} diff --git a/salt/metalk8s/salt/minion/running.sls b/salt/metalk8s/salt/minion/running.sls index 942322e283..17f86acb86 100644 --- a/salt/metalk8s/salt/minion/running.sls +++ b/salt/metalk8s/salt/minion/running.sls @@ -20,3 +20,11 @@ Ensure salt-minion running: - test.ping: [] - require: - service: Ensure salt-minion running + +Ensure startup state finished: + metalk8s.module_run: + - state.running: [] + - attempts: 5 + - until: [] + - require: + - module: Ensure salt-minion running diff --git a/scripts/bootstrap.sh.in b/scripts/bootstrap.sh.in index fdf4d8bb6c..656acf94e2 100755 --- a/scripts/bootstrap.sh.in +++ b/scripts/bootstrap.sh.in @@ -203,10 +203,10 @@ configure_salt_minion_local_mode() { local -r file_root="$base_dir/salt" "$SALT_CALL" --file-root="$file_root" \ - --local --retcode-passthrough saltutil.sync_all + --local --retcode-passthrough saltutil.sync_all saltenv=base "$SALT_CALL" --file-root="$file_root" \ --local --retcode-passthrough state.sls metalk8s.salt.minion.local \ - pillar="{'metalk8s': {'products': '$base_dir'}}" + pillar="{'metalk8s': {'products': '$base_dir'}}" saltenv=base } get_salt_container() {