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

Fixes #36622 - Mark needs_publish after reindexing #10668

Merged
merged 1 commit into from
Aug 2, 2023

Conversation

sjha4
Copy link
Member

@sjha4 sjha4 commented Jul 28, 2023

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_content
7. 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.

@theforeman-bot
Copy link

Issues: #36622

# 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)
Copy link
Member

@ianballou ianballou Aug 2, 2023

Choose a reason for hiding this comment

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

Suggested change
# 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?

Copy link
Member Author

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.

Copy link
Member

@ianballou ianballou left a 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.

Copy link
Member

@ianballou ianballou left a comment

Choose a reason for hiding this comment

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

Looking good!

@sjha4 sjha4 merged commit 4e3d804 into Katello:master Aug 2, 2023
5 checks passed
wbclark pushed a commit to wbclark/katello that referenced this pull request Sep 7, 2023
wbclark pushed a commit that referenced this pull request Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants