Skip to content

Commit

Permalink
pass filesystem type explicitely when it can not get computed from df…
Browse files Browse the repository at this point in the history
… output (fix #1394)
  • Loading branch information
guillomovitch committed Dec 18, 2011
1 parent 47feefb commit 17308ff
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
5 changes: 3 additions & 2 deletions lib/FusionInventory/Agent/Task/Inventory/Input/BSD/Drives.pm
Expand Up @@ -25,8 +25,9 @@ sub doInventory {
my @filesystems;
foreach my $type (@types) {
push @filesystems, getFilesystemsFromDf(
logger => $logger,
command => "df -P -k -t $type"
logger => $logger,
command => "df -P -k -t $type",
type => $type
);
}

Expand Down
Expand Up @@ -25,8 +25,9 @@ sub doInventory {
my @filesystems;
foreach my $type (@types) {
push @filesystems, getFilesystemsFromDf(
logger => $logger,
command => "df -P -k -t $type"
logger => $logger,
command => "df -P -k -t $type",
type => $type,
);
}

Expand Down
8 changes: 6 additions & 2 deletions lib/FusionInventory/Agent/Tools/Unix.pm
Expand Up @@ -146,7 +146,8 @@ sub _parseDhcpLeaseFile {
}

sub getFilesystemsFromDf {
my $handle = getFileHandle(@_);
my %params = (@_);
my $handle = getFileHandle(%params);

my @filesystems;

Expand All @@ -161,14 +162,17 @@ sub getFilesystemsFromDf {
chomp $line;
my @infos = split(/\s+/, $line);

# depending of the number of colums, information index change
# depending on the df implementation, and how it is called
# the filesystem type may appear as second colum, or be missing
# in the second case, it has to be given by caller
my ($filesystem, $total, $free, $type);
if ($headers[1] eq 'Type') {
$filesystem = $infos[1];
$total = $infos[2];
$free = $infos[4];
$type = $infos[6];
} else {
$filesystem = $params{type},
$total = $infos[1];
$free = $infos[3];
$type = $infos[5];
Expand Down

0 comments on commit 17308ff

Please sign in to comment.