<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package GLPI::Agent::Task::Inventory::Solaris::Controllers;

use strict;
use warnings;

use parent 'GLPI::Agent::Task::Inventory::Module';

use GLPI::Agent::Tools;

use constant    category    =&gt; "controller";

sub isEnabled {
    return canRun('cfgadm');
}

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

    my $inventory = $params{inventory};
    my $logger    = $params{logger};

    my $handle = getFileHandle(
        command =&gt; 'cfgadm -s cols=ap_id:type:info',
        logger  =&gt; $logger,
    );

    return unless $handle;

    while (my $line = &lt;$handle&gt;) {
        next if $line =~  /^Ap_Id/;
        next unless $line =~ /^(\S+)\s+(\S+)\s+(\S+)/;
        my $name = $1;
        my $type = $2;
        my $manufacturer = $3;
        $inventory-&gt;addEntry(
            section =&gt; 'CONTROLLERS',
            entry =&gt; {
                NAME         =&gt; $name,
                MANUFACTURER =&gt; $manufacturer,
                TYPE         =&gt; $type,
            }
        );
    }
    close $handle;
}

1;
</pre></body></html>