Skip to content

Commit

Permalink
fix regression to discovery disks
Browse files Browse the repository at this point in the history
  • Loading branch information
kvaps committed May 2, 2024
1 parent 2401f13 commit dd50536
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion pkg/engine/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,37 @@ type Options struct {

// Render executes the rendering of templates based on the provided options.
func Render(ctx context.Context, c *client.Client, opts Options) ([]byte, error) {
helmEngine.LookupFunc = newLookupFunction(ctx, c)

// Gather facts and enable lookup options
if !opts.Offline {
if err := helpers.FailIfMultiNodes(ctx, "talm template"); err != nil {
return nil, err
}

response, err := c.Disks(ctx)
if err != nil {
if response == nil {
return nil, fmt.Errorf("error getting disks: %w", err)
}
}
for _, m := range response.Messages {
for _, d := range m.Disks {
dj, err := json.Marshal(d)
if err != nil {
return nil, err
}
var disk map[string]interface{}
err = json.Unmarshal(dj, &disk)
if err != nil {
return nil, err
}
helmEngine.Disks[d.DeviceName] = disk
}
}

helmEngine.LookupFunc = newLookupFunction(ctx, c)
}

chartPath, err := os.Getwd()
if err != nil {
return nil, err
Expand Down

0 comments on commit dd50536

Please sign in to comment.