projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
16997: Test map key order in check/dump. Fix duplicate warnings.
[arvados.git]
/
lib
/
config
/
cmd.go
diff --git
a/lib/config/cmd.go
b/lib/config/cmd.go
index 5cb76fc35d63bd331f92e7ec02fccc1084a0c0e6..8e638e6ecb4cc712a7ba08f68c09ea2c33b189fc 100644
(file)
--- a/
lib/config/cmd.go
+++ b/
lib/config/cmd.go
@@
-12,7
+12,7
@@
import (
"os"
"os/exec"
"os"
"os/exec"
- "git.
curoverse.com
/arvados.git/sdk/go/ctxlog"
+ "git.
arvados.org
/arvados.git/sdk/go/ctxlog"
"github.com/ghodss/yaml"
"github.com/sirupsen/logrus"
)
"github.com/ghodss/yaml"
"github.com/sirupsen/logrus"
)
@@
-90,6
+90,7
@@
func (checkCommand) RunCommand(prog string, args []string, stdin io.Reader, stdo
flags := flag.NewFlagSet("", flag.ContinueOnError)
flags.SetOutput(stderr)
loader.SetupFlags(flags)
flags := flag.NewFlagSet("", flag.ContinueOnError)
flags.SetOutput(stderr)
loader.SetupFlags(flags)
+ strict := flags.Bool("strict", true, "Strict validation of configuration file (warnings result in non-zero exit code)")
err = flags.Parse(args)
if err == flag.ErrHelp {
err = flags.Parse(args)
if err == flag.ErrHelp {
@@
-113,11
+114,16
@@
func (checkCommand) RunCommand(prog string, args []string, stdin io.Reader, stdo
// such that the deprecated keys/files are superfluous and can
// be deleted.
loader.SkipDeprecated = true
// such that the deprecated keys/files are superfluous and can
// be deleted.
loader.SkipDeprecated = true
+ loader.SkipLegacy = true
withoutDepr, err := loader.Load()
if err != nil {
return 1
}
withoutDepr, err := loader.Load()
if err != nil {
return 1
}
+ // Reset() to avoid printing the same warnings twice when they
+ // are logged by both without-legacy and with-legacy loads.
+ logbuf.Reset()
loader.SkipDeprecated = false
loader.SkipDeprecated = false
+ loader.SkipLegacy = false
withDepr, err := loader.Load()
if err != nil {
return 1
withDepr, err := loader.Load()
if err != nil {
return 1
@@
-141,15
+147,21
@@
func (checkCommand) RunCommand(prog string, args []string, stdin io.Reader, stdo
fmt.Fprintln(stdout, "Your configuration is relying on deprecated entries. Suggest making the following changes.")
stdout.Write(diff)
err = nil
fmt.Fprintln(stdout, "Your configuration is relying on deprecated entries. Suggest making the following changes.")
stdout.Write(diff)
err = nil
- return 1
+ if *strict {
+ return 1
+ }
} else if len(diff) > 0 {
fmt.Fprintf(stderr, "Unexpected diff output:\n%s", diff)
} else if len(diff) > 0 {
fmt.Fprintf(stderr, "Unexpected diff output:\n%s", diff)
- return 1
+ if *strict {
+ return 1
+ }
} else if err != nil {
return 1
}
if logbuf.Len() > 0 {
} else if err != nil {
return 1
}
if logbuf.Len() > 0 {
- return 1
+ if *strict {
+ return 1
+ }
}
return 0
}
}
return 0
}