pvl.hosts-dhcp: expect and log HostError
authorTero Marttila <tero.marttila@aalto.fi>
Thu, 26 Feb 2015 15:05:04 +0200
changeset 482 41622bb9b95c
parent 481 8a7df0a6b0fb
child 483 19d084bb4afd
pvl.hosts-dhcp: expect and log HostError
bin/pvl.hosts-dhcp
--- a/bin/pvl.hosts-dhcp	Thu Feb 26 15:04:43 2015 +0200
+++ b/bin/pvl.hosts-dhcp	Thu Feb 26 15:05:04 2015 +0200
@@ -21,8 +21,12 @@
     hosts = pvl.hosts.apply(options, args)
 
     # process
-    for line in pvl.hosts.dhcp.apply_hosts_dhcp(options, hosts):
-        print line
+    try:
+        for line in pvl.hosts.dhcp.apply_hosts_dhcp(options, hosts):
+            print line
+    except pvl.hosts.HostError as error:
+        log.error("%s", error)
+        return 3
 
 if __name__ == '__main__':
     pvl.args.main(main)