- Timestamp:
- 04/10/08 18:41:48 (16 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Changelog
r114 r117 3 3 pxe filemame menu. 4 4 Author: Bas van der Vlies 5 6 - Fixed some spell errors 7 Author: Bas van der Vlies 8 9 - Add new optione -w/--equal-width, eg: 10 * pxeconfig -w --basename gb-r40n -s 1 -e 2 --filename default.install 11 12 Will create links to default.install for hosts: 13 gb-r40n09 14 gb-r40n10 15 16 Suggested by : Ole Holm Nielsen 17 Implemented by : Bas van der Vlies 18 19 - Fixed a bug when pxeconfig directory was set in pxeconfig.conf it was not 20 used at all. 21 Author: Bas van der Vlies 22 23 - Fixed a bug in short option '-b' (basename) must have an argument. 24 Author: Bas van der Vlies 25 5 26 6 27 1.0.0 -
trunk/pxeconfig.conf
r75 r117 1 1 [DEFAULT] 2 pxe_config_dir : /tftpboot/pxelinux.cfg3 debug : 02 pxe_config_dir : ./pxelinux.cfg 3 debug : 1 -
trunk/pxeconfig.in
r114 r117 71 71 # 72 72 DEBUG=0 73 VERBOSE=0 73 74 74 75 # Constants … … 82 83 REMOVE='remove' 83 84 INTERACTIVE='interactive' 84 VERSION='1.0.0' 85 86 SHORTOPT_LIST='be:f:hin:s:rV' 87 LONGOPT_LIST=['basename=', 'debug', 'end=', 'file=', 'help', 'interactive', 'net=', 'start=', 'remove', 'version' ] 85 EQUALWIDTH='equalwidth' 86 VERSION='1.1.0' 87 88 SHORTOPT_LIST='b:e:f:hin:s:rwvV' 89 LONGOPT_LIST=[ 'basename=', 'debug', 'end=', 'equal-width', 90 'file=', 'help', 'interactive', 'net=', 'start=', 91 'remove', 'verbose', 'version', 'equal-width' 92 ] 93 94 def verbose(str): 95 if VERBOSE: 96 print '%s' 88 97 89 98 def ReadConfig(file): … … 339 348 340 349 global DEBUG 350 global VERBOSE 341 351 342 352 # if nothing is specified then print usage and exit … … 380 390 binfo[START] = value 381 391 392 elif opt in ['-w', '--equal-width']: 393 binfo[EQUALWIDTH] = True 394 395 elif opt in ['-v', '--verbose']: 396 VERBOSE = 1 397 382 398 elif opt in ['-V', '--version']: 383 399 print VERSION … … 388 404 def host_2_net(hosts, binfo): 389 405 """ 390 Convert host snameto a net address that can be handled by manage_links function406 Convert hostname(s) to a net address that can be handled by manage_links function 391 407 """ 392 408 for host in hosts: … … 414 430 sys.exit(1) 415 431 432 if binfo[EQUALWIDTH]: 433 width = len(str(binfo[END])) 434 416 435 hostnames = list() 417 436 for i in xrange(binfo[START], binfo[END] + 1): 418 hostname = '%s%d' %(binfo[BASENAME], i) 437 if binfo[EQUALWIDTH]: 438 hostname = '%s%0*d' %(binfo[BASENAME], width, i) 439 else: 440 hostname = '%s%d' %(binfo[BASENAME], i) 441 419 442 if DEBUG: 420 443 print 'host = %s, Basename = %s, number = %d' %(hostname, binfo[BASENAME], i) … … 427 450 # 428 451 global DEBUG 452 global PXE_CONF_DIR 429 453 430 454 bootinfo = {} 431 bootinfo[REMOVE] = 0 455 bootinfo[REMOVE] = False 456 bootinfo[EQUALWIDTH] = False 432 457 433 458 configfile = '@pxeconfig_conf@' … … 438 463 if not DEBUG: 439 464 DEBUG = int(settings['debug']) 465 440 466 except KeyError: 441 467 pass 442 468 469 if not os.path.isdir(PXE_CONF_DIR): 470 print 'pxeconfig directory: %s does not exists' %(PXE_CONF_DIR) 471 sys.exit(1) 472 443 473 check_args(sys.argv, bootinfo) 444 474
Note: See TracChangeset
for help on using the changeset viewer.