csc-sync-debian quickfix

This commit is contained in:
Andrew Wang 2022-07-24 17:45:33 +00:00
parent 7a3c8c1c93
commit 9f2cce23c8
2 changed files with 19 additions and 9 deletions

View File

@ -99,12 +99,6 @@ func startRepoSync(repo *config.Repo) {
repo.Logger.Debug("Changes found; will attempt to sync") repo.Logger.Debug("Changes found; will attempt to sync")
} }
args := getSyncCommand(repo)
if len(args) == 0 {
repo.Logger.Error("zero length command given for sync")
return
}
// clear the rsync log file before starting the sync // clear the rsync log file before starting the sync
if repo.RsyncLogFile != "" { if repo.RsyncLogFile != "" {
err := os.Truncate(repo.RsyncLogFile, 0) err := os.Truncate(repo.RsyncLogFile, 0)
@ -113,6 +107,12 @@ func startRepoSync(repo *config.Repo) {
} }
} }
args := getSyncCommand(repo)
if len(args) == 0 {
repo.Logger.Error("zero length command given for sync")
return
}
ch := spawnProcess(repo, args) ch := spawnProcess(repo, args)
if ch == nil { if ch == nil {
// spawnSyncProcess will have already logged error // spawnSyncProcess will have already logged error

View File

@ -198,10 +198,20 @@ func cscSyncDebian(repo *config.Repo) []string {
args = append(args, addConditionalFlags(repo, baseFlags|excludeTmp|ipv4)...) args = append(args, addConditionalFlags(repo, baseFlags|excludeTmp|ipv4)...)
args = append(args, buildRsyncDaemonHost(repo)+"/pool/", buildDownloadDir(repo)+"/pool/") args = append(args, buildRsyncDaemonHost(repo)+"/pool/", buildDownloadDir(repo)+"/pool/")
args = append(args, []string{ ch := spawnProcess(repo, args)
"&&", "nice", "rsync", "-rlHtvp", if ch == nil {
// spawnSyncProcess will have already logged error
return nil
}
cmd := <-ch
if cmd.ProcessState.ExitCode() != 0 {
return nil
}
args = []string{
"nice", "rsync", "-rlHtvp",
"--exclude", filepath.Join("project/trace", config.Conf.Hostname), "--exclude", filepath.Join("project/trace", config.Conf.Hostname),
}...) }
args = append(args, addConditionalFlags(repo, baseFlags|excludeTmp|ipv4|delayUpdatesDeleteAfter)...) args = append(args, addConditionalFlags(repo, baseFlags|excludeTmp|ipv4|delayUpdatesDeleteAfter)...)
args = append(args, buildRsyncDaemonHost(repo), buildDownloadDir(repo)) args = append(args, buildRsyncDaemonHost(repo), buildDownloadDir(repo))