-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Interactive mod (safe mod) for collecting cluster (#206)
* interactive mod for collecting cluster * nit * fix
- Loading branch information
Showing
10 changed files
with
87 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
|
||
"strings" | ||
|
||
"github.com/DataDog/KubeHound/pkg/telemetry/log" | ||
) | ||
|
||
func AskForConfirmation() (bool, error) { | ||
var response string | ||
|
||
_, err := fmt.Scanln(&response) | ||
if err.Error() != "unexpected newline" { | ||
return false, fmt.Errorf("scanln: %w", err) | ||
} | ||
|
||
switch strings.ToLower(response) { | ||
case "y", "yes": | ||
return true, nil | ||
case "n", "no": | ||
return false, nil | ||
default: | ||
log.I.Error("Please type (y)es or (n)o and then press enter:") | ||
|
||
return AskForConfirmation() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
package globals | ||
|
||
const ( | ||
TagComponent = "component" | ||
TagTeam = "team" | ||
TagService = "service" | ||
TagComponent = "component" | ||
CollectedClusterComponent = "collected_cluster" | ||
TagTeam = "team" | ||
TagService = "service" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters