diff --git a/debian/changelog b/debian/changelog index 279c4d7a..a0cdbfd6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,8 @@ byobu (4.37) unreleased; urgency=low - * UNRELEASED + * usr/lib/byobu/ec2_cost: LP: #862655 + - fix ec2 cost estimator on OpenStack instances by falling back to + the approximation calculator -- Dustin Kirkland Tue, 27 Sep 2011 10:59:05 -0400 diff --git a/usr/lib/byobu/ec2_cost b/usr/lib/byobu/ec2_cost index 74cfe6a8..31c9de4d 100755 --- a/usr/lib/byobu/ec2_cost +++ b/usr/lib/byobu/ec2_cost @@ -36,12 +36,16 @@ __ec2_cost() { # Try to use metadata service if metadata_available; then zone=$(wget -q -O - http://169.254.169.254/latest/meta-data/placement/availability-zone) + if [ ! -r "$BYOBU_PREFIX/share/$PKG/ec2/rates.${zone%?}" ]; then + zone="us-east-1d" + fi . "$BYOBU_PREFIX/share/$PKG/ec2/rates.${zone%?}" type=$(wget -q -O - http://169.254.169.254/latest/meta-data/instance-type | $SED -e "s/\./_/g") eval rate="\$$type" file_to_stat="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/ec2_cost.instance_type" [ -f "$file_to_stat" ] || wget -q -O "$file_to_stat" http://169.254.169.254/latest/meta-data/instance-type - else + fi + if [ -z "$rate" ]; then . "$BYOBU_PREFIX/share/$PKG/ec2/rates."* # Count CPUs, Memory, Architecture, hours cpu=$(grep -c "^processor.*:" /proc/cpuinfo) || cpu=1