From: Ian Jackson Subject: [OSSTEST PATCH 24/32] cr-ensure-disk-space: Honour different config for published log expiry Date: Tue, 24 Mar 2015 19:02:47 +0000 Message-ID: <1427223775-8592-25-git-send-email-ian.jackson@eu.citrix.com> References: <1427223775-8592-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YaU6f-0000Cn-6L for xen-devel@lists.xenproject.org; Tue, 24 Mar 2015 19:03:17 +0000 In-Reply-To: <1427223775-8592-1-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org 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 --- 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 $!; $_=

; @@ -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