A PHP Error was encountered

Severity: 8192

Message: Function create_function() is deprecated

Filename: geshi/geshi.php

Line Number: 4698

Backtrace:

File: /home3/analyti4/public_html/nerdingout/pastetool/application/libraries/geshi/geshi.php
Line: 4698
Function: _error_handler

File: /home3/analyti4/public_html/nerdingout/pastetool/application/libraries/geshi/geshi.php
Line: 4621
Function: _optimize_regexp_list_tokens_to_string

File: /home3/analyti4/public_html/nerdingout/pastetool/application/libraries/geshi/geshi.php
Line: 1655
Function: optimize_regexp_list

File: /home3/analyti4/public_html/nerdingout/pastetool/application/libraries/geshi/geshi.php
Line: 2029
Function: optimize_keyword_group

File: /home3/analyti4/public_html/nerdingout/pastetool/application/libraries/geshi/geshi.php
Line: 2168
Function: build_parse_cache

File: /home3/analyti4/public_html/nerdingout/pastetool/application/libraries/Process.php
Line: 45
Function: parse_code

File: /home3/analyti4/public_html/nerdingout/pastetool/application/models/Pastes.php
Line: 517
Function: syntax

File: /home3/analyti4/public_html/nerdingout/pastetool/application/controllers/Main.php
Line: 693
Function: getPaste

File: /home3/analyti4/public_html/nerdingout/pastetool/index.php
Line: 315
Function: require_once

RouterBuild.py - NerdingOut Paste Tool (Stikked)

RouterBuild.py

From Black, 6 Years ago, written in Python, viewed 67 times.
URL http://nerdingout.net/pastetool/view/2bf6017e Embed
Download Paste or View Raw
  1. import os
  2. import csv
  3. import string
  4.  
  5. # READ IN THE TEMPLATE FILE AND STORE CONTENTS IN A STRING TEMPLATE
  6. with open('BaseMPLSRouter.tmpl') as t:
  7.         FinalBaseConfig = t.read()
  8.        
  9. # OPEN CSV CONFIG FILE AND READ INTO AN ARRAY
  10. with open('RouterDetails.csv', mode='r') as csvfile:
  11.         Detail_file = csv.reader(csvfile, delimiter=',')
  12.         # Cycle through Each ITEM-VALUE pair in the DETAIL FILE
  13.         for row in Detail_file:
  14.                 # DEREFERENCE row ARRAY FOR CLARITY IN READING CODE
  15.                 CONFIG_ITEM = row[0]
  16.                 CONFIG_VALUE = row[1]
  17.                 # CHECK TO MAKE SURE THE CONFIG_VALUE YOU ARE ATTEMPTING TO STORE IN THE DICTIONARY IS DEFINED.
  18.                 if CONFIG_VALUE.strip()!='':
  19.                         # DO THE ACTUAL SUBSTITUTION
  20.                         FinalBaseConfig = FinalBaseConfig.replace(CONFIG_ITEM,CONFIG_VALUE)
  21.                         # FIND ROUTER NAME TO USE FOR OUTPUT FILENAME
  22.                         if CONFIG_ITEM == "@RTR_NAME_OF_ROUTER":
  23.                                 outputfilename = CONFIG_VALUE
  24.                                 # REMOVE ANY OLD COPIES OF THE GENERATED FILE BEFORE REGENERATING IT
  25.                                 if os.path.isfile(outputfilename):
  26.                                         os.remove(outputfilename)
  27.        
  28. # OPEN FINAL CONFIG OUTPUT FILE AND WRITE THE MODIFIED TEMPLATE AS FINAL CONFIG.
  29. with open(outputfilename + '.txt', 'w') as outputFile:
  30.         print '\n Writing Final Config File: ' + outputfilename
  31.         outputFile.write(FinalBaseConfig)

Reply to "RouterBuild.py"

Here you can reply to the paste above

captcha