Skip to content
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

license endpoint should return number of nodes in existing orgs #437

Closed
jeremiahsnapp opened this issue Jul 20, 2015 · 1 comment · Fixed by #444
Closed

license endpoint should return number of nodes in existing orgs #437

jeremiahsnapp opened this issue Jul 20, 2015 · 1 comment · Fixed by #444

Comments

@jeremiahsnapp
Copy link
Contributor

Currently the node count used by the license endpoint simply counts all nodes in the nodes table. This is not an accurate count. If an organization is deleted no cleanup work is done so the nodes in that org remain in the nodes table resulting in inaccurate node counts.

This SQL query should be fixed so it joins with the orgs table.

https://github.com/chef/chef-server/blob/12.1.1/src/oc_erchef/apps/chef_db/priv/pgsql_statements.config#L22-L23

SELECT COUNT(*) as count FROM nodes LEFT JOIN orgs ON nodes.org_id = orgs.id WHERE orgs.id IS NOT NULL;
@stevendanna stevendanna added this to the accepted-minor milestone Jul 21, 2015
@stevendanna
Copy link
Contributor

@jeremiahsnapp Thanks for the report, were you planning on filing a PR for this change or should someone else pick it up?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants