Ejemplo n.º 1
0
    def addAdapter(self, options, index=None):
        '''
            Insert a networkAdapter before the given index or at the end of the list.
            options should be a string (name) or a dict
        '''
        adapter = NetworkAdapter(options)
        adapter.validateAll()

        if index is not None:
            self._adapters.insert(index, adapter)
        else:
            self._adapters.append(adapter)
        return adapter
Ejemplo n.º 2
0
    def addAdapter(self, options, index=None):
        '''
            Insert a networkAdapter before the given index or at the end of the list.
            options should be a string (name) or a dict
        '''
        adapter = NetworkAdapter(options)
        adapter.validateAll()

        if index:
            self._adapters.insert(index, adapter)
        else:
            self._adapters.append(adapter)
        return adapter
Ejemplo n.º 3
0
 def _parse_iface(self, line):
     if line.startswith('iface'):
         sline = line.split()
         # Update the self._context when an iface clause is encountered.
         self._context += 1
         self._adapters.append(NetworkAdapter(sline[1].strip()))
         self._adapters[self._context].setAddressSource(sline[-1].strip())
         self._adapters[self._context].setAddrFam(sline[2].strip())
Ejemplo n.º 4
0
    def addAdapter(self, options, index=None):
        """Insert a NetworkAdapter before the given index
        or at the end of the list.
            options should be a string (name) or a dict

            Args:
                options (string or dict): options to build a network adaptator
                index (integer, optional): index to insert the NetworkAdapter
        """
        adapter = NetworkAdapter(options)
        adapter.validateAll()

        if index is None:
            self._adapters.append(adapter)
        else:
            self._adapters.insert(index, adapter)
        return adapter
Ejemplo n.º 5
0
    def addAdapter(self, options, index=None):
        """Insert a NetworkAdapter before the given index
        or at the end of the list.
            options should be a string (name) or a dict

            Args:
                options (string or dict): options to build a network adaptator
                index (integer, optional): index to insert the NetworkAdapter
        """
        adapter = NetworkAdapter(options)
        adapter.validateAll()

        if index is None:
            self._adapters.append(adapter)
        else:
            self._adapters.insert(index, adapter)
        return adapter