MT#6257 Support --public option to mark AMIs as public available

changes/46/546/1
Michael Prokop 13 years ago
parent 93c12dc5f2
commit 09d818893c

@ -32,12 +32,14 @@ Supported OPTIONS:
(if unset defaults to m1.medium)
--ngcp-release <VERSION> sip:provider release version
(if unset defaults to <latest>)
--public Make AMI available to the public
(if unset defaults to private)
--region <REGION> specify region that should be used
(if unset defaults to the eu-west-1 zone)
"
}
CMDLINE_OPTS=base-ami:,help,instance-type:,ngcp-release:,region:
CMDLINE_OPTS=base-ami:,help,instance-type:,ngcp-release:,public,region:
_opt_temp=$(getopt --name $0 -o +bch --long $CMDLINE_OPTS -- "$@")
if [ $? -ne 0 ]; then
@ -46,6 +48,8 @@ if [ $? -ne 0 ]; then
fi
eval set -- "$_opt_temp"
_opt_public=false
while :; do
case "$1" in
--base-ami)
@ -60,6 +64,9 @@ while :; do
--ngcp-release)
shift; NGCP_RELEASE="$1"
;;
--public)
_opt_public=true
;;
--region)
shift; AWS_REGION="$1"
;;
@ -210,6 +217,15 @@ else
exit 1
fi
if $_opt_public ; then
echo "Marking AMI as public"
ec2-modify-image-attribute "$AMI-ID" --launch-permission -a all
if [ $? -ne 0 ] ; then
echo "Noticed problem when trying to mark AMI with ID $AMI_ID as public." >&2
exit 1
fi
fi
echo "*** Debugging information ***"
echo "--- user-data-file ---"
cat "$USER_DATA_FILE"

Loading…
Cancel
Save