- Timestamp:
- 04/14/09 16:18:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/pxeconfig.in
r133 r135 157 157 return files[index-1] 158 158 159 def manage_links( dict, options):159 def manage_links(haddr, options): 160 160 """ 161 161 Create the links in the PXE_CONF_DIR, … … 164 164 """ 165 165 if options.VERBOSE: 166 print 'manage_links( )'166 print 'manage_links(%s)' %(haddr) 167 167 168 168 os.chdir(PXE_CONF_DIR) 169 naddr = dict[NETWORK]170 169 pxe_filename = options.filename 171 170 172 for i in range(dict[START], dict[END]+1): 173 haddr = '%s%02X' %(naddr, i) 174 175 if options.REMOVE: 176 if options.DEBUG or options.DRY_RUN: 177 print 'removing %s/%s' %(PXE_CONF_DIR, haddr) 178 179 if os.path.exists(haddr) and not options.DRY_RUN: 180 os.unlink(haddr) 181 182 else: 183 if options.DEBUG or options.DRY_RUN: 184 print 'linking %s to %s' %(haddr, pxe_filename) 185 186 if not options.DRY_RUN: 187 if os.path.exists(haddr): 188 os.unlink(haddr) 189 os.symlink(pxe_filename, haddr) 171 if options.REMOVE: 172 if options.DEBUG or options.DRY_RUN: 173 print 'removing %s/%s' %(PXE_CONF_DIR, haddr) 174 175 if os.path.exists(haddr) and not options.DRY_RUN: 176 os.unlink(haddr) 177 178 else: 179 if options.DEBUG or options.DRY_RUN: 180 print 'linking %s to %s' %(haddr, pxe_filename) 181 182 if not options.DRY_RUN: 183 if os.path.exists(haddr): 184 os.unlink(haddr) 185 os.symlink(pxe_filename, haddr) 190 186 191 187 def net_2_hex(net, options): … … 263 259 264 260 options, args = parser.parse_args() 261 262 if not args: 263 print __doc__ 264 sys.exit(0) 265 265 266 266 if options.VERSION: … … 300 300 cnet = string.joinfields(net[0:3], '.') 301 301 302 binfo = dict() 303 binfo[NETWORK] = net_2_hex(cnet, options) 304 binfo[START] = int(net[3]) 305 binfo[END] = int(net[3]) 306 manage_links(binfo, options) 302 haddr = '%s%02X' %(net_2_hex(cnet, options), int(net[3])) 303 304 manage_links(haddr, options) 307 305 308 306
Note: See TracChangeset
for help on using the changeset viewer.