File tree Expand file tree Collapse file tree
roles/pattern_settings/tasks Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 }}"
You can’t perform that action at this time.
0 commit comments