Changeset 194


Ignore:
Timestamp:
10/29/10 10:31:49 (10 years ago)
Author:
bas
Message:

src/pxeconfig.py:

  • can also use mac addresses as input ;-)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/pxeconfig.py

    r186 r194  
    2828#
    2929"""
    30 Usage: pxeconfig [-f,--filename <name>] <hosts>
    31 
    32 Specifying hostnames:
     30Usage: pxeconfig [-f,--filename <name>] <hosts|mac_addresses>
     31
     32Specifying hosts or mac addresses:
    3333   To specify a range use the [] to indicate a range,
    3434   a couple of examples:
    3535
    3636   The first five nodes of rack 16
    37           - gb-r16n[1-5]
     37        - gb-r16n[1-5]
    3838
    3939   The first five nodes and node 12 and 18 of rack 16 to 20
     
    4141
    4242   The first five nodes de in rack 16 with padding enabled
    43           - gb-r[16]n[01-5]
    44 
     43        - gb-r[16]n[01-5]
     44
     45   Host with mac address 00:19:b9:de:21:47 and first five node of rack 15
     46        - 00:19:b9:de:21:47 gb-r15n[1-5]
     47         
    4548The ranges ([]) are not only limited to numbers, letters can also be used.
    4649
     
    310313        ##
    311314        # Are the hosts wiht only mac addresses defined in the configuration file
     315        # or specified on the command line
     316        #
     317        mac_addr_re = re.compile('([a-fA-F0-9]{2}[:|\-]?){6}')
    312318
    313319        for host in args:
     
    315321                        mac_addr = config.get(host, 'mac_address')
    316322                        mac_2_hex(mac_addr, options)
     323
     324                elif mac_addr_re.search(host):
     325                        mac_2_hex(host, options)
    317326                else:
    318327                        host_2_hex(host, options)
Note: See TracChangeset for help on using the changeset viewer.