"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"
)
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 {
return 2
}
+ // Load the config twice -- once without loading deprecated
+ // keys/files, once with -- and then compare the two resulting
+ // configs. This reveals whether the deprecated keys/files
+ // have any effect on the final configuration.
+ //
+ // If they do, show the operator how to update their config
+ // 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
}
+ // 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.SkipLegacy = false
withDepr, err := loader.Load()
if err != nil {
return 1
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)
- return 1
+ if *strict {
+ return 1
+ }
} else if err != nil {
return 1
}
if logbuf.Len() > 0 {
- return 1
+ if *strict {
+ return 1
+ }
}
return 0
}