[PDB-1473] firm up behavior around empty lists vs 404s for nonexistent data Created: 2015/05/04  Updated: 2015/07/10  Resolved: 2015/06/04

Status: Closed
Project: PuppetDB
Component/s: None
Affects Version/s: None
Fix Version/s: PDB 3.0.0

Type: Improvement Priority: Normal
Reporter: Wyatt Alt Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Story Points: 2
Sprint: PuppetDB 2015-06-03, PuppetDB 2015-06-17


The console UI team needs to be able to differentiate between "nonexistent node" and "no data for existing node" when they issue the query

curl -X GET http://localhost:8080/v4/nodes/fakenode/facts

Talking with, Russell Mull I think we reached the following proposal:

Our shorthand endpoints follow the pattern

If the result of filtering <endpoint> to all values matching <identifier> is an empty list, then /<endpoint>/<identifier> and any children thereof should 404.

If the result of filtering <endpoint> to all values matching <identifier> is nonempty, then all children should be lists, empty or not.

Comment by Ken Barber [ 2015/05/21 ]

Did a quick survey of the impact so we know where the incorrect parts are: https://docs.google.com/spreadsheets/d/1ya_IPOgPYw_e9POAGmPJDd5YbqiNO32hLZDoCq5JL5w/edit#gid=0

In short it looks like:


... all return 200's with empty arrays when there is no parent data.

Comment by Ken Barber [ 2015/05/27 ]

Patch is here: https://github.com/puppetlabs/puppetdb/pull/1419

Doc I used to analyse the endpoints that were broken: https://docs.google.com/spreadsheets/d/1ya_IPOgPYw_e9POAGmPJDd5YbqiNO32hLZDoCq5JL5w/edit#gid=0

Generated at Sat Jul 11 08:38:39 PDT 2020 using Jira 8.5.2#805002-sha1:a66f9354b9e12ac788984e5d84669c903a370049.