Ejemplo n.º 1
0
    def process(self):
        self.hosts = {}
        self.changed = []
        self.devinfo = CsHelper.get_device_info()
        self.preseed()
        self.cloud = CsFile(DHCP_HOSTS)
        self.dhcp_opts = CsFile(DHCP_OPTS)
        self.conf = CsFile(CLOUD_CONF)

        self.cloud.repopulate()
        self.dhcp_opts.repopulate()

        for item in self.dbag:
            if item == "id":
                continue
            self.add(self.dbag[item])
        self.write_hosts()

        if self.cloud.is_changed():
            self.delete_leases()

        self.configure_server()

        restart_dnsmasq = self.conf.commit()
        self.cloud.commit()
        self.dhcp_opts.commit()

        if not self.cl.is_redundant() or self.cl.is_master():
            if restart_dnsmasq:
                CsHelper.service("dnsmasq", "restart")
            else:
                CsHelper.start_if_stopped("dnsmasq")
                CsHelper.service("dnsmasq", "reload")
Ejemplo n.º 2
0
 def _enable_radvd(self, dev):
     """
     Setup radvd for primary VR
     """
     if dev == '':
         return
     CsHelper.service("radvd", "enable")
     CsHelper.start_if_stopped("radvd")
Ejemplo n.º 3
0
    def process(self):
        self.hosts = {}
        self.changed = []
        self.devinfo = CsHelper.get_device_info()
        self.preseed()
        self.cloud = CsFile(DHCP_HOSTS)
        self.dhcp_opts = CsFile(DHCP_OPTS)
        self.conf = CsFile(CLOUD_CONF)

        self.cloud.repopulate()
        self.dhcp_opts.repopulate()

        for item in self.dbag:
            if item == "id":
                continue
            self.add(self.dbag[item])
        self.write_hosts()

        self.configure_server()

        restart_dnsmasq = False

        if self.conf.commit():
            restart_dnsmasq = True

        if self.cloud.commit():
            restart_dnsmasq = True

        self.dhcp_opts.commit()

        if restart_dnsmasq:
            self.delete_leases()

        if not self.cl.is_redundant() or self.cl.is_master():
            if restart_dnsmasq:
                CsHelper.service("dnsmasq", "restart")
            else:
                CsHelper.start_if_stopped("dnsmasq")
                CsHelper.service("dnsmasq", "reload")