Apparently the "get_objects_filtered" command recently was disabled at the command line. Does anyone know the replacement?
Cheers - Bob
This thread was automatically locked due to age.
#!/usr/bin/perl
#
# get_objects_filtered work-alike
#
# v. 20141223-poc-1
#
# teched.net
#
#
#
# Proof of Concept, not for production use
#
#
#
# PoC (has warnings)
#use warnings;
#
use strict;
use Astaro::ConfdPlRPC;
use Data:[[[:D]]]umper;
$Data:[[[:D]]]umper::Terse = 1;
my $confd = Astaro::ConfdPlRPC->new or die 'connect failed';
$confd->lock or die 'lock failed';
for $_ (@{ $confd->get_objects() or die 'get failed'}) {
#
# PoC, blind eval from command line
#
if (eval @ARGV[0]) {
print Data:[[[:D]]]umper->Dump([$_], []);
}
}
$confd->disconnect;
exit 0;
test:/root/pl # perl gof.pl '$_->{data}->{address} eq "127.0.0.1"'
{
'lock' => 'global',
'ref' => 'REF_NetworkLocalhost',
'data' => {
'name' => 'Localhost',
'resolved' => 1,
'hostnames' => [],
'reverse_dns' => 0,
'resolved6' => 1,
'address6' => '::1',
'comment' => 'Loopback interface address',
'interface' => '',
'address' => '127.0.0.1',
'macs' => [],
'duids' => []
},
'class' => 'network',
'type' => 'host',
'hidden' => 1,
'autoname' => 0,
'nodel' => ''
}
#!/usr/bin/perl
#
# get_objects_filtered work-alike
#
# v. 20141223-poc-1
#
# teched.net
#
#
#
# Proof of Concept, not for production use
#
#
#
# PoC (has warnings)
#use warnings;
#
use strict;
use Astaro::ConfdPlRPC;
use Data:[[[:D]]]umper;
$Data:[[[:D]]]umper::Terse = 1;
my $confd = Astaro::ConfdPlRPC->new or die 'connect failed';
$confd->lock or die 'lock failed';
for $_ (@{ $confd->get_objects() or die 'get failed'}) {
#
# PoC, blind eval from command line
#
if (eval @ARGV[0]) {
print Data:[[[:D]]]umper->Dump([$_], []);
}
}
$confd->disconnect;
exit 0;
test:/root/pl # perl gof.pl '$_->{data}->{address} eq "127.0.0.1"'
{
'lock' => 'global',
'ref' => 'REF_NetworkLocalhost',
'data' => {
'name' => 'Localhost',
'resolved' => 1,
'hostnames' => [],
'reverse_dns' => 0,
'resolved6' => 1,
'address6' => '::1',
'comment' => 'Loopback interface address',
'interface' => '',
'address' => '127.0.0.1',
'macs' => [],
'duids' => []
},
'class' => 'network',
'type' => 'host',
'hidden' => 1,
'autoname' => 0,
'nodel' => ''
}