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: 551
Function: getPaste

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

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home3/analyti4/public_html/nerdingout/pastetool/system/core/Exceptions.php:271)

Filename: view/raw.php

Line Number: 2

Backtrace:

File: /home3/analyti4/public_html/nerdingout/pastetool/themes/default/views/view/raw.php
Line: 2
Function: header

File: /home3/analyti4/public_html/nerdingout/pastetool/application/core/MY_Loader.php
Line: 173
Function: include

File: /home3/analyti4/public_html/nerdingout/pastetool/application/core/MY_Loader.php
Line: 43
Function: _ci_load

File: /home3/analyti4/public_html/nerdingout/pastetool/application/controllers/Main.php
Line: 558
Function: view

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

import os import re import csv import string import subprocess class ConfigBuilder(object): def __init__(self, CSV,basetemplatefile,vrftemplatefile): self.CSV = CSV self.CSV_DICT = {} self.basetemplatefile = basetemplatefile self.basetemplatecontents = '' self.vrftemplatefile = vrftemplatefile self.vrftemplatecontents = '' # READ IN BASE CONFIG TEMPLATE with open(self.basetemplatefile) as b: self.basetemplatecontents = b.read() self.baseresultstring = self.basetemplatecontents # READ IN VRF TEMPLATE with open(self.vrftemplatefile) as v: self.vrftemplatecontents = v.read() self.vrfresultstring = '' # READ IN CSV FILE with open(self.CSV, mode='r') as csvfile: Detail_file = csv.reader(csvfile, delimiter=',') # Cycle through Each ITEM-VALUE pair in the DETAIL FILE for row in Detail_file: # DEREFERENCE row ARRAY FOR CLARITY IN READING CODE ITEM = row[0] try: VALUE = row[1] except IndexError: VALUE = '' print "==== WARNING: ==== " + ITEM + " is missing a comma in the CSV file" try: REQUIRED_FIELD = bool(row[2]) except IndexError: REQUIRED_FIELD = False if (REQUIRED_FIELD == True and VALUE == ''): print "\n==== WARNING: ==== " + ITEM + " == IS A REQUIRED FIELD!\n" # CHECK TO MAKE SURE THE CONFIG_VALUE ISN"T BLANK BEFORE STORING IN DICTIONARY if VALUE.strip()!='': self.CSV_DICT[ITEM] = VALUE def generateBaseConfig(self): # Cycle through Each ITEM-VALUE pair in the CSV DICTIONARY for key in self.CSV_DICT: # DEREFERENCE row ARRAY FOR CLARITY IN READING CODE ITEM = key VALUE = self.CSV_DICT[key] # CHECK TO MAKE SURE THE CONFIG_VALUE ISN"T BLANK self.baseresultstring = self.baseresultstring.replace(ITEM,VALUE) return self.baseresultstring def generateAgencyVRFs(self): NumVRFs = self.queryitem('@NUMBER_OF_AGENCY_VRFS') for x in range(1, int(NumVRFs)+1): self.vrfresultstring = self.vrfresultstring + self.vrftemplatecontents # Cycle through Each ITEM-VALUE pair in the CSV DICTIONARY for key in self.CSV_DICT: #print key, self.CSV_DICT[key] # DEREFERENCE row ARRAY FOR CLARITY IN READING CODE ITEM = key VALUE = self.CSV_DICT[key] # remove VRF1, VRF2, etc in ITEM key and replace with just VRF so I can use one template for all vrfs basepattern = "VRF" iterator = str(x) fullpattern = basepattern+iterator regex = re.compile(fullpattern) ITEM = regex.sub('VRF', ITEM) #print ITEM, VALUE self.vrfresultstring = self.vrfresultstring.replace(ITEM,VALUE) return self.vrfresultstring def queryitem(self,querystring): # Cycle through Each ITEM-VALUE pair in the CSV DICTIONARY for key in self.CSV_DICT: # DEREFERENCE row ARRAY FOR CLARITY IN READING CODE ITEM = key VALUE = self.CSV_DICT[key] if ITEM == querystring: queryresult = VALUE return queryresult def writeconfig(self,outputfilename,FinalOutput): if os.path.isfile(outputfilename): os.remove(outputfilename) with open(outputfilename + '.txt', 'w') as outputFile: print '\n==== INFO: ==== WRITING FINAL CONFIG FILE: ' + outputfilename + '.txt' outputFile.write(FinalOutput) def fullbuild(self): baseconfig = self.generateBaseConfig() vrfconfig = self.generateAgencyVRFs() outputfilename = self.queryitem('@RTR_NAME_OF_ROUTER') FinalOutput = baseconfig + vrfconfig self.writeconfig(outputfilename,FinalOutput) def OpenOutput(object): fileName = object.queryitem('@RTR_NAME_OF_ROUTER')+'.txt' programName = "notepad.exe" subprocess.Popen([programName, fileName]) def main(): MPLSGen = ConfigBuilder('RouterDetails.csv','BaseMPLSRouter.tmpl','AgencyVRF.tmpl') MPLSGen.fullbuild() OpenOutput(MPLSGen) if __name__ == '__main__': main()