コード例 #1
0
 def __init__(self):
     preference = global_config.get('netutils', 'preference',
                                    'ioctlnetutils.py')
     available = self.find_available_netutils()
     if preference in available:
         self.recommended_netutils = self.load_netutils(preference)
     else:
         netutils = self.find_available_netutils()
         self.recommended_netutils = self.load_netutils(netutils[0])
コード例 #2
0
 def _parse_dhclient(self, pipe):
     """ Parse the output of dhclient.
     Parses the output of dhclient and returns the status of
     the connection attempt.
     Keyword arguments:
     pipe -- stdout pipe to the dhcpcd process.
     Returns:
     'success' if succesful', an error code string otherwise.
     """
     dhclient_complete = False
     dhclient_success = False
     print_dhclient_output = global_config.get('dhclient', 'print_output', 
                                               True)
     while not dhclient_complete:
         line = pipe.readline()
         if line == '':  
             dhclient_complete = True
         else:
             if print_dhclient_output: log(line.strip('\n'))
         if line.startswith('bound'):
             log(line.strip('\n'))
             dhclient_success = True
             dhclient_complete = True
     return dhclient_success
コード例 #3
0
 def start(self):
     dhcp_client = self._clients.get(global_config.get('dhcp', 'preference',
                                     self._clients.items()[0][0]),
                                     self._clients.items()[0][1])
     self.dhcp_client = dhcp_client(self.interface_name)
     self.dhcp_client.start()
コード例 #4
0
 def do_start(self):
     check_timeout = global_config.get('wiredlinkcheck',
                                       'timeout_seconds', 2)
     gobject.timeout_add_seconds(check_timeout, self.check_status)
     self.check_status()