@@ -30,7 +30,16 @@ function pre_config_init {
3030}
3131
3232function post_config_init {
33- find_redacted_files " /src/etc/kayobe"
33+ KAYOBE_CONFIG_SECRET_PATHS_DEFAULT=(
34+ " etc/kayobe/kolla/passwords.yml"
35+ " etc/kayobe/secrets.yml"
36+ " etc/kayobe/environments/$KAYOBE_ENVIRONMENT /secrets.yml"
37+ " etc/kayobe/environments/$KAYOBE_ENVIRONMENT /kolla/passwords.yml"
38+ ${KAYOBE_CONFIG_SECRET_PATHS_EXTRA[@]}
39+ )
40+ KAYOBE_CONFIG_SECRET_PATHS=(" ${KAYOBE_CONFIG_SECRET_PATHS[@]:- ${KAYOBE_CONFIG_SECRET_PATHS_DEFAULT[@]} } " )
41+
42+ find_redacted_files " /stack/kayobe-automation-env/src/kayobe-config/etc/kayobe"
3443
3544 # Some values are currently determined dynamically from container versions
3645 export KAYOBE_AUTOMATION_CONFIG_DIFF_FLUENTD_BINARY=" ${KAYOBE_AUTOMATION_CONFIG_DIFF_FLUENTD_BINARY:- td-agent} "
@@ -42,40 +51,21 @@ function post_config_init {
4251
4352function find_redacted_files {
4453 KAYOBE_CONFIG_VAULTED_FILES_PATHS=()
45- KAYOBE_CONFIG_SECRET_PATHS=()
4654 local directory=" $1 "
4755
48- # Define forbidden paths patterns
49- KAYOBE_CONFIG_FORBIDDEN_ENVIRONMENTS=(
50- " aufn-ceph"
51- " ci-aio"
52- " ci-builder"
53- " ci-multinode" )
56+ echo $directory
5457
5558 # Search for vaulted files recursively in the directory
5659 while IFS= read -r -d ' ' file; do
57- # Check if the file path contains any forbidden path patterns
58- local ignore_file=false
59- for pattern in " ${KAYOBE_CONFIG_FORBIDDEN_ENVIRONMENTS[@]} " ; do
60- if [[ " $file " == * " environments/${pattern} " * ]]; then
61- ignore_file=true
62- break
63- fi
64- done
65- # Continue to the next file if this one should be ignored
66- if [ " $ignore_file " = true ]; then
67- continue
68- fi
69- if head -n 1 " $file " | grep -q " ANSIBLE_VAULT;1" ; then
60+ if grep -q " ANSIBLE_VAULT;1" " $file " ; then
7061 truncated_path=" ${file# " $directory /" } "
7162 vaulted_file=" etc/kayobe/$truncated_path "
72- if [[ " $vaulted_file " == * .yml ]]; then
73- KAYOBE_CONFIG_SECRET_PATHS+=(" etc/kayobe/$truncated_path " )
74- else
63+ if ! [[ " ${KAYOBE_CONFIG_SECRET_PATHS_DEFAULT[*]} " =~ " $vaulted_file " ]]; then
7564 KAYOBE_CONFIG_VAULTED_FILES_PATHS+=(" etc/kayobe/$truncated_path " )
7665 fi
7766 fi
7867 done < <( find " $directory " -type f -print0)
68+ echo ${KAYOBE_CONFIG_VAULTED_FILES_PATHS[*]}
7969}
8070
8171function redact_file {
0 commit comments