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

fix(core) ensure a plugin created with PUT gets enabled #4220

Closed
wants to merge 1 commit into from

Conversation

hishamhm
Copy link
Contributor

When a plugin is newly created with PUT (e.g. with /plugins/{uuid}), this needs to trigger a regeneration of the plugins map.

Our dao:upsert operation triggers an "update" CRUD event. This change is the conservative approach to fixing the problem, instead of changing the CRUD event and ensuring that all consumers of CRUD events handle a new "upsert" event.

Includes a regression test.

Fixes #4191.

When a plugin is newly created with PUT (e.g. with
`/plugins/{uuid}`), this needs to trigger a regeneration
of the plugins map.

Our `dao:upsert` operation triggers an `"update"` CRUD event.
This change is the conservative approach to fixing the problem,
instead of changing the CRUD event and ensuring that all
consumers of CRUD events handle a new `"upsert"` event.

Includes a regression test.

Fixes #4191.
cache:invalidate("plugins_map:version")
end
log(DEBUG, "[events] Plugin updated, invalidating plugins map")
cache:invalidate("plugins_map:version")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A more efficient approach would be to be able to "query" the plugins_map to determine without the plugin in question is already part of it or not, and rebuild the map only when necessary. We can keep this as a backlog item for now.

path = "/mypath",
})
assert.res_status(401, res)
end)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a subsequent commit locally in which I moved this test to a more appropriate test suite (plugins_map invalidations have their own test suite).

@thibaultcha
Copy link
Member

Manually merged, thanks!

@hishamhm hishamhm deleted the fix/plugin-put branch February 14, 2019 20:41
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 this pull request may close these issues.

Kong plugins doesn't get executed unless kong reloaded or restarted
2 participants