* usr/bin/byobu-janitor, usr/lib/byobu/include/shutil: LP: #1071287

- ensure that we re-check metadata service availability each time
    byobu-janitor runs
  - move metadata_available flag to more ephemeral run dir
  - drop timeout on metadata check to 5 seconds
This commit is contained in:
Dustin Kirkland 2012-10-31 09:42:37 +01:00
commit 47a1536a47
3 changed files with 10 additions and 2 deletions

5
debian/changelog vendored
View file

@ -14,6 +14,11 @@ byobu (5.22) unreleased; urgency=low
- use a better variable name for memory usage
* usr/lib/byobu/custom, usr/share/man/man1/byobu.1:
- fix color for custom scripts; default to no color changes
* usr/bin/byobu-janitor, usr/lib/byobu/include/shutil: LP: #1071287
- ensure that we re-check metadata service availability each time
byobu-janitor runs
- move metadata_available flag to more ephemeral run dir
- drop timeout on metadata check to 5 seconds
[ Jake Biesinger and Dustin Kirkland ]
* usr/share/byobu/keybindings/common, usr/share/byobu/keybindings/f-

View file

@ -27,6 +27,9 @@ PKG="byobu"
# Ensure that all updates get run immediately
rm -rf "$BYOBU_RUN_DIR/.last.$BYOBU_BACKEND"
# Ensure that we re-check metadata service
rm -f "$BYOBU_CONFIG_DIR/.metadata_available" "$BYOBU_RUN_DIR/.metadata_available"
# Exit immediately, if we're not forced, and there is no reload flag
FLAG="$BYOBU_RUN_DIR/reload-required"
if [ "$1" != "--force" ] && [ ! -e "$FLAG" ]; then

View file

@ -209,7 +209,7 @@ metadata_available() {
# This is really ugly. We need a reliable, fast way of determining
# if a metadata service is available, that does NOT slow down non-ec2
# machines.
local x=0 cache="$BYOBU_CONFIG_DIR/.metadata_available"
local x=0 cache="$BYOBU_RUN_DIR/.metadata_available"
# First, check the cache
if [ -s "$cache" ]; then
# Metadata is non-empty, so we have metadata available
@ -218,7 +218,7 @@ metadata_available() {
# Must seed the cache
if [ -e /etc/ec2_version ] || [ -e /usr/sbin/update-grub-legacy-ec2 ]; then
# This *looks* like a machine with metadata, so background a potentially slow check
wget -q -O "$cache" --timeout=10 --tries=1 http://169.254.169.254 2>/dev/null &
wget -q -O "$cache" --timeout=5 --tries=1 http://169.254.169.254 2>/dev/null &
sleep 0.02
[ -s "$cache" ] && x=1
fi