Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,37 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

```

## github.com/alessio/shellescape

* Name: github.com/alessio/shellescape
* Version: v1.4.2
* License: [MIT](https://github.com/alessio/shellescape/blob/v1.4.2/LICENSE)

```
The MIT License (MIT)

Copyright (c) 2016 Alessio Treglia

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

```

## github.com/benbjohnson/clock

* Name: github.com/benbjohnson/clock
Expand Down
3 changes: 3 additions & 0 deletions changes/unreleased/Fixed-20251219-094938.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: Fixed
body: Fixed incorrect pgbackrest command format for database restore endpoint.
time: 2025-12-19T09:49:38.606386-05:00
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/pgEdge/control-plane
go 1.24.3

require (
github.com/alessio/shellescape v1.4.2
github.com/cilium/ipam v0.0.0-20230509084518-fd66eae7909b
github.com/cschleiden/go-workflows v0.19.0
github.com/docker/docker v27.1.1+incompatible
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
github.com/alessio/shellescape v1.4.2 h1:MHPfaU+ddJ0/bYWpgIeUnQUqKrlJ1S7BfEYPM4uEoM0=
github.com/alessio/shellescape v1.4.2/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30=
github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o=
github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
Expand Down
4 changes: 4 additions & 0 deletions server/internal/orchestrator/swarm/patroni_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net/url"
"path/filepath"

"github.com/alessio/shellescape"
"github.com/samber/do"
"github.com/spf13/afero"
clientv3 "go.etcd.io/etcd/client/v3"
Expand Down Expand Up @@ -475,6 +476,9 @@ func generatePatroniConfig(

if spec.RestoreConfig != nil {
restoreOptions := utils.BuildOptionArgs(spec.RestoreConfig.RestoreOptions)
for i, o := range restoreOptions {
restoreOptions[i] = shellescape.Quote(o)
}
cfg.Bootstrap.Method = utils.PointerTo(patroni.BootstrapMethodNameRestore)
cfg.Bootstrap.Restore = &patroni.BootstrapMethodConf{
Command: utils.PointerTo(PgBackRestRestoreCmd("restore", restoreOptions...).String()),
Expand Down
4 changes: 0 additions & 4 deletions server/internal/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@ func BuildOptionArgs(options map[string]string) []string {
res = append(res, prefix+k)
continue
}
// Quote value if it contains whitespace
if strings.ContainsAny(v, " \t\r\n") {
v = `"` + v + `"`
}

res = append(res, prefix+k+"="+v)
}
Expand Down
6 changes: 3 additions & 3 deletions server/internal/utils/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestBuildOptionArgs(t *testing.T) {
},
expected: []string{
"--type=time",
`--target="2025-06-11 09:00:00"`,
`--target=2025-06-11 09:00:00`,
},
},
{
Expand All @@ -53,8 +53,8 @@ func TestBuildOptionArgs(t *testing.T) {
"tab": "one\t two",
},
expected: []string{
"--note=\"line1\nline2\"",
"--tab=\"one\t two\"",
"--note=line1\nline2",
"--tab=one\t two",
},
},
}
Expand Down