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

Check if mod is published in CKAN triggers #257

Merged
merged 1 commit into from
May 13, 2020

Conversation

HebaruSan
Copy link
Contributor

@HebaruSan HebaruSan commented May 13, 2020

Problem

CKAN is receiving mod indexing requests for unpublished mods, which are then updated at publish. KSP-CKAN/NetKAN#7896:

image

Unpublished mods aren't supposed to be revealed to the world in any way, and CKAN's validation checks won't work until publish.

Cause

In #231 a notify_ckan call in create_mod was changed to send_to_ckan. notify_ckan did not make sense because it only works for mods that are already indexed. However, send_to_ckan still doesn't make sense because a mod at this point is not published, and all other usages of this function check mod.published. create_mod as currently written cannot validly trigger any CKAN events. However, in principle it is possible that at some point in the future create_mod might also set a mod as published, if such a change was worked on.

Changes

Now notify_ckan and send_to_ckan themselves check both mod.ckan and mod.published internally and only send triggers if both are true, so it will be safe to call either one whenever we want. NetKAN pull requests will now be submitted at publish instead of creation. The code calling these functions no longer checks either of these properties.

@HebaruSan HebaruSan requested a review from DasSkelett May 13, 2020 18:28
@HebaruSan HebaruSan added Priority: Low Status: Ready Area: Backend Related to the Python code that runs inside gunicorn Type: Bug labels May 13, 2020
Copy link
Member

@DasSkelett DasSkelett left a comment

Choose a reason for hiding this comment

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

Good solution. Thanks!

@HebaruSan HebaruSan merged commit 1e77cf0 into KSP-SpaceDock:alpha May 13, 2020
@HebaruSan HebaruSan deleted the fix/ckan-unpub branch May 13, 2020 18:32
@HebaruSan HebaruSan mentioned this pull request Jun 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Backend Related to the Python code that runs inside gunicorn Priority: Low Status: Ready Type: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants