Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 check runtime config before .NET framework analysis #283

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion cmd/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -2030,9 +2030,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
Loading