my $driver = Gearman::Driver->new(
namespaces => [qw(APKPM)],
- server => 'localhost:4730',
+ server => $ENV{GEARMAN} || 'localhost:4730',
# server => 'localhost:4731,localhost:7003',
interval => 3,
);
return $res;
}
+sub poll : Job : MinProcesses(1) : MaxProcesses(1) : Encode(e_json) {
+ my ( $self, $job, $workload ) = @_;
+
+ my $entries = $self->do( 'LDAP_search' => '(&(cn=aa*)(dhcpStatements=*))' ); # FIXME
+ my $ip_username;
+ foreach my $entry ( @$entries ) {
+ $ip_username->{ $entry->{cn} } = $1 if $entry->{dhcpStatements} =~ m/fixed-address\s+/;
+ }
+
+ return $ip_username;
+}
1;