Skip to content

Commit

Permalink
Code refactor of tag
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardomozart authored Jan 20, 2025
1 parent 5a09faf commit 9158660
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions lib/GLPI/Agent/Task/NetInventory.pm
Original file line number Diff line number Diff line change
Expand Up @@ -348,21 +348,16 @@ sub _sendMessage {
# Load GLPI::Agent::XML::Query as late as possible
return unless GLPI::Agent::XML::Query->require();

my $message;
if (defined($self->{config}->{tag}) && length($self->{config}->{tag})) {
$message = GLPI::Agent::XML::Query->new(
deviceid => $self->{deviceid} || 'foo',
query => 'SNMPQUERY',
tag => $self->{config}->{'tag'},
content => $content
);
} else {
$message = GLPI::Agent::XML::Query->new(
deviceid => $self->{deviceid} || 'foo',
query => 'SNMPQUERY',
content => $content
);
}
my %message_params = (
deviceid => $self->{deviceid} || 'foo',
query => 'SNMPQUERY',
content => $content
);
$message_params{tag} = $self->{config}->{'tag'}
if defined($self->{config}->{tag}) && length($self->{config}->{tag});
my $message = GLPI::Agent::XML::Query->new(
%message_params
);

if ($self->{target}->isType('local')) {
my ($handle, $file);
Expand Down

0 comments on commit 9158660

Please sign in to comment.