- Timestamp:
- 04/14/08 09:44:08 (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Changelog
r123 r126 66 66 - gb-r02n02 67 67 68 Author: Bas van der Vlies 69 70 - Added --dry-run mode 68 71 Author: Bas van der Vlies 69 72 -
trunk/pxeconfig.in
r125 r126 48 48 -r,--remove 49 49 -w,--equal-width 50 --dry-run 50 51 51 52 If leading zeros are used for <number>, then host names will be padded … … 56 57 command line options. 57 58 58 When this program is started interactive it will ask the following questions: 59 1) Network address (Class C-network address only) 60 2) Starting number 61 3) Ending number 62 4) Which PXE config file to use 63 64 For example, if the answers are: 65 1) 10.168.44 66 2) 2 67 3) 4 68 4) default.node_install 69 70 Then the result is that is create symbolic links in /tftpboot/pxelinux.cfg: 71 0AA82C02 ----> default.node_install 72 0AA82C03 ----> default.node_install 73 0AA82C04 ----> default.node_install 59 See following link for usage and examples: 60 - https://subtrac.sara.nl/oss/pxeconfig/wiki/PxeUsage 74 61 """ 75 62 … … 83 70 import re 84 71 85 # DEBUG 86 # 87 DEBUG=0 88 VERBOSE=0 72 # Global Variables 73 # 74 DEBUG = False 75 VERBOSE = False 76 DRY_RUN = False 89 77 90 78 # Constants … … 104 92 105 93 SHORTOPT_LIST='b:e:f:hin:s:rwvN:H:R:V' 106 LONGOPT_LIST=[ 'basename=', 'debug', 'end=', 'equal-width', 107 'file=', 'help', 'host-range=', 'interactive', 'net=', 108 'node=', 'start=', 'rack=', 'remove', 'verbose', 109 'version', 'equal-width' 94 LONGOPT_LIST=[ 'basename=', 'debug', 'dry-run', 'end=', 'equal-width', 95 'file=', 'help', 'host-range=', 'interactive', 'net=', 'node=', 96 'start=', 'rack=', 'remove', 'verbose', 'version', 'equal-width' 110 97 ] 111 98 … … 206 193 207 194 def manage_links(dict): 208 209 210 195 """ 196 Create the links in the PXE_CONF_DIR, 197 list : A list containing: network hex address, pxe config file, 211 198 start number, end number 212 """ 213 str = 'manage_links' 214 verbose(str) 215 216 os.chdir(PXE_CONF_DIR) 217 naddr = dict[NETWORK] 218 pxe_filename = dict[FILENAME] 219 220 for i in range(dict[START], dict[END]+1): 221 haddr = '%s%02X' %(naddr, i) 222 223 if dict[REMOVE] == True: 224 if DEBUG: 225 print 'removing %s/%s' %(PXE_CONF_DIR, haddr) 226 if os.path.exists(haddr): 227 os.unlink(haddr) 228 else: 229 if DEBUG: 230 print 'linking %s to %s' %(haddr, pxe_filename) 231 if os.path.exists(haddr): 232 os.unlink(haddr) 233 os.symlink(pxe_filename, haddr) 199 """ 200 str = 'manage_links' 201 verbose(str) 202 203 os.chdir(PXE_CONF_DIR) 204 naddr = dict[NETWORK] 205 pxe_filename = dict[FILENAME] 206 207 for i in range(dict[START], dict[END]+1): 208 haddr = '%s%02X' %(naddr, i) 209 210 if dict[REMOVE] == True: 211 if DEBUG or DRY_RUN: 212 print 'removing %s/%s' %(PXE_CONF_DIR, haddr) 213 214 if os.path.exists(haddr) and not DRY_RUN: 215 os.unlink(haddr) 216 217 else: 218 if DEBUG or DRY_RUN: 219 print 'linking %s to %s' %(haddr, pxe_filename) 220 221 if not DRY_RUN: 222 if os.path.exists(haddr): 223 os.unlink(haddr) 224 os.symlink(pxe_filename, haddr) 234 225 235 226 def net_2_hex(net): … … 479 470 global DEBUG 480 471 global VERBOSE 472 global DRY_RUN 481 473 482 474 # if nothing is specified then print usage and exit … … 498 490 499 491 elif opt in ['--debug']: 500 DEBUG = 1 492 DEBUG = True 493 494 elif opt in ['--dry-run']: 495 DRY_RUN = True 501 496 502 497 elif opt in ['-e', '--end']: … … 527 522 528 523 elif opt in ['-v', '--verbose']: 529 VERBOSE = 1524 VERBOSE = True 530 525 531 526 elif opt in ['-H', '--host-range']:
Note: See TracChangeset
for help on using the changeset viewer.