Skip to content
This repository has been archived by the owner on Dec 8, 2020. It is now read-only.

clean CCVs first, CVs later #55

Merged
merged 1 commit into from
May 15, 2018
Merged

clean CCVs first, CVs later #55

merged 1 commit into from
May 15, 2018

Conversation

evgeni
Copy link
Member

@evgeni evgeni commented May 9, 2018

this allows to remove more CVs, as removing CCVs might mark more CVs as unused

@evgeni
Copy link
Member Author

evgeni commented May 9, 2018

@Rocco83 can you please have a look at this? That's splitting out the clean changes from #53

However, I am not 100% sure as your old code slightly contradicted the comments and I had to change it a bit.
Let me explain:

  • cvs.sort_by! { |cv| cv["composite"] ? 0 : 1 } sorts the CCVs first, CVs last (as it sorts from 0 to 1)
  • your old code had if cv["composite"] == true and firstccv == true which would fire on the very first CCV (so the first one we look at) and thus there is nothing to wait on
  • I changed the logic to if not composite and firstcv, that is, clean all CCVs, when we find the first CV, wait for the created tasks.

I also dropped the exit from the error handling when the destroy fails, as I think its fine to continue here given https://projects.theforeman.org/issues/23458

@evgeni
Copy link
Member Author

evgeni commented May 9, 2018

@gearboxscott also would love your opinion on this change (fresh minds and all)

this allows to remove more CVs, as removing CCVs might mark more CVs as
unused
@Rocco83
Copy link
Contributor

Rocco83 commented May 15, 2018

I changed the logic to if not composite and firstcv, that is, clean all CCVs, when we find the first CV, wait for the created tasks.

It is a code refuse, because also in my comment there is

# Order the Content View to have before the non Composite Content View
# Needed to have delete proceeding in the correct order

Opposite of the current behavior.
I moved in a second time to CCV first (not CV as by comment).
Fun fact, this mess has been done to spot https://projects.theforeman.org/issues/23458.

Long story short, your code fix is correct 👍

I also dropped the exit from the error handling when the destroy fails, as I think its fine to continue here given https://projects.theforeman.org/issues/23458

👍

@evgeni evgeni merged commit bf46394 into master May 15, 2018
@evgeni evgeni deleted the clean-ccv-first branch May 15, 2018 15:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants