From 5cd040cc0bbcbabcb2edf11ee46b5a7502058e8e Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Tue, 21 Feb 2012 21:40:56 -0600 Subject: [PATCH] * usr/lib/byobu/ec2_cost, usr/share/byobu/status/statusrc, usr/share/man/man1/byobu.1: LP: #929907 - disable the ec2_cost plugin if not running in EC2, allow override with EC2_ESTIMATE=1 in ~/.byobu/statusrc --- debian/changelog | 4 ++++ usr/lib/byobu/ec2_cost | 2 ++ usr/share/byobu/status/statusrc | 6 ++++++ usr/share/man/man1/byobu.1 | 2 +- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 6c9f3078..ada4c72d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,10 @@ byobu (5.13) unreleased; urgency=low - check tput for 256 color support before defaulting to that in tmux mode * usr/lib/byobu/disk_io: LP: #934893 - initialize the x1 value correctly + * usr/lib/byobu/ec2_cost, usr/share/byobu/status/statusrc, + usr/share/man/man1/byobu.1: LP: #929907 + - disable the ec2_cost plugin if not running in EC2, + allow override with EC2_ESTIMATE=1 in ~/.byobu/statusrc -- Dustin Kirkland Thu, 16 Feb 2012 23:58:36 -0600 diff --git a/usr/lib/byobu/ec2_cost b/usr/lib/byobu/ec2_cost index 9ddc980e..deeb7ec8 100755 --- a/usr/lib/byobu/ec2_cost +++ b/usr/lib/byobu/ec2_cost @@ -47,6 +47,8 @@ __ec2_cost() { file_to_stat="$cache.type" fi if [ -z "$rate" ]; then + # No instance type/rate, exit immediately unless we explicitly want an estimate + [ "$EC2_ESTIMATE" = "1" ] || return . "$BYOBU_PREFIX/share/$PKG/ec2/rates."* # Count CPUs, Memory, Architecture, hours cpu=$(grep -c "^processor.*:" /proc/cpuinfo) || cpu=1 diff --git a/usr/share/byobu/status/statusrc b/usr/share/byobu/status/statusrc index a46ba33c..42745984 100644 --- a/usr/share/byobu/status/statusrc +++ b/usr/share/byobu/status/statusrc @@ -72,3 +72,9 @@ # to instead count number of distinct users logged onto the system # Default: 0 #USERS_DISTINCT=0 + +# If we're not in EC2 (ie, no metadata service, and no known instance type), the +# ec2_cost status is disabled by default. To override, and get an esitmate, set +# this to '1'. +# Default: 0 +#EC2_ESTIMATE=0 diff --git a/usr/share/man/man1/byobu.1 b/usr/share/man/man1/byobu.1 index 460a9690..2465a27c 100644 --- a/usr/share/man/man1/byobu.1 +++ b/usr/share/man/man1/byobu.1 @@ -47,7 +47,7 @@ Note that BYOBU_CONFIG_DIR=\fI$XDG_CONFIG_HOME/byobu\fP if defined, and \fI$HOME \fBdistro\fP \- OS/distribution name of the release running on the current system as reported by \fBlsb_release(1)\fP or \fI/etc/issue\fP; displayed in the lower bar in bold black text toward the left on a grey background; you may override the detected release with DISTRO=Whatever in \fI$BYOBU_CONFIG_DIR/statusrc\fP -\fBec2_cost\fP \- an estimation of the cost of the current boot of the system in terms of the Amazon EC2 billing model; displayed in the lower bar toward the right in green text on a black background; there is a leading '~' to indicate that this is an estimation, and the monetary units are US Dollars '$' +\fBec2_cost\fP \- an estimation of the cost of the current boot of the system in terms of the Amazon EC2 billing model; displayed in the lower bar toward the right in green text on a black background; there is a leading '~' to indicate that this is an estimation, and the monetary units are US Dollars '$'; if not running in EC2, this plugin is disabled unless EC2_ESTIMATE=1 in \fI~/.byobu/statusrc\fP \fBentropy\fP \- a count of the system's current entropy in bytes; displayed in the lower bar toward the right in yellow text on a dark grey background; there is a leading 'e' to indicate 'entropy'