Skip to content

Commit

Permalink
turn into a private method
Browse files Browse the repository at this point in the history
  • Loading branch information
guillomovitch committed Jul 10, 2015
1 parent 98b9688 commit 9155066
Showing 1 changed file with 19 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,6 @@ sub isEnabled {
return canRun('vzlist');
}

sub getMACs {
my ($ctid, $logger) = @_;

my @ipLines = getAllLines(
command => "vzctl exec '$ctid' 'ip -0 a'",
logger => $logger
);

my @macs;
foreach my $line (@ipLines) {
next unless $line =~ /^\s+link\/ether ($mac_address_pattern)\s/;
push @macs, $1;
}

return join('/', @macs);
}

sub doInventory {
my (%params) = @_;

Expand Down Expand Up @@ -97,7 +80,7 @@ sub doInventory {
STATUS => $status,
SUBSYSTEM => $subsys,
VMTYPE => "Virtuozzo",
MAC => getMACs($ctid, $logger)
MAC => _getMACs($ctid, $logger)
}
);

Expand All @@ -106,4 +89,22 @@ sub doInventory {
close $handle;
}

sub _getMACs {
my ($ctid, $logger) = @_;

my @ipLines = getAllLines(
command => "vzctl exec '$ctid' 'ip -0 a'",
logger => $logger
);

my @macs;
foreach my $line (@ipLines) {
next unless $line =~ /^\s+link\/ether ($mac_address_pattern)\s/;
push @macs, $1;
}

return join('/', @macs);
}


1;

0 comments on commit 9155066

Please sign in to comment.