Skip to content

Commit e98b181

Browse files
committed
fix: Fix --itemtype & --esx-itemtype support on windows
1 parent 273ba31 commit e98b181

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

lib/GLPI/Agent/Inventory.pm

+2-2
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ sub new {
183183
_format => '',
184184
_glpi_version => glpiVersion('v10'),
185185
_required => $params{required} // [],
186-
_itemtype => $params{itemtype} // "Computer",
186+
_itemtype => empty($params{itemtype}) ? "Computer" : $params{itemtype},
187187
content => {
188188
HARDWARE => {
189189
VMSYSTEM => "Physical" # Default value
@@ -294,7 +294,7 @@ sub getContent {
294294
deviceid => $self->getDeviceId(),
295295
content => $self->{content},
296296
partial => $self->isPartial(),
297-
itemtype => $self->{_itemtype} // "Computer",
297+
itemtype => empty($self->{_itemtype}) ? "Computer" : $self->{_itemtype},
298298
);
299299

300300
# Support json file on additional-content with json output

lib/GLPI/Agent/Task/ESX.pm

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ sub createInventory {
6767
logger => $self->{logger},
6868
glpi => $glpi_version,
6969
tag => $tag,
70-
itemtype => $self->{config}->{'esx-itemtype'} // "Computer",
70+
itemtype => empty($self->{config}->{'esx-itemtype'}) ? "Computer" : $self->{config}->{'esx-itemtype'},
7171
# deviceid can be set and so reused from previous netscan
7272
deviceid => $deviceid
7373
);

lib/GLPI/Agent/Task/Inventory.pm

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ sub run {
125125
logger => $self->{logger},
126126
glpi => $self->{target}->getTaskVersion('inventory'),
127127
required => $self->{config}->{'required-category'} // [],
128-
itemtype => $self->{config}->{'itemtype'} // "Computer",
128+
itemtype => empty($self->{config}->{'itemtype'}) ? "Computer" : $self->{config}->{'itemtype'},
129129
tag => $tag
130130
);
131131

lib/GLPI/Agent/Task/RemoteInventory.pm

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ sub run {
5454
my $remoteinv = GLPI::Agent::Inventory->new(
5555
statedir => $self->{target}->getStorage()->getDirectory(),
5656
logger => $self->{logger},
57-
itemtype => $self->{config}->{'itemtype'} // "Computer",
57+
itemtype => empty($self->{config}->{'itemtype'}) ? "Computer" : $self->{config}->{'itemtype'},
5858
);
5959
my $continue = $remoteinv->canCleanupOldRemoteStateFile();
6060
if ($continue) {

0 commit comments

Comments
 (0)