From 8b3bc64d362ad7c37ee67a31878e430a192f5b91 Mon Sep 17 00:00:00 2001 From: Joe Reuss Date: Tue, 19 Dec 2023 14:33:27 -0600 Subject: [PATCH] Fixes to allow topology to still work Made writebackhost be advertised within `AdvertiseOSDF` --- client/main.go | 9 ++++++--- director/advertise.go | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/client/main.go b/client/main.go index 759382c4c..b935b10bf 100644 --- a/client/main.go +++ b/client/main.go @@ -501,13 +501,14 @@ func DoStashCPSingle(sourceFile string, destination string, methods []string, re OSDFDirectorUrl := param.Federation_DirectorUrl.GetString() useOSDFDirector := viper.IsSet("Federation.DirectorURL") - var ns namespaces.Namespace - if destScheme == "stash" || destScheme == "osdf" || destScheme == "pelican" { log.Debugln("Detected writeback") + if !strings.HasPrefix(destination, "/") { + destination = strings.TrimPrefix(destination, destScheme+"://") + } + var ns namespaces.Namespace // If we have a director set, go through that for namespace info, otherwise use topology if useOSDFDirector { - destination = strings.TrimPrefix(destination, destScheme+"://") dirResp, err := QueryDirector(destination, OSDFDirectorUrl) if err != nil { log.Errorln("Error while querying the Director:", err) @@ -542,6 +543,8 @@ func DoStashCPSingle(sourceFile string, destination string, methods []string, re if string(sourceFile[0]) != "/" { sourceFile = "/" + sourceFile } + + var ns namespaces.Namespace // If we have a director set, go through that for namespace info, otherwise use topology if useOSDFDirector { dirResp, err := QueryDirector(sourceFile, OSDFDirectorUrl) diff --git a/director/advertise.go b/director/advertise.go index b8d520301..75e06ea6e 100644 --- a/director/advertise.go +++ b/director/advertise.go @@ -78,6 +78,7 @@ func AdvertiseOSDF() error { nsAd.RequireToken = ns.UseTokenOnRead nsAd.Path = ns.Path nsAd.DirlistHost = ns.DirlistHost + nsAd.WritebackHost = ns.WritebackHost issuerURL, err := url.Parse(ns.CredentialGeneration.Issuer) if err != nil { log.Warningf("Invalid URL %v when parsing topology response: %v\n", ns.CredentialGeneration.Issuer, err)