summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Edwards <jeremyedwards@google.com>2014-06-12 11:38:28 -0700
committerJeremy Edwards <jeremyedwards@google.com>2014-06-12 11:38:28 -0700
commitbbfb78ff625686b293d6055aea8a8f020709183a (patch)
tree236b7806388ff902343bef80c367919fff9c0976
parent7ed81dd3a67c8f2f212525c53e4c4b59f34fe57f (diff)
downloadgoogle-compute-image-packages-bbfb78ff625686b293d6055aea8a8f020709183a.tar.gz
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}
}