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
fix: getDatabaseBackups() should check error on .downloads deletion #6133
Conversation
Download the artifacts for this pull request:
See Testing a PR. |
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.
GetBackup()
has a call to prepDownloadDir()
:
Lines 211 to 218 in 6cb2569
func (p *Provider) GetBackup(backupType string) ([]string, []string, error) { | |
var err error | |
var fileNames []string | |
if backupType != "database" && backupType != "files" { | |
return nil, nil, fmt.Errorf("could not get backup: %s is not a valid backup type", backupType) | |
} | |
p.prepDownloadDir() |
And prepDownloadDir()
recreates files
directory:
Lines 290 to 297 in 6cb2569
// prepDownloadDir ensures the download cache directories are created and writeable. | |
func (p *Provider) prepDownloadDir() { | |
destDir := p.getDownloadDir() | |
filesDir := filepath.Join(destDir, "files") | |
_ = os.RemoveAll(destDir) | |
err := os.MkdirAll(filesDir, 0755) | |
util.CheckErr(err) | |
} |
The .ddev/.downloads/files directory may exist somehow when trying to just get databases.
prepDownloadDir()
does not check the type of backup (from backupType
) and always creates files
.
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.
Hmm, I looked at the code again, and the .ddev/.downloads
(or .ddev/.downloads/files
) directory is deleted and then created again later.
But in any case, if files
dir is created all the time before call to getDatabaseBackups()
, then if the next command fails, it will remain, the check added here is correct.
Agreed. The support issue in Discord appears to be something going wrong with mutagen or mutagen configuration. Even though mutagen sync is done, the files directory still exists. |
0faf7cf
to
f028a22
Compare
The Issue
From https://discord.com/channels/664580571770388500/1232668554550186024/1232668554550186024
The .ddev/.downloads/files directory may exist somehow when trying to just get databases.
Currently in HEAD
ddev pull
ignores failure to delete and recreate the .downloads directory.How This PR Solves The Issue
Check the error.
Manual Testing Instructions
Automated Testing Overview
Related Issue Link(s)
Release/Deployment Notes