Logo Search packages:      
Sourcecode: wicd version File versions

def wicd::wnettools::Interface::CheckDHCP (   self  )  [inherited]

Check for a valid DHCP client. 

Checks for the existence of a supported DHCP client.  If one is
found, the appropriate values for DHCP_CMD, DHCP_RELEASE, and
DHCP_CLIENT are set.  If a supported client is not found, a
warning is printed.

Definition at line 228 of file wnettools.py.

00228                        :
        """ Check for a valid DHCP client. 
        
        Checks for the existence of a supported DHCP client.  If one is
        found, the appropriate values for DHCP_CMD, DHCP_RELEASE, and
        DHCP_CLIENT are set.  If a supported client is not found, a
        warning is printed.
        
        """
        def get_client_name(cl):
            """ Converts the integer value for a dhcp client to a string. """
            if cl in [misc.DHCLIENT, "dhclient"]:
                client = "dhclient"
            elif cl in [misc.DHCPCD, "dhcpcd"]:
                client = "dhcpcd"
            else:
                client = "pump"
            return client
        
        print 'checking dhcp...'
        
        if self.DHCP_CLIENT:
            dhcp_client = get_client_name(self.DHCP_CLIENT)
            dhcp_path = self._find_client_path(dhcp_client)
            if not dhcp_path:
                print "WARNING: Could not find selected dhcp client.  Wicd " + \
                      " will try to find another supported client."
        if not self.DHCP_CLIENT or not dhcp_path:
            dhcp_client = None
            dhcp_path = None
            dhcpclients = ["dhclient", "dhcpcd", "pump"]
            for client in dhcpclients:
                dhcp_path = self._find_client_path(client)
                if dhcp_path:
                    dhcp_client = client
                    break
    
        if not dhcp_client:
            print "WARNING: No supported DHCP Client could be found!"
            return
        elif dhcp_client in [misc.DHCLIENT, "dhclient"]:
            dhcp_client = misc.DHCLIENT
            dhcp_cmd = dhcp_path
            dhcp_release = dhcp_cmd + " -r"
        elif dhcp_client in [misc.PUMP, "pump"]:
            dhcp_client = misc.PUMP
            dhcp_cmd = dhcp_path + " -i"
            dhcp_release = dhcp_cmd + " -r -i"
        elif dhcp_client in [misc.DHCPCD, "dhcpcd"]:
            dhcp_client = misc.DHCPCD
            dhcp_cmd = dhcp_path
            dhcp_release = dhcp_cmd + " -k"
        else:
            dhcp_client = None
            dhcp_cmd = None
            dhcp_release = None

        self.DHCP_CMD = dhcp_cmd
        self.DHCP_RELEASE = dhcp_release
        self.DHCP_CLIENT = dhcp_client
    
    def CheckWiredTools(self):


Generated by  Doxygen 1.6.0   Back to index