Some regressions on v3.4.0 RC*
GermanG opened this issue · 15 comments
This is an early report, since I pulled from master.
In the Query section, API EndPoint PQL:
inventory [ certname, facts.osfamily ] { facts.osfamily = 'RedHat' }
This shows "Number of results" with a number, but only the headers are shown.
Checking the JSON view the results are there.
If we only use
inventory [ certname ] { facts.osfamily = 'RedHat' }
The table shows up, but certname is no longer a link to the node URL.
The javascript console in firefox shows
Uncaught Error: DataTables warning: table id=query_table - Requested unknown parameter 'facts.osfamily' for row 0, column 1. For more information about this error, please see http://datatables.net/tn/4
The template puppetboard/templates/query.html changes in c34f65b and does not longer use {{ result | prettyprint }}
which inserted the href to make the certname linked to the node entry.
EDIT: wrong commit
I also noticed that when I click on a value with space in /fact/uptime, f.e. "79 days" I am going to fact/uptime/79%2Bdays
and it shows nothing. Only when I replace %2B
(URL-encoded +
) with a space I get the proper output.
Please check out v3.4.0 RC4 (NOT RC3, that's a broken release, sorry) and let me know if the regressions are fixed for you, @GermanG.
Sorry for the late response.
It's way better now :)
If I run
inventory[certname, environment, timestamp, trusted] { facts.os.release.major = '7' }
It shows everything, but as soon as I add facts
inventory[certname, facts.os.release.full ] { facts.os.release.major = '7' }
The result is an empty list (but the count is ok, and when I check the json is ok too)
Yup
Uncaught Error: DataTables warning: table id=query_table - Requested unknown parameter 'facts.os.release.full' for row 0, column 1. For more information about this error, please see http://datatables.net/tn/4
I would really like to fix it and release 3.4.0 already (as we have more changes in the pipeline already), but I don't have access to Puppet > 5 env right now. :/ Help from someone who can try to reproduce it and provide a fix would be much appreciated then.
Looking at the resulting html, I think you only need to mock the result to test it
var data = [{"certname": "test1.example.com", "facts.os.release.full": "7.9.2009"}, {"certname": "asf1206.example.com", "facts.os.release.full": "7.9.2009"}, {"certname": "test30.example.com", "facts.os.release.full": "7.9.2009"}]
After some troubleshooting I've found the issue, the periods in the field name, facts have facts.os.blah, if I substitute with a string "blahblah" seems to be fine.
Reading some docs in datatables.net made me modify the html into something like
var data = [
["test1.example.com", "7.9.2009"],
["asf1206.example.com", "7.9.2009"],
["test30.example.com", "7.9.2009"]
]
var table = $('#query_table').DataTable({
"buttons": [
{
extend: 'csv',
filename: 'Puppetboard_query',
text: 'Download as CSV',
},
{
extend: 'excel',
filename: 'Puppetboard_query',
text: 'Download as XLSX',
},
],
// Data provided directly
"data": data,
"columns": [
],
// Custom options
'columns': [
{
"title": "certname",
"render": function (data, type, full, meta) {
return `<a href='/node/${data}'>${data}</a>`
},
},
{
"title": "facts.os.release.full",
},
],
This seems to work, I'll try to figure out the code to produce this.
quick and dirty
--- a/puppetboard/templates/query.html
+++ b/puppetboard/templates/query.html
@@ -134,7 +134,7 @@
'columns': [
{% for column in columns %}
{
- "data": "{{ quote_columns_data(column) }}",
+ "title": "{{ quote_columns_data(column) }}",
{% if column in ['node', 'certname'] %}
"render": function (data, type, full, meta) {
return `<a href='{{ url_for("node", node_name="") }}${data}'>${data}</a>`
diff --git a/puppetboard/views/query.py b/puppetboard/views/query.py
index 9c7737b..c7e8a33 100644
--- a/puppetboard/views/query.py
+++ b/puppetboard/views/query.py
@@ -62,13 +62,16 @@ def query(env):
if not zero_results:
columns = result[0].keys()
+ output = []
+ for items in result:
+ output.append(list(items.values()))
else:
columns = []
return render_template('query.html',
form=form,
zero_results=zero_results,
- result=result,
+ result=output,
columns=columns,
envs=envs,
current_env=env)
Thanks a lot the debugging and the fix @GermanG! I couldn't have done that myself at this time.
Can you please test v3.4.0rc6 and confirm that it works for you?
Cool, release of v3.4.0 final is on the way!