AJNOURI / textfsm

Automatically exported from code.google.com/p/textfsm
Apache License 2.0
0 stars 0 forks source link

Template file handed to the TextFSM should have their file pointer put to the top of the file. #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Take any pointer to a template file and reuse it with subsequent TextFSM() 
calls.

What is the expected output? What do you see instead?
Expected output would be nothing, instead get:
Missing state 'Start'.

Basically, you want to have one reference to a template as a module level 
constant:

# Read in textfsm template and have it parse the output.
TMP = open(os.path.join(PATH, 'some_template'))

If you were to do:
 re_table = textfsm.TextFSM(TMP)
 parse_results = re_table.ParseText(output_text)
 re_table = textfsm.TextFSM(TMP)
 parse_results = re_table.ParseText(output_text)

The second one would fail.  The reason being is that textfsm is not putting the 
file pointer back to the top of the file.  This means I need to move the file 
pointer back to the top each time.  This should be done inside textfsm.

Original issue reported on code.google.com by jd...@google.com on 8 Apr 2011 at 9:21

GoogleCodeExporter commented 9 years ago

Original comment by ha...@google.com on 25 May 2011 at 7:19

GoogleCodeExporter commented 9 years ago
http://codereview.appspot.com/4560043/

Original comment by ha...@google.com on 26 May 2011 at 4:50

GoogleCodeExporter commented 9 years ago

Original comment by ha...@google.com on 3 Jun 2011 at 8:11