Skip to content

Commit 1553c59

Browse files
0xff8g-bougard
andauthored
Update lib/GLPI/Agent/Task/Inventory.pm
Co-authored-by: Guillaume Bougard <[email protected]>
1 parent b64e7a8 commit 1553c59

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/GLPI/Agent/Task/Inventory.pm

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,20 @@ sub run {
159159
map { $_ => 1 } @{$self->{config}->{'category'}}
160160
};
161161

162+
if (keys(%{$self->{enabled}})) {
163+
# Be sure at least bios and hardware category are enabled via category option
164+
foreach my $category (qw(bios hardware)) {
165+
$self->{logger}->debug("$category not enabled, forcing as it is required")
166+
unless $self->{enabled}->{$category};
167+
$self->{enabled}->{$category} = 1;
168+
}
169+
# Software category requires os to be enabled too
170+
if ($self->{enabled}->{software} && !$self->{enabled}->{os}) {
171+
$self->{logger}->debug("Forcing os category as required by software one")
172+
$self->{enabled}->{os} = 1;
173+
}
174+
}
175+
162176
# Support inventory event
163177
if ($event && !$self->setupEvent()) {
164178
$self->{logger}->info("Skipping Inventory task event on ".$self->{target}->id());

0 commit comments

Comments
 (0)