diff options
author | David VaĊĦek <david.vasek@nic.cz> | 2023-02-07 16:24:23 +0100 |
---|---|---|
committer | Daniel Salzman <daniel.salzman@nic.cz> | 2023-02-15 16:11:00 +0100 |
commit | ad32a3b1cc18851bfca66ca3630b943937e30dd8 (patch) | |
tree | 6fd47cf3922f7ac47ef2e5f1ca09327c97eff8a1 /samples | |
parent | scripts: remove unused scripts for OBS (diff) | |
download | knot-ad32a3b1cc18851bfca66ca3630b943937e30dd8.tar.xz knot-ad32a3b1cc18851bfca66ca3630b943937e30dd8.zip |
samples: dbus_client.pl -- follow the same output style as .sh and .py samples
Diffstat (limited to 'samples')
-rwxr-xr-x | samples/dbus_client.pl | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/samples/dbus_client.pl b/samples/dbus_client.pl index 5023eccd6..f650575d2 100755 --- a/samples/dbus_client.pl +++ b/samples/dbus_client.pl @@ -2,19 +2,51 @@ use Net::DBus; use Net::DBus::Reactor; +use Time::HiRes; my $bus = Net::DBus->system; # Get a handle to the 'knotd' service -my $knotd = $bus->get_service("cz.nic.knotd"); +my $knotd; +while (true) { + eval { + $knotd = $bus->get_service("cz.nic.knotd"); + }; + if (!$@) { + last; + } + sleep(0.1); +} # Get the device manager my $knotd_interface = $knotd->get_object("/cz/nic/knotd", "cz.nic.knotd.events"); +$knotd_interface->connect_to_signal('started', sub +{ + print "Server started\n"; +}); + +$knotd_interface->connect_to_signal('stopped', sub +{ + print "Server stopped\n"; +}); + $knotd_interface->connect_to_signal('zone_updated', sub { my ($zone, $serial) = @_; - print "Zone $zone updated, SOA serial $serial\n"; + print "Updated zone=$zone to serial=$serial\n"; +}); + +$knotd_interface->connect_to_signal('zone_ksk_submission', sub +{ + my ($zone, $key_tag, $kasp_id) = @_; + print "Ready KSK for zone=$zone keytag=$key_tag keyid=$kasp_id\n"; +}); + +$knotd_interface->connect_to_signal('zone_dnssec_invalid', sub +{ + my ($zone) = @_; + print "Invalid DNSSEC for zone=$zone\n"; }); # Main loop |