-
Notifications
You must be signed in to change notification settings - Fork 284
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
Fixes #36622 - Mark needs_publish after reindexing #10668
Conversation
Issues: #36622 |
app/models/katello/content_view.rb
Outdated
# d) If repo was indexed after cv publish. This can happen under 3 cases: | ||
# i) Index runs because last index(before publish) had failed and repo is picked up for index even if pulp publication hasn't changed. | ||
# ii) Complete sync runs or sync adds/removes new content (Already true because new pulp publication/version gets created) | ||
# iii) repo.index_content(force_index: true) is run. (This doesn't necessarily indicate contents changed. Corner case where we play safe and return true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# iii) repo.index_content(force_index: true) is run. (This doesn't necessarily indicate contents changed. Corner case where we play safe and return true) | |
# iii) repo.index_content is run. (This doesn't necessarily indicate contents changed. Corner case where we play safe and return true) |
From the code and testing it looks like force_index: true
isn't needed to make the CVV say that it needs an update?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hah..I had that meant for the action Repository::IndexContent which takes that param but then I moved the indexed_at datetime update to index_content method to be more accurate..Will update the text here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working fine for me! Just that one comment above.
f3c3daf
to
a975127
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good!
(cherry picked from commit 4e3d804)
(cherry picked from commit 4e3d804)
What are the changes introduced in this pull request?
Set needs_publish true when repo is indexed.
Considerations taken when implementing this change?
An indexing in katello will now show up as needs_publish=true in the CV. Thanks to optimizations, when repo contents haven't changed, indexing is skipped so in most cases, CV won't set needs_publish=true when contents haven't changed. But if a forced index is run on repo wthout adding new content, CV will have needs_publish true. You can see this by going to console and running: repo.index_content manually.
What are the testing steps for this pull request?
The reproducer steps are a little weird because you need to fake an indexing error in katello to reproduce this.
1: (Fake the error)
In app/models/katello/repository.rb , method index_content add
fail _('Forced error')
as first line. (Downstream requires server restart to reload updates:foreman-maintain service restart
)2. Restart the server and create a new yum repo. Do not sync the repo yet.
3. Add new repo to a CV and publish the Content View.
4. Sync the repo. Skip the indexing failure from Dynflow console of the task and let the task finish with warning. You shouldn't see any content in the repo.
5. Publish the CV again.
6. Remove the
fail _('Forced error')
from app/models/katello/repository.rb , method index_content7. Restart server (Downstream requires server restart to reload updates:
foreman-maintain service restart
)8. Sync the repo now.
9. You should see the CV have the needs_publish icon show up once contents are added correctly in katello.