Skip to content

Commit

Permalink
🐛 Do not exit if annotations not defined in scan/vuln cmd. (#842)
Browse files Browse the repository at this point in the history
* 🐛 Do not exit if annotations not defined in scan/vuln cmd.
* 🧹 add comment why we need no error check for annotations

---------

Co-authored-by: Christoph Hartmann <chris@lollyrock.com>
  • Loading branch information
preslavgerchev and chris-rock authored Oct 16, 2023
1 parent 181d628 commit e942641
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions apps/cnspec/cmd/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,8 @@ func getCobraScanConfig(cmd *cobra.Command, runtime *providers.Runtime, cliRes *
log.Fatal().Err(err).Msg("failed to parse inventory")
}

annotations, err := cmd.Flags().GetStringToString("annotation")
if err != nil {
log.Fatal().Err(err).Msg("failed to parse annotations")
}

// annotations are user-added, editable labels for assets and are optional, therefore we do not need to check for err
annotations, _ := cmd.Flags().GetStringToString("annotation")
// merge the config and the user-provided annotations with the latter having precedence
optAnnotations := opts.Annotations
if optAnnotations == nil {
Expand Down

0 comments on commit e942641

Please sign in to comment.