Skip to content

Commit

Permalink
datasetIngestor: fix the check for "allowexistingsource is set"
Browse files Browse the repository at this point in the history
  • Loading branch information
consolethinks committed Aug 9, 2024
1 parent 6632a6f commit 9bfcb6e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions cmd/commands/datasetIngestor.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,15 @@ For Windows you need instead to specify -user username:password on the command l
color.Set(color.FgYellow)
if len(foundList) > 0 {
fmt.Println("Warning! The following datasets have been found with the same sourceFolder: ")
} else {
log.Println("Finished testing for existing source folders.")
}
for _, element := range foundList {
fmt.Printf(" - PID: \"%s\", sourceFolder: \"%s\"\n", element.Pid, element.SourceFolder)
}
color.Unset()
if !allowExistingSourceFolder && len(foundList) > 0 {
if cmd.Flags().Changed("allowexistingsource") {
if !cmd.Flags().Changed("allowexistingsource") {
log.Printf("Do you want to ingest the corresponding new datasets nevertheless (y/N) ? ")
scanner.Scan()
archiveAgain := scanner.Text()
Expand Down Expand Up @@ -491,15 +493,15 @@ func createLocalSymlinkCallbackForFileLister(skipSymlinks *string, skippedLinks
keep := true
pointee, _ := os.Readlink(symlinkPath) // just pass the file name
if !filepath.IsAbs(pointee) {
dir, err := filepath.Abs(filepath.Dir(symlinkPath))
symlinkAbs, err := filepath.Abs(filepath.Dir(symlinkPath))
if err != nil {
return false, err
}
// log.Printf(" CWD path pointee :%v %v %v", dir, filepath.Dir(path), pointee)
pabs := filepath.Join(dir, filepath.Dir(symlinkPath), pointee)
pointee, err = filepath.EvalSymlinks(pabs)
pointeeAbs := filepath.Join(symlinkAbs, pointee)
pointee, err = filepath.EvalSymlinks(pointeeAbs)
if err != nil {
log.Printf("Could not follow symlink for file:%v %v", pabs, err)
log.Printf("Could not follow symlink for file:%v %v", pointeeAbs, err)
keep = false
log.Printf("keep variable set to %v", keep)
}
Expand Down

0 comments on commit 9bfcb6e

Please sign in to comment.