mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-07 21:16:57 +02:00
fix(oem/ami): Add option to copy to a single region.
It is not uncommon for a single region to fail with some internal server error or other transient issue. Make it easy to fix up that one region.
This commit is contained in:
parent
bb6a18fbb8
commit
2f93bdbd54
@ -38,14 +38,24 @@ AMI=
|
||||
VER=
|
||||
BOARD="amd64-usr"
|
||||
GROUP="alpha"
|
||||
REGIONS=()
|
||||
|
||||
while getopts "a:V:b:g:hv" OPTION
|
||||
add_region() {
|
||||
if [[ -z "${AKI[$1]}" ]]; then
|
||||
echo "Invalid region '$1'" >&2;
|
||||
exit 1
|
||||
fi
|
||||
REGIONS+=( "$1" )
|
||||
}
|
||||
|
||||
while getopts "a:V:b:g:r:hv" OPTION
|
||||
do
|
||||
case $OPTION in
|
||||
a) AMI="$OPTARG";;
|
||||
V) VER="$OPTARG";;
|
||||
b) BOARD="$OPTARG";;
|
||||
g) GROUP="$OPTARG";;
|
||||
r) add_region "$OPTARG";;
|
||||
h) echo "$USAGE"; exit;;
|
||||
v) set -x;;
|
||||
*) exit 1;;
|
||||
@ -77,6 +87,10 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ${#REGIONS[@]} -eq 0 ]]; then
|
||||
REGIONS=( "${!AKI[@]}" )
|
||||
fi
|
||||
|
||||
# The name has a limited set of allowed characterrs
|
||||
name=$(sed -e "s%[^A-Za-z0-9()\\./_-]%_%g" <<< "CoreOS-$GROUP-$VER")
|
||||
description="CoreOS $GROUP $VER"
|
||||
@ -113,7 +127,7 @@ do_copy() {
|
||||
ec2-modify-image-attribute --region "$r" "$r_amiid" --launch-permission -a all
|
||||
}
|
||||
|
||||
for r in "${!AKI[@]}"
|
||||
for r in "${REGIONS[@]}"
|
||||
do
|
||||
[ "${r}" == "${region}" ] && continue
|
||||
echo "Starting copy of $AMI from $region to $r"
|
||||
|
Loading…
Reference in New Issue
Block a user