mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix: update vendor for edito retry (#18309)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
This commit is contained in:
@@ -88,7 +88,7 @@ require (
|
||||
yunion.io/x/jsonutils v1.0.1-0.20230613121553-0f3b41e2ef19
|
||||
yunion.io/x/log v1.0.1-0.20230411060016-feb3f46ab361
|
||||
yunion.io/x/ovsdb v0.0.0-20230306173834-f164f413a900
|
||||
yunion.io/x/pkg v1.0.1-0.20230912084455-1393f31347db
|
||||
yunion.io/x/pkg v1.0.1-0.20231012131524-8a175238485b
|
||||
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e
|
||||
yunion.io/x/sqlchemy v1.1.2-0.20231011114043-0d203453d3e2
|
||||
yunion.io/x/structarg v0.0.0-20220312084958-9c6c79c7d1c6
|
||||
|
||||
@@ -1189,8 +1189,8 @@ yunion.io/x/ovsdb v0.0.0-20230306173834-f164f413a900 h1:Hu/4ERvoWaN6aiFs4h4/yvVB
|
||||
yunion.io/x/ovsdb v0.0.0-20230306173834-f164f413a900/go.mod h1:0vLkNEhlmA64HViPBAnSTUMrx5QP1CLsxXmxDKQ80tc=
|
||||
yunion.io/x/pkg v0.0.0-20190620104149-945c25821dbf/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
|
||||
yunion.io/x/pkg v0.0.0-20190628082551-f4033ba2ea30/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
|
||||
yunion.io/x/pkg v1.0.1-0.20230912084455-1393f31347db h1:yxiqu3C7wDnL3M8Nn54QmBp+rRgT4k5+/E6kJPVPlco=
|
||||
yunion.io/x/pkg v1.0.1-0.20230912084455-1393f31347db/go.mod h1:ksCJVQ+DwKrJ5QBEoU8pzrDFfDaZVAFH/iJ6yQCYxJk=
|
||||
yunion.io/x/pkg v1.0.1-0.20231012131524-8a175238485b h1:0eDqhMiGCPcbYLXRuCprsNCOsj0cQ09swUmGkXatlBk=
|
||||
yunion.io/x/pkg v1.0.1-0.20231012131524-8a175238485b/go.mod h1:ksCJVQ+DwKrJ5QBEoU8pzrDFfDaZVAFH/iJ6yQCYxJk=
|
||||
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e h1:v+EzIadodSwkdZ/7bremd7J8J50Cise/HCylsOJngmo=
|
||||
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e/go.mod h1:0iFKpOs1y4lbCxeOmq3Xx/0AcQoewVPwj62eRluioEo=
|
||||
yunion.io/x/sqlchemy v1.1.2-0.20231011114043-0d203453d3e2 h1:DB6wG9VXsnJGaABcfN89wRjRPCCCuJSsd8xob48BD8Q=
|
||||
|
||||
Vendored
+1
-1
@@ -1531,7 +1531,7 @@ yunion.io/x/log/hooks
|
||||
yunion.io/x/ovsdb/cli_util
|
||||
yunion.io/x/ovsdb/schema/ovn_nb
|
||||
yunion.io/x/ovsdb/types
|
||||
# yunion.io/x/pkg v1.0.1-0.20230912084455-1393f31347db
|
||||
# yunion.io/x/pkg v1.0.1-0.20231012131524-8a175238485b
|
||||
## explicit; go 1.18
|
||||
yunion.io/x/pkg/appctx
|
||||
yunion.io/x/pkg/errors
|
||||
|
||||
+23
-1
@@ -18,10 +18,28 @@ import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
||||
"yunion.io/x/pkg/errors"
|
||||
)
|
||||
|
||||
var editors = []string{
|
||||
"vim",
|
||||
"vi",
|
||||
"nvim",
|
||||
"nano",
|
||||
}
|
||||
|
||||
func findEditor() string {
|
||||
for _, prog := range editors {
|
||||
cmd := exec.Command(prog, "--version")
|
||||
if err := cmd.Run(); err == nil {
|
||||
return prog
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func Edit(yaml string) (string, error) {
|
||||
tmpfile, err := ioutil.TempFile("", "policy-blob")
|
||||
if err != nil {
|
||||
@@ -36,7 +54,11 @@ func Edit(yaml string) (string, error) {
|
||||
return "", errors.Wrap(err, "tmpfile.Close")
|
||||
}
|
||||
|
||||
cmd := exec.Command("vim", tmpfile.Name())
|
||||
editor := findEditor()
|
||||
if len(editor) == 0 {
|
||||
return "", errors.Wrapf(errors.ErrNotFound, "no editor found, supported editors are: %s", strings.Join(editors, ","))
|
||||
}
|
||||
cmd := exec.Command(editor, tmpfile.Name())
|
||||
cmd.Stdin = os.Stdin
|
||||
cmd.Stdout = os.Stdout
|
||||
err = cmd.Run()
|
||||
|
||||
Reference in New Issue
Block a user