Skip to content

Commit

Permalink
feat: Run esx inventory after esx discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
g-bougard committed Oct 3, 2023
1 parent 56acce5 commit 93f341a
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions lib/GLPI/Agent/Task/NetDiscovery.pm
Original file line number Diff line number Diff line change
Expand Up @@ -430,15 +430,19 @@ sub run {
$inventory->run();

} elsif ($authremote) {
my $credentials = [
grep { $_->{ID} eq $authremote } @{$jobaddress->{remote_credentials}}
];
if ($credentials->{TYPE} eq 'esx') {
# As we still have run the connection part in _scanAddressByRemote(), we reuse the connected object
$esxscan->serverInventory();
} else {
GLPI::Agent::Task::RemoteInventory->require();
# TODO Support RemoteInventory task run
my $credentials = first { $_->{ID} eq $authremote } @{$jobaddress->{remote_credentials}};
if ($credentials) {
my $path;
$path = $self->{target}->getPath() if $self->{target}->isType('local');
# When target path is agent folder, inventory should be saved in inventory subfolder
$path .= '/inventory' if $path eq '.';
if ($credentials->{TYPE} eq 'esx' && $esxscan) {
# As we still have run the connection part in _scanAddressByRemote(), we reuse the connected object
$esxscan->serverInventory($path);
} else {
GLPI::Agent::Task::RemoteInventory->require();
# TODO Support RemoteInventory task run
}
}
}

Expand Down

0 comments on commit 93f341a

Please sign in to comment.