Skip to content

Commit

Permalink
🧹 aws ebs scan: reassign to fs conn once mounted (#2523)
Browse files Browse the repository at this point in the history
  • Loading branch information
vjeffrey authored Nov 8, 2023
1 parent fa915ff commit 4a29652
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion providers/aws/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,15 @@ func (s *Service) connect(req *plugin.ConnectReq, callback plugin.ProviderCallba
case string(awsec2ebsconn.EBSConnectionType):
s.lastConnectionID++
conn, err = awsec2ebsconn.NewAwsEbsConnection(s.lastConnectionID, conf, asset)

if conn.Asset() != nil && len(conn.Asset().Connections) > 0 && conn.Asset().Connections[0].Options["mounted"] != "" {
// if we've already done all the mounting work, then reassign the connection
// to be the filesystem connection so we use the right connection down the line
fsconn := conn.(*awsec2ebsconn.AwsEbsConnection).FsProvider
conn = fsconn
req.Asset = fsconn.Asset()
req.Asset.Connections[0] = fsconn.Conf
asset = req.Asset
}
default:
s.lastConnectionID++
conn, err = connection.NewAwsConnection(s.lastConnectionID, asset, conf)
Expand Down

0 comments on commit 4a29652

Please sign in to comment.