Make sure intf exists and is not configured.
( intf )
| 19 | |
| 20 | |
| 21 | def checkIntf( intf ): |
| 22 | "Make sure intf exists and is not configured." |
| 23 | config = quietRun( 'ifconfig %s 2>/dev/null' % intf, shell=True ) |
| 24 | if not config: |
| 25 | error( 'Error:', intf, 'does not exist!\n' ) |
| 26 | exit( 1 ) |
| 27 | ips = re.findall( r'\d+\.\d+\.\d+\.\d+', config ) |
| 28 | if ips: |
| 29 | error( 'Error:', intf, 'has an IP address,' |
| 30 | 'and is probably in use!\n' ) |
| 31 | exit( 1 ) |
| 32 | |
| 33 | |
| 34 | if __name__ == '__main__': |