Fix merge conflict

This commit is contained in:
David Wertenteil
2022-09-18 11:41:28 +03:00
parent 196d07edc6
commit 4351099e79
3 changed files with 6 additions and 13 deletions
+1 -1
View File
@@ -90,7 +90,7 @@ func GetScanCommand(ks meta.IKubescape) *cobra.Command {
scanCmd.PersistentFlags().StringSliceVar(&scanInfo.UseFrom, "use-from", nil, "Load local policy object from specified path. If not used will download latest")
scanCmd.PersistentFlags().BoolVarP(&scanInfo.Submit, "submit", "", false, "Send the scan results to ARMO management portal 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().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 differnet between versions, this is for maintaining backward and forward compatibility. Supported:'v1'/'v2'")
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.CustomClusterName, "cluster-name", "", "Set the custom name of the cluster. Not same as the kube-context flag")
// Deprecated flags - remove 1.May.2022
+4 -5
View File
@@ -7,7 +7,6 @@ import (
"os"
"regexp"
"strings"
"regexp"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -105,10 +104,10 @@ func NewLocalConfig(
updateCredentials(lc.configObj, credentials)
// If a custom cluster name is provided then set that name, else use the cluster's original name
if customClusterName != ""{
// If a custom cluster name is provided then set that name, else use the cluster's original name
if customClusterName != "" {
lc.configObj.ClusterName = AdoptCustomClusterName(customClusterName)
}else if clusterName != "" {
} else if clusterName != "" {
lc.configObj.ClusterName = AdoptClusterName(clusterName) // override config clusterName
}
@@ -476,7 +475,7 @@ func DeleteConfigFile() error {
}
// To check if the custom cluster name is valid:
func AdoptCustomClusterName(customClusterName string) string{
func AdoptCustomClusterName(customClusterName string) string {
is_alphanumeric := regexp.MustCompile(`^[a-zA-Z0-9]*$`).MatchString(customClusterName)
// Check it does not contain special-characters
+1 -7
View File
@@ -112,6 +112,7 @@ type ScanInfo struct {
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
CustomClusterName string // Set the custom name of the cluster
ExcludedNamespaces string // used for host scanner namespace
IncludeNamespaces string //
InputPatterns []string // Yaml files input patterns
@@ -210,13 +211,6 @@ func (scanInfo *ScanInfo) setOutputFile() {
}
}
// func (scanInfo *ScanInfo) GetScanningEnvironment() string {
// if len(scanInfo.InputPatterns) != 0 {
// return ScanLocalFiles
// }
// return ScanCluster
// }
func (scanInfo *ScanInfo) SetPolicyIdentifiers(policies []string, kind apisv1.NotificationPolicyKind) {
for _, policy := range policies {
if !scanInfo.contains(policy) {