Skip to content

Commit

Permalink
JSON version default v2
Browse files Browse the repository at this point in the history
Signed-off-by: David Wertenteil <dwertent@armosec.io>
  • Loading branch information
dwertent committed Feb 6, 2023
1 parent a45ee8e commit 086144c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cmd/scan/scan.go
Expand Up @@ -86,7 +86,7 @@ func GetScanCommand(ks meta.IKubescape) *cobra.Command {
scanCmd.PersistentFlags().BoolVar(&scanInfo.UseDefault, "use-default", false, "Load local policy object from default path. If not used will download latest")
scanCmd.PersistentFlags().StringSliceVar(&scanInfo.UseFrom, "use-from", nil, "Load local policy object from specified path. If not used will download latest")
scanCmd.PersistentFlags().StringVar(&scanInfo.HostSensorYamlPath, "host-scan-yaml", "", "Override default host scanner DaemonSet. Use this flag cautiously")
scanCmd.PersistentFlags().StringVar(&scanInfo.FormatVersion, "format-version", "v1", "Output object can be different between versions, this is for maintaining backward and forward compatibility. Supported:'v1'/'v2'")
scanCmd.PersistentFlags().StringVar(&scanInfo.FormatVersion, "format-version", "v2", "Output object can be different between versions, this is for maintaining backward and forward compatibility. Supported:'v1'/'v2'")
scanCmd.PersistentFlags().StringVar(&scanInfo.CustomClusterName, "cluster-name", "", "Set the custom name of the cluster. Not same as the kube-context flag")
scanCmd.PersistentFlags().BoolVarP(&scanInfo.Submit, "submit", "", false, "Submit the scan results to Kubescape SaaS where you can see the results in a user-friendly UI, choose your preferred compliance framework, check risk results history and trends, manage exceptions, get remediation recommendations and much more. By default the results are not submitted")
scanCmd.PersistentFlags().BoolVarP(&scanInfo.OmitRawResources, "omit-raw-resources", "", false, "Omit raw resources from the output. By default the raw resources are included in the output")
Expand Down
2 changes: 1 addition & 1 deletion cmd/submit/results.go
Expand Up @@ -89,7 +89,7 @@ func getResultsCmd(ks meta.IKubescape, submitInfo *v1.Submit) *cobra.Command {
return nil
},
}
resultsCmd.PersistentFlags().StringVar(&formatVersion, "format-version", "v1", "Output object can be different between versions, this is for maintaining backward and forward compatibility. Supported:'v1'/'v2'")
resultsCmd.PersistentFlags().StringVar(&formatVersion, "format-version", "v2", "Output object can be different between versions, this is for maintaining backward and forward compatibility. Supported:'v1'/'v2'")

return resultsCmd
}
Expand Down
2 changes: 1 addition & 1 deletion core/cautils/scaninfo.go
Expand Up @@ -112,7 +112,7 @@ type ScanInfo struct {
View string // Display all of the input resources and not only failed resources
Format string // Format results (table, json, junit ...)
Output string // Store results in an output file, Output file name
FormatVersion string // Output object can be differnet between versions, this is for testing and backward compatibility
FormatVersion string // Output object can be different between versions, this is for testing and backward compatibility
CustomClusterName string // Set the custom name of the cluster
ExcludedNamespaces string // used for host scanner namespace
IncludeNamespaces string //
Expand Down
8 changes: 4 additions & 4 deletions core/pkg/resultshandling/results.go
Expand Up @@ -98,11 +98,11 @@ func NewPrinter(ctx context.Context, printFormat, formatVersion string, verboseM
switch printFormat {
case printer.JsonFormat:
switch formatVersion {
case "v2":
return printerv2.NewJsonPrinter()
default:
logger.L().Ctx(ctx).Warning("Deprecated format version", helpers.String("run", "--format-version=v2"), helpers.String("This will not be supported after", "1/Jan/2023"))
case "v1":
logger.L().Ctx(ctx).Warning("Deprecated format version", helpers.String("run", "--format-version=v2"))
return printerv1.NewJsonPrinter()
default:
return printerv2.NewJsonPrinter()
}
case printer.JunitResultFormat:
return printerv2.NewJunitPrinter(verboseMode)
Expand Down

0 comments on commit 086144c

Please sign in to comment.