Convert pkg-map and svc-map copies to explicit variables
Using the explicit variables, these elements don't have to walk the path to find the files in other elements; they can extract it directly Change-Id: I0a64b45e9f2cfa28e84b2859d76b065a6c4590f0
This commit is contained in:
parent
37a53354ec
commit
412b333bda
@ -8,10 +8,14 @@ set -o pipefail
|
||||
|
||||
sudo mkdir -p $TMP_MOUNT_PATH/usr/share/pkg-map/
|
||||
|
||||
for ELEMENT in $IMAGE_ELEMENT ; do
|
||||
for DIR in ${ELEMENTS_PATH//:/ }; do
|
||||
if [ -f "$DIR/$ELEMENT/pkg-map" ]; then
|
||||
sudo cp "$DIR/$ELEMENT/pkg-map" "$TMP_MOUNT_PATH/usr/share/pkg-map/$ELEMENT"
|
||||
eval declare -A image_elements=($(get_image_element_array))
|
||||
|
||||
for i in "${!image_elements[@]}"; do
|
||||
element=$i
|
||||
element_dir=${image_elements[$i]}
|
||||
|
||||
pkg_map="${element_dir}/pkg-map"
|
||||
if [ -f "${pkg_map}" ]; then
|
||||
sudo cp "${pkg_map}" "$TMP_MOUNT_PATH/usr/share/pkg-map/$element"
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
@ -61,14 +61,10 @@ def write_data_to_file(data, service_file_path):
|
||||
|
||||
|
||||
def main():
|
||||
elements = os.environ.get("IMAGE_ELEMENT").split(' ')
|
||||
element_paths = os.environ.get("ELEMENTS_PATH").split(':')
|
||||
elements = yaml.safe_load(os.environ.get("IMAGE_ELEMENT_YAML"))
|
||||
service_names = dict()
|
||||
for element in elements:
|
||||
if not element.strip():
|
||||
continue
|
||||
for element_path in element_paths:
|
||||
data_path = os.path.join(element_path, element, "svc-map")
|
||||
for element, path in elements.items():
|
||||
data_path = os.path.join(path, "svc-map")
|
||||
if os.path.exists(data_path):
|
||||
with open(data_path, 'r') as dataFile:
|
||||
data = yaml.load(dataFile.read())
|
||||
|
Loading…
Reference in New Issue
Block a user