summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Edwards <jeremyje@gmail.com>2014-06-13 14:03:07 -0700
committerJeremy Edwards <jeremyje@gmail.com>2014-06-13 14:03:07 -0700
commit2f211c079710247ba2ab2486cedcf0c1a45b9b50 (patch)
tree236b7806388ff902343bef80c367919fff9c0976
parent7ed81dd3a67c8f2f212525c53e4c4b59f34fe57f (diff)
parentbbfb78ff625686b293d6055aea8a8f020709183a (diff)
downloadgoogle-compute-image-packages-2f211c079710247ba2ab2486cedcf0c1a45b9b50.tar.gz
Merge pull request #80 from jeremyje/master
Use cat instead of printf to display metadata value.
-rwxr-xr-xgoogle-startup-scripts/usr/share/google/get_metadata_value6
1 files changed, 4 insertions, 2 deletions
diff --git a/google-startup-scripts/usr/share/google/get_metadata_value b/google-startup-scripts/usr/share/google/get_metadata_value
index 053b143..fe3c288 100755
--- a/google-startup-scripts/usr/share/google/get_metadata_value
+++ b/google-startup-scripts/usr/share/google/get_metadata_value
@@ -25,12 +25,14 @@ function metadata_get_url_code() {
}
function print_metadata_value() {
- local readonly response=$(curl "${1}" -H "Metadata-Flavor: Google" -s)
+ local readonly tmpfile=$(mktemp)
+ curl -f "${1}" -H "Metadata-Flavor: Google" > ${tmpfile} 2>/dev/null
local readonly return_code=$?
# If the command completed successfully, print the metadata value to stdout.
if [[ ${return_code} == 0 ]]; then
- printf "${response}"
+ cat ${tmpfile}
fi
+ rm -f ${tmpfile}
return ${return_code}
}