Skip to content

Commit

Permalink
Merge pull request #238 from phreaker0/parser-fixes
Browse files Browse the repository at this point in the history
correctly parse zfs column output (space can be included in the values)
  • Loading branch information
jimsalterjrs committed Jun 28, 2018
2 parents e718dcd + 34b942e commit 5e291b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion sanoid
Expand Up @@ -521,7 +521,7 @@ sub getsnaps {
}

foreach my $snap (@rawsnaps) {
my ($fs,$snapname,$snapdate) = ($snap =~ m/(.*)\@(.*ly)\s*creation\s*(\d*)/);
my ($fs,$snapname,$snapdate) = ($snap =~ m/(.*)\@(.*ly)\t*creation\t*(\d*)/);

# avoid pissing off use warnings
if (defined $snapname) {
Expand Down
10 changes: 5 additions & 5 deletions syncoid
Expand Up @@ -678,7 +678,7 @@ sub getzfsvalue {
open FH, "$rhost $mysudocmd $zfscmd get -H $property $fsescaped |";
my $value = <FH>;
close FH;
my @values = split(/\s/,$value);
my @values = split(/\t/,$value);
$value = $values[2];
return $value;
}
Expand Down Expand Up @@ -999,7 +999,7 @@ sub getsnaps() {
if ($line =~ /\Q$fs\E\@.*guid/) {
chomp $line;
my $guid = $line;
$guid =~ s/^.*\sguid\s*(\d*).*/$1/;
$guid =~ s/^.*\tguid\t*(\d*).*/$1/;
my $snap = $line;
$snap =~ s/^.*\@(.*)\tguid.*$/$1/;
$snaps{$type}{$snap}{'guid'}=$guid;
Expand All @@ -1011,7 +1011,7 @@ sub getsnaps() {
if ($line =~ /\Q$fs\E\@.*creation/) {
chomp $line;
my $creation = $line;
$creation =~ s/^.*\screation\s*(\d*).*/$1/;
$creation =~ s/^.*\tcreation\t*(\d*).*/$1/;
my $snap = $line;
$snap =~ s/^.*\@(.*)\tcreation.*$/$1/;
$snaps{$type}{$snap}{'creation'}=$creation;
Expand Down Expand Up @@ -1070,9 +1070,9 @@ sub getsendsize {
# the output format is different in case of
# a resumed receive
if (defined($receivetoken)) {
$sendsize =~ s/.*\s([0-9]+)$/$1/;
$sendsize =~ s/.*\t([0-9]+)$/$1/;
} else {
$sendsize =~ s/^size\s*//;
$sendsize =~ s/^size\t*//;
}
chomp $sendsize;

Expand Down

0 comments on commit 5e291b6

Please sign in to comment.