File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change 33import sys
44import os
55import yaml
6+ import re
67from pathlib import Path
78from cr_template import CR_Template
89
@@ -71,6 +72,16 @@ def merge_spray_components_version_files(merged_file_path):
7172 elif os .path .exists (f"{ checkpointPath3 } /main.yml" ):
7273 print ("checkpoint path 3" )
7374 merge_dir_content_to_file ([checkpointPath3 , sprayDefaultPath ], merged_file_path )
75+
76+ f = None
77+ with open (merged_file_path , "r" ) as file :
78+ f = yaml .safe_load (file )
79+ if re .match (r".*{{.*" , f .get ("kube_version" , "" )):
80+ f ["kube_version" ] = list (f ['kubelet_checksums' ]['amd64' ].keys ())[0 ]
81+
82+ if f is not None :
83+ with open (merged_file_path , "w" ) as file :
84+ yaml .dump (f , file )
7485
7586
7687def get_value_from_yml (yml_file_path , key ):
Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ RUN /usr/bin/python3 -m pip install --no-cache-dir pip -U \
2525RUN ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\( arm\)\( 64\)\? .*/\1\2 /' -e 's/aarch64$/arm64/')" \
2626 && if [ -d 'roles/kubespray-defaults/defaults/main' ]; then \
2727 KUBE_VERSION=$(sed -n 's/^kube_version: //p' roles/kubespray-defaults/defaults/main/main.yml); \
28+ if [[ "$KUBE_VERSION" == *{{* ]]; then \
29+ KUBE_VERSION=$(python3 -c "import yaml,pathlib;f=pathlib.Path('roles/kubespray-defaults/defaults/main/checksums.yml');d=yaml.safe_load(f.read_text());print(list(d['kubelet_checksums']['amd64'].keys())[0])" ); \
30+ fi \
2831 else \
2932 KUBE_VERSION=$(sed -n 's/^kube_version: //p' roles/kubespray-defaults/defaults/main.yaml); \
3033 fi \
You can’t perform that action at this time.
0 commit comments