ConfD User Community

Subscribing to multiple endpoints at once


writing with the python API. I am expanding on the 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))

            while (True):

        except KeyboardInterrupt:
            print("\nCtrl-C pressed\n")