Skip to content

Commit 62c1756

Browse files
author
Martin Jackson
committed
Include fix for runnning in dev mode
1 parent 8af5caf commit 62c1756

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

roles/pattern_settings/tasks/resolve_overrides.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,35 @@
99
| default(lookup("pipe","pwd"), true)
1010
| trim
1111
}}
12+
13+
# When playbooks run from a collection install (e.g. .../cluster_utils/playbooks), PWD points at
14+
# that directory while values-global.yaml lives at the pattern Git repo root. Walk upward from the
15+
# initial guess until values-global.yaml is found; if none, keep the guess (fail later as before).
16+
- name: Canonicalize pattern_dir to directory containing values-global.yaml
17+
ansible.builtin.command:
18+
argv:
19+
- python3
20+
- -c
21+
- |
22+
import os
23+
import sys
24+
25+
start = os.path.abspath(os.environ["RHVP_PATTERN_DIR_GUESS"])
26+
d = start
27+
while True:
28+
if os.path.isfile(os.path.join(d, "values-global.yaml")):
29+
sys.stdout.write(d)
30+
break
31+
parent = os.path.dirname(d)
32+
if parent == d:
33+
sys.stdout.write(start)
34+
break
35+
d = parent
36+
environment:
37+
RHVP_PATTERN_DIR_GUESS: "{{ pattern_dir }}"
38+
register: _rhvp_pattern_dir_canonical
39+
changed_when: false
40+
41+
- name: Apply canonical pattern_dir
42+
ansible.builtin.set_fact:
43+
pattern_dir: "{{ _rhvp_pattern_dir_canonical.stdout | trim }}"

0 commit comments

Comments
 (0)