snowfakery
task fails on Linux when renaming working directory
#3859
Labels
snowfakery
task fails on Linux when renaming working directory
#3859
Describe the bug
An error occurs when running the
snowfakery
task, specifically when attempting to move a directory (run_dir/template_1
). The error message indicates that the directory is not empty, causing the task to fail.Expected Behavior
The
snowfakery
task should complete without issues, moving or handling directories as needed. The directory should be managed appropriately even if it is not empty. Note: The command runs successfully when running locally on macOS.Actual Behavior
On Linux, the task fails with an error
[Errno 39] Directory not empty
when attempting to moverun_dir/template_1
.Potential Root Cause
The
snowfakery
task appears to be renaming thetemplate_1
directory to the same name. When using Python's shutil.move() to move a file or directory to the same path, an error can occur because Unix-like systems enforce logical constraints on file operations. Specifically, moving a file to the same location is effectively a no-op and doesn't make sense regarding file operations.On macOS:
macOS handles this operation without an error, possibly because it internally ignores attempts to move a directory to itself.
On UNIX (Linux):
The operation fails with a Directory not empty error because the system sees it as an attempt to overwrite a directory (template_dir) with itself, which is not allowed when the destination directory already contains files or subdirectories.
Potential Fix
Update the
_generate_and_load_initial_batch
function that "rename[s] directory to reflect real number of sets created" starting at line 576 incumulusci/tasks/bulkdata/snowfakery.py
. Check ifnew_template_dir
matchestemplate_dir
before processingshutil.move(template_dir, new_template_dir)
to skip the command altogether.Reproduction steps
recipes/delivery.yml
) with a working directory (run_dir
) and required Salesforce org.snowfakery
task when movingrun_dir/template_1
.Your CumulusCI and Python versions
Operating System
Linux 4.4.0 #1 SMP Sun Jan 10 15:06:54 PST 2016 x86_64 GNU/Linux
Windows environment
No response
CumulusCI installation method
pip
Error Gist
https://gist.github.com/schenkkp/f8f74a3a774adc76886d5908438fadee
Additional information
No response
The text was updated successfully, but these errors were encountered: