-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Webapp gets incomplete data from the MariaDB for Jenkins #21
Comments
Confirming issue. MariaDB has both rows of data but the data.json that is generated when the ansible-playbook is run by jenkins only gets the last row of data. Tested against ansible 2.10 as well just in case it is some oddball issue with ansible. Same result. Saw same ansible error reported above, but in both webapp and via container shell. This issue is not unique to the specific use case Ian raised. I was able duplicate it with "management interfaces" tab as well by adding both em0 and em1 interfaces to a spine switch. In that case, em1 was only exposed to jenkins. |
Yes that was my understanding as well, pretty sure the issue is around views.py where the webapp gets the info from mariadb and generates the data.json. |
Confirmed based on Debug info that data is being truncated in views.py code. Output in log shows data set at line 207 but my 924 the extra rows are gone. Querying Maria DB directly using the same selector/order by as the python code returns the data as expected. So something from the data retrieval into json file is losing fidelity. line 922 calls the function to create temp.xlsx. This file seems correct to me. Has the data as expected in temp.xlsx.
Python only stores the second entry in memory:
I think this is what is happening here. I say logic error because I do not believe this can work as intended and needs to be explored further as a change to how we process these sheets when specific hosts have "duplicate" entries. |
Potential workaround for now...for multi-line entries like syslog you can create additional columns in the syslog tab. I did facility2 and level2. Updated the template to use both:
This generated the proper yaml file :
And Jenkins ran the job and generated junos.conf file properly. This is less clunky than the first workaround I proposed earlier (and since removed). Still clunky but I believe this should become an enhancement request rather than a bug as we will need to do some work on how the data retrieved and stored in memory to make the use case as specified above to work properly. |
Thanks Matt, I've tried your workaround and I can confirm that it works, thank you very much. We can caveat this behaviour in the docs for now and move on. Whether it's an ER or a bug I don't know, I'll defer to you since you spent longer looking into the code than I did :-) |
Doing a basic test on the example data definitely shows that this problem is not caused by yaml2xls:
You can then you can convert this file back to yaml by doing: and that produces the following:
Which has a slightly different start but nothing important has changed. |
This seems to be resolved by an undocumented feature in NITA. If we change the column header on syslog to be host+.facility and host+.level the views.py subroutines use ordered_dicts as fields instead of strings. So we go from this: ('syslog', OrderedDict([('loghost', '100.123.0.17'), ('facility', 'daemon'), ('level', 'info')]))])), To this: ('syslog', OrderedDict([('loghost', '100.123.0.17'), ('host', [OrderedDict([('facility', 'any'), ('level', 'warning')]), OrderedDict([('facility', 'daemon'), ('level', 'info')])])]))])), Then after that I believe it should just be updating the j2 template to iterate through each element like the evpn_port template does in the examples. If you look at the example files for the data center use case evpn_port tab there is "+" on the tab name too. I assume it’s doing some sort of larger grouping that may not matter for the syslog example (I’m almost sure that’s it honestly). However, this worked without the tab name being "syslog+". Something to explore further while working on developer's guide. |
This sounds like a documentation bug against nita-yaml-to-excel |
Tried to build a simple syslog config using this JSON data:
Run write_yaml_files.py from within the jenkins container to generate ./group_vars/spines.yaml:
And use this J2 template to build the Junos config:
If running from the shell, the build process works correctly. If running from the Webapp, Ansible fails with this error:
This error is because the YAML file was not fully built by the "Build" job. However, the Excel data is all correctly stored in the "ngcn_worksheets" table inside the "Sites" database (running in the MariaDB container). So somehow, this data is not getting extracted correctly by the webapp when it runs the Jenkins job.
The text was updated successfully, but these errors were encountered: