Hello community, here is the log from the commit of package google-startup-scripts for openSUSE:Factory checked in at 2015-12-03 13:31:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/google-startup-scripts (Old) and /work/SRC/openSUSE:Factory/.google-startup-scripts.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "google-startup-scripts" Changes: -------- --- /work/SRC/openSUSE:Factory/google-startup-scripts/google-startup-scripts.changes 2015-08-03 17:22:39.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.google-startup-scripts.new/google-startup-scripts.changes 2015-12-03 13:32:00.000000000 +0100 @@ -1,0 +2,6 @@ +Mon Nov 23 19:40:05 UTC 2015 - rjsch...@suse.com + +- Update to version 1.2.10 (bsc#956339,bsc#956340) + + Fix for metadata scripts at a redirected URL + +------------------------------------------------------------------- Old: ---- google-startup-scripts-1.2.7.tar.bz2 New: ---- google-startup-scripts-1.2.10.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ google-startup-scripts.spec ++++++ --- /var/tmp/diff_new_pack.qPWsoa/_old 2015-12-03 13:32:01.000000000 +0100 +++ /var/tmp/diff_new_pack.qPWsoa/_new 2015-12-03 13:32:01.000000000 +0100 @@ -17,7 +17,7 @@ Name: google-startup-scripts -Version: 1.2.7 +Version: 1.2.10 Release: 0 Summary: GCE start up tools License: Apache-2.0 ++++++ google-startup-scripts-1.2.7.tar.bz2 -> google-startup-scripts-1.2.10.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/google-startup-scripts-1.2.7/usr/share/google/boto/boto_plugins/compute_auth.py new/google-startup-scripts-1.2.10/usr/share/google/boto/boto_plugins/compute_auth.py --- old/google-startup-scripts-1.2.7/usr/share/google/boto/boto_plugins/compute_auth.py 2015-07-11 02:13:30.000000000 +0200 +++ new/google-startup-scripts-1.2.10/usr/share/google/boto/boto_plugins/compute_auth.py 2015-09-24 21:47:38.000000000 +0200 @@ -61,7 +61,7 @@ request.add_unredirected_header('Metadata-Flavor', 'Google') data = urllib2.urlopen(request).read() return json.loads(data) - except (urllib2.URLError, urllib2.HTTPError, IOError), e: + except (urllib2.URLError, urllib2.HTTPError, IOError): return None def __GetGSScopes(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/google-startup-scripts-1.2.7/usr/share/google/fetch_script new/google-startup-scripts-1.2.10/usr/share/google/fetch_script --- old/google-startup-scripts-1.2.7/usr/share/google/fetch_script 2015-07-11 02:13:30.000000000 +0200 +++ new/google-startup-scripts-1.2.10/usr/share/google/fetch_script 2015-09-24 21:47:38.000000000 +0200 @@ -35,11 +35,12 @@ local readonly dest=$2 local readonly logfile=$3 - case "${url}" in - gs://*) - log "Downloading url from ${url} to ${dest} using gsutil"; - gsutil cp "${url}" "${dest}" > "${logfile}" 2>&1 && return 0;; - esac + if [[ "$url" =~ gs://* ]]; then + log "Downloading url from ${url} to ${dest} using gsutil" + gsutil cp "${url}" "${dest}" > "${logfile}" 2>&1 && return 0 + log "Failed to download $url" + return 1 + fi # Many of the Google Storage URLs are supported below. # It is prefered that customers specify their object using @@ -85,7 +86,7 @@ # Unauthenticated download of the object. log "Downloading url from ${url} to ${dest} using curl" curl --max-time "${CURL_TIMEOUT}" --retry "${CURL_RETRY_LIMIT}" \ - 2>> "${logfile}" -o "${dest}" -- "${url}" && return 0; + 2>> "${logfile}" -o "${dest}" -L -- "${url}" && return 0; log "Failed to download $url" return 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/google-startup-scripts-1.2.7/usr/share/google/first-boot new/google-startup-scripts-1.2.10/usr/share/google/first-boot --- old/google-startup-scripts-1.2.7/usr/share/google/first-boot 2015-07-11 02:13:30.000000000 +0200 +++ new/google-startup-scripts-1.2.10/usr/share/google/first-boot 2015-09-24 21:47:38.000000000 +0200 @@ -32,55 +32,63 @@ ${PREFIX}/usr/share/google/get_metadata_value id 2>/dev/null } -# Output the instance id. -# Returns 1 if the instance id hasn't changed, 0 if it has. -function update_instanceid_on_disk() { - local readonly instanceid=$1 +# Checks the instance id has changed. +# Exits with return code 0 if the instance id hasn't changed. +function check_stored_instance_id() { + local readonly instance_id=$1 - if [[ "${instanceid}" == "" ]]; then - # Cannot determine instance id. Either we're not running on a Compute VM, + if [[ "${instance_id}" == "" ]]; then + # Cannot determine instance id. Either we're not running on a Compute VM, # or networking hasn't started up yet, etc. exit 1 fi - if [[ "${instanceid}" != "unknown-instance" && - "${instanceid}" == "$(cat ${INSTANCE_FILE} 2>/dev/null)" ]]; then + if [[ "${instance_id}" != "unknown-instance" && + "${instance_id}" == "$(cat ${INSTANCE_FILE} 2>/dev/null)" ]]; then # Instance id is same as on disk. exit 1 fi - - # We are booting this instance for the first time. - echo ${instanceid} > ${INSTANCE_FILE} - exit 0 } -# This uses a subshell, opens LOCK_FILE on FD 200, locks it, and then -# checks whether the instance has changed. -function sync_new_instance_check() { - local instanceid=$(get_instance_id) - (flock 200; update_instanceid_on_disk ${instanceid}) 200> ${LOCK_FILE} +# Performs host key setup if the instance has changed. +# Otherwise we exit with a non-zero return code. +function manage_stored_instance_id() { + local readonly instance_id=$1 + + # Create a subshell to manage the lock file. The file lock is released + # when the subshell exits. + ( + # Open LOCK_FILE on FD 200 and lock it. This prevents concurrent calls + # to regenerate host keys that spam console output. + flock -e 200 + + # Checks whether the instance has changed. + # If the instance hasn't changed, exit the script. + check_stored_instance_id ${instance_id} + + # If the instance hasn't changed, we have now exited the subshell. + # Since the instance changed, we do host key regeneration. + log "Running first-boot" + + # Regenerate host keys for ssh. + if [[ -x ${PREFIX}/usr/share/google/regenerate-host-keys ]]; then + ${PREFIX}/usr/share/google/regenerate-host-keys + fi + + # We are booting this instance for the first time. + echo ${instance_id} > ${INSTANCE_FILE} + ) 200> ${LOCK_FILE} + return $? } -sync_new_instance_check +declare -r INSTANCE_ID=$(get_instance_id) + +manage_stored_instance_id ${INSTANCE_ID} if [[ $? != 0 ]]; then - # The instance hasn't changed. Just exit. + # The instance hasn't changed so exit. exit 0 fi -##################################################################### -# If the instance hasn't changed, we have now exited this script. -# Since the instance changed, we have to do a bunch of work. -##################################################################### - -log "Running first-boot" - -declare -r INSTANCE_ID=$(cat ${INSTANCE_FILE}) - -# Regenerate host keys for ssh. -if [[ -x ${PREFIX}/usr/share/google/regenerate-host-keys ]]; then - ${PREFIX}/usr/share/google/regenerate-host-keys -fi - # Make a per-instance data directory. mkdir -p ${PREFIX}/var/lib/google/per-instance/${INSTANCE_ID}