Skip to content
Open
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ path = [
"internal/cmd/visualizer/index.html",
"test/data/*.json",
"test/data/*.yaml",
"api/v1alpha1/zz_generated.deepcopy.go"
"api/v1alpha1/zz_generated.deepcopy.go",
"internal/cmd/visualizer/demo_data.json"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Verify demo_data.json existence

# Check if demo_data.json exists
if [ -f "internal/cmd/visualizer/demo_data.json" ]; then
  echo "✓ demo_data.json exists"
  ls -lh internal/cmd/visualizer/demo_data.json
else
  echo "✗ demo_data.json not found"
  echo "Demo data appears to be embedded in index.html instead"
fi

# Show what's actually in the visualizer directory
echo -e "\nFiles in internal/cmd/visualizer/:"
ls -lh internal/cmd/visualizer/

Repository: ironcore-dev/metal-operator

Length of output: 322


Remove the non-existent demo_data.json reference from REUSE.toml line 31.

The annotation references internal/cmd/visualizer/demo_data.json, but this file does not exist. The visualizer directory only contains index.html (which embeds demo data inline) and visualizer.go. This incorrect annotation will cause REUSE compliance check failures.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@REUSE.toml` at line 31, REUSE.toml contains a nonexistent file reference
"internal/cmd/visualizer/demo_data.json" which breaks REUSE checks; open
REUSE.toml and remove that exact entry (the string
"internal/cmd/visualizer/demo_data.json") from the listed files so only existing
assets (e.g., index.html and visualizer.go) remain referenced, then run the
REUSE compliance check to confirm the failure is resolved.

]
precedence = "aggregate"
SPDX-FileCopyrightText = "2024 SAP SE or an SAP affiliate company and IronCore contributors"
Expand Down
17 changes: 12 additions & 5 deletions cmd/metalctl/app/visualizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
var (
port int
vizKubeContext string
vizDryRun bool
)

func NewVisualizationCommand() *cobra.Command {
Expand All @@ -29,19 +30,25 @@ func NewVisualizationCommand() *cobra.Command {
visualizerCmd.Flags().StringVar(&kubeconfig, "kubeconfig", "", "Path to a kubeconfig.")
visualizerCmd.Flags().StringVar(&vizKubeContext, "context", "", "Name of the kubeconfig context to use.")
visualizerCmd.Flags().IntVar(&port, "port", 8080, "Port to run the web server on")
visualizerCmd.Flags().BoolVar(&vizDryRun, "dry-run", false, "Serve sample demo data without connecting to a cluster")

return visualizerCmd
}

func runVisualizer(_ *cobra.Command, _ []string) error {
log.Println("A 3D visualizer for server resources")

c, err := cmdclient.CreateClient(kubeconfig, vizKubeContext, scheme)
if err != nil {
log.Fatalf("Error creating kubernetes client: %v", err)
var vis *visualizer.Visualizer
if vizDryRun {
vis = visualizer.NewVisualizer(nil, port)
vis.DryRun = true
} else {
c, err := cmdclient.CreateClient(kubeconfig, vizKubeContext, scheme)
if err != nil {
log.Fatalf("Error creating kubernetes client: %v", err)
}
vis = visualizer.NewVisualizer(c, port)
}

vis := visualizer.NewVisualizer(c, port)

return vis.StartAndServe()
}
Loading
Loading