mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-08 05:26:58 +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=
|
VER=
|
||||||
BOARD="amd64-usr"
|
BOARD="amd64-usr"
|
||||||
GROUP="alpha"
|
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
|
do
|
||||||
case $OPTION in
|
case $OPTION in
|
||||||
a) AMI="$OPTARG";;
|
a) AMI="$OPTARG";;
|
||||||
V) VER="$OPTARG";;
|
V) VER="$OPTARG";;
|
||||||
b) BOARD="$OPTARG";;
|
b) BOARD="$OPTARG";;
|
||||||
g) GROUP="$OPTARG";;
|
g) GROUP="$OPTARG";;
|
||||||
|
r) add_region "$OPTARG";;
|
||||||
h) echo "$USAGE"; exit;;
|
h) echo "$USAGE"; exit;;
|
||||||
v) set -x;;
|
v) set -x;;
|
||||||
*) exit 1;;
|
*) exit 1;;
|
||||||
@ -77,6 +87,10 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ ${#REGIONS[@]} -eq 0 ]]; then
|
||||||
|
REGIONS=( "${!AKI[@]}" )
|
||||||
|
fi
|
||||||
|
|
||||||
# The name has a limited set of allowed characterrs
|
# The name has a limited set of allowed characterrs
|
||||||
name=$(sed -e "s%[^A-Za-z0-9()\\./_-]%_%g" <<< "CoreOS-$GROUP-$VER")
|
name=$(sed -e "s%[^A-Za-z0-9()\\./_-]%_%g" <<< "CoreOS-$GROUP-$VER")
|
||||||
description="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
|
ec2-modify-image-attribute --region "$r" "$r_amiid" --launch-permission -a all
|
||||||
}
|
}
|
||||||
|
|
||||||
for r in "${!AKI[@]}"
|
for r in "${REGIONS[@]}"
|
||||||
do
|
do
|
||||||
[ "${r}" == "${region}" ] && continue
|
[ "${r}" == "${region}" ] && continue
|
||||||
echo "Starting copy of $AMI from $region to $r"
|
echo "Starting copy of $AMI from $region to $r"
|
||||||
|
Loading…
Reference in New Issue
Block a user