Break out references to $c{Logs...} into new dircfg() function, and
look up $c{${cfgbase}...} first.  No functional change with existing
config.

Signed-off-by: Ian Jackson <ian.jack...@eu.citrix.com>
---
 cr-ensure-disk-space |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/cr-ensure-disk-space b/cr-ensure-disk-space
index 1064590..0ee84c7 100755
--- a/cr-ensure-disk-space
+++ b/cr-ensure-disk-space
@@ -70,6 +70,11 @@ sub ontarget ($) {
     }
 }
 
+sub dircfg ($) {
+    my ($k) = @_;
+    return $c{"${cfgbase}${k}"} // $c{"Logs${k}"};
+}
+
 for (;;) {
     open P, "-|", ontarget "df --block-size=1M -P $pubdir" or die $!;
     $_= <P>;
@@ -78,8 +83,8 @@ for (;;) {
     m,^\S+\s+\d+\s+\d+\s+(\d+)\s+, or die "$_ ?";
     $!=0; $?=0; close P or die "$! $?";
     my $space= $1;
-    printf "space: %8d, wanted: %8d ", $space, $c{LogsMinSpaceMby};
-    last if $space >= $c{LogsMinSpaceMby};
+    printf "space: %8d, wanted: %8d ", $space, dircfg('MinSpaceMby');
+    last if $space >= dircfg('MinSpaceMby');
 
     if (!@flights) {
        open P, "-|", ontarget "ls -1 $pubdir" or die $!;
@@ -103,7 +108,7 @@ for (;;) {
 
     printf "(age %dd) ", $age / 86400;
 
-    die "age $age" if $age < $c{LogsMinExpireAge};
+    die "age $age" if $age < dircfg('MinExpireAge');
 
     printf "...";
 
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to