Skip to content

Commit

Permalink
🐛 check runtime config before .NET framework analysis (#283)
Browse files Browse the repository at this point in the history
🐛 check config before .NET framework analysis

Signed-off-by: David Zager <[email protected]>
  • Loading branch information
djzager authored Jul 16, 2024
1 parent 8d37a07 commit 9e99c4b
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion cmd/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -2033,9 +2033,30 @@ func (a *analyzeCommand) analyzeDotnetFramework(ctx context.Context) error {

var err error

// Check configuration
var systemInfo struct {
Plugins struct {
Network []string `json:"network"`
} `json:"plugins"`
}
cmd := exec.Command(Settings.PodmanBinary, []string{"system", "info", "--format=json"}...)
out, err := cmd.Output()
if err != nil {
return err
}
if err = json.Unmarshal(out, &systemInfo); err != nil {
return err
}
a.log.V(5).Info("container network plugins", "plugins", systemInfo)
if !slices.Contains(systemInfo.Plugins.Network, "nat") {
err := fmt.Errorf("Unsupported container client configuration")
a.log.Error(err, ".NET Framework projects must be analyzed using docker configured to run Windows containers")
return err
}

// Create network
networkName := container.RandomName()
cmd := exec.Command(Settings.PodmanBinary, []string{"network", "create", "-d", "nat", networkName}...)
cmd = exec.Command(Settings.PodmanBinary, []string{"network", "create", "-d", "nat", networkName}...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err = cmd.Run()
Expand Down

0 comments on commit 9e99c4b

Please sign in to comment.