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

Allow shutil to copy into existing isolation directory #1311

Merged
merged 2 commits into from
Oct 17, 2023

Conversation

christophert
Copy link
Contributor

Fixes #1309 by adding dirs_exist_ok=True to the copytree call. Tested locally and the directory correctly populates with project directory files.

@christophert christophert requested a review from a team as a code owner September 27, 2023 18:33
@Shrews
Copy link
Contributor

Shrews commented Sep 29, 2023

We need to dig into the history of this. It seems there is a directory_isolation_cleanup configuration setting that doesn't appear to be exposed that is supposed to control cleaning up of the isolation directory. I'm not certain we should always just blindly overwrite it based on the existence of this setting.

@christophert
Copy link
Contributor Author

It looks like that setting would control cleaning it up once the run was completed. This change allows copytree to copy into the newly made directory by tempfile.mkdtemp in line 135, not any existing project isolation directory created by previous runs.

Copy link
Contributor

@Shrews Shrews left a comment

Choose a reason for hiding this comment

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

dirs_exist_ok added in Python 3.8, so this should be ok.

@Shrews Shrews merged commit 5d155be into ansible:devel Oct 17, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Directory isolation copying fails in sandboxed environments
2 participants