-
Notifications
You must be signed in to change notification settings - Fork 94
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
Update remove_existing_renders
to only delete qhub related files/directories
#800
Conversation
|
||
for deletable_dir in deletable_dirs: | ||
deletable_dir = dest_repo_dir / deletable_dir | ||
if deletable_dir.exists(): |
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.
Ah. Sorry I shouldn't have mentioned that os.remove
and shutil.rmtree
shouldn't be used. I meant that more generally that long term i'd like to minimize the number of times that we make this call! Since it's a scary operation.
I'm fine with using shutil.rmtree
here and I think that will dramatically reduce the code here.T his should remove all the walking in the code.
Also deletable_dirs
should include .gitlab-ci.yml
.
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.
Got it! Thanks for the feedback. And I agree, using shutil.rmtree
would be preferred.
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.
Thanks @iameskild this looks great to me and worked when I tested it locally.
Closes #767
The approach taken will only remove files/directories found in the
deletable_dirs
list. In the linked issue, the acceptance criteria specifies removing allos.remove
andshutil.rmtree
logic so my current solution employsPath
object methods (which essentially do the same thing).I have also added a
verbosity
flag (currently set to0
- none) if and when we would like to output the list of files/directories being deleted.All feedback is welcome :)