Refactor syncuser to reduce walking the container fs

- Closes #1209

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2024-05-02 13:28:57 -06:00
parent 36a508319c
commit 6b8ca378d8
5 changed files with 52 additions and 61 deletions

View File

@@ -231,12 +231,11 @@ func ContainerImport(cip *wwapiv1.ContainerImportParameter) (containerName strin
return
}
SyncUserShowOnly := !cip.SyncUser
err = container.SyncUids(cip.Name, SyncUserShowOnly)
if err != nil {
err = fmt.Errorf("error in user sync, fix error and run 'syncuser' manually: %s", err)
wwlog.Error(err.Error())
if cip.SyncUser {
if cip.SyncUser {
err = container.SyncUids(cip.Name, true)
if err != nil {
err = fmt.Errorf("error in user sync, fix error and run 'syncuser' manually: %s", err)
wwlog.Error(err.Error())
return
}
}