Agent/OS/MacOS/Slots.pm

Registered by Andreas Xenos

Dmidecode does not exist n Mac computers. This module is migrated to MacOS directory and it returns results through system_profiler from the type SPPCIDataType. The returned information displayes the occupied ports.

Blueprint information

Status:
Complete
Approver:
mortheres
Priority:
Medium
Drafter:
None
Direction:
Approved
Assignee:
Andreas Xenos
Definition:
Approved
Series goal:
Accepted for stable-2.0
Implementation:
Implemented
Milestone target:
None
Started by
mortheres
Completed by
mortheres

Sprints

Whiteboard

package Ocsinventory::Agent::Backend::OS::MacOS::Slots;

sub check {
    return(undef) unless -r '/usr/sbin/system_profiler'; # check perms
    return (undef) unless can_load("Mac::SysProfile");
    return 1;
}

sub run {
    my $params = shift;
    my $common = $params->{common};

    # create the profile object and return undef unless we get something back
    my $pro = Mac::SysProfile->new();
    my $data = $pro->gettype('SPPCIDataType');
    return(undef) unless(ref($data) eq 'ARRAY');

    foreach my $slot (@$data) {

        my ($name, $description, $status) = '';

        $name = $slot->{'_name'};
        $description = $slot->{'sppci_link-width'}." ".$slot->{'sppci_bus'}." ".$slot->{'sppci_slot_name'};

        $common->addSlot({
            'NAME' => $name,
            'DESCRIPTION' => $description,
        });
    }

}

1;

---------------------------------------------------------------------------------------------------------------------------------------

Hi Andreas,

Thanks a lot for your proposal and code.

It has been implemented in 1091 of the stable-2.0 branch : http://bazaar.launchpad.net/~ocsinventory-dev/ocsinventory-unix-agent/stable-2.0/revision/1091

Kind regards,

--
Guillaume

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.