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/
|
sudo mkdir -p $TMP_MOUNT_PATH/usr/share/pkg-map/
|
||||||
|
|
||||||
for ELEMENT in $IMAGE_ELEMENT ; do
|
eval declare -A image_elements=($(get_image_element_array))
|
||||||
for DIR in ${ELEMENTS_PATH//:/ }; do
|
|
||||||
if [ -f "$DIR/$ELEMENT/pkg-map" ]; then
|
for i in "${!image_elements[@]}"; do
|
||||||
sudo cp "$DIR/$ELEMENT/pkg-map" "$TMP_MOUNT_PATH/usr/share/pkg-map/$ELEMENT"
|
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
|
fi
|
||||||
done
|
done
|
||||||
done
|
|
||||||
|
@ -61,14 +61,10 @@ def write_data_to_file(data, service_file_path):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
elements = os.environ.get("IMAGE_ELEMENT").split(' ')
|
elements = yaml.safe_load(os.environ.get("IMAGE_ELEMENT_YAML"))
|
||||||
element_paths = os.environ.get("ELEMENTS_PATH").split(':')
|
|
||||||
service_names = dict()
|
service_names = dict()
|
||||||
for element in elements:
|
for element, path in elements.items():
|
||||||
if not element.strip():
|
data_path = os.path.join(path, "svc-map")
|
||||||
continue
|
|
||||||
for element_path in element_paths:
|
|
||||||
data_path = os.path.join(element_path, element, "svc-map")
|
|
||||||
if os.path.exists(data_path):
|
if os.path.exists(data_path):
|
||||||
with open(data_path, 'r') as dataFile:
|
with open(data_path, 'r') as dataFile:
|
||||||
data = yaml.load(dataFile.read())
|
data = yaml.load(dataFile.read())
|
||||||
|
Loading…
Reference in New Issue
Block a user