Skip to content

Commit 18651c0

Browse files
authored
🐛 aws: initialize asset options (#5474)
Signed-off-by: Salim Afiune Maya <afiune@mondoo.com>
1 parent ab9d78b commit 18651c0

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

providers/aws/connection/connection.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ func NewAwsConnection(id uint32, asset *inventory.Asset, conf *inventory.Config)
109109
}
110110

111111
// merge the options to make sure we don't miss anything
112+
if asset.Options == nil {
113+
asset.Options = map[string]string{}
114+
}
112115
maps.Copy(asset.Options, conf.Options)
113116

114117
opts := parseFlagsForConnectionOptions(asset.Options, conf.GetCredentials())

providers/aws/connection/connection_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,15 @@ import (
77
"testing"
88

99
"github.com/stretchr/testify/require"
10+
"go.mondoo.com/cnquery/v11/providers-sdk/v1/inventory"
1011
)
1112

13+
func TestNewAwsConnection(t *testing.T) {
14+
conn, err := NewAwsConnection(123, &inventory.Asset{}, &inventory.Config{})
15+
require.Nil(t, err)
16+
require.NotNil(t, conn)
17+
}
18+
1219
func TestParseOptsToFilters(t *testing.T) {
1320
t.Run("all opts are mapped to discovery filters correctly", func(t *testing.T) {
1421
opts := map[string]string{

0 commit comments

Comments
 (0)