- Timestamp:
- 04/13/08 18:46:59 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/pxeconfig.in
r123 r125 211 211 start number, end number 212 212 """ 213 str = 'manage_links' 214 verbose(str) 215 213 216 os.chdir(PXE_CONF_DIR) 214 217 naddr = dict[NETWORK] … … 230 233 os.symlink(pxe_filename, haddr) 231 234 232 def convert_network(net):235 def net_2_hex(net): 233 236 """ 234 237 This function checks if the give network is a Class C-network and will 235 238 convert the network address to a hex address if true. 236 239 """ 237 str = ' convert_network: %s' %(net)240 str = 'net_2_hex : %s' %(net) 238 241 verbose(str) 239 242 … … 286 289 287 290 try: 288 naddr = convert_network(network)291 naddr = net_2_hex(network) 289 292 break 290 293 except PxeConfig, detail: … … 344 347 345 348 if hostnames: 346 host_2_ net(hostnames, binfo)349 host_2_hex(hostnames, binfo) 347 350 sys.exit(0) 348 351 … … 356 359 else: 357 360 set_padding(binfo) 358 create_links = base_2_ net361 create_links = base_2_host 359 362 360 363 elif binfo.has_key(NETWORK): … … 512 515 513 516 elif opt in ['-n', '--net']: 514 binfo[NETWORK] = convert_network(value)517 binfo[NETWORK] = net_2_hex(value) 515 518 516 519 elif opt in ['-r', '--remove']: … … 548 551 check_args(binfo, args) 549 552 550 def host_2_ net(hosts, binfo):553 def host_2_hex(hosts, binfo): 551 554 """ 552 555 Convert hostname(s) to a net address that can be handled by manage_links function 553 556 """ 557 str = 'host_2_hex: %s' %hosts 558 verbose(str) 559 554 560 for host in hosts: 555 561 try: … … 562 568 cnet = string.joinfields(net[0:3], '.') 563 569 564 binfo[NETWORK] = convert_network(cnet)570 binfo[NETWORK] = net_2_hex(cnet) 565 571 binfo[START] = int(net[3]) 566 572 binfo[END] = int(net[3]) 567 573 manage_links(binfo) 568 574 569 def base_2_ net(binfo):575 def base_2_host(binfo): 570 576 """ 571 577 Construct hostname(s) from the supplied basename and start and end numbers 572 578 """ 579 str = 'base_2_host' 580 verbose(str) 581 573 582 start = binfo[START] 574 583 end = binfo[END] … … 589 598 hostnames.append(hostname) 590 599 591 host_2_ net(hostnames,binfo)600 host_2_hex(hostnames,binfo) 592 601 593 602 def rack_2_net(binfo): 594 603 """ 595 604 """ 605 str = 'rack_2_net' 606 verbose(str) 596 607 basename = binfo[BASENAME] 597 608 start = binfo[RACK][START] 598 609 end = binfo[RACK][END] 599 600 610 601 611 if start > end: … … 619 629 print 'rack ', new_bootinfo 620 630 621 base_2_ net(new_bootinfo)631 base_2_host(new_bootinfo) 622 632 623 633 def main():
Note: See TracChangeset
for help on using the changeset viewer.