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 #37820 - If a smart proxy sync task fails in plan, we don't report it in sync status #11142

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

sjha4
Copy link
Member

@sjha4 sjha4 commented Sep 13, 2024

What are the changes introduced in this pull request?

By default, plan phase and finalize phase in actions are wrapped in a single transaction. Any error in these phases rolls back all DB changes during the phase.
One of those changes is a link record to the task that links the resource (smart proxy in this action) and the task so we can query the tasks back using for_resource helper like here:

The issue is when the action fails during the plan phase the link record is deleted as part of the transaction rollback.

Considerations taken when implementing this change?

We can turn the transaction middleware off for an action. Doing this for smart proxy sync means that any DB changes made during a failed plan/finalize phase will persist.
Looking at the capsule sync task, the only DB op we do in finalize is around audit records. We should be able to live without having it wrapped in a transaction.

What are the testing steps for this pull request?

  1. Have a server and proxy.
  2. Sync.
  3. Turn the proxy off and start a proxy sync.
  4. It will fail.
  5. Refresh page and you'll not see the failed task being reported.
  6. With this PR it ill show last task as failed.
  7. Try the same with some error in run phase. Use fail "random error" in any planned action's run phase to mimic this for example.
  8. Failed task should still show up in proxy details page.

@sjha4
Copy link
Member Author

sjha4 commented Sep 13, 2024

@adamruzicka 👀 :FYI:

Copy link
Member

@chris1984 chris1984 left a comment

Choose a reason for hiding this comment

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

Works fine for me and code looks fine. @adamruzicka any objections?

Copy link
Member

@adamruzicka adamruzicka left a comment

Choose a reason for hiding this comment

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

any objections?

While I'm not exactly happy about us having to do this, we don't really have any other sensible option, so yeah, let's go with this

@sjha4 sjha4 merged commit 2caec80 into Katello:master Sep 17, 2024
27 checks passed
chris1984 pushed a commit that referenced this pull request Sep 17, 2024
chris1984 pushed a commit that referenced this pull request Sep 17, 2024
jeremylenz pushed a commit to jeremylenz/katello that referenced this pull request Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants