1
0
mirror of https://github.com/openshift/installer.git synced 2026-02-05 06:46:36 +01:00

scripts/maintenance/tag-route53-hosted-zones: Drop '-e' from echo

The 'echo -e' calls landed with the script in 82bdd9fe
(installer/scripts: AWS tag and delete scripts, 2017-06-28,
coreos/tectonic-installer#1239).  But $tags doesn't actually need any
backslash expansion:

  $ date_string='2000-01-01'
  $ tags="[{\"Key\":\"expirationDate\",\"Value\":\"$date_string\"}]"
  $ echo "${tags}"
  [{"Key":"expirationDate","Value":"2000-01-01"}]

Perhaps the original concern was over the \" in the tags definition,
but those are expanded by the shell during that initialization.  By
the time we get around to invoking echo, there are no backslashes left
(unless the user has injected some via --date-override, and we don't
want to support that ;).
This commit is contained in:
W. Trevor King
2018-07-08 14:57:48 -07:00
parent 04fa686ed9
commit 873a035df4

View File

@@ -77,7 +77,7 @@ private_zones=$(aws route53 list-hosted-zones | \
jq ".HostedZones[] | select(.Config.PrivateZone == true) | .Id" | \
sed "s@\"@@g")
for key in $(echo -e "$tags" | jq ".[].Key"); do
for key in $(echo "$tags" | jq ".[].Key"); do
for zone in $private_zones; do
zone="${zone##*/}"
is_not_tagged=$(aws route53 list-tags-for-resource \
@@ -87,7 +87,7 @@ for key in $(echo -e "$tags" | jq ".[].Key"); do
if [ -z "$is_not_tagged" ]; then
if aws route53 change-tags-for-resource \
--resource-type hostedzone \
--add-tags "$(echo -e "$tags")" \
--add-tags "$tags" \
--resource-id "${zone##*/}"; then
echo "Tagged hosted zone ${zone##*/}"
else