diff --git a/nodes/vr_sros/vr-sros.go b/nodes/vr_sros/vr-sros.go index 255846150..c838db836 100644 --- a/nodes/vr_sros/vr-sros.go +++ b/nodes/vr_sros/vr-sros.go @@ -262,8 +262,10 @@ func (s *vrSROS) applyPartialConfig(ctx context.Context, addr, platformName, return err } + configContentStr := string(configContent) + // check file contains content, otherwise exit early - if strings.TrimSpace(string(configContent)) == "" { + if strings.TrimSpace(configContentStr) == "" { return nil } @@ -315,8 +317,16 @@ func (s *vrSROS) applyPartialConfig(ctx context.Context, addr, platformName, } } } - // converting byte slice to newline delimited string slice - cfgs := strings.Split(string(configContent), "\n") + + // Normalize character sequences to avoid interaction issues with CLI + replacer := strings.NewReplacer( + "\r\n", "\n", // replace EOL CRLF with LF + "\t", " ", // replace tabs with 4 spaces + ) + configContentStr = replacer.Replace(configContentStr) + + // converting string to newline delimited string slice + cfgs := strings.Split(configContentStr, "\n") // config snippets should not have commit command, so we need to commit manually // and quit from the config mode