* usr/bin/byobu-launch, usr/lib/byobu/ec2_cost,

usr/lib/byobu/hostname, usr/lib/byobu/include/shutil,
  usr/lib/byobu/ip_address: LP: #1208853
  - revert this recent commit, as it appears to have some unintended
    consequences, and it was just cleaning up some false positive
    bashism hits
This commit is contained in:
Dustin Kirkland 2013-08-06 22:37:24 +01:00
commit 7d22b869e5
6 changed files with 18 additions and 14 deletions

7
debian/changelog vendored
View file

@ -1,6 +1,11 @@
byobu (5.53) unreleased; urgency=low byobu (5.53) unreleased; urgency=low
* UNRELEASED * usr/bin/byobu-launch, usr/lib/byobu/ec2_cost,
usr/lib/byobu/hostname, usr/lib/byobu/include/shutil,
usr/lib/byobu/ip_address: LP: #1208853
- revert this recent commit, as it appears to have some unintended
consequences, and it was just cleaning up some false positive
bashism hits
-- Dustin Kirkland <kirkland@ubuntu.com> Mon, 05 Aug 2013 09:23:03 +0100 -- Dustin Kirkland <kirkland@ubuntu.com> Mon, 05 Aug 2013 09:23:03 +0100

View file

@ -63,8 +63,7 @@ elif [ "$BYOBU_SOURCED_PROFILE" != "1" ] && [ "$LC_BYOBU" != "0" ] && [ "$BYOBU_
[ -z "$_byobu_sourced" ] && [ -r "$HOME/.profile" ] && . "$HOME/.profile" [ -z "$_byobu_sourced" ] && [ -r "$HOME/.profile" ] && . "$HOME/.profile"
if byobu-launcher; then if byobu-launcher; then
# Wait very briefly for the no-logout flag to get written? # Wait very briefly for the no-logout flag to get written?
local brief="0.1" sleep 0.1
sleep $brief
if [ -e "$BYOBU_CONFIG_DIR/no-logout-on-detach" ] || [ -e "$BYOBU_RUN_DIR/no-logout" ]; then if [ -e "$BYOBU_CONFIG_DIR/no-logout-on-detach" ] || [ -e "$BYOBU_RUN_DIR/no-logout" ]; then
# The user does not want to logout on byobu detach # The user does not want to logout on byobu detach
rm -f "$BYOBU_RUN_DIR/no-logout" # Remove one-time no-logout flag, if it exists rm -f "$BYOBU_RUN_DIR/no-logout" # Remove one-time no-logout flag, if it exists

View file

@ -32,17 +32,17 @@ __ec2_cost_detail() {
} }
__ec2_cost() { __ec2_cost() {
local zone type file_to_stat cpu mem rate hours tx_gb rx_gb network_cost uptime_cost total_cost interface cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/ec2_cost" brief="0.02" local zone type file_to_stat cpu mem rate hours tx_gb rx_gb network_cost uptime_cost total_cost interface cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/ec2_cost"
if [ -s "$cache.rate" ]; then if [ -s "$cache.rate" ]; then
read rate < "$cache.rate" read rate < "$cache.rate"
elif metadata_available; then elif metadata_available; then
# Try to use metadata service # Try to use metadata service
[ -s "$cache.zone" ] || wget -q -O- http://169.254.169.254/latest/meta-data/placement/availability-zone </dev/null >"$cache.zone" 2>/dev/null & [ -s "$cache.zone" ] || wget -q -O- http://169.254.169.254/latest/meta-data/placement/availability-zone </dev/null >"$cache.zone" 2>/dev/null &
sleep $brief sleep 0.02
[ -s "$cache.zone" ] && read zone < "$cache.zone" [ -s "$cache.zone" ] && read zone < "$cache.zone"
zone=${zone%%[a-z]} zone=${zone%%[a-z]}
[ -s "$cache.type" ] || wget -q -O- http://169.254.169.254/latest/meta-data/instance-type </dev/null >"$cache.type" 2>/dev/null & [ -s "$cache.type" ] || wget -q -O- http://169.254.169.254/latest/meta-data/instance-type </dev/null >"$cache.type" 2>/dev/null &
sleep $brief sleep 0.02
[ -s "$cache.type" ] && read type < "$cache.type" [ -s "$cache.type" ] && read type < "$cache.type"
$BYOBU_PREFIX/lib/byobu/include/ec2instancespricing.py --type ondemand --filter-region $zone --filter-type $type --filter-os-type linux --format csv | tail -n1 > "$cache.rate" $BYOBU_PREFIX/lib/byobu/include/ec2instancespricing.py --type ondemand --filter-region $zone --filter-type $type --filter-os-type linux --format csv | tail -n1 > "$cache.rate"
read rate < "$cache.rate" read rate < "$cache.rate"

View file

@ -24,12 +24,12 @@ __hostname_detail() {
} }
__hostname() { __hostname() {
local h= brief="0.02" local h=
if metadata_available; then if metadata_available; then
local cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/hostname" local cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/hostname"
# Background a retrieval of our public hostname # Background a retrieval of our public hostname
wget -q -O- http://169.254.169.254/latest/meta-data/public-hostname </dev/null >"$cache" 2>/dev/null & wget -q -O- http://169.254.169.254/latest/meta-data/public-hostname </dev/null >"$cache" 2>/dev/null &
sleep $brief sleep 0.02
[ -s "$cache" ] && read h < "$cache" [ -s "$cache" ] && read h < "$cache"
else else
h=$(hostname -s 2>/dev/null || hostname) h=$(hostname -s 2>/dev/null || hostname)

View file

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

View file

@ -28,7 +28,7 @@ __ip_address_detail() {
} }
__ip_address() { __ip_address() {
local interface ipaddr cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/ip_address" brief="0.02" local interface ipaddr cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/ip_address"
# Allow interface overrides in $BYOBU_CONFIG_DIR/statusrc # Allow interface overrides in $BYOBU_CONFIG_DIR/statusrc
if [ -n "$MONITORED_NETWORK" ]; then if [ -n "$MONITORED_NETWORK" ]; then
interface="$MONITORED_NETWORK" interface="$MONITORED_NETWORK"
@ -43,7 +43,7 @@ __ip_address() {
if [ "$IP_EXTERNAL" = "1" ]; then if [ "$IP_EXTERNAL" = "1" ]; then
# Background an update # Background an update
wget -q -O- http://v6.ipv6-test.com/api/myip.php </dev/null >"$cache" 2>/dev/null & wget -q -O- http://v6.ipv6-test.com/api/myip.php </dev/null >"$cache" 2>/dev/null &
sleep $brief sleep 0.02
else else
# Background an update # Background an update
if [ -x /sbin/ip ]; then if [ -x /sbin/ip ]; then
@ -62,12 +62,12 @@ __ip_address() {
*) *)
if [ "$IP_EXTERNAL" = "1" ]; then if [ "$IP_EXTERNAL" = "1" ]; then
wget -q -O- http://v4.ipv6-test.com/api/myip.php </dev/null >"$cache" 2>/dev/null & wget -q -O- http://v4.ipv6-test.com/api/myip.php </dev/null >"$cache" 2>/dev/null &
sleep $brief sleep 0.02
[ -s "$cache" ] && read ipaddr < "$cache" [ -s "$cache" ] && read ipaddr < "$cache"
elif metadata_available; then elif metadata_available; then
# We're in EC2, so get our public IP address # We're in EC2, so get our public IP address
wget -q -O- http://169.254.169.254/latest/meta-data/public-ipv4 </dev/null >"$cache" 2>/dev/null & wget -q -O- http://169.254.169.254/latest/meta-data/public-ipv4 </dev/null >"$cache" 2>/dev/null &
sleep $brief sleep 0.02
[ -s "$cache" ] && read ipaddr < "$cache" [ -s "$cache" ] && read ipaddr < "$cache"
else else
if [ -x /sbin/ip ]; then if [ -x /sbin/ip ]; then