def makeDefaultDnsmasqConfFile(restartDNSMasq=True):
     #Only write file if its a dreamplug
     #bluegiga captiveportal takes care of this automatically
     if Platform.getPlatform() == Platform.PLATFORM_LINUX_DREAMPLUG:
         try:
             ProcessExecutor.setCorrectBackhaulInterface()
             logger.info("writing dnsmasq file %s" % ClientURISettings.DNSMASQ_DEFAULT_FILE)         
             content = default_dnsmasq.CONTENT.replace("PROXIMUS_DNSMASQ_CONFIG_FILE", ClientURISettings.DNSMASQ_CONFIG_FILE).replace("PROXIMUS_DNS_INTERFACE", SystemWriter.getCurrentAccessPointInterface())            
             SystemWriter.writeFile(ClientURISettings.DNSMASQ_DEFAULT_FILE, content)
             if (restartDNSMasq):
                 ProcessExecutor.restartDNS()
                 
         except Exception as err:
             logger.error(err)
 def getCorrectExtBackhaulInterface(write=True):
     try:
         if ( write ):
             ProcessExecutor.setCorrectBackhaulInterface()                                                                              
         content = SystemWriter.readFileToString(ClientURISettings.CAPTIVEPORTAL_BACKHAUL_EXT_INTERFACE_FILE)                                           
         if (content != None):                                                                                                                        
             return content.strip()   
         else:
             if Platform.getPlatform() == Platform.PLATFORM_LINUX_BLUEGIGA:
                 return "nap"
             else:
                 return "eth0"       
     except Exception as err:
             logger.error(err)    
             logger.debug("Returning default interface")                                                                                                       
             if Platform.getPlatform() == Platform.PLATFORM_LINUX_BLUEGIGA:
                 return "nap"
             else:
                 return "eth0"
 def getCorrectExtBackhaulInterface(write=True):
     try:
         if (write):
             ProcessExecutor.setCorrectBackhaulInterface()
         content = SystemWriter.readFileToString(
             ClientURISettings.CAPTIVEPORTAL_BACKHAUL_EXT_INTERFACE_FILE)
         if (content != None):
             return content.strip()
         else:
             if Platform.getPlatform() == Platform.PLATFORM_LINUX_BLUEGIGA:
                 return "nap"
             else:
                 return "eth0"
     except Exception as err:
         logger.error(err)
         logger.debug("Returning default interface")
         if Platform.getPlatform() == Platform.PLATFORM_LINUX_BLUEGIGA:
             return "nap"
         else:
             return "eth0"
    def makeDefaultDnsmasqConfFile(restartDNSMasq=True):
        #Only write file if its a dreamplug
        #bluegiga captiveportal takes care of this automatically
        if Platform.getPlatform() == Platform.PLATFORM_LINUX_DREAMPLUG:
            try:
                ProcessExecutor.setCorrectBackhaulInterface()
                logger.info("writing dnsmasq file %s" %
                            ClientURISettings.DNSMASQ_DEFAULT_FILE)
                content = default_dnsmasq.CONTENT.replace(
                    "PROXIMUS_DNSMASQ_CONFIG_FILE",
                    ClientURISettings.DNSMASQ_CONFIG_FILE).replace(
                        "PROXIMUS_DNS_INTERFACE",
                        SystemWriter.getCurrentAccessPointInterface())
                SystemWriter.writeFile(ClientURISettings.DNSMASQ_DEFAULT_FILE,
                                       content)
                if (restartDNSMasq):
                    ProcessExecutor.restartDNS()

            except Exception as err:
                logger.error(err)