writing with the python API. I am expanding on the dhcpd_conf.py from the first intro example. Instead of just subscribing to one endpoint (dhcpd), I want to subscribe to multiple. However, right now it subscribes to one, and if I ‘ctrl-c’ then it moves on to the next. Instead, how could I create multiple subscriptions at once?
Here is my code:
for filename in os.listdir(‘templates’):
with open(os.path.join('templates', filename), "r") as tmpl: # code here to get endpoint path sub = Subscriber(10, cdbPath) def subscriberfun(path, tmpl, confname): while (True): # This is the place to HUP the daemon print("Configuration applied to " + path) sub.subscribeloop(path, tmpl, confname) print("Configuration changed") thread.start_new_thread(subscriberfun, (cdbPath, tmpl, confname)) try: while (True): time.sleep(0.1) except KeyboardInterrupt: print("\nCtrl-C pressed\n") tmpl.close()