genesis-community / bosh-genesis-kit

A Genesis Kit for BOSH deployments
MIT License
10 stars 22 forks source link

Respect the position of virtual features if explicitly specified #102

Closed bodymindarts closed 4 years ago

bodymindarts commented 4 years ago

We iterate through the array of GENESIS_REQUESTED_FEATURES and make the following change: if a specified feature is actually a virtual feature that would be included add a + and remove it from the end

VIRTUAL_FEATURES=( "aws-secret-access-keys" "s3-blobstore-secret-access-keys" "internal-blobstore" "external-db" )
new_features=()
found_virtual_features=()
for feature in ${GENESIS_REQUESTED_FEATURES[@]}; do
  if [ $(array_contains "${VIRTUAL_FEATURES[@]}" "${feature}" ) == "y" ]; then
    if [ $(array_contains "${GENESIS_REQUESTED_FEATURES[@]}" "+${feature}") == "y" ]; then
        new_features+=( "+${feature}" )
        found_virtual_features+=( "+${feature}" )
    elif [[ $(array_contains "${found_virtual_features[@]}" "${feature}") == "n" ]]; then
      new_features+=( "${feature}" )
    fi
  elif [ $(array_contains "${found_virtual_features[@]}" "${feature}") == "n" ]; then
    new_features+=( "${feature}" )
  fi
done
GENESIS_REQUESTED_FEATURES=( "${new_features[@]}" )