Skip to content

Commit

Permalink
make transfer config dependent on copyFlag, fail if autoarchive is de…
Browse files Browse the repository at this point in the history
…manded for globus transfers
  • Loading branch information
consolethinks committed Sep 4, 2024
1 parent 128f69f commit 2ff12e4
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions cmd/commands/datasetIngestor.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,30 +93,31 @@ For Windows you need instead to specify -user username:password on the command l
var globusClient globus.GlobusClient
var gConfig cliutils.GlobusConfig

switch transferType {
case Ssh:
transferFiles = cliutils.SshTransfer
case Globus:
transferFiles = cliutils.GlobusTransfer
var globusConfigPath string
if cmd.Flags().Lookup("globus-cfg").Changed {
globusConfigPath = globusCfgFlag
} else {
execPath, err := os.Executable()
if err != nil {
log.Fatalln("can't find executable path:", err)
if copyFlag {
switch transferType {
case Ssh:
transferFiles = cliutils.SshTransfer
case Globus:
transferFiles = cliutils.GlobusTransfer
var globusConfigPath string
if cmd.Flags().Lookup("globus-cfg").Changed {
globusConfigPath = globusCfgFlag
} else {
execPath, err := os.Executable()
if err != nil {
log.Fatalln("can't find executable path:", err)
}
globusConfigPath = filepath.Join(filepath.Dir(execPath), "globus.yaml")
}
globusConfigPath = filepath.Join(filepath.Dir(execPath), "globus.yaml")
}

globusClient, gConfig, err = cliutils.GlobusLogin(globusConfigPath)
if err != nil {
log.Fatalln("couldn't create globus client:", err)
}
globusClient, gConfig, err = cliutils.GlobusLogin(globusConfigPath)
if err != nil {
log.Fatalln("couldn't create globus client:", err)
}

if autoarchiveFlag {
log.Println("Cannot autoarchive when transferring via Globus due to the transfer happening asynchronously. Use the \"globusCheckTransfer\" command to archive them")
autoarchiveFlag = false
if autoarchiveFlag {
log.Fatalln("Cannot autoarchive when transferring via Globus due to the transfer happening asynchronously. Use the \"globusCheckTransfer\" command to archive them")
}
}
}

Expand Down

0 comments on commit 2ff12e4

Please sign in to comment.