You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think due to our puppet node ttl is set to the default value (14 days), I believe the handler is not working 100% as expected. After doing some troubleshooting, I've found that even if we have purged a node in puppet, it remains in the puppet database until the node ttl has expired. Here is what the payload looks like for a node that has not been purged when hitting the /pdb/query
/v4/nodes endpoint:
The main difference is that the deactivated field has a date in it, rather than being null. If we could change the handler to not just check for an HTTP OK, but examine the payload and ensure that deactivated is not null, I think the handler would work more effectively. I'll take a stab at it soon, but here's the part I'm talking about with some added pseudocode logic
// Determine if the node existsifresp.StatusCode==http.StatusOK {
log.Printf("puppet node %q exists, checking if deactivated.", name)
ifclient.response["deactivated"] !=nil {
returntrue, nil
} else {
returnfalse, nil
}
} elseifresp.StatusCode==http.StatusNotFound {
log.Printf("puppet node %q does not exist", name)
returnfalse, nil
}
returnfalse, fmt.Errorf("unexpected HTTP status %s while querying PuppetDB", http.StatusText(resp.StatusCode))
}
I've confirmed by querying the puppetdb log that even after purging the node, the handler gets a 200 even on a purged node, so it thinks the node exists and will not delete it. Here is what that log looks like:
I think due to our puppet node ttl is set to the default value (14 days), I believe the handler is not working 100% as expected. After doing some troubleshooting, I've found that even if we have purged a node in puppet, it remains in the puppet database until the node ttl has expired. Here is what the payload looks like for a node that has not been purged when hitting the /pdb/query
/v4/nodes endpoint:
Here is what it looks like on a node we have recently purged:
The main difference is that the deactivated field has a date in it, rather than being null. If we could change the handler to not just check for an HTTP OK, but examine the payload and ensure that deactivated is not null, I think the handler would work more effectively. I'll take a stab at it soon, but here's the part I'm talking about with some added pseudocode logic
I've confirmed by querying the puppetdb log that even after purging the node, the handler gets a 200 even on a purged node, so it thinks the node exists and will not delete it. Here is what that log looks like:
Does it make sense if I say that?
The text was updated successfully, but these errors were encountered: